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
| Blog.find({} function(err, docs) { | |
| if (err) { | |
| cb(err, null); | |
| } else { | |
| console.log(docs); | |
| } | |
| }); |
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
| describe 'mean' do | |
| let(:array_1) { [1, 2, 3, 4, 5, 5, 7] } | |
| let(:array_2) { [4, 4, 5, 5, 6, 6, 6, 7] } | |
| it "is defined as a method" do | |
| defined?(mean).should eq 'method' | |
| 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
| function createMy() { | |
| var my = {}, | |
| privateVariable = 1; | |
| function privateMethod() { | |
| // ... | |
| } | |
| my.moduleProperty = 1; | |
| my.moduleMethod = 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
| def super_fizzbuzz(array) | |
| fizzbuzzed = [] | |
| array.each do |num| | |
| if num % 3 == 0 && num % 5 == 0 # return "FizzBuzz" | |
| elseif num % 3 == 0 # return "Fizz" | |
| elseif num % 5 == 0 # return "Buzz" | |
| elseif num / | |
| place | |
| 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
| # shortest_string is a method that takes an array of strings as its input | |
| # and returns the shortest string | |
| # +array+ is an array of strings | |
| # shortest_string(array) should return the shortest string in +array+ | |
| # If +array+ is empty the method should return nil | |
| # array.sort.first | |
| def shortest_string(array) | |
| new_count = [ ] |
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
| { | |
| "id": 6, | |
| "name": "Campaign with RFPs and IOs", | |
| "budget_cents": 11100000, | |
| "start_date": "2013-04-29", | |
| "end_date": "2014-02-21", | |
| "client": { | |
| "id": 6, | |
| "name": "Kwik-E-Mart" | |
| }, |
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 http = require('http'), | |
| should = require('should'), | |
| io = require('socket.io'), | |
| decode = require('.npm/socket.io/0.6.8/package/lib/socket.io/utils').decode, | |
| encode = require('.npm/socket.io/0.6.8/package/lib/socket.io/utils').encode, | |
| WebSocket = require('.npm/socket.io/0.6.8/package/support/node-websocket-client/lib/websocket.js').WebSocket; | |
| exports['Socket.IO mocking'] = function(assert){ | |
| var _server = require('http').createServer(function(){}); | |
| // A mock client object. |
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
| module Frylock | |
| attr_accessor :app | |
| def config | |
| @config ||= Frylock::Config.new(app || Rails) | |
| 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
| sudo su postgres -c '/opt/local/lib/postgresql84/bin/initdb -D /opt/local/var/db/postgresql84/defaultdb' | |
| sudo sed -i -e 's/#client_min_messages = notice/client_min_messages = error/' /opt/local/var/db/postgresql84/defaultdb/postgresql.conf | |
| sudo sed -i -e 's/#log_min_messages = warning/log_min_messages = error/' /opt/local/var/db/postgresql84/defaultdb/postgresql.conf | |
| sudo /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/postgresql84-server.wrapper start | |
| sudo su postgres -c '/opt/local/lib/postgresql84/bin/createuser -s mms' | |
| sudo su postgres -c '/opt/local/lib/postgresql84/bin/createuser -s YOUR_USER_NAME' | |
| /opt/local/lib/postgresql84/bin/createdb mms_development | |
| /opt/local/lib/postgresql84/bin/createdb mms_test |
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
| ActionController::Routing::Routes.draw do |map| | |
| map.resources :fans | |
| map.resources :league_players | |
| map.logout '/logout', :controller => 'sessions', :action => 'destroy' | |
| map.login '/login', :controller => 'sessions', :action => 'new' | |
| map.check '/check', :controller => 'sessions', :action => 'create' | |
NewerOlder