Skip to content

Instantly share code, notes, and snippets.

View michaelstephens's full-sized avatar

Michael Stephens michaelstephens

  • Procore Technology
  • United States
View GitHub Profile
var allParrots = document.querySelectorAll("[data-emoji-name]");
for(var i =0; i < allParrots.length; i++){
var d = allParrots[i];
if(d.dataset.emojiName.indexOf('parrot') !== -1) {
d.click();
$(".btn_danger").click();
}
}
@mileandra
mileandra / letsencrypt_setup.md
Last active April 9, 2020 19:39
Letsencrypt on Ubuntu 16.04 with Nginx, Rails and Capistrano-Unicorn-Nginx

Install Letsencrypt

Install with apt-get

$ sudo apt-get update    
$ sudo apt-get install letsencrypt

Generate a strong DH

$ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048

Configure nginx

@halloffame
halloffame / rebuild_database.sh
Last active December 16, 2015 00:49
One line script for destroying and rebuilding Rails database.
bundle exec rake db:reset db:migrate db:test:prepare db:seed
# This will reset your database and reload your current schema.
### OR ###
bundle exec rake db:drop db:create db:migrate db:test:prepare db:seed
# This will destroy your db, recreate it, and then migrate your current schema.
@mungruby
mungruby / singleton_struct.rb
Created May 29, 2012 02:10
Avoiding redefining constant Struct::ClassName warnings
fields = [:switch, :sha_ind, :dtdm, :utdm, :ttdm, :actual]
def create_struct name, fields
Struct.new(name, *fields)
end
def create_singleton_struct name, fields
if Struct::const_defined? name
Struct.const_get name
else
@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"
@adamcrown
adamcrown / .irbrc
Last active November 7, 2023 06:34
My Bundler proof .irbrc file including wirble, awesome_print, hirb, console logging and route helpers
require 'rubygems' unless defined? Gem # rubygems is only needed in 1.8
def unbundled_require(gem)
loaded = false
if defined?(::Bundler)
Gem.path.each do |gems_path|
gem_path = Dir.glob("#{gems_path}/gems/#{gem}*").last
unless gem_path.nil?
$LOAD_PATH << "#{gem_path}/lib"