|
A MIRACLE posted:You might want to look into Rubymine for an IDE. I'm technically faster in VIM but being able to run your specs inline is really handy for workflow. Rubymine is kingshit for debugging a single spec. Saves me a ridiculous amount of time and wasted pp some_dumb_variable bullshit at work.
|
# ? Jun 16, 2014 18:10 |
|
|
# ? May 24, 2024 14:48 |
|
Rubymine is ok, but I've dropped it for Gedit + console.
|
# ? Jun 16, 2014 19:07 |
|
pp variable_name? Just install pry and use binding.pry to work things out with breakpoints and the repl. I imagine that's basically what RubyMine gives you except it works with any editor you want.
|
# ? Jun 16, 2014 23:21 |
|
I use vim.vroom, with it's "run current file's spec" command bound to leader-r. Maybe not as fast as running a single spec, but not by much at all, and I still get vim's goodness.
|
# ? Jun 17, 2014 01:23 |
|
Sil posted:pp variable_name? Just install pry and use binding.pry to work things out with breakpoints and the repl. I imagine that's basically what RubyMine gives you except it works with any editor you want. Rubymine's a proper visual debugger. I thought I could do as well with open-source stuff, but the complete package is really great and worth the money. pry is Power Wheels and Rubymine is the comfort of a Benz with the power of a Corvette.
|
# ? Jun 17, 2014 04:03 |
|
Cocoa Crispies posted:Rubymine's a proper visual debugger. I thought I could do as well with open-source stuff, but the complete package is really great and worth the money. pry is Power Wheels and Rubymine is the comfort of a Benz with the power of a Corvette. Word.
|
# ? Jun 17, 2014 11:35 |
|
I have to say something about the Rails tutorial book: test-driven development should really be left until after the reader understands what's actually going on. As it is now, I'm writing tests for some vague reason and what exactly the drat program is doing is buried in a verbose mountain of . Something like 50% of the book is TDD, as opposed to 100% teaching me how to make things in Rails. Writing unit tests only teaches me how to test code, if I'm just writing a bunch of tests I have no loving clue what is going on behind the scenes aside from "expect specification to render partial in view", which means jack poo poo if I haven't gotten familiar with all that already. I don't know what I'm doing! Let me figure that out first! It's really distracting and just makes it harder for me to learn. It's pointless to learn TDD first if the tests mean nothing to me. IMO, learn it when you need it - i.e. when you're actually writing applications and feel the need for a testing framework. If you do the Rails tutorial book and you're completely new to either Rails or web development in general, skip the testing framework stuff - you'll get much more out of it wayyyy later in life. EDIT: I also just found out about application templates so now I can just write one properly working application and then apply it to new apps! Thank god I don't have to write the same thing over and over again. Although I'm not sure how to add controller code here... EDIT 2: Oh, I may not be able to. Oh well, I can always copy it from an example file. Pollyanna fucked around with this message at 16:45 on Jun 17, 2014 |
# ? Jun 17, 2014 16:03 |
|
Pollyanna posted:I have to say something about the Rails tutorial book: test-driven development should really be left until after the reader understands what's actually going on. As it is now, I'm writing tests for some vague reason and what exactly the drat program is doing is buried in a verbose mountain of . Something like 50% of the book is TDD, as opposed to 100% teaching me how to make things in Rails. Writing unit tests only teaches me how to test code, if I'm just writing a bunch of tests I have no loving clue what is going on behind the scenes aside from "expect specification to render partial in view", which means jack poo poo if I haven't gotten familiar with all that already. I don't know what I'm doing! Let me figure that out first! What about the tests in his example is unclear? You've done a few things and should be able to follow along, even if it seems like a roundabout way to look at development.
|
# ? Jun 17, 2014 18:05 |
|
EAT THE EGGS RICOLA posted:What about the tests in his example is unclear? You've done a few things and should be able to follow along, even if it seems like a roundabout way to look at development. Could be an issue with the scope of the tests. The testing style preferred by Rails isn't very behavioural and so the assertions don't make a lot of sense to someone not familiar with rails. In the example given by Pollyanna, rendering partials in views? Sure they're sort of generic terms but that's Rails terminology. How about "lists each animal on the page" or whatever, then at least the intentions of the test are clear to the authors before they start implementing the code to do it.
|
# ? Jun 17, 2014 18:23 |
|
Arachnamus posted:Could be an issue with the scope of the tests. The testing style preferred by Rails isn't very behavioural and so the assertions don't make a lot of sense to someone not familiar with rails. I think that the terminology is pretty generic, but I guess that there's a base level of familiarity you need to avoid having the learning curve be a vertical cliff.
|
# ? Jun 17, 2014 18:26 |
|
Given I have two sites on two different domains with the exact same backend/structure just separate data (and slightly different layouts), does it make sense to use a multitenancy model and run them off the same (production will almost certainly be Heroku) instance? The schema isn't terribly complex. I would think the overhead would still be less than running (let alone maintaining) two separate apps, just curious if anyone else has run into this.
|
# ? Jun 17, 2014 23:59 |
|
This may be beyond the scope of this thread or too much of a "do my homework for me" kind of question, but is anyone familiar with Gollum (and gollum-lib), the wiki that powers Github? I want to use it, with custom markup extensions for a small side project. The problem is, I don't know the first thing about Ruby, or Rails. I usually learn by hacking, but in this case, Gollum is too complex for me to even do that. Specifically, I just need to figure out how to turn overload the double-bracket syntax that Gollum already uses and that should be enough of a toehold to figure out the rest: code:
If I hack the source directly, I don't know download both repositories and tell them to use the local, hacked up versions. If I try to duck punch, I don't know how -- syntactically -- to do that either. Rails in general, and Gollum in particular, are just too complicated for me to make sense of. Are there any step-by-step guides, from a brand new Mac/Linux installation, that can teach me how to hack a project like this? I'm totally lost.
|
# ? Jun 18, 2014 18:04 |
|
Kobayashi posted:This may be beyond the scope of this thread or too much of a "do my homework for me" kind of question, but is anyone familiar with Gollum (and gollum-lib), the wiki that powers Github? I want to use it, with custom markup extensions for a small side project. The problem is, I don't know the first thing about Ruby, or Rails. I usually learn by hacking, but in this case, Gollum is too complex for me to even do that. You should probably start with a beginner rails tutorial to let you know how some of these projects are structured. Then a beginner gems tutorial to show you how the gems are structured. Then you want to look up how to use bundler gemfile with a local directory.
|
# ? Jun 18, 2014 19:37 |
|
The Milkman posted:Given I have two sites on two different domains with the exact same backend/structure just separate data (and slightly different layouts), does it make sense to use a multitenancy model and run them off the same (production will almost certainly be Heroku) instance? The schema isn't terribly complex. I would think the overhead would still be less than running (let alone maintaining) two separate apps, just curious if anyone else has run into this. I have run into it but in situations where there were security implications involved so they had to be on different machines, let alone different apps. It's a question of where do you want your complexity, in your code or in your configuration? I'd go for configuration myself, there's tools built to handle it (staging vs production is a common instance of this).
|
# ? Jun 22, 2014 09:39 |
|
Is anyone using Sublime Text 3 at all to interact with Ruby? I'm wondering if I should go with RubyMine instead.
|
# ? Jul 7, 2014 21:46 |
|
xenilk posted:Is anyone using Sublime Text 3 at all to interact with Ruby? I'm wondering if I should go with RubyMine instead. I do all my Rails work in ST3. It's pretty fun. Then again I don't find that I need much IDE-level help working with Ruby/JS code. When I tried RubyMine I thought it was a) interesting and had potential b) slow and c) a decent chunk of of work to learn how to use properly for unclear benefits above ST3+command line tools.
|
# ? Jul 7, 2014 22:03 |
Sil posted:I do all my Rails work in ST3. It's pretty fun. Then again I don't find that I need much IDE-level help working with Ruby/JS code. When I tried RubyMine I thought it was a) interesting and had potential b) slow and c) a decent chunk of of work to learn how to use properly for unclear benefits above ST3+command line tools. pretty much. I use Rubymine because the shop uses it, but I'd probably be just as happy using VIM + command line. Having a shortcut to run any tests inline is pretty handy though. But there's probably plugins for that for Sublime
|
|
# ? Jul 7, 2014 22:09 |
|
Pollyanna posted:I have to say something about the Rails tutorial book: test-driven development should really be left until after the reader understands what's actually going on. As it is now, I'm writing tests for some vague reason and what exactly the drat program is doing is buried in a verbose mountain of . Something like 50% of the book is TDD, as opposed to 100% teaching me how to make things in Rails. Writing unit tests only teaches me how to test code, if I'm just writing a bunch of tests I have no loving clue what is going on behind the scenes aside from "expect specification to render partial in view", which means jack poo poo if I haven't gotten familiar with all that already. I don't know what I'm doing! Let me figure that out first! Does the tutorial get better in the later chapters? I've gone through the first few so far and I have sample applications written in rails, but I don't actually know anything about rails. It's all been "Use rails generate scaffold! Now you have a site! Look at the site, you made that!". I'm getting the impression that Rails is really helpful for developing web apps, but I'm not interested in making a twitter clone and so far I haven't seen anything in the tutorial that will teach me to do anything that isn't making a twitter clone.
|
# ? Jul 8, 2014 01:10 |
|
You should use Rubymine, because it understand ruby code, so code navigation, automated refactoring etc. actually work and the debugger is awesome.
|
# ? Jul 8, 2014 01:16 |
|
Coca Koala posted:...I'm not interested in making a twitter clone and so far I haven't seen anything in the tutorial that will teach me to do anything that isn't making a twitter clone. Yeah I'm in the same boat currently, but I realize I have to walk before I run. Rails seems really powerful but there's a poo poo ton to learn before I can start kicking rear end...I just have to stick with it and one day (not so soon) I'll be able to dream it and do it. This is as far as I've ever come with a framework and it's exciting to have so many "a-ha!" moments. I think the rails guide is just enough to get your feet wet so you can start referencing the api/docs whenever you want to tackle a new problem, or at least know what to google.
|
# ? Jul 8, 2014 02:25 |
|
Sil posted:I do all my Rails work in ST3. It's pretty fun. Then again I don't find that I need much IDE-level help working with Ruby/JS code. When I tried RubyMine I thought it was a) interesting and had potential b) slow and c) a decent chunk of of work to learn how to use properly for unclear benefits above ST3+command line tools. How does ST3 compare to ST2? I've used the latter very happily for a few years now, and I'm only vaguely aware that ST3 even exists.
|
# ? Jul 8, 2014 02:42 |
|
Even though I was brought up using Visual Studio/Eclipse it never seemed like there was too much to gain from a Ruby IDE. Then again the ruby I'm writing isn't the most complex stuff aroundLexicon posted:How does ST3 compare to ST2? I've used the latter very happily for a few years now, and I'm only vaguely aware that ST3 even exists. Mostly it's more complicated to get package manager installed. Less cheeky answer: https://www.sublimetext.com/forum/viewtopic.php?f=2&t=16369 I've been using 3 for about a year now and the only issue I have with it is sometimes the terminal helper is bad at opening the folder I pass in sometimes.
|
# ? Jul 8, 2014 07:06 |
|
I'm having trouble understanding how to write a front-end heavy application in Rails, and how a JavaScript MVC framework would work in tandem with it. The way I learned it, the server handles stuff like routing and logic (a GET request to this URL does this action, a POST request to this other URL does this other action), database interaction (@user = User.find(1)), and serving up a page (index.html.erb, etc.). Apparently, though, JSMVC frameworks like Angular or Ember handle routing and modeling and everything themselves. It's basically like, writing a standard desktop application in JavaScript, sending that to the user, and only using the server to store and serve data. Is that correct? What does a basic, single-page JS MVC app look like in Rails?
|
# ? Jul 8, 2014 17:00 |
|
Typically, the the backend side has at least two responsibilities. 1) Provide an (JSON) API for the JS frontend. 2) Serve the correct frontend code for the browser. While the frontend has two responsibilities as well. 1) Communicate with the backend API (e.g. "Give me the list of users in JSON format", or "Save this new user with these and these attributes") 2) Display the information to the user ("Now that I have the list of users in JSON format, transform it to a bunch of HTML and display it on the page".
|
# ? Jul 8, 2014 17:09 |
|
So, for example, my Rails app would:
While the big-rear end JS script does this:
Is that right? Where does the MVC come into play with the JS framework, then? This just seems as though it only handles V, while the server still handles M and C. Where does it do routing and everything? What does it control?
|
# ? Jul 8, 2014 17:30 |
|
Pollyanna posted:
By "big-rear end js script" are you talking about something like angular.js ? If yes, I'm just about on the same boat than you are... intrigued with how you'd be doing all of this. Edit: I think ruby would be the RESTful API (with all the routes etc for the api) while angular.js would have its own routes for display purposes that use the API to fetch its data? xenilk fucked around with this message at 18:01 on Jul 8, 2014 |
# ? Jul 8, 2014 17:58 |
|
If you're using Rails, I think the only thing you'll be able to sub in is the V. Otherwise, you'd stop using rails since its the M and C. Optionally, the JS stuff does MVC for the front end, but I don't know what that would be. I guess the model would be your view state, and the controller would... uh I dunno: handle what objects get instantiated and what they are interacting with. e: Why would you do this? What is your end implementation and user experience? Pollyanna posted:
For instance, you can keep your JS library and use ruby js/json responses to supply variables. But why use JS for something other than front-end, and try to re-implement already existing functionality? KoRMaK fucked around with this message at 18:05 on Jul 8, 2014 |
# ? Jul 8, 2014 17:59 |
|
That's exactly why I'm confused. Apparently MVC frameworks are what make single page apps much easier(?), but they're mutually exclusive with anything that isn't Node or...are apparently standalone? Otherwise, there's a whole lot of repetition going on. I don't understand. If I'm gonna be using Rails, then I'm really only ever gonna be using JS as part of the View. Probably not to 100% replace it - ERB is there for a reason, isn't it? - but apparently the toast of the town in modern web dev is a heavy front end, which as far as I can tell just means that the server can be replaced with a hard drive and the rest of the server code is sent to the client. It kinda feels like front-end heavy stuff is just trying to wrangle web applications into being written like desktop applications.
|
# ? Jul 8, 2014 18:08 |
Just go make a Meteor practice app
|
|
# ? Jul 8, 2014 18:10 |
|
Pollyanna posted:It kinda feels like front-end heavy stuff is just trying to wrangle web applications into being written like desktop applications. I get that vibe too. I think for node.js the server is written in js and then run through an interpretor. Why use JS to power a server? I have no idea. But I also didn't get RoR's when I first started and thought it was overly complicated, but I ended up turning around on that as soon as I got past the hello world app (the most useless and irrelevant example of MVC)
|
# ? Jul 8, 2014 18:22 |
|
I've been using Ember on the last couple of projects I've done and it's not bad. Don't use Ember-Data, it blows, there are a couple of others that are better, and I've rolled my own. What makes it possible in Rails is the ember-rails gem: https://github.com/emberjs/ember-rails This is key because it effectively gives you your file structure and code design. Thing with Ember is that while it claims to be a MVC front end, it's got 2 view components, 1 controller, and 2 model components (1 of which is optional). Plus their controller acts as a sort of model in its own right. So I can see how you might be confused with that. But do it the ember-rails way, it'll work out for you.
|
# ? Jul 8, 2014 18:38 |
|
This is gonna sound horrible, but the reality of programming languages is that they all become the same thing in the end so you can use them all for pretty much the same implementation - there's no reason you can't do systems programming in Lua or Cobol on Wheelchair. The issue I have is that...I just prefer JavaScript to be specific to UI/UX. JavaScript just makes more sense in that context, and there's no reason it can't be a server, but there's no reason it has to be either. Maybe I'm just being nitpicky but I prefer JS sticks to what it's good at. It's like segregation, which is a little hosed up. kayakyakr posted:Thing with Ember is that while it claims to be a MVC front end, it's got 2 view components, 1 controller, and 2 model components (1 of which is optional). Plus their controller acts as a sort of model in its own right. So I can see how you might be confused with that. So if I use Ember with Rails, I end up having at least two Models, two Controllers, and three Views? That...isn't very dry. Not to say that code benchmarking is the point of coding, but whether something makes sense or not affects whether I know what the gently caress I'm doing or not. Pollyanna fucked around with this message at 18:41 on Jul 8, 2014 |
# ? Jul 8, 2014 18:39 |
|
Pollyanna posted:Maybe I'm just being nitpicky but I prefer JS sticks to what it's good at.
|
# ? Jul 8, 2014 18:59 |
Haha, since when is Javascript "good" at UI? You have to lug templating libraries with you to get even basic UI sensibility (unless you're cool with jQuery spaghetti). Javascript works for the browser DOM because it has to apply to everyone's OS, screen size, browser version etc. But a baked in UI language (smartphones, hell even Java windows) will always be easier to write for
|
|
# ? Jul 8, 2014 19:04 |
|
A MIRACLE posted:Haha, since when is Javascript "good" at UI? Javascript works for the browser DOM because it has to apply to everyone's OS, screen size, browser version etc. But a baked in UI language (phones, hell even Java windows) will always be easier to write for
|
# ? Jul 8, 2014 19:05 |
|
Okay by "good at" I mean "typically used for". I really don't understand what JS is supposed to be for. Scripting? DOM manipulation? Just kinda sorta whatever?
|
# ? Jul 8, 2014 19:09 |
Pollyanna posted:Okay by "good at" I mean "typically used for". Just sorta whatever. It has a weird history and barely resembles the version I learned in like 1999. It's lightning fast in its NPM implementation which is why some hipsters like to use it on the server. You have to be *really* down with closures though
|
|
# ? Jul 8, 2014 19:11 |
|
KoRMaK posted:Haha, ok easy. Easy on yourself there. Separation of duties is a more applicable phrase. Separation of concerns would be the appropriate software term.
|
# ? Jul 8, 2014 19:12 |
|
A MIRACLE posted:You have to be *really* down with closures though Smol posted:Separation of concerns would be the appropriate software term.
|
# ? Jul 8, 2014 19:15 |
|
|
# ? May 24, 2024 14:48 |
KoRMaK posted:I think I had this asked in an interview, I still don't get it. http://en.wikipedia.org/wiki/Closure_(computer_programming) If I understand it right, a practical example that I deal with regularly is a jquery iterator, e.g. each(function() { ... }); Yep, basically your nested scope has access to everything above it in order of proximity. Scopes are limited to functions and loops, if-clauses don't have their own scope.
|
|
# ? Jul 8, 2014 19:17 |