Skip to content

Instantly share code, notes, and snippets.

View garyharan's full-sized avatar
🎯
Focusing

Gary Haran garyharan

🎯
Focusing
View GitHub Profile
rr() {
rake
if [ $? -gt 0 ]; then
say "Some tests failed."
echo "Some tests failed."
else
say "All tests green."
echo "All tests green."
fi
}
@garyharan
garyharan / gist:774985
Created January 11, 2011 19:43
TalkerApp.com plugin to receive audio ring when you are mentioned in a message.
plugin.command = 'togglementionsound';
plugin.usage = '/togglementionsound';
plugin.onCommand = function(talkerEvent) {
if (talkerEvent.command == plugin.command) {
$.cookie('ReceivedMentionSound', ($.cookie('ReceivedMentionSound') == 'false' ? 'true': 'false'), {
expires: (function() {
var d = new Date();
d.setTime(new Date().getTime() + 10 * 365 * 24 * 60 * 60 * 1000);
return d
@garyharan
garyharan / Emma and her drums
Created February 23, 2011 05:37
I learned a lot about the world while playing with my little one.
Watching Emma discover the world brings back memories of my own childhood.
Emma pats materials and things to see how it rubs against her tiny hands. She gets engrossed in the act of hitting two objects together. She doesn't just enjoy the sound they create but in her case often hears that specific sound for the first time. She looks at reflections on objects and is starting to notice that you can learn to follow those light patterns to their sources. She especially loves the metal bowls and the mirror-like surface of my tea pot. Perhaps the way everything is disproportionate in them amuses her. I guess big noses are innately funny.
I remember having similar moments as a child but my memory can't go as far back as what Emma is experiencing right now. I remember for instance the scratching sound made by those weird animated holograms. I remember being fascinated by the depth found in the VISA logo of my mother's credit card. I remember that weird feeling you get when your hair is in the proximity o
@garyharan
garyharan / args
Created April 6, 2011 00:50
fudging args
#!/usr/bin/ruby
require 'net/http'
def url(*args)
if args.length == 1
"/#{1}/#{args[0]}.json"
else
"/#{1}/#{args.shift.to_s}.json?#{parametrize args}"
end
end
@garyharan
garyharan / compilemacvim.sh
Created May 13, 2011 13:04
How I compiled macvim
./configure --with-features=huge --enable-cscope --enable-pythoninterp --enable-rubyinterp --enable-perlinterp --enable-gui=macvim --with-mac-arch=intel --enable-multibyte --enable-clipboard=yes --enable-xterm_clipboard=yes
@garyharan
garyharan / jquery.placeholder.js
Created May 20, 2011 14:47
Make older browsers act as do modern browsers in regards to placeholder in inputs
$(function(){
if ("placeholder" in document.createElement( "input" )){ return }
$('input[placeholder]').each(function(){
$(this).val($(this).attr('placeholder')).css('color', '#999')
}).focus(function(){
var placeholder = $(this).attr('placeholder')
$(this).val( placeholder == $(this).val() || $(this).val() == '' ? '' : $(this).val() ).css('color', '#333')
}).blur(function(){
var placeholder = $(this).attr('placeholder')
@garyharan
garyharan / larger_checkboxes.css
Created May 20, 2011 18:40
How to make checkboxes bigger in Safari/Webkit browsers
input[type="checkbox"] {
-webkit-transform: scale(1.2, 1.2);
}
@garyharan
garyharan / aliases.sh
Created June 20, 2011 18:42
Bash functions for rails 2/3
#!/bin/sh
# script/server with Rails 3 support
ss() {
if [ -f ./script/rails ]; then
./script/rails server $@
else
./script/server $@
fi
}
@garyharan
garyharan / jquery.sample.coffee
Created September 13, 2011 16:19
Sample coffeescript jquery plugin
(($) ->
default_options =
color: 'red'
$.fn.samplePlugin = (options = default_options) ->
hello()
@each ->
$(this).css
background: options.color
# thanks to cmer for this
if Rails.env.development?
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0
call_without_quiet_assets(env).tap do
Rails.logger.level = previous_level
end