Skip to content

Instantly share code, notes, and snippets.

@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 March 22, 2024 13:44
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 pi@192.168.xxx.xxx
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
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@garethrees
garethrees / _analytics.html.erb
Created November 24, 2012 22:35
Rails Shared Templates
<%#
# Renders Google Analytics tracking script
#
# Example
#
# <%= render 'shared/analytics', ua_code: 'UA-XXXXXX-X' %>
#
#%>
<% if Rails.env.production? %>
<script type="text/javascript">
@garethrees
garethrees / hash_arguments.rb
Last active October 12, 2015 14:08
Hash arguments, default values and asserting valid keys
def donate_to_charity(args = {})
# Set valid options that can be supplied. All others will be cut.
valid_args = [:user_id, :charity_id, :amount]
# Set default options if none are supplied
defaults = { :user_id => nil,
:charity_id => 1,
:amount => 25 }
# Raise ArgumentError if invalid keys are passed