Skip to content

Instantly share code, notes, and snippets.

View clamstew's full-sized avatar
🧘
🎨 🤖 🚀 vibe-coding 24/7. Let's Go!

Clay Stewart clamstew

🧘
🎨 🤖 🚀 vibe-coding 24/7. Let's Go!
View GitHub Profile
@clamstew
clamstew / gist:7199992
Created October 28, 2013 16:25
Using staby lambda to put scope on the model
class Task < ActiveRecord::Base
belongs_to :project
belongs_to :employee
scope :complete, ->{ where(complete: true) }
scope :incomplete, ->{ where(complete: false) }
end
@clamstew
clamstew / gist:7042573
Created October 18, 2013 14:42
Jeff Felchner's dotfiles that has his shortcuts for git
[core]
quotepath = false
editor = vim -f
whitespace = trailing-space,space-before-tab
[branch]
autosetupmerge = false
autosetuprebase = remote
[difftool "araxis2way"]
cmd = compare -wait -2 "$LOCAL" "$REMOTE" "$MERGED"
[mergetool "araxis2way"]
@clamstew
clamstew / .gitignore
Last active December 24, 2015 02:19
Hartl's augmented .gitignore file from railstutorial.org
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
def initialize (args={:event_time, :deadline, :event_name, :event_location, :minimum_attendees, :maximum_attendees, :creator_name, :phone, :email, :invitees})
@required = args.fetch(:event_time, :deadline, :minimum_attendees) # .fetch will throw an error if key doesn't exist in Hash
@optional = args[:creator, :event_name, :event_location, :attendees, :maximum_attendees] # simple access returns nil if key isn't set--no exception raised
end
@clamstew
clamstew / gist:6595483
Last active December 23, 2015 06:39
Gamble in JSON
{
"firstName": "Daniel",
"lastName": "McAdams",
"age": 307.69448,
"address": [{
"streetAddress": "2101 E 20th Street",
"city": "Austin",
"state": "TX",
"postalCode": 78722
}, {