This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p() { cd ~/projects/$1; } | |
_p() { _files -W ~/projects -/; } | |
compdef _p p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.dateFormat = [[NSDateFormatter alloc] init]; | |
[self.dateFormat setDateFormat:@"d MMMM YYYY"]; | |
NSLog(@"now formatted = %@", [self.dateFormat dateFromString:@"5 August 2012"]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcpy | |
from arcpy import env | |
env.workspace = "C:\UtahAddressModel\SouthJordan_July2012" | |
rows = arcpy.UpdateCursor("SJC_AddressPts") | |
for row in rows: | |
if row.getValue("TYPE") == "CHURCH": | |
row.setValue("TYPE_D", "REL") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
knight = Knight.new(0, 0) | |
memo = Array.new | |
1.upto(100000) do |x| | |
knight.move | |
knight.move until knight.position == [0, 0] | |
puts x if x % 100 == 0 | |
memo << knight.count | |
knight.count = 0 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class Knight | |
attr_accessor :x, :y, :count | |
def initialize(x, y) | |
@x, @y, @count = x, y, 0 | |
end | |
def position |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Placemark> | |
<name>North America</name> | |
<description>North America is a continent in the northern hemisphere, bounded on the north by the Arctic Ocean, on the ea | |
A change: Both North and South America are named after Amerigo Vespucci, who was the first European to suggest that the Americas were not the E | |
North America occupies the northern portion of the landmass generally referred to as the New World, the Western Hemisphere, the Ameri | |
<LookAt> | |
<longitude>-92.38030591736968</longitude> | |
<latitude>41.60040029662516</latitude> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
octave:1> A = [1 2; 3 4] | |
A = | |
1 2 | |
3 4 | |
octave:2> A - mean(A) | |
warning: operator -: automatic broadcasting operation applied | |
ans = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
keys = %w[event event_id event_type name description date] | |
Hash[*keys.map { |v| [v.to_sym, nil] }.flatten] |