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/ruby | |
require 'nokogiri' | |
require 'open-uri' | |
query = "stuff" | |
doc = Nokogiri::HTML(open("http://thesaurus.com/browse/#{query}")) | |
puts doc.search("//td[text()='Synonyms:']/following-sibling::td/span").text |
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
injekt@shirley ~ $ perl -e 'use Data::Dumper; print Dumper(grep { defined &{"Data\::Dumper\::$_"} } keys %{"Data\::Dumper\::"})' | |
$VAR1 = 'Seen'; | |
$VAR2 = 'Toaster'; | |
$VAR3 = 'Varname'; | |
$VAR4 = 'Values'; | |
$VAR5 = 'Dumpf'; | |
$VAR6 = 'new'; | |
$VAR7 = '_sortkeys'; | |
$VAR8 = 'Pair'; | |
$VAR9 = 'DESTROY'; |
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
# TESTING - not current Cinch syntax | |
# part the current channel | |
bot.plugin "part" do |m| | |
m.channel.part | |
end | |
# With a part message | |
bot.plugin "part :message" do |m| | |
m.channel.part m.args[:message] |
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
injekt@shirley ~ $ ruby test.rb London | |
London ( /ˈlʌndən/) is the capital of England and the United Kingdom (UK). It is Britain's largest and most populous metropolitan area. A major settlement for two millennia, its history goes back to its founding by the Romans, who called it Londinium.[6] London's core, the ancient City of London, or the 'square mile' financial district, largely retains its mediaeval boundaries. Since at least the 19th century, the name "London" has also referred to the metropolis developed around this core.[7] Today, the bulk of this conurbation forms the London region[8] and the Greater London administrative area,[9][note 1] with its own elected mayor and assembly.[10] |
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/perl -w | |
use strict; | |
use warnings; | |
use feature qw/say/; | |
sub search($) { | |
my $path = shift; |
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/perl -w | |
use strict; | |
use warnings; | |
use IO::Socket::INET; | |
use feature qw/say/; | |
# Google translate |
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 ruby | |
require 'open-uri' | |
require 'json' | |
# Google translate | |
def translate(text, langto='en', langfrom='en') | |
text.gsub!(/\s+/, '+') | |
s = open("http://translate.google.com/translate_a/t?client=t&text=#{text}&hl=#{langfrom}&tl=#{langto}") |
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
<?php | |
function trimit(&$val) { | |
$val = trim($val); | |
} | |
function trim_array_contents(&$arr) { | |
array_walk($arr, 'trimit'); | |
} |
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
module Ramaze::Helper | |
module RespondTo | |
Formats = { | |
'json' => 'application/json', | |
'xml' => 'application/xml', | |
'yaml' => 'application/yaml', | |
# others .. | |
} | |
# Hack to remove format from params |
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
<?php | |
class Person { | |
var $name; | |
public function __construct($name) { | |
$this->name = $name; | |
} | |
public function __get($value) { |
OlderNewer