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 ruby | |
require 'rubygems' | |
require "wrest" | |
require "multi_json" | |
require 'pp' | |
target_host="http://localhost:8080" | |
login_user="enter_username" | |
login_user_password="enter_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
ruby-1.9.3-preview1 :001 > class Foo | |
ruby-1.9.3-preview1 :002?> private | |
ruby-1.9.3-preview1 :003?> def self.up | |
ruby-1.9.3-preview1 :004?> "w00t" | |
ruby-1.9.3-preview1 :005?> end | |
ruby-1.9.3-preview1 :006?> end | |
=> nil | |
ruby-1.9.3-preview1 :007 > class Bar | |
ruby-1.9.3-preview1 :008?> class << self | |
ruby-1.9.3-preview1 :009?> private |
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
error: Gemset 'buildr' does not exist, rvm gemset create 'buildr' first. | |
info: Using jruby 1.6.5 with gemset buildr | |
Installing bundler... | |
Fetching: bundler-1.0.21.gem (100%) | |
Successfully installed bundler-1.0.21 | |
1 gem installed | |
Installing ri documentation for bundler-1.0.21... | |
Installing RDoc documentation for bundler-1.0.21... |
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> | |
<head> | |
<title>Get your computer to spell for you</title> | |
<script type="text/javascript"> | |
function spellText(text) { | |
for (var i = 0; i <= text.length; i++) { | |
var c = text.substring(i, i + 1).toLowerCase(); | |
var duration = null; |
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
OSGi is supported by JRuby 1.6.0 onwards. | |
1. OSGiScriptingContainer | |
Check out that class. Any OSGi app must use this container. In particular, you can add bundles to the jruby classpath easily with this container. | |
2. LocalScopeContext | |
By default it is set to SINGLETHREAD. That's the only one that works right now, others will spawn CNFE randomly when used. |
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
describe "No should was harmed" do | |
it "should not care whatever I do with == for booleans" do | |
true == false | |
end | |
it "should not care for numbers" do | |
1 == 0 | |
end | |
it "should not even do type validation" do |
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
eclipseSDK = Buildr::artifact("org.eclipse:eclipse-SDK:zip:3.6M3-win32") | |
eclipseSDK.invoke | |
Buildr::unzip(File.dirname(eclipseSDK.to_s) => eclipseSDK.to_s).extract |
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 'rubygems' | |
require 'net/http' | |
require 'hpricot' | |
SERVER = "jira.example.com" | |
GRAPH_URL = "/secure/ChartBoard.jspa?type=CCB&selectedProjectId=xxxxx&selectedBoardId=xxxxxx&colPage=1" | |
Net::HTTP.start(SERVER) {|http| | |
req = Net::HTTP::Get.new(GRAPH_URL) | |
resp = http.request(req) | |
html = Hpricot(resp.body) |
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 ruby | |
puts "Enter content and press Ctrl+D when ready" | |
old_stty = `stty -g` | |
# Set up the terminal in non-canonical mode input processing | |
# This causes the terminal to process one character at a time | |
system "stty -icanon min 1 time 0 -isig" | |
answer = "" | |
while true | |
char = STDIN.getc | |
break if char == ?\C-d # break on Ctrl-d |
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 'uri' | |
require 'net/http' | |
require 'rubygems' | |
require 'hpricot' | |
def extract_updates(url) | |
html = Net::HTTP.get(URI.parse(url)) | |
doc = Hpricot(html) | |
table = doc.search("//*[@id='issuetable']") | |
table.search("//*[@class='nav duedate']").remove |