You wrote:
= hb 'if content.condition1' do
= hb 'if content.condition2' do
%p Some paragraph
= hb 'else'
%p another paragraph
= hb 'else'
%p third paragraph
You wrote:
= hb 'if content.condition1' do
= hb 'if content.condition2' do
%p Some paragraph
= hb 'else'
%p another paragraph
= hb 'else'
%p third paragraph
#!/usr/bin/env ruby | |
require "date" | |
class Fixnum | |
Date::MONTHNAMES[1..-1].each_with_index do |month, index| | |
define_method month.downcase do |year| | |
Date.new(year, index+1, self) | |
end | |
end | |
end |
scope '/api' do | |
resources :users, except: [:edit] | |
end | |
root to: 'ember#index' | |
get '*path' => 'ember#index' |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>Render Multiple Outlets</title> | |
<script src="js/vendor/jquery.js"></script> | |
<script src="js/vendor/handlebars.js"></script> | |
<script src="js/vendor/ember.js"></script> | |
<script src="js/vendor/ember-data.js"></script> | |
</head> |
curl -s 'http://realbusinessmen.tumblr.com/api/read?type=photo&num=50' | ruby -r'rexml/document' -e 'puts REXML::Document.new(STDIN).elements["tumblr/posts"].to_a.shuffle.pop.map(&:text)' |
The Ember router is getting number of enhancements that will greatly enhance its power, reliability, predictability, and ability to handle asynchronous loading logic (so many abilities), particularly when used in conjunction with promises, though the API is friendly enough that a deep understanding of promises is not required for the simpler use cases.
namespace :db do | |
namespace :migrate do | |
desc "Re-run a migration that's already been run" | |
task :rerun => [:environment, :load_config] do | |
class ActiveRecord::Migrator | |
def rerun | |
target = migrations.detect { |m| m.version == @target_version } | |
raise UnknownMigrationVersionError.new(@target_version) if target.nil? | |
target.migrate(:up) | |
end |
I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.
In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.
While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.
Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio