Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Gauthier ngauthier

View GitHub Profile
@beanieboi
beanieboi / gist:ad526faf063181f336a2
Last active Sep 13, 2021
Codeship Nginx Config for Heroku
View gist:ad526faf063181f336a2
daemon off;
# Heroku dynos have at least 4 cores.
worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>;
events {
use epoll;
accept_mutex on;
worker_connections 1024;
}
View indecent_exposure.rb
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
View README.md
@ngauthier
ngauthier / computers.md
Created Nov 24, 2012
Computers for sale
View computers.md

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 Aug 29, 2012
Javascript Lint Lightning Talk
View Gemfile
source :rubygems
gem 'showoff'
gem 'gli', '1.6.0'
@jlong
jlong / uri.js
Created Apr 20, 2012
URI Parsing with Javascript
View uri.js
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 Mar 13, 2012
Gnome-shell dual monitor separate workspaces
View gist:2025990
# 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 Jan 6, 2012
Ubuntu Way of managing Rubies
View gist:1569088
# 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 \
View default_param_hack.rb
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 Dec 21, 2011
Import a blogger archive to jekyll
View import.rb
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)