Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env sh
echo $SHRUG | tr -d '\n' | pbcopy
echo $SHRUG
stoft / point_mutations_perf_text.exs
Last active Aug 29, 2015
Exercism exercise "point mutations" performance test.
View point_mutations_perf_text.exs
if System.get_env("EXERCISM_TEST_EXAMPLES") do
defmodule DNATest do
use ExUnit.Case, async: true
SteveBenner / macfix1-install-nokogiri.rb
Last active Aug 13, 2019
Mac fix - Install Nokogiri gem on OS X 10.9 Mavericks
View macfix1-install-nokogiri.rb
#!/usr/bin/env ruby
# Mac fix 1 - Install the Nokogiri gem on Mac OS 10.9 Mavericks
# Usage: to configure and install using Bundler, pass in 'bundle' as an argument to the script.
# Nokogiri works at a very low level, so it has many issues on various platforms.
# As a result, the command `install gem nokogiri` often will fail. This fix is for
# errors involving 'libiconv', such as the following one I encountered:
jed /
Last active Nov 27, 2021
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

adamwiggins /
Last active Dec 17, 2015
End of a chapter: my Heroku departure message

It's with a heavy heart that I announce that Friday, May 31 2013 will be my last day at Heroku.

How can I possibly put into words what Heroku has meant to me these last six years? I can say it was a tremendous experience; or the opportunity of a lifetime; or the greatest thing I have ever been a part of. I can say that Heroku has been my life's work, as I did recently in a public blog post. All of those things are true, but none seem to capture the enormity of what's transpired these past six years.

I tend to focus on mechanical elements of a company: product, code, design, process. But what has surprised me the most at Heroku is that none of these things is the best part. The best part is the team.

I've never had the chance to work with a more singular group of people. Talented, passionate, skilled, dedicated. Most of all, sharing a set of values: elegance, craft, maniacal focus on simplicity; and an uncompromising belief that the future will be made of software, and how that software gets made will shape

joakimk / Rakefile
Created Oct 2, 2012
Try to run no-rails rake tasks first and fallback to rails when none is found.
View Rakefile
#!/usr/bin/env rake
# If the code below fails, uncomment this. There are no known issues now, but we had one.
#require File.expand_path('../config/application', __FILE__)
#require File.expand_path('../lib/tasks/no_rails', __FILE__)
# Load all non-rails tasks.
path = File.expand_path('../lib/tasks/no_rails', __FILE__)
piscisaureus /
Created Aug 13, 2012
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

josephwecker /
Created Aug 11, 2012
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful. Now a repo:
# License: Public Domain.
# Author: Joseph Wecker, 2012
# This gist is slow and is missing .bashrc_once
# Use the one in the repo instead!
# (Thanks gioele)
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
scotttam / apns.rb
Created Jan 31, 2012
Sends an Apple Push Notification with Ruby
View apns.rb
require "rubygems"
require "yajl"
require "openssl"
require "socket"
device_token = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62'
device_token = device_token.gsub(" ", "")
the_byte_token = [device_token].pack("H*")
file ="ruby_the_byte_token", "wb")