Skip to content

Instantly share code, notes, and snippets.

View bobthecow's full-sized avatar

Justin Hileman bobthecow

View GitHub Profile
@lg0
lg0 / markdown.xml
Created April 10, 2012 19:58
Markdown Syntax Highlighting for Sublime text 2
<!-- copy this to YOUR_THEME.tmTheme-->
<dict>
<key>name</key>
<string>diff: deleted</string>
<key>scope</key>
<string>markup.deleted</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#EAE3CA</string>
@popthestack
popthestack / wp-to-nanoc.php
Created April 29, 2012 18:48
Hacked together Wordpress -> Nanoc script
<?php
$db = mysql_connect('localhost', 'db_user', 'db_password');
mysql_select_db('blog');
$sql = "SELECT * FROM wp_posts WHERE post_status IN ('publish', 'private') AND post_type = 'post'";
$r = mysql_query($sql);
get_posts($r);
// do drafts separately in order to keep them from messing with published posts' URLs
@yeeguy
yeeguy / quickerclip.rb
Created June 21, 2012 08:25
Faster rspec tests with Paperclip
# inspired by https://gist.github.com/406460 and
# http://pivotallabs.com/users/rolson/blog/articles/1249-stubbing-out-paperclip-imagemagick-in-tests
# plus some additional monkeypatching to prevent "too many files open" err's
#
# place this file in <app root>/spec/support
#
RSpec.configure do |config|
$paperclip_stub_size = "800x800"
end
@brentvatne
brentvatne / quickerclip.rb
Created June 21, 2012 18:17 — forked from yeeguy/quickerclip.rb
Faster rspec tests with Paperclip
# inspired by https://gist.github.com/406460 and
# http://pivotallabs.com/users/rolson/blog/articles/1249-stubbing-out-paperclip-imagemagick-in-tests
# plus some additional monkeypatching to prevent "too many files open" err's
#
# place this file in <app root>/spec/support
#
RSpec.configure do |config|
$paperclip_stub_size = "800x800"
end
@mikhailov
mikhailov / 0. nginx_setup.sh
Last active April 2, 2024 14:57
NGINX+SPDY with Unicorn. True Zero-Downtime unless migrations. Best practices.
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@skrat
skrat / gist:3181775
Created July 26, 2012 12:34
Backbone.Model getters/setter for default attributes
/**
* Defines getter/setter properties using Backbone.Model defaults
* @param {Function} ctor constructor of Bakcbone.Model
*/
function defaultProperties(ctor) {
if (!ctor.prototype.defaults)
return;
var defattr = function(name) {
Object.defineProperty(ctor.prototype, name, {
get: function() {
@ttscoff
ttscoff / growlnotify.rb
Created August 1, 2012 11:18
Seamless drop-in to turn existing growlnotify calls into Mountain Lion Notifications
#!/usr/bin/env ruby
# encoding: utf-8
# == Synopsis
# Requires the terminal-notifier gem ([sudo] gem install terminal-notifier)
# growlnotify wrapper to turn Growl alerts into Mountain Lion notifications
# Uses growlnotify option syntax to keep your old scripts working with the new shiny.
#
# If you use Growl via growlnotify in your shell scripting, this script
# will replace Growl's alerts with Mountain Lion notifications.
@ttscoff
ttscoff / keys.m
Created August 5, 2012 14:48
Command line utility for checking whether a modifier key is held
#import <Carbon/Carbon.h>
// `keys` utility for checking whether a modifier key is held
// From <http://lists.apple.com/archives/applescript-users/2009/Sep/msg00374.html>
//
// $ clang keys.m -framework Carbon -o keys
int main (int argc, const char * argv[]) {
unsigned int modifiers = GetCurrentKeyModifiers();
if (argc == 1)
@ttscoff
ttscoff / Launch All in Dock.applescript
Created August 5, 2012 14:58
Launch all Dock apps with exclusions based on modifier keys
-- Launch All in Dock.applescript
-- Brett Terpstra 2012
--
-- Modified version of an AppleScript to launch all
-- persistent (Keep in Dock) apps[^1]. Allows you to exclude
-- apps based on modifier keys held when it runs.
--
-- Uses the `keys` utility found on the Apple Mailing Lists[^2].
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
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 = git@github.com:joyent/node.git

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: