Skip to content

Instantly share code, notes, and snippets.

View szehnder's full-sized avatar

Sean Zehnder szehnder

  • Samsung Ads
  • Lexington, KY
View GitHub Profile
//
// Signal+Extensions.swift
// Khan Academy
//
// Created by Nacho Soto on 10/1/15.
// Copyright © 2015 Khan Academy. All rights reserved.
//
import ReactiveCocoa
@cobbal
cobbal / monad.swift
Last active April 6, 2016 04:40
Monad protocol in swift
protocol Monad {
typealias F
typealias U
class func bind<M : Monad where M.U == U>(Self, F -> M) -> M
class func `return`(F) -> Self
}
extension Array : Monad {
typealias F = T
@yctay
yctay / figaro-capistrano.rb
Created April 30, 2013 05:34
Capistrano recipe for deploying figaro's application.yml
namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
transfer :up, "config/application.yml", "#{shared_path}/application.yml", :via => :scp
end
desc "Symlink application.yml to the release path"
task :finalize do
run "ln -sf #{shared_path}/application.yml #{release_path}/config/application.yml"
end
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@thekindofme
thekindofme / delayed_job
Created November 22, 2011 02:55 — forked from semipermeable/delayed_job
Sys-V init script for delayed job that plays well with capistrano and rvm
#! /bin/sh
### BEGIN INIT INFO
# Provides: delayed_job
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
### END INIT INFO
@fabrizioc1
fabrizioc1 / install-sqlite.sh
Created July 14, 2011 18:34
Installing sqlite3 in CentOS for use with ruby-sqlite3
# The YUM package is too old for use with ruby-sqlite3, use the autoconf package from www.sqlite.org
cd /opt
wget http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz
tar xvzf sqlite-autoconf-3070701.tar.gz
ln -s /opt/sqlite-autoconf-3070701 /opt/sqlite3
cd /opt/sqlite3
./configure --prefix=/opt/sqlite3
make
make install
# Shared library will be installed in /usr/local/lib.
@elisehuard
elisehuard / gist:819022
Created February 9, 2011 18:58
(minimal) mongrel2 handler in ruby
require 'zmq'
require 'json'
handler_ctx = ZMQ::Context.new(1)
# receive and response for mongrel2 handlers
# queue address corresponds to what's in the configuration
recv_queue = handler_ctx.socket(ZMQ::PULL)
recv_queue.connect("tcp://127.0.0.1:9999")
@thokra
thokra / gist:818689
Created February 9, 2011 15:50
jQuery fix
$.ajaxSetup({
headers: {
"X-CSRF-Token": $("meta[name='csrf-token']").attr('content')
}
});