Skip to content

Instantly share code, notes, and snippets.

View bluefuton's full-sized avatar

Chris R bluefuton

View GitHub Profile
@bluefuton
bluefuton / settings.json
Last active August 31, 2015 18:14
My Sublime Text user settings
{
"font_face": "Inconsolata",
"font_size": 16,
"ignored_packages":
[
"Vintage"
],
"trim_trailing_white_space_on_save": true,
"open_files_in_new_window": false,
}
Hi there,
I've just signed up to your website, <name>.
I'm a web developer by trade and just noticed that you sent my password back to me by email in plain text. From a security point of view, this is a really bad idea.
As a general rule, it's best not to store any passwords in plain text or send them to the user by email.
You can read more about this at:
http://plaintextoffenders.com/faq/devs
@bluefuton
bluefuton / flickr_yahoo_toolbar_hide.user.js
Created July 2, 2013 09:32
Hide Yahoo! toolbar on Flickr - Greasemonkey script
// ==UserScript==
// @name Hide Yahoo toolbar on Flickr
// @description Make the Yahoo 'eyebrow' toolbar vanish on Flickr
// @namespace http://bluefuton.com
// @version 0.1
// @author Chris Rosser
// @license MIT
// @released 2013-07-02
// @updated 2013-07-02
// @match *://flickr.com/*
@bluefuton
bluefuton / lion_patch.rb
Last active September 30, 2023 15:58
Quick example of how to override an instance method in an existing Ruby library. We use this approach when producing Redmine plugins.
#!/usr/bin/env ruby -rubygems
module Zoo
module Animal
class Lion
def make_noise
"rawr"
end
end
end
@bluefuton
bluefuton / .bash_profile
Last active October 8, 2015 14:48
Include current Git or Subversion branch name in terminal prompt
parse_git_branch () {
if [ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1; then git branch | sed -n '/\* /s///p'; fi | awk '{print " ["$1"]" }'
}
parse_svn_branch() {
parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | awk '{print " ["$1"]" }'
}
parse_svn_url() {
svn info 2>/dev/null | sed -ne 's#^URL: ##p'
}
parse_svn_repository_root() {
@bluefuton
bluefuton / gist:2916321
Last active October 6, 2015 01:58
Start Sublime Text from the terminal
# Add to your .bash_profile
# Check the name of your Sublime app in /Applications (can include version number)
alias sub='open -a "Sublime Text"'
# Source: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=1450
@bluefuton
bluefuton / traits.php
Last active October 2, 2015 19:58
PHP 5.4: sluggable trait example
<?php
/* Traits: you can probably think of them a bit like interfaces,
but instead of just defining a list of methods that need to be implemented,
they will actually be implemented by including the trait.
Known in Ruby as mixins.
The name was inspired by Steve's Ice Cream Parlor in Somerville, Massachusetts:
The ice cream shop owner offered a basic flavor of ice cream
(vanilla, chocolate, etc.) and blended in a combination of extra items
(nuts, cookies, fudge, etc.) and called the item a "Mix-in",
@bluefuton
bluefuton / gist:2204364
Created March 26, 2012 10:35
Create an archive of the changed files between two Subversion revisions, preserving directory structure
# Based upon http://serverfault.com/a/49324
tar -cf archive.tar `svn diff -r 542:HEAD --summarize | grep -v "^D" | awk '{print $2}' | grep -vw "."`
@bluefuton
bluefuton / gist:1480694
Created December 15, 2011 10:54
Compare two directory trees with diff
# Compare the contents of dir1 with dir2 (excluding anything in .svn folders and .DS_Store files)
diff -a -q -r -x *.svn* -x .DS_Store dir1 dir2
@bluefuton
bluefuton / gist:1468061
Created December 12, 2011 16:15
OS X: replace tabs with spaces in all files using expand
find . -name "*.php" | while read line; do expand -t 4 $line > $line.new; mv $line.new $line; done