Skip to content

Instantly share code, notes, and snippets.

View scottymac's full-sized avatar

Scott McMillin scottymac

View GitHub Profile
test 1
Forking trevor's gist

Keybase proof

I hereby claim:

  • I am scottymac on github.
  • I am scottymac (https://keybase.io/scottymac) on keybase.
  • I have a public key whose fingerprint is 36A4 DC4D 2E93 A124 8936 3E78 3BEA 3029 2C1D 2805

To claim this, I am signing this object:

@scottymac
scottymac / Postgres Cast an Array Column for Comparison
Last active August 29, 2015 14:04
Postgres Cast an Array Column for Comparison
-- datetimes is an array column of strings (b/c ActiveRecord doesn't support arrays of datetimes just yet (but soon))
-- This is doing a date comparison
SELECT * FROM table WHERE now() ANY (CAST(datetimes as timestamp[]))
in ActiveRecord:
scope :past, lambda {
where(":now > ALL (CAST(datetimes as timestamp[]))", { now: Time.zone.now })
}
@scottymac
scottymac / Events.cs
Last active August 29, 2015 14:08 — forked from wmiller/Events.cs
using System.Collections;
using System.Collections.Generic;
public class GameEvent
{
}
public class Events
{
static Events instanceInternal = null;
from http://radar.oreilly.com/2008/11/why-i-like-twitter.html
"There's a real lesson to Facebook here about giving other services (like Twitter) access to their social graph. They have the best one going, but because they try to keep users coming back to their interface, and even the applications built on their service have to live in Facebook, they end up as a ghetto rather than a true internet service. It's the data, not the interface! Let other people use your data, build on it, and it will still belong to you. Hold it too tight, and they will compete with it."
@scottymac
scottymac / my git shell prompt with dirty status
Created February 3, 2009 16:57
my git shell prompt with dirty status
function parse_git_dirty {
git diff --quiet || echo "•"
}
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "["${ref#refs/heads/}"$(parse_git_dirty)]"
}
YELLOW="\[\033[0;33m\]"
(function($) {
$.fn.imageAsync = function(options) {
var settings = $.extend({}, $.fn.imageAsync.defaults, options);
return this.each(function() {
if( $(this).attr('src') ) {
var originalImageSrc = $(this).attr('src');
### /lib/rack/sass ###
require 'sass'
module Rack
class Sass < Rack::File
def initialize(root, options = {})
@root = root
@options = options
end
# Lighter -- Campfire from the command line
# usage: ruby lighter.rb subdomain "Main Room" macournoyer@gmail
require "rubygems"
require "tinder"
require "readline"
require "highline/import"
class Lighter
def initialize(room)
@room = room
@scottymac
scottymac / base58.rb
Created June 18, 2009 18:52 — forked from jou/base58.rb
# http://www.flickr.com/groups/api/discuss/72157616713786392/
# manufacturing flic.kr style photo URLs
module Base58
def self.encode(n)
alphabet = %w(
1 2 3 4 5 6 7 8 9
a b c d e f g h i
j k m n o p q r s
t u v w x y z A B