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
# Run using rspec. | |
# e.g.: rspec file_name.rb | |
require 'rubygems' | |
require 'rspec' | |
module Enumerable | |
def mymap (&block) | |
return nil if block.nil? |
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
// Run using jasmine-node. | |
// e.g.: jasmine-node file_name.spec.js | |
Array.prototype.mymap = function (callback) { | |
var obj = Object(this); | |
if (obj.length === 0) return null; | |
if (typeof(callback) === 'undefined') return null; | |
for (var i = 0, o; o = obj[i]; i++) { |
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 'rubygems' | |
require 'rspec' | |
module Enumerable | |
def myinject (base = nil, &block) | |
return nil if block.nil? | |
return nil if self.length.zero? | |
if base.nil? | |
case self.first |
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
Array.prototype.myinject = function () { | |
var obj = Object(this); | |
var base; | |
var callback; | |
if (arguments.length === 2) { | |
base = arguments[0]; | |
callback = arguments[1]; | |
} else if (arguments.length === 1) { | |
callback = arguments[0]; |
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
rm -rf _deploy | |
mkdir _deploy | |
cd _deploy | |
git init | |
git remote add origin [email protected]:username/username.github.io.git | |
git pull origin master | |
cd .. | |
bundle exec rake deploy |
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
# Get a list of existing remote branches | |
git fetch origin | |
# Checkout the branch from that branch | |
git checkout -b branch_name origin/branch_name | |
git pull origin branch_name | |
git push origin branch_name # yields 'Everything up-to-date' |
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
# By commit hash | |
git for-each-ref --sort=-committerdate refs/heads/ | |
# By name, date. | |
git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(authorname) %(refname:short)' |
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
// Reset the index to the desired tree. | |
git reset <specific sha> | |
// Move the branch pointer back to the previous HEAD. | |
git reset --soft HEAD@{1} | |
git commit | |
git push origin master |
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
upstream foo_backend { | |
server 127.0.0.1:8080; | |
} | |
server { | |
listen 443 ssl; | |
ssl_certificate /etc/nginx/ssl/foo.com.bundle.crt; | |
ssl_certificate_key /etc/nginx/ssl/foo.com.key; | |
ssl_ciphers RC4:HIGH:!aNULL:!MD5; | |
ssl_prefer_server_ciphers on; |
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
CREATE TABLE employees (company varchar, name varchar, age int, role varchar, primary key (company, name, age)) with clustering order by (name desc, age asc); |
OlderNewer