Skip to content

Instantly share code, notes, and snippets.

View bouchard's full-sized avatar

Brady Bouchard bouchard

View GitHub Profile
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {
@jrk
jrk / scpi.pl
Created July 22, 2009 08:03
An improved replacement for scp, with resume and advanced compression support. By Andrei Alexandrescu.
#!/usr/bin/env perl
# Via: http://erdani.org/code/scpi.html
################################################################################
## Copyright (c) 2006 by Andrei Alexandrescu
## Permission to use, copy, modify, distribute and sell this software for any
## purpose is hereby granted without fee, provided that the above copyright
## notice appear in all copies and that both that copyright notice and this
## permission notice appear in supporting documentation.
## The author makes no representations about the
#!/usr/bin/perl
# Description: http://daringfireball.net/2010/08/open_urls_in_safari_tabs
# License: See below.
# http://gist.github.com/507356
use strict;
use warnings;
use URI::Escape;
// Add Modernizr test for font-smoothing
// A designer may wish to darken the colour of a given font when antialiasing is applied
// Examples of font-smoothing in action: http://bit.ly/bLeUg1
/*
Usage:
Add to your page
Use html.fontsmoothing h1 { color: xxx; } to make your colours darker
*/
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@srpouyet
srpouyet / nginx.conf
Last active August 5, 2018 22:37
Nginx Upstart script (Ubuntu 12.04)
### Nginx upstart script
### source: http://serverfault.com/a/391737/70451
### /etc/init/nginx.conf
description "nginx http daemon"
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
env DAEMON=/usr/local/sbin/nginx
@robinsloan
robinsloan / langoliers.rb
Last active November 6, 2024 14:31
The Langoliers, a tweet deletion script
require "rubygems"
require "twitter"
require "json"
# things you must configure
TWITTER_USER = "your_username"
MAX_AGE_IN_DAYS = 1 # anything older than this is deleted
# get these from dev.twitter.com
CONSUMER_KEY = "your_consumer_key"
@iogakos
iogakos / wma_hash.rb
Created November 22, 2012 09:40
Weighted Moving Average - Ruby Implementation
# Weighted Moving Average (WMA)
# http://en.wikipedia.org/wiki/Moving_average#Weighted_moving_average
#
# Given a hash, calculates the weighted moving averages of its values within
# a window size given. Modifies the original hash values.
#
# @param hash [Hash] the hash for whom values calculate the weighted moving
# averages.
# @param maws [Fixnum] the Moving Average Window Size. The greatest this
# number is the smoothest the calculated averages will be.
@jbgo
jbgo / debug_system_stack_error.md
Created January 9, 2013 15:08
debug SystemStackError in ruby 1.9

This is how I debug SystemStackError when there is no stack trace.

My first attempt was:

begin
  a_method_that_causes_infinite_recursion_in_a_not_obvious_way
rescue SystemStackError
  puts caller
end
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active November 18, 2024 11:51
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k