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
require 'benchmark' | |
def method1(&block) | |
true if block | |
end | |
def method2(&block) | |
true if block_given? | |
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
import Data.Word | |
freq = 0.3 | |
spread = 8.0 | |
unbase :: Integral int => int -> Word8 -> Word8 -> Word8 -> int | |
unbase base r g b = (fi r*base+fi g)*base+fi b | |
where fi = fromIntegral | |
-- | Approximate a 24-bit Rgb colour with a colour in the xterm256 6x6x6 colour cube, returning its index. |
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
server 'server.host.or.ip.address', :app | |
set :user, 'user' | |
set :deploy_to, '/path/to/deploy' | |
set :repository, 'git repository address' | |
set :branch, 'origin/master' | |
namespace :deploy do | |
desc 'Deploy' | |
task :default do |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
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
class Asset < ActiveRecord::Base | |
# === List of columns === | |
# id : integer | |
# data_file_name : string | |
# data_content_type : string | |
# data_file_size : integer | |
# assetable_id : integer | |
# assetable_type : string | |
# type : string |
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
%% Create N processes in a ring. | |
%% Send a message round the ring M times so that a total of N * M messages get sent. | |
-module(ring). | |
-export([start/0, start/2]). | |
start() -> | |
start(10, 10). | |
start(N, M) -> |
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
[ -f $HOME/.profile ] && . $HOME/.profile | |
HISTSIZE=2000 | |
SAVEHIST=$HISTSIZE | |
HISTFILE=$HOME/.zsh_history | |
setopt append_history | |
setopt inc_append_history | |
setopt extended_history | |
setopt hist_find_no_dups | |
setopt hist_ignore_all_dups |
NewerOlder