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
ruby-1.9.2-p290 :001 > class Object | |
ruby-1.9.2-p290 :002?> def yes | |
ruby-1.9.2-p290 :003?> true | |
ruby-1.9.2-p290 :004?> end | |
ruby-1.9.2-p290 :005?> | |
ruby-1.9.2-p290 :006 > def no | |
ruby-1.9.2-p290 :007?> false | |
ruby-1.9.2-p290 :008?> end | |
ruby-1.9.2-p290 :009?> end | |
=> nil |
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
test_db=> CREATE TABLE foo ( | |
test_db(> id serial, | |
test_db(> thing varchar(40) NOT NULL | |
test_db(> ); | |
NOTICE: CREATE TABLE will create implicit sequence "foo_id_seq" for serial column "foo.id" | |
CREATE TABLE | |
test_db=> insert into foo (thing) values ('test'); | |
INSERT 0 1 | |
test_db=> insert into foo (thing) values ('test2'); | |
INSERT 0 1 |
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
[1.9.2] ~ $ ruby threads.rb | |
popping the stack | |
vals is now [16] | |
popping the stack | |
vals is now [1, 16] | |
popping the stack | |
vals is now [1, 11, 16] | |
popping the stack | |
vals is now [1, 11, 16, 19] | |
popping the stack |
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
$:.unshift File.join(File.dirname(__FILE__), 'lib') | |
require 'em-campfire' | |
EM.run { | |
adaptor = EM::Campfire.new(:subdomain => "subdomain", :api_key => "foo") | |
connection.join ["Robot Army", "Monitoring", "Testing"] | |
connection.on_message do |msg| | |
# A hash |
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
<?php | |
$group_url = urlencode("http://tech.dir.groups.yahoo.com/group/OneStopCOBOL"); | |
$api_url = "http://yahoo-group-data.herokuapp.com/api/v1/group/$group_url"; | |
if (ini_get('allow_url_fopen') == '1') { | |
if ($fp = fopen($api_url, 'r')) { | |
$content = ''; | |
// keep reading until there's nothing left | |
while ($line = fread($fp, 1024)) { |
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 'open-uri' | |
require 'cgi' | |
url = "http://tech.dir.groups.yahoo.com/group/OneStopCOBOL" | |
json = open("http://yahoo-group-data.herokuapp.com/api/v1/group/#{CGI.escape(url)}").read | |
json = json.force_encoding("utf-8") if RUBY_VERSION[/1\.9/] | |
puts json |
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 http = require('http'); | |
var encoded_url = encodeURIComponent('http://tech.groups.yahoo.com/group/OneStopCOBOL/'); | |
var host = 'yahoo-group-data.herokuapp.com'; | |
var client = http.createClient(80, host); | |
var request = client.request('GET', '/api/v1/group/' + encoded_url, {'host': host}); | |
request.end(); | |
request.on('response', function (response) { | |
console.log('STATUS: ' + response.statusCode); |
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": false, | |
"not_found": false, | |
"age_restricted": false, | |
"name": "OneStopCOBOL", | |
"description": "OneStopCOBOL - Official COBOL group", | |
"post_email": "[email protected]", | |
"subscribe_email": "[email protected]", | |
"owner_email": "[email protected]", | |
"unsubscribe_email": "[email protected]", |
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
defm | |
UserAgent.parse(request.user_agent) | |
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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |