Skip to content

Instantly share code, notes, and snippets.

View vinbarnes's full-sized avatar

Kevin R. Barnes vinbarnes

View GitHub Profile
gist_ql()
{
GIST=$1
TMPFILE=~/tmp/gist_$GIST
gist $GIST > ~/tmp/gist_$GIST
qlmanage -c public.plain-text -p $TMPFILE >& /dev/null
}
#!/usr/bin/env ruby
require 'rubygems'
require 'mechanize'
MY_NAME = 'Yossef Mendelssohn'
CHECKIN_REQUEST_URL = 'http://www.southwest.com/flight/retrieveCheckinDoc.html'
prompt = false
conf = ARGV[0]
require 'spec/runner/formatter/progress_bar_formatter'
class NescafeFormatter < Spec::Runner::Formatter::ProgressBarFormatter
def example_failed(example, counter, failure)
super
dump_failure(counter, failure)
end
end
@copiousfreetime
copiousfreetime / csv-search.rb
Created November 15, 2011 19:02
Searching through a CSV
#!/usr/bin/env ruby
require 'csv'
# This assumes:
# - Ruby 1.9's CSV library, if you are using 1.8, use FasterCSV.
#
# https://raw.github.com/hadley/data-baby-names/master/baby-names.csv
csv_fname = "baby-names.csv"
@jupp0r
jupp0r / emacs.rb
Created March 1, 2012 01:11
Homebrew Formular enabling Lion Fullscreen for Emacs 24 git HEAD
require 'formula'
class Emacs < Formula
homepage 'http://www.gnu.org/software/emacs/'
url 'http://ftpmirror.gnu.org/emacs/emacs-23.4.tar.bz2'
mirror 'http://ftp.gnu.org/pub/gnu/emacs/emacs-23.4.tar.bz2'
md5 '070c68ad8e3c31fb3cb2414feaf5e6f0'
fails_with_llvm "Duplicate symbol errors while linking.", :build => 2334
@eric
eric / _using_it.rb
Created March 16, 2012 20:41
Use Arel in Rails 2.3
>> engine = ArelBack::Engine.new(ar.connection, Arel::Visitors::MySQL)
>> table = Arel::Table.new(ar.table_name, engine)
>> table.project(Arel.sql('*')).to_sql
=> "SELECT * FROM `awesome_table` "
>>
$(document).ready(function() {
// automatically fix obfuscated email addresses pasted into
// to/cc/bcc fields
$("textarea[name=to], textarea[name=cc], textarea[name=bcc]")
.live('blur', function(e){
var text = $(this).val();
var separators = ['_', ' ', '\\[', '\\]', '\\(', '\\)'];
var separatorExp = '(' + separators.join('|') + ')+';
@paneq
paneq / page.conf
Created April 3, 2013 14:57
nginx maintenance page that is JSON friendly
if (-f $document_root/system/maintenance.html) {
return 503;
}
error_page 503 @maintenance;
location @maintenance {
internal;
if ($http_accept ~ json) {
return 503 "{}";
}
@willurd
willurd / web-servers.md
Last active April 25, 2024 09:21
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
Nature's first green is gold,
Her hardest hue to hold.
Her early leaf's a flower;
But only so an hour.
Then leaf subsides to leaf.
So Eden sank to grief,
So dawn goes down to day.
Timezones: they're here to stay.