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
DateSort.prototype.sortedDesc = function(theArray){ | |
return theArray.sort(date_sort_desc); | |
} | |
var date_sort_desc = function(a,b){ | |
a = new Date(a.publishDate); | |
b = new Date(b.publishDate); | |
return a<b ? 1 : a>b ? -1 : 0; | |
}; |
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 urllib | |
import re | |
def find_between( s, first, last ): | |
try: | |
start = s.index( first ) + len( first ) | |
end = s.index( last, start ) | |
return s[start:end] | |
except ValueError: | |
return "" |
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 AddSequenceToTableName < ActiveRecord::Migration | |
def up | |
#add sequence to | |
execute <<-SQL | |
ALTER TABLE table_name ALTER COLUMN id SET DEFAULT nextval('table_name_id_seq'::regclass); | |
SQL | |
end | |
def down | |
execute <<-SQL |
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 CreateTableNameSequence < ActiveRecord::Migration | |
def up | |
#create sequence for categories table | |
execute <<-SQL | |
CREATE SEQUENCE table_name_id_seq | |
INCREMENT 1 | |
MINVALUE 1 | |
MAXVALUE 9223372036854775807 | |
START 25 | |
CACHE 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
#!/usr/bin/env python | |
import RPi.GPIO as GPIO, time | |
GPIO.setmode(GPIO.BCM) | |
GREEN_LED = 18 | |
RED_LED = 23 | |
GPIO.setup(GREEN_LED, GPIO.OUT) | |
GPIO.setup(RED_LED, GPIO.OUT) | |
count = 0 |
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 python | |
import RPi.GPIO as GPIO, time | |
GPIO.setmode(GPIO.BCM) | |
GREEN_LDE = 18 | |
RED_LED = 23 | |
GPIO.setup(GREEN_LED, GPIO.OUT) | |
GPIO.setup(RED_LED, GPIO.OUT) | |
count = 0 |
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
# ~.autotest | |
require 'rubygems' | |
require 'autotest_notification' | |
SPEAKING = false | |
DOOM_EDITION = false | |
BUUF = false | |
PENDING = false | |
STICKY = false | |
SUCCESS_SOUND = '' | |
FAILURE_SOUND = '' |
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
#-2*-2 = 2*2. In other words, when you | |
#multiply 2 negative integers it is the | |
#same as multiplying the same two positive | |
#integers. -x*-y = x*y | |
x = 2 | |
y = 3 | |
puts ((x*y + x*-y) + -x*-y == x*y) == | |
((x*y + x*-y) + -x*-y == -x*-y) |
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> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Test Canvas II</title> | |
<!-- get excanvas.js from http://code.google.com/p/explorercanvas/ | |
Note the test cases and examples. Very cool! --> | |
<!--[if IE]> | |
<script src="excanvas.js"></script> |
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> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Test Canvas</title> | |
<!-- get excanvas.js from http://code.google.com/p/explorercanvas/ | |
Note the test cases and examples. Very cool! --> | |
<!--[if IE]> | |
<script src="excanvas.js"></script> |
NewerOlder