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
https = require 'https' | |
fs = require 'fs' | |
options = { | |
key: fs.readFileSync('privatekey.pem'), | |
cert: fs.readFileSync('certificate.pem') | |
} | |
host = 'levityisland.com' |
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/ruby | |
# america's funniest home ruby tricks: | |
# barebones textmate shell REPL | |
# paste this into a textmate window | |
# type a command at the prompt, then type Cmd-a Ctrl-r | |
prompt = "> " | |
history = DATA.read.split("\n") | |
cmd = history.last.gsub(/^#{prompt}/, '') | |
print "\n#{`#{cmd}`}#{prompt}" | |
__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
<html> | |
<body> | |
<div id="foo"></div> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript" charset="utf-8"></script> | |
<script type="text/javascript" charset="utf-8"> | |
$(function() { | |
$('#foo').hide().slideDown(null, function() { | |
x = intentionally_cause_error; | |
}) | |
}) |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
{block:Description}<meta name="description" content="{MetaDescription}" />{/block:Description} | |
<meta name="text:Twitter Username" content=""/> | |
<meta name="text:Flickr Username" content=""/> | |
<meta name="text:Disqus Shortname" content=""/> | |
<meta name="color:Asterisk" content="#17f0ff"/> |
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 'xmpp4r' | |
include Jabber | |
Client.new(JID.new "#{USERNAME}/Home").instance_eval do | |
connect 'talk.google.com' | |
auth PASSWORD | |
send Message.new(RECIPIENT, MESSAGE).tap{|m| m.type = :chat } | |
close | |
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/ruby | |
require 'rubygems' | |
require 'mechanize' | |
print "email: " | |
email = gets.chomp | |
print "password: " | |
password = gets.chomp | |
agent = Mechanize.new |
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/ruby | |
LOGIN, PASSWORD = 'your_number', 'your_password' | |
require 'rubygems' | |
require 'mechanize' | |
agent = Mechanize.new | |
agent.get 'https://wireless.att.com' | |
login = agent.page.forms_with(:name=>'loginActionForm').first |
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
set -g prefix C-a | |
unbind C-b | |
bind C-a send-prefix | |
set-window-option -g mode-keys vi | |
bind k up-pane | |
bind j down-pane |
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/ruby | |
require 'yaml' | |
# DATA is a little-used feature of the Ruby language; it's a file handle | |
# whose contents are everything in the current file after the __END__. | |
# YAML is "Yet Another Markup Language". | |
data = YAML.load(DATA) | |
def url_for(entry_num) |
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
# O.o | |
# http://opensoul.org/blog/archives/2010/12/12/the-ruby-infinite-hash/ | |
>> hash = Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) } | |
=> {} | |
>> hash['a'] = 1 | |
=> 1 | |
>> hash['a'] | |
=> 1 | |
>> hash['b'] |