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
var sys = require("sys"), | |
http = require("http"), | |
fs = require('fs'), | |
path = require('path'); | |
http.createServer(function(request, response) { | |
var headers = { "Content-Type": "text/html" }; | |
var filename = path.join(process.cwd(), '../work/terminix/knox/index.html'); | |
path.exists(filename, function(exists) { | |
if(!exists) { |
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
def parse_html_entities(value) | |
value.gsub(/</, '<').gsub(/>/, '>') | |
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
require 'net/http' | |
#require 'URI' | |
json = Net::HTTP.get(URI.parse('http://roulette.engineyard.com')) | |
lucky_number = json.gsub(/\{|\}/, '').split(':')[1].gsub(/\"/,'').to_i | |
def play_roulette(bet, lucky_number) | |
pay_out = 100 | |
mod = case lucky_number | |
when 7..12, 14..19 then 2 | |
when 13 then 5 | |
when 2..6, 20..24 then 1 |
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
Model: | |
class Order < ActiveRecord::Base | |
has_many :line_items, :dependent => :destroy | |
# PAYMENT_TYPES = ["Check", "Credit card", "Purchase order"] | |
belongs_to :payment_type | |
validates :name, :address, :email, :presence => true | |
validates_inclusion_of :payment_type_id, :in => PaymentType.all.map { |type| type.id }, :message => "- Invalid payment type selected" |
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
<div class="agent"> | |
<ul> | |
<li><a href="/Dumpster-Rental-Company/ME/Hermon-ME" class="a-city">Hermon</a></li> | |
<li><span>Local:</span><abbr title="+12075616611">207-561-6611</abbr></li> | |
<li id="tollFree"><span>Toll Free:</span> <abbr title="+18888695249">888-869-5249</abbr></li> | |
</ul> | |
</div> | |
<!-- to: --> |
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
require 'csv' | |
require 'net/http' | |
obsolete_metros = [] | |
class OldMetro | |
attr_accessor :url, :state | |
def initialize(url, state) | |
@url = url | |
@state = state | |
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
text = IO.read('zips.csv') | |
def add_leading(zip) | |
if zip.size < 5 | |
t = 5 - zip.size | |
t.times do | |
zip = "0#{zip}" | |
end | |
end | |
zip |
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
# copy and paste the code and save as a ruby file (.rb extension). Works with ruby 1.8.7 (default version on Snow Leopard). | |
# With the CSV file containing the data, run the script with the following syntax: | |
# ruby to_kml.rb <clientname> <filename> | |
# So if this was for DAC Group, and the file was locations.csv: | |
# ruby to_kml.rb DAC_Group locations.csv | |
# | |
# CSV Formatting requirements: | |
# | |
# Must contain columns: name, address, lat, lng. You may leave other columns in there if you wish. There is no downfall to doing so. | |
# To get lat/lng values, use the address or zipcode data that you have, and paste it into the form here: out2launchdigital.com/pagetorrent/geocoder/ |
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
/* | |
* Autocomplete - jQuery plugin 1.1pre | |
* | |
* Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer | |
* | |
* Dual licensed under the MIT and GPL licenses: | |
* http://www.opensource.org/licenses/mit-license.php | |
* http://www.gnu.org/licenses/gpl.html | |
* | |
* Revision: $Id: jquery.autocomplete.js 5785 2008-07-12 10:37:33Z joern.zaefferer $ |
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
provinces = { | |
:AB => "Alberta", | |
:BC => "British-Columbia", | |
:MB => 'Manitoba', | |
:SK => 'Saskatchewan', | |
:QC => 'quebec' | |
} | |
"BC | |
BC | |
BC |
OlderNewer