Skip to content

Instantly share code, notes, and snippets.

View barce's full-sized avatar

Barce barce

View GitHub Profile
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
@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)
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
# Schema version: 20100219041630
#
# Table name: listings
#
# id :integer not null, primary key
# name :string(255)
# fulldescription :text
# batch_id :integer
# latitude :float
# longitude :float
sub isPrivate {
my $ip = shift;
my @a_ip = split /\./, $ip;
my $i_secret = 0;
if ($a_ip[0] == 10)
{
$i_secret = 1;
}
<?php
// referencing class methods with a variable
class X {}
$foo = new X;
$foo->bar = 'yar';
$baz = 'bar';
class Debate
attr_accessor :pros :cons
def resolve
if self.pros > self.cons
return 1
return 0
end
end
[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
<?php
$title = $_SERVER['SCRIPT_NAME'];
?>
<html>
<head>
<title><?php echo $title ; ?></title>
<head>
<script>
window.location = 'http://www.example.com/';
</script>