Skip to content

Instantly share code, notes, and snippets.

@beanieboi
beanieboi / gist:ad526faf063181f336a2
Last active May 11, 2023 15:59
Codeship Nginx Config for Heroku
daemon off;
# Heroku dynos have at least 4 cores.
worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>;
events {
use epoll;
accept_mutex on;
worker_connections 1024;
}
module IndecentExposure
extend ActiveSupport::Concern
module ClassMethods
private
def expose(name, &block)
var = "@#{name}"
define_method(name) do
instance_variable_set(var, instance_variable_get(var) || instance_eval(&block))
end
@ngauthier
ngauthier / README.md
Created November 27, 2012 16:05
Rdio on Linux
@ngauthier
ngauthier / computers.md
Created November 24, 2012 22:03
Computers for sale

I am consolidating and upgrading my systems, and I have two desktops up for sale.

Gaming Desktop

This is my current gaming machine. I can max out Starcraft II and Diablo III. I can play BF3 on high. Runs Win 8 fast.

  • 3.0ghz quad core AMD processor
  • 8gb RAM
  • 100GB PCIe SSD
  • 1TB HD
@ngauthier
ngauthier / Gemfile
Created August 29, 2012 14:36
Javascript Lint Lightning Talk
source :rubygems
gem 'showoff'
gem 'gli', '1.6.0'
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@rgo
rgo / gist:2025990
Created March 13, 2012 01:16
Gnome-shell dual monitor separate workspaces
# By default the behavior is:
# Primary monitor work as always and second monitor only have one and fixed workspace
# I.e. you change to next workspace, primary monitor change to this workspace and second monitor remain as is.
# The desired behaviour is:
# Primary monitor and secondary monitor are linked workspace.
# I.e. you change to next workspace, primary monitor change to this workspace and second monitor too.
$ gconf-editor
# Look for /desktop/gnome/shell/windows/workspaces_only_on_primary and set to false
@wmoxam
wmoxam / gist:1569088
Created January 6, 2012 05:05
Ubuntu Way of managing Rubies
# Installs Ruby, makes 1.9.2 the default.
sudo aptitude install ruby rubygems ri ruby1.9.1 ri1.9.1 jruby
sudo update-alternatives --remove-all gem
sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.8 300 \
--slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \
/usr/share/man/man1/ruby1.8.1.gz \
def output name=((default=true); "caius")
puts "name: #{name.inspect}"
puts "default: #{default.inspect}"
end
output
# >> name: "caius"
# >> default: true
output "avdi"
@ngauthier
ngauthier / import.rb
Created December 21, 2011 16:19
Import a blogger archive to jekyll
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
# usage: ruby import.rb my-blog.xml
# my-blog.xml is a file from Settings -> Basic -> Export in blogger.
data = File.read ARGV[0]
doc = Nokogiri::XML(data)