Skip to content

Instantly share code, notes, and snippets.

View airblade's full-sized avatar

Andy Stewart airblade

View GitHub Profile
@airblade
airblade / gist:10651609
Last active February 20, 2018 22:57
Vim testing frameworks

In no particular order:

  • vroom

    • uses vim as a server
    • implemented in python
    • tests written in custom syntax
  • vimrunner

    • uses vim as a server
  • implemented in ruby

@airblade
airblade / private.xml
Created August 8, 2013 09:50
Easier access to umlauts and sharp-s on OSX using KeyRemap4MacBook
<?xml version="1.0"?>
<root>
<item>
<name>Easier umlauts</name>
<appendix>Use left-control + vowel</appendix>
<identifier>private.easier_umlauts</identifier>
<autogen>
__KeyToKey__
KeyCode::A, ModifierFlag::CONTROL_L | ModifierFlag::SHIFT_L,
-- See article here: http://daringfireball.net/2007/07/simple_inbox_sweeper
-- The following should be one long line:
set _description to "All unflagged, read messages in each IMAP account
inbox will be moved to the “Archive” mailbox corresponding to that
account. This action is not undoable."
tell application "Mail"
display alert "Archive read messages from IMAP inboxes?" buttons ¬
{"Cancel", "Archive"} cancel button 1 message _description
@airblade
airblade / gist:4713705
Created February 5, 2013 10:53
Typhoeus example.
require 'typhoeus'
class ImageDownloader
# Returns an array of images at the given `urls`.
# Each element is either a StringIO representation of an image
# or nil if the image could not be downloaded for any reason.
#
# Params:
# urls - an array of URLs pointing to images
(*
# DESCRIPTION #
This script files the selected Mail messages to the specified folder (Action, by default).
# LICENSE #
Created by Dan Byler (contact: dbyler@gmail.com); released as public domain.
@airblade
airblade / gist:2988937
Created June 25, 2012 14:21
Monkey-patch enabling Rails 2.3 to use SMTP over SSL
# config/initializers/email.rb
# Monkey-patch to enable ActionMailer to send STMP email over SSL.
# Necessitated by Fastmail mandating SSL by 30 June 2012.
module ActionMailer
class Base
def perform_delivery_smtp(mail)
destinations = mail.destinations
mail.ready_to_send
@airblade
airblade / gist:2988877
Created June 25, 2012 14:11
Monkey-patch enabling Rails 3.0 - 3.1 to use SMTP over SSL
# config/initializers/email.rb
require 'mail'
# Monkey-patch Mail to support SSL, which Fastmail mandates by 30 June 2012.
#
# Mail introduced SSL support in v2.4.0.
# Rails / ActionMailer doesn't use that version of Mail until Rails 3.2.0.
#
@airblade
airblade / crontab
Created March 6, 2012 09:27
Nginx and Unicorn configuration for Rails 3.0.x apps.
@reboot cd /var/www/apps/myapp/current && bundle exec unicorn -c /var/www/apps/myapp/current/config/unicorn.rb -E production -D
@airblade
airblade / nginx
Created February 7, 2012 09:41
Nginx configuration for Rails 2.3 apps
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon (Centos)
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
@airblade
airblade / pre-commit
Created February 6, 2012 14:51
Git pre-commit hook to prevent direct commits to staging or production branches.
#!/bin/sh
BRANCH=$(git name-rev HEAD | cut -d' ' -f2)
if [ "$BRANCH" = "staging" -o "$BRANCH" = "production" ]
then
echo "You must not commit to staging or production."
exit 1
fi