$ rails g model User
belongs_to
has_one
module Enumerable | |
def pluck(key) | |
map {|obj| obj[key] } | |
end | |
end |
# run using ```rvm jruby-1.6.7 do jruby "-J-Xmx2000m" "--1.9" tej.rb``` | |
require 'rubygems' | |
require 'nokogiri' | |
require 'csv' | |
f = File.open("/tmp/preview.html") | |
doc = Nokogiri::HTML(f) | |
csv = CSV.open("/tmp/output.csv", 'w',{:col_sep => ",", :quote_char => '\'', :force_quotes => true}) |
Originally published in June 2008
When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.
To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.
Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.
source 'https://rubygems.org' | |
gem 'rake' | |
gem 'lotus-router' | |
gem 'lotus-controller' | |
gem 'lotus-view' | |
group :test do | |
gem 'rspec' | |
gem 'capybara' |
// app/initializers/csrf.js | |
export default { | |
name: 'csrf', | |
initialize: function(container, app) { | |
app.inject('route', 'csrf', 'service:csrf'); | |
app.inject('controller', 'csrf', 'service:csrf'); | |
} | |
} |
#Programming Manifesto
##Books Ruby
TinyMCE is a javascript WYSIWYG editor that is highly configurable and has a ton of features and plugins. It integrates with jQuery and, with a bit of work, it can be integrated in your ember-cli app.
Step 1: Install TinyMCE:
bower install --save tinymce
Step 2: Import the required files into your app via broccoli. In order to do that you will need a plugin called broccoli-static-compiler
:
This post shows how to use TinyMCE 4.1 WYSIWYG text editor in a Rails 4 application for editing content in a textarea field.
TinyMCE is a powerful online WYSIWYG editor with many plugins.
If you want to insert an image by selecting it from images stored on server or upload an image to server, then you need to have a file manager with tinyMCE. TinyMCE comes with a file manager which is not free.
elFinder is an open-source file manager which can be easily integrated with tinyMCE 4.1.
#Ruby Interview Questions
Plain old english: Ways of grouping code we want to run.
The simplest explanation for a block is that it is a chunk of code between {}
or do...end
, that can't be stored in a variable and isn't an object.
A block is just part of the syntax of a method call. It doesn’t mean anything on a standalone basis and can only appear in argument lists.
The difference is subtle, but p prints the true value of an object, rather than a string-ified version of the object. This will make more sense soon, but for the sake of simplicity, we'll use the p command throughout the exercises, as we'll want to see the true values of our code returned to the output window.