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
defmodule MyApp.ArchivePostScenario do | |
alias MyApp.Repo | |
alias Ecto.Multi | |
alias __MODULE__.Query | |
def run(options) do | |
post = Keyword.fetch!(options, :post) | |
archive_and_delete([ | |
comments: Query.comments(post), |
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
#!/usr/bin/env bash | |
input_file=$1 | |
header_file=./output/headers.csv | |
rows_file=./output/rows.csv | |
mkdir -p ./output | |
head -1 $input_file > $header_file | |
tail -n +2 $input_file > $rows_file |
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 |
It's easy to organize styles by page when the app is small, but a year from now we'll probably have 50+ pages and having a separate stylesheet for each page will result in tons of duplication.
The grid has a ton of feature and it's really customizable from variables.scss. Anywhere you're doing multi-column layouts, try to use the grid.
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
# 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
#!/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
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) -> |
NewerOlder