Skip to content

Instantly share code, notes, and snippets.

View adamhunter's full-sized avatar

Adam Hunter adamhunter

View GitHub Profile
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
-module(test_helper).
-export([riak_test/1]).
riak_test(Fun) ->
start_riak(),
{ok, Riak} = riak:local_client(),
Ret = (catch Fun(Riak)),
stop_riak(),
case Ret of
-module(bucket_reloader).
-export([reload/3]).
reload(FromServer, ToServer, Bucket) ->
{ok, CFrom} = riak:client_connect(FromServer),
{ok, CTo} = riak:client_connect(ToServer),
{ok, Keys} = CFrom:list_keys(Bucket),
io:format("Transferring ~p keys~n", [length(Keys)]),
transfer(CFrom, CTo, Bucket, Keys, 0).
@jakebellacera
jakebellacera / nginx-apache-reverse-proxy-wordpress-mu-vhost.conf
Created September 21, 2010 23:39
Useful nginx virtual host configuration for reverse proxy (proxy_pass) with Apache
# useful nginx configuration for reverse proxy with Apache
# edit lines 8, 11, and 30
# taken from: http://syslog.tv/2010/01/11/debian-apache-2-nginx-wordpress-mu/
# edits by jakebellacera (http://github.com/jakebellacera && http://jakebellacera.com)
server {
listen 80;
server_name domain.com *.domain.com; # edit this to your domain
@nowhereman
nowhereman / Object_tap.html
Last active June 11, 2016 21:27
Object#tap in JavaScript
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Object#tap in JavaScript</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="http://sugarjs.com/javascripts/sugar-0.9.5.min.js"></script>
<script type="text/javascript">
jQuery.noConflict();
(function($) {
def output name=((default=true); "caius")
puts "name: #{name.inspect}"
puts "default: #{default.inspect}"
end
output
# >> name: "caius"
# >> default: true
output "avdi"
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@jwarchol
jwarchol / README.md
Created July 28, 2012 21:06
Breathing LED on a Raspberry Pi

Raspberry Pi Breathing LED

This is a demonstration of using Ruby and the WiringPi Gem to pulse an LED connected to a GPIO pin in a manner similar to the sleep indicator on a MacBook.

A video of the effect can be found here: http://www.youtube.com/watch?v=NCUMXK7qf-c

// Make our app module, its easier to do this in raw javascript
// and then put the rest of our app content (controllers etc)
// in their own coffeescript files.
//
// Your ng-app should include this module name, eg: <html ng-app="TodoApp">
angular.module('TodoApp', []);
@justinbaker999
justinbaker999 / evil.rb
Created November 17, 2014 18:24
evil programmer fiend.. usage ruby evil.rb <filetoreplace>
s=IO.read(ARGV[0]);File.write(ARGV[0], s.gsub(";","\u037E"))