Skip to content

Instantly share code, notes, and snippets.

View sllvn's full-sized avatar
🔥

Andrew Sullivan sllvn

🔥
View GitHub Profile
p() { cd ~/projects/$1; }
_p() { _files -W ~/projects -/; }
compdef _p p
class Contract < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :contract_type
has_many :contract_terms
def display_name
"#{self.contract_type.name}: #{self.person_name}"
end
@sllvn
sllvn / contract.rb
Last active December 12, 2015 01:39
class Contract < ActiveRecord::Base
belongs_to :contract_type
has_many :contract_terms
def display_name
"#{self.contract_type.name}: #{self.person_name}"
end
def person_name
# todo: this seems inefficient, do we want to throw important metadata in the
@sllvn
sllvn / gist:4693484
Last active December 12, 2015 01:48
def display_name
name = self.name
name = "N/A" if name.blank? or name.nil?
name
end
[83] pry(main)> reader.objects[2].instance_of? Hash
=> true
[84] pry(main)> reader.objects.select { |x| x.instance_of? Hash }
=> []
unsorted = %w{11 17 2 200 201 205 209 21 213 217 218 220 223 227 228 232 240 248 2X 3 307 313 320 33 35 354 35M 39 41 45 451 453 454 455 456 460 461 462 463 47 470 471 472 473 477 500 501 509 513 516 517 519 520 523 525 527 534 54 550 6 603 604 606 608 612 613 616 62 625 626 627 630 640 645 667 670 675 701 703 704 72 750 805 806 807 809 811 821 822 830 831 832 833 834 836 842 850 853 862 880 9 901 902 919 920 951 952 954 960 962 990 992 F400 F401 F514 F518 F546 F547 F556 F570 F578 F590 F618 F628 F638 F868 F94}
sorted = %w{2 2X 3 6 9 11 17 21 33 35 35M 39 41 45 47 54 62 72 200 201 205 209 213 217 218 220 223 227 228 232 240 248 307 313 320 354 451 453 454 455 456 460 461 462 463 470 471 472 473 477 500 501 509 513 516 517 519 520 523 525 527 534 550 603 604 606 608 612 613 616 625 626 627 630 640 645 667 670 675 701 703 704 750 805 806 807 809 811 821 822 830 831 832 833 834 836 842 850 853 862 880 901 902 919 920 951 952 954 960 962 990 992 F400 F401 F514 F518 F546 F547 F556 F570 F578 F590 F618 F628 F638 F868
$($($('ul')[1]).find('li')[1]).append('<p>Direction: <strong>Southbound</strong> | <a href="#">Northbound</a></p><p>Next hour of arrivals:</p><table><tr><td style="padding-right: 20px;"><strong>900 S</strong></td><td style="padding-right: 10px;">10:06</td><td style="padding-right: 10px;">10:21</td><td style="padding-right: 10px;">10:36</td><td>10:51</td></tr><tr><td><strong>1300 S</strong></td><td>10:08</td><td>10:23</td><td>10:38</td><td>10:53</td></tr><tr><td><strong>2100 S</strong></td><td>10:11</td><td>10:26</td><td>10:41</td><td>10:56</td></tr></table>')
// Languages: name (local), name_en, name_fr, name_es, name_de
@name: '[name_en]';
// Common Colors //
@water: #c3e6ff;
@park: #cec;
Map {
background-color:#fff;
}
@sllvn
sllvn / gist:6179326
Created August 7, 2013 22:15
seattle coworking
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-122.316955,
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.