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
# A module which adds support for attribute validation and requirements | |
# directly to the Hash object in Ruby. Very useful for methods which | |
# require a ton of attributes. | |
# | |
# ==== Example Usage | |
# | |
# require 'attribute_support' | |
# | |
# class Klass | |
# def renew_domain(attributes = {}) |
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
>> @hosting_account = @client.hosting_accounts.new({"primary_domain_name"=>"", "hosting_account_features_attributes"=>{"0"=>{"feature_type_id"=>"1", "units"=>"10"}, "1"=>{"feature_type_id"=>"2", "units"=>"5"}, "2"=>{"feature_type_id"=>"3", "units"=>"5"}, "3"=>{"feature_type_id"=>"4", "units"=>"10"}}}) | |
=> #<HostingAccount id: nil, client_id: 1, cpanel_server_id: nil, username: nil, password: nil, payment_period: "annual", automatically_renew: false, primary_domain_name: "", expires_at: nil, created_at: nil, updated_at: nil> | |
>> @hosting_account.save | |
=> false | |
>> @hosting_account | |
=> #<HostingAccount id: 5, client_id: 1, cpanel_server_id: nil, username: nil, password: nil, payment_period: "annual", automatically_renew: false, primary_domain_name: "", expires_at: "2010-06-22", created_at: "2009-06-22 10:52:31", updated_at: "2009-06-22 10:52:31"> |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title>ultrasn0w: Is it out yet?</title> | |
<meta name="description" content="Answering the question: Is ultrasn0w out yet?" /> | |
<meta name="keywords" content="iphone,3.0,iphone os,ultrasn0w,dev team" /> |
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
# Without indexes | |
ForecastPoint Load (20.1ms) SELECT warning_date_time FROM `forecast_points` ORDER BY warning_date_time DESC LIMIT 1 | |
ForecastPoint Load (11.7ms) SELECT * FROM `forecast_points` WHERE (`forecast_points`.`warning_date_time` = '2005-09-18 00:00:00') | |
# With a simple index on warning_date_time | |
ForecastPoint Load (0.4ms) SELECT warning_date_time FROM `forecast_points` ORDER BY warning_date_time DESC LIMIT 1 | |
ForecastPoint Load (0.7ms) SELECT * FROM `forecast_points` WHERE (`forecast_points`.`warning_date_time` = '2005-09-18 00:00:00') |
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
# List of NHC/TPC models used in forecasting. Parsed from list here: | |
# http://www.nrlmry.navy.mil/atcf_web/docs/database/new/techlist.dat.nhc | |
NUM,TECH,ERRS,RETIRED,COLOR,DEFAULTS,INT-DEFS,RADII-DEFS,LONG NAME | |
00,CARQ,0,0,0,0,0,1,Combined ARQ Position | |
00,WRNG,0,0,0,0,0,1,Warning | |
03,OFCL,1,0,3,1,1,1,NHC official forecast | |
03,OFCI,0,0,11,1,1,1,NHC official forecast (Interpolated) | |
03,OHPC,0,0,17,1,0,1,HPC official forecast | |
03,OOPC,0,0,17,1,0,1,OPC official forecast | |
03,OMPC,0,0,17,1,0,1,MPC official forecast |
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
WBAN,Station ID,Station Name,Latitude (deg/min/sec),Longitude (deg/min/sec),Elevation (ft),Tower Height (m) | |
14929,KABR,"Aberdeen, SD",452721,0982447,1302,20 | |
54766,KENX,"Albany, NY",423511,0740350,1826,20 | |
03019,KABX,"Albuquerque, NM",350859,1064926,5870,20 | |
03981,KFDR,"Altus AFB, OK",342144,0985835,1267,10 | |
23047,KAMA,"Amarillo, TX",351400,1014233,3587,20 | |
26548,PAHG,"Anchorage, AK",604333,1512105,242,30 | |
53819,KFFC,"Atlanta, GA",332149,0843357,858,30 | |
12971,KEWX,"Austin/San Antonio, TX",294214,0980142,633,20 | |
93240,KBBX,"Beale AFB, CA",392946,1213754,167,10 |
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
$ sudo gem update --system | |
$ sudo gem update |
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
/* | |
* calculate (initial) bearing between two points | |
* see http://williams.best.vwh.net/avform.htm#Crs | |
*/ | |
LatLon.bearing = function(lat1, lon1, lat2, lon2) { | |
lat1 = lat1.toRad(); lat2 = lat2.toRad(); | |
var dLon = (lon2-lon1).toRad(); | |
var y = Math.sin(dLon) * Math.cos(lat2); | |
var x = Math.cos(lat1)*Math.sin(lat2) - |
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
// Calculate destination point given start point, initial bearing (deg) and distance (km) | |
LatLon.prototype.destPoint = function(brng, d) { | |
var R = 6371; // Earth's mean radius in km | |
var lat1 = this.lat.toRad(); | |
var lon1 = this.lon.toRad(); | |
var brng = brng.toRad(); | |
var lat2 = Math.asin(Math.sin(lat1) * Math.cos(d / R) + | |
Math.cos(lat1) * Math.sin(d / R) * Math.cos(brng)); | |
var lon2 = lon1 + Math.atan2(Math.sin(brng) * Math.sin(d / R) * Math.cos(lat1), |
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
hostroute = Brand.find_by_name("Hostroute") | |
ultraspeed = Brand.find_by_name("Ultraspeed") | |
core_brand = case class_id | |
when 1 then ultraspeed | |
when 2 then hostroute | |
when 5 then hostroute | |
else | |
hostroute | |
end |
OlderNewer