This file contains hidden or 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 'json' | |
| require 'httparty' | |
| class Page | |
| FBURL = "http://api.facebook.com/restserver.php" | |
| APIVER = "1.0" | |
| def self.fan_count | |
| params = { | |
| "method" => "Pages.getInfo", | |
| "api_key" => KEY, |
This file contains hidden or 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
| (defun eshell/clear () | |
| "Clears your eshell if you're spastic" | |
| (interactive) | |
| (let ((inhibit-read-only t)) | |
| (erase-buffer))) |
This file contains hidden or 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
| private static int GetDayNumber(DayOfWeek dayOfWeek) | |
| { | |
| switch (dayOfWeek) | |
| { | |
| case DayOfWeek.Monday: | |
| return 1; | |
| case DayOfWeek.Tuesday: | |
| return 2; | |
| case DayOfWeek.Wednesday: |
This file contains hidden or 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
| module Awesomeness | |
| def hello | |
| puts "hello" | |
| end | |
| def self.included(klass) | |
| klass.class_eval { include Awesomeness::ClassMethods } | |
| end | |
| module ClassMethods | |
| def hello | |
| puts "YAY" |
This file contains hidden or 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
| module Awesomeness | |
| module ClassMethods | |
| def hello | |
| puts "YAY" | |
| end | |
| end | |
| def hello | |
| puts "hi" | |
| end |
This file contains hidden or 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
| //kicking around prepared statement api ideas for | |
| //http://github.com/brianc/node-postgres | |
| var Client = require('node-postgres').Client; | |
| var client = new Client({ | |
| name: 'brian', | |
| database: 'test' | |
| }); | |
| client.connect(); |
This file contains hidden or 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
| client.parse('statementName', 'select * from boom where name = $1', Æ(err, statement) { | |
| if(err) { | |
| //do something | |
| } | |
| statement.bind('portalName', ['_alex'], Æ(err, portal) { | |
| if(err) { | |
| //do something | |
| } | |
| portal.execute(10, Æ(err, row) { |
This file contains hidden or 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 Stream = require('net').Stream; | |
| var stream = new Stream(); | |
| stream.connect(6543,'1.0.1.1'); | |
| stream.on('connect', function() { | |
| console.log('connected'); | |
| stream.end(); | |
| }) |
This file contains hidden or 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 Client = require(__dirname + '/node-postgres/lib').Client; | |
| var client = new Client({ | |
| host: '1.0.1.1', | |
| port: 6543, | |
| user: 'Kev', | |
| database: 'dev', | |
| password: '...' | |
| }); |
This file contains hidden or 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 pg = require('pg'); | |
| var cs = "postgres://blarg:blarg@localhost/blarg-upload-development"; | |
| pg.connect( cs, function( err, client ) { | |
| //check for a connection error | |
| if(err) { | |
| console.log(err); | |
| return; | |
| } | |
| var filename = "foobar"; |