Skip to content

Instantly share code, notes, and snippets.

Nathan Youngman nathany

Block or report user

Report or block nathany

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nathany
nathany / rails-4.0.10.rc1.rb
Created Aug 21, 2014
Test case for bug in Rails 4.0.10.rc
View rails-4.0.10.rc1.rb
# Activate the gem you are reporting the issue against.
# gem 'activerecord', '4.0.9' # works
gem 'activerecord', '4.0.10.rc1'
# gem 'activerecord', '4.1.5' # works
# gem 'activerecord', '4.1.6.rc1'
gem 'pg'
require 'active_record'
@nathany
nathany / go.cson
Created Oct 4, 2014
Atom conversion of GoSublime-next.tmLanguage
View go.cson
'comment': 'Based on work from github.com/frou/GoFeather and github.com/DisposaBoy/GoSublime'
'fileTypes': [
'go'
]
'firstLineMatch': '-[*]-( Mode:)? Go -[*]-'
'name': 'GoSublime-next'
'patterns': [
{
'begin': '/\\*'
'end': '\\*/'
@nathany
nathany / README.md
Created Apr 28, 2015
Go / Ruby bridge with Sidekiq
View README.md
brew install redis
gem install sidekiq
go get -u github.com/jrallison/go-workers

redis-server /usr/local/etc/redis.conf
@nathany
nathany / gist:175670
Created Aug 26, 2009
pivot table example in SQL Server 2005
View gist:175670
select PT.FacID, f1.FacName, [1] as QtyAlloc, [-1] as QtyUsed, [1] + [-1] as QtyRemain
from
(
select f1.FacID, sign(f1.Quantity) as Sgn, f1.Quantity
from FacCredits f1
) as q1
pivot
(
sum(q1.Quantity)
for q1.Sgn in ([1], [-1])
View gist:188207
/* Pure CSS tool tips from CSS Mastery, originally by Eric Meyer? With fix for IE, see below */
a.tooltip {
position: relative;
}
a.tooltip span {
display: none;
}
@nathany
nathany / gist:190435
Created Sep 21, 2009
based on hello from Stuart Halloway's book
View gist:190435
;; reference to a set (unique) visitors
(def visitors (ref #{}))
(defn hello
"Writes hello message to *out*. Calls you by username.
Knows if you have been here before."
([] (hello "world")) ; with no arguments
([username]
(dosync
;; deref visitors, call username to see if it's there
@nathany
nathany / landing.rb
Created Oct 12, 2009
Heroku is great to host single-page "sites" for all those domains I'm not using.
View landing.rb
require 'rubygems'
require 'sinatra'
require 'haml'
Domains = %w{gemsmith vogsphere youngman seraph intercessory cyaonline significantwhitespace 14159265358979}
DefaultDomain = 'default'
# what domain does the host contain?
# put this here because helpers are a pain to test!
def view_for_domain(host)
@nathany
nathany / gist:211991
Created Oct 16, 2009 — forked from kylefox/gist:211989
Git prompt for Bash
View gist:211991
# Shows the [branch], and an * if there are uncommitted changes. Example:
# ~/projects/my_project[master*]:
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
@nathany
nathany / edit.html.haml
Created Dec 3, 2009
starting on some RJS-like helpers for jQuery and CKEditor
View edit.html.haml
- javascript_tag do
= after_ready do
= add_ckeditor_plugins(:snippet)
@nathany
nathany / show SQL in irb console
Created Mar 11, 2010
Rails SQL logging from console
View show SQL in irb console
ActiveRecord::Base.connection.instance_variable_set :@logger, Logger.new(STDOUT)
You can’t perform that action at this time.