Skip to content

Instantly share code, notes, and snippets.

View invisiblefunnel's full-sized avatar

Danny Whalen invisiblefunnel

View GitHub Profile
# Hoptoad integration example.
task "deploy:before" => "isolate:dotgems" do
if /\.gems/ =~ `git status`
abort "Changed gems. Commit '.gems' and deploy again."
end
ENV["TO"] = Deploy.env
end
irb(main):001:0> class Foo; def to_ary; ['<3', :hi]; end end
=> nil
irb(main):002:0> a ,= Foo.new
=> #<Foo:0x007fbd8a08c4e8>
irb(main):003:0> a
=> "<3"
irb(main):004:0>
@NZKoz
NZKoz / aa_instructions.md
Created May 2, 2012 03:07
Back Up All Your Gmail
  • Install getmail (aptitude install getmail4)
  • Set Up Your Imap Server (tl;dr)
  • getmail
  • ruby date_based_archive.rb ~/Maildir/.Archive

1. Load data

  • Setup postgres or your database or choice.
  • Download the onebusaway gtfs loader.
  • Find the appropriate database jar (postgresql, 9.4-1201 JDBC 41 is what I used)
java -classpath path/to/onebusaway-gtfs-hibernate-cli-1.3.4.jar:path/to/postgresql-9.4-1201.jdbc41.jar \
  org.onebusaway.gtfs.GtfsDatabaseLoaderMain \
  --driverClass=org.postgresql.Driver \
@pkqk
pkqk / unicodecsv.py
Created November 6, 2012 18:05
Unicode safe extension to csv.DictReader
"""
Safely deal with unicode(utf-8) in csv files
removing nasty BOM surprises
"""
import csv
import codecs
require 'fiddle'
require 'minitest/autorun'
class RubyVM
class InstructionSequence
address = Fiddle::Handle::DEFAULT['rb_iseq_load']
func = Fiddle::Function.new(address, [Fiddle::TYPE_VOIDP] * 3, Fiddle::TYPE_VOIDP)
define_singleton_method(:load) do |data, parent = nil, opt = nil|
func.call(Fiddle.dlwrap(data), parent, opt).to_value
@jamis
jamis / growing-tree.rb
Created December 31, 2010 05:23
An implementation of the "Growing Tree" algorithm for maze generation.
# --------------------------------------------------------------------
# An implementation of the "Growing Tree" algorithm. This one is
# notable for it's ability to become nearly identical to Prim's
# algorithm, or the Recursive Backtracking algorithm, depending on
# how the cells are removed from the list that aggregates as the
# algorithm runs.
#
# This script allows you to play with those settings by specifying
# the mode after the width and height parameters, as "random" (pull
# the cell from list at random), "newest" (pull the newest cell),
@chengyin
chengyin / linkedout.js
Last active July 11, 2021 15:23
Unsubscribe all LinkedIn email in "one click". For an easier to use version, you can check out the bookmarklet: http://chengyin.github.io/linkedin-unsubscribed/
// 1. Go to page https://www.linkedin.com/settings/email-frequency
// 2. You may need to login
// 3. Open JS console
// ([How to?](http://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers))
// 4. Copy the following code in and execute
// 5. No more emails
//
// Bookmarklet version:
// http://chengyin.github.io/linkedin-unsubscribed/
@pramsey
pramsey / ccog-readinglist.md
Last active September 3, 2021 00:30
Canadian Council on Geomatics Reading List
@dunhamsteve
dunhamsteve / table.html
Last active July 17, 2022 17:34
Example of a scrollable table that only renders visible rows
<!-- This code is public domain, share and enjoy. -->
<html>
<style type="text/css" media="screen">
#table {
position: absolute;
top: 30px;
bottom: 0;
left: 10px;
right: 10px;
}