Key Binding | Description |
---|---|
f |
search for file / directory |
This file contains 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 'spec_helper' | |
describe Assignment do | |
describe "#percentage" do | |
specify do | |
assignment = Assignment.new(score: 5, total: 10) | |
expect(assignment.percentage).to eq(50) | |
end | |
end |
This file contains 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
angular.module("rails").factory "RailsResourceCollection", (_) -> | |
class RailsResourceCollection | |
constructor: (models=[]) -> | |
@models = models | |
angular.module("rails").factory "RailsResourceCollectionMixin", (RailsResourceCollection) -> | |
RailsResourceCollectionMixin = -> | |
RailsResourceCollectionMixin.extended = (Resource) -> | |
Resource.intercept "afterResponse", (result, resource, context) -> |
This file contains 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 | |
set -x | |
set -e | |
DATABASE='YOUR_DEV_DATABASE' | |
HEROKU_APP='YOUR_HEROKU_APP' | |
dropdb ${DATABASE} |
This file contains 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
# Taken from https://gist.github.com/mattwynne/1228927 | |
# | |
# usage: | |
# it "should return a result of 5" do | |
# eventually { long_running_thing.result.should eq(5) } | |
# end | |
# | |
module AsyncHelpers | |
def eventually(options = {}) | |
timeout = options[:timeout] || 2 |
This file contains 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
class TestServer | |
def initialize(options) | |
@server_port = options.fetch(:server_port) | |
@client_port = options.fetch(:client_port) | |
end | |
def start | |
@pid = spawn(command) | |
end |
This file contains 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 UserSchema = new Schema({ | |
email : String, | |
hashed_password : String, | |
first_name : String, | |
last_name : String, | |
salt : String, | |
auth_method : String, | |
signupDate : { type: Date, default: Date.now } | |
}); |
This file contains 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 flatiron = require('flatiron'), | |
path = require('path'), | |
plates = require('plates'), | |
app = flatiron.app; | |
app.config.file({ file: path.join(__dirname, 'config', 'config.json') }); | |
app.use(flatiron.plugins.http); | |
app.use(require("./plugins/load")); |
This file contains 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
defmodule Rps do | |
def run(input) do | |
player1 = String.split(input, "") | |
player2 = Enum.shuffle(["r", "p", "s"]) | |
result = | |
[player1, player2] | |
|> Enum.zip() | |
|> Enum.map(&result/1) | |
|> Enum.sum() | |
|> case do |
OlderNewer