Skip to content

Instantly share code, notes, and snippets.

@rondevera
rondevera / git-changelog
Created November 4, 2014 02:56 — forked from jfsiii/git-changelog
Generates a Markdown changelog for a npm/bower repo
#!/usr/bin/env bash
function printCommitLine(){
local FROM=$1
local TO=$2
if [ TO ]; then
git log $GIT_LOG_OPTS --format="$LOG_FORMAT_OPTS" $FROM..$TO
else
git log $GIT_LOG_OPTS --format="$LOG_FORMAT_OPTS" $FROM
fi
@rondevera
rondevera / onblack.js
Created July 22, 2009 02:38
On Black bookmarklet: For quickly getting the On Black URL for a Flickr photo.
/*
On Black bookmarklet
rondevera.com
For quickly getting the On Black URL for a Flickr photo.
(On Black: http://bighugelabs.com/onblack.php)
Usage:
- Create a new item in your bookmark bar with "On Black" as the name, and the
code below as the location.
@rondevera
rondevera / gist:237254
Created November 17, 2009 20:49
Add a spacer to the OS X Dock
# Add a spacer to the OS X Dock:
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; osascript -e 'tell app "Dock" to quit'
@rondevera
rondevera / jquery-data-removal.js
Created December 1, 2009 19:34
jQuery $().data gotcha: A collection can be removed from and re-added to the DOM, but its data disappears.
// Using jQuery 1.3.2:
// Setup:
var $foo = $('<div id="foo"></div>').appendTo('body');
$foo; // => [div#foo]
$foo.data('bar', 123);
$foo.data('bar'); // => 123
// Teardown:
$foo.remove(); // => [div#foo]
@rondevera
rondevera / copy_activerecord_attributes_to_globalize2_translation.rb
Created December 7, 2009 02:29
Using Globalize2 for Rails, copy existing attributes from ActiveRecord instances to their default translation proxy instances
# Using Globalize2: http://github.com/joshmh/globalize2
# Copy existing attributes from ActiveRecord instance to default translation
# proxy instance:
SomeClass.all.each do |x|
x.globalize_options[:translated_attributes].each do |a|
x.send(:"#{a}=", x.read_attribute(a))
end
x.save
end
@rondevera
rondevera / hubb.sh
Created October 19, 2010 19:45
OS X: Opens the specified file/directory in GitHub via your browser
# Usage from within a Git repo:
#
# hubb public/javascripts/app.js
# # Opens `https://github.com/<repo>/blob/<branch>/public/javascripts/app.js`
# # in your browser.
#
# hubb
# # Opens `https://github.com/<repo>` in your browser.
hubb(){
repo=$(git config remote.origin.url | sed "s/^git@github\.com:\(.*\)\.git$/\1/")
<html lang="en">
<head>
<style>
div {
position: relative;
display: inline-block;
margin: 2em;
padding: 5em;
background: #fcfcfc;
background: -webkit-gradient(linear, left top, left bottom,
var Carl = (function(){
var C = {},
drops = []; // private
C.eavesdrops = function(pattern){
drops.push(pattern);
};
return C;
}());
@rondevera
rondevera / gist:935626
Created April 21, 2011 22:34
project_completion.bash
cdp(){
# For changing directly to a specific project's directory.
# Usage: `cdp bloombox`
local proj=$1
c "/Users/ron/Documents/Projects/$proj/"
settabtitle $proj
}
_cdp(){
# Tab completion routine for `cdp`:
COMPREPLY=()
@rondevera
rondevera / gist:957820
Created May 5, 2011 20:11
Shrink Campfire images
/* Useful when Campfire chat images are
being used more for noise than signal.
To use in Propane, add to
~/Library/Application Support/Propane/styles/cf_chat.css
and restart the app:
*/
table.chat tr.message a.loaded img {
max-width: 100px !important;