Skip to content

Instantly share code, notes, and snippets.

@strawberryjello
strawberryjello / postgresql-cleanup.sh
Created June 15, 2016 08:00
Cleaning up PostgreSQL PID file and restarting the server after it crashes because of OS X updates
#! /bin/sh
rm /usr/local/var/postgres/postmaster.pid
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
@robertsdionne
robertsdionne / deepdream-install.md
Last active February 15, 2021 16:07
Deepdream installation
#!/usr/bin/env bash

# Assuming OS X Yosemite 10.10.4

# Install XCode and command line tools
# See https://itunes.apple.com/us/app/xcode/id497799835?mt=12#
# See https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html
xcode-select --install
@bomberstudios
bomberstudios / sketch-plugins.md
Last active February 26, 2024 07:02
A list of Sketch plugins hosted at GitHub, in no particular order.
@sj26
sj26 / capybara-jquery_ui.rb
Last active January 30, 2019 14:45
Some helpers for interactive with jQuery UI from Capybara, but only when using Selenium WebDriver.
require "capybara"
# Encapsulate some jQuery UI interactions so we can call them cleanly using Capybara.
module Capybara::JQueryUI
# Find the jQuery UI Autocomplete widget corresponding to this element
def autocompleter
jquery_result(jquery_this(".autocomplete('widget')").first)
end
# Fill in an autocompletable field and accept a completion.
@jescalan
jescalan / shakespearian_insults.coffee
Created May 18, 2012 17:46
Release the shakespearian insults!
# Because sometimes curses are not enough.
request = require 'request'
module.exports = (robot) ->
robot.respond /release the shakespearian insults/i, (msg) ->
request uri: 'http://www.pangloss.com/seidel/Shaker/index.html', (err, res, body) ->
msg.send body.match(/<font size="\+2">\s(.*)<\/font>/)[1].replace(/<br>/, " ")
@mikehoward
mikehoward / gist:2012377
Created March 10, 2012 18:22
re-write of MiniMagick

This is a rough outline rewrite the internals of MiniMagick - a ruby gem for using ImageMagick and GraphicsMagick from ruby scripts. MiniMagick's most prominent feature is creating appropriate shell commands which are run as subprocesses - thereby making the gem less fragile w.r.t. the graphics libraries and changes to the *Magick routines.

the Image Class.

The MiniMagick image class does too much. I propose that the Image class should be responsible for the image files only and not be involved in running *Magick commands.

Image#new(path = nil)

If path is nil, creates a temporary file using

@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@robertjwhitney
robertjwhitney / stupid-watcher.gemspec
Created December 22, 2011 23:24
stupid watcher is stupid
Gem::Specification.new do |s|
s.name = 'stupid-watcher'
s.version = '0.0.2'
s.platform = Gem::Platform::RUBY
s.author = 'Robert Whitney'
s.email = 'robertj.whitney@gmail.com'
s.summary = 'Stupid watcher is stupid'
s.description = 'Watches a file, does stuff when that file is updated.'
s.files = ['stupid_watcher.rb']
@rkh
rkh / chat.rb
Created December 14, 2011 12:55
Simple Chat Application using the Sinatra Streaming API
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
@mikhailov
mikhailov / installation.sh
Created November 23, 2010 15:18
nginx+passenger (real production config)
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz