| EMBERJS | BACKBONEJS |
|---|---|
| -built in support for standard features yields a larger package size | +smaller package size |
| +supporting many common features means library's dependencies list will grow less over time | -achieves smaller package size by sacrificing built in features |
| -if the common features aren't needed then they are unnecessarily included | -smaller package size advantage is lost if many libraries are used to compensate/extend backbone's feature set |
| +hailed as strong when for multipage, navigational, long-term project | +hailed as strong when project is a single page or part of a page (widget) |
| +has a default testing stack using QUnit | -no default testing library, implies a task for choosing and implementing a testing stack |
| +More opinionated can be good when multiple teams or developers are working in the same project | -Less opinionated can be bad when multiple teams or developers are working in the same project. Can lead to incons |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while IFS="," read -r downcased titleized; do | |
| cd What${titleized}IsIt | |
| git checkout . | |
| sed -i "s/center/not-center/g" ./index.html | |
| sed -i 's/document.getElementById("time").innerHTML = (date + "<br\/>" + time + ":" + s);/document.getElementById("time").innerHTML = ("<div class='pull-left'>" + date + "<\/div><div class='pull-right'>" + time + ":" + s + "<\/div>");/g' ./assets/script.js | |
| cat ../style.css >> assets/style.css | |
| git commit -am "Adds markup and css for pull-left and pull-right classes" | |
| git push -u origin gh-pages | |
| cd .. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [email protected]:rthbound/WhatMoonIsIt.git | |
| sourcename=WhatMoonIsIt | |
| while IFS="," read -r downcased titleized; do | |
| rm -rf What${titleized}IsIt | |
| newsource=$(echo $source | sed "s/$sourcename/$titleized/g") | |
| git clone $source What${titleized}IsIt | |
| find ./What${titleized}IsIt -type f -exec sed -i "s/Moon/$titleized/g" {} \; | |
| find ./What${titleized}IsIt -type f -exec sed -i "s/our moon/moon/g" {} \; | |
| find ./What${titleized}IsIt -type f -exec sed -i "s/moon/$downcased/g" {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def getgst | |
| d { 'gets fired' } | |
| s = Building.get_gst_for_building(params[:buildinginfo]) | |
| d { s.to_s('F') } | |
| @var = s.to_s('F') | |
| respond_to do |format| | |
| format.html { render :text => @var } | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if request.xhr? | |
| render partial: 'this_controller/index', layout: false | |
| else | |
| respond_to do |format| | |
| format.html # index.html.erb | |
| format.json | |
| end | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "usno/imagery" | |
| require "open-uri" | |
| require "RMagick" | |
| include Magick | |
| def animate(n,f) | |
| i=0 | |
| time = Time.now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Monkey patch hash | |
| class Hash | |
| # @return [Hash] a hash with underscored keys | |
| def underscore_keys | |
| result = {} | |
| self.each do |k,v| | |
| k = k.to_s.underscore | |
| result[k] = v.kind_of?(Hash) ? v.underscore_keys : v | |
| result[k] = v.collect { |obj| obj.underscore_keys if obj.kind_of?(Hash) } if v.kind_of?(Array) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SQLite version 3.x | |
| # gem install sqlite3 | |
| # | |
| # Ensure the SQLite 3 gem is defined in your Gemfile | |
| # gem 'mysql2' | |
| #gem 'pg' | |
| development: | |
| adapter: postgresql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Extend the Array class with a to_h method | |
| class Array | |
| def to_h | |
| Hash[*self] | |
| end | |
| end | |
| # Extend rexml/document to create a Ruby hash from xml | |
| class REXML::Document |