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 quicksort(a) | |
return a if a.size <= 1 | |
p = a[0] # pivot element | |
quicksort(a.select {|i| i < p }) + a.select {|i| i == p} + quicksort(a.select {|i| i > p }) | |
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
@map = GMap.new("map") | |
@map.control_init(:large_map => true,:map_type => false) | |
loc3=MultiGeocoder.geocode('Seattle, 98109') | |
ianazones = GMarker.new([loc3.lat,loc3.lng], | |
:info_window => "Welcome to Seattle", | |
:title => "Seattle 98109") | |
@map.center_zoom_init([loc3.lat,loc3.lng], 14) |
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 Chamber | |
attr_accessor :name, :address, :state, :city, :zip | |
def to_json(*a) | |
{ | |
'json_class' => self.class.name, # = 'Chamber' | |
'data' => [ name, address, state, city, zip ] | |
}.to_json(*a) | |
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
# Schema version: 20100219041630 | |
# | |
# Table name: listings | |
# | |
# id :integer not null, primary key | |
# name :string(255) | |
# fulldescription :text | |
# batch_id :integer | |
# latitude :float | |
# longitude :float |
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
sub isPrivate { | |
my $ip = shift; | |
my @a_ip = split /\./, $ip; | |
my $i_secret = 0; | |
if ($a_ip[0] == 10) | |
{ | |
$i_secret = 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
<?php | |
// referencing class methods with a variable | |
class X {} | |
$foo = new X; | |
$foo->bar = 'yar'; | |
$baz = 'bar'; |
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 Debate | |
attr_accessor :pros :cons | |
def resolve | |
if self.pros > self.cons | |
return 1 | |
return 0 | |
end | |
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
[info] == com.twitter.service.snowflake.IdWorkerSpec == | |
[info] IdWorkerSpec | |
[info] IdWorker should | |
[info] + generate an id | |
[info] + return an accurate timestamp | |
[info] + return the correct job id | |
[info] + properly mask server id | |
[info] + properly mask timestamp | |
[info] + roll over sequence id | |
[info] + generate increasing ids |
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
<?php | |
$title = $_SERVER['SCRIPT_NAME']; | |
?> | |
<html> | |
<head> | |
<title><?php echo $title ; ?></title> | |
<head> | |
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
<script> | |
window.location = 'http://www.example.com/'; | |
</script> |
OlderNewer