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
| @paper_totals_by_client = Paper.past_pending | |
| .joins(:client) | |
| .group("clients.name") | |
| .limit(5) | |
| .count | |
| # returns an object like the following: | |
| # => {"Sample Business"=>1, "Sample Business 2"=>1, "Sample Business 3"=>1, "Sample Business 4"=>6} |
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
| MSSWApp = Ember.Application.create(); | |
| MSSWApp.Router.map(function() { | |
| this.resource('categories', function() { | |
| this.resource('category', { path: ':category_id' }); | |
| }); | |
| }); | |
| MSSWApp.IndexRoute = Ember.Route.extend({ | |
| model: function() { |
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 'benchmark' | |
| def build_spiral(spiral_size) | |
| total = 0 | |
| spiral_size.step(1, -2) do |i| | |
| v1= i**2 | |
| i -= 1 | |
| total += i == 0 ? 1 : [v1, v1-i, v1-2*i, v1-3*i].inject{ |sum,x| sum + x } | |
| end | |
| total |
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
| #!/bin/bash | |
| # CentOS rbenv system wide installation script | |
| # Forked from https://gist.github.com/1237417 | |
| # Installs rbenv system wide on CentOS 5/6, also allows single user installs. | |
| # Install pre-requirements | |
| yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \ | |
| make bzip2 autoconf automake libtool bison iconv-devel git-core |
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 'test/unit' | |
| class SampleTest < Test::Unit::TestCase | |
| def test_ | |
| end | |
| end | |
| # Returns the following |
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
| var Person = function(name) { | |
| this.name = name; | |
| } | |
| Person.prototype.getName = function() { | |
| return this.name; | |
| } | |
| var thomas = new Person('Thomas'); | |
| var amy = new Person('Amy'); |
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
| (function(countdown, container){ | |
| function log(){ | |
| console.log(index); | |
| } | |
| function iterate(){ | |
| log(); | |
| if(index>1) setTimeout(iterate, 1000); | |
| index--; |