Skip to content

Instantly share code, notes, and snippets.

# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@epitron
epitron / instapaper-backup.rb
Last active October 17, 2017 02:37
An Instapaper scraper.
#!/usr/bin/env ruby
require 'mechanize'
USERNAME = ""
PASSWORD = ""
# TODO: Save cookies with "http.cookie_jar.{load,save} filename"
# TODO: Store password in ~/.config or some kind of wallet
@gbp
gbp / spec_helper.rb
Created March 14, 2014 10:43
rspec with zeus and spork
require 'rubygems'
prefork = lambda {
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
}
each_run = lambda {
...
@samknight
samknight / fuzzyregex.js
Created February 7, 2014 14:39
Fuzzy Regex match
// This will allow unordered search terms to match relevant string
// e.g. Really Long String will be matched by
// - long string
// - long really
// - all ring
// ..etc
// I have used this anonymous function to override the matcher function in select2
function(term, text) {
@L422Y
L422Y / osx_automount_nfs.md
Last active December 6, 2025 17:55
Automounting NFS share in OS X into /Volumes

I have spent quite a bit of time figuring out automounts of NFS shares in OS X...

Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible:

/etc/auto_master (see last line):

#
# Automounter master map
#

+auto_master # Use directory service

@nowlinuxing
nowlinuxing / gist:6435240
Created September 4, 2013 10:23
execute Controller#action via rails runner with user authentication (devise)
rails runner "ApplicationController.allow_forgery_protection = false; s = ActionDispatch::Integration::Session.new(Rails.application); s.post('/login', user: {login: 'admin', password: 'password'}); s.get('/my'); puts s.response.body"
@kneath
kneath / growth.md
Last active November 12, 2018 06:33
Growth position

Hack on github.com with me

Thanks everyone! I've got enough leads for the time being.

@maxehmookau
maxehmookau / raspiairplay.md
Created July 2, 2013 19:04
How to turn a Raspberry Pi in to an AirPlay Server

How to turn a Raspberry Pi in to an AirPlay Server

$ ssh [email protected]
Enter Password: raspberry

$ sudo raspi-config
Choose 'Repurpose entire SD card'

Update apt repositories

@qrush
qrush / gist:5301799
Created April 3, 2013 14:41
spring clean your git repos!
# remove any bad refs
git remote prune origin
# pipe into bash and auto-delete any branches that have been merged into master!
git log master --pretty=format:'%d' | grep '^ (origin' | tr -d ' ()' | sed 's/origin\//git push origin :/'
@Odaeus
Odaeus / packages.md
Last active December 15, 2015 10:19
Packages for running Ruby on Rails on Ubuntu

Minimal for gem compilation

  • build-essential

Common for gems

  • libxml2
  • libxml2-dev (for nokogiri)

Ruby compilation

  • libreadline6