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
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import org.apache.http.auth.AuthScope; | |
import org.apache.http.auth.UsernamePasswordCredentials; | |
import org.apache.http.impl.client.BasicCredentialsProvider; | |
import org.apache.http.impl.client.DefaultHttpClient; | |
import org.apache.http.client.methods.HttpGet; | |
import org.apache.http.HttpRequest; | |
import org.apache.http.HttpResponse; | |
public class SimpleRequest { |
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
use LWP::UserAgent; | |
my $agent = LWP::UserAgent->new(); | |
$agent->credentials($host, $realm, $user, $pass); | |
print $agent->get($uri)->content(); |
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
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> | |
<script> | |
var socket; | |
$(function() { | |
// ws_path should be of the form ws://host/_hippie/ws | |
var ws_path = "ws:<% request.base.opaque %>_hippie/ws"; |
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
x = 0 | |
[1,2,3].each{|x| puts x} | |
puts x |
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
conn_info: | |
server: irc.freenode.net | |
port: 6667 | |
channels: | |
- '#foo' | |
- '#bar' | |
nick: foobot | |
username: foobot | |
name: defender of the universe | |
ignore_list: |
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
/* | |
Treewidth is a class that reduces a graph by a series of "safe" rules. | |
It also generates a minimum value for the treewidth of the graph. | |
The rules that have been implemented so far are: | |
* Islet Rule | |
* Twig Rule | |
* Series Rule | |
* Triangle Rule | |
* Simplicial Rule | |
* Almost Simplicial Rule |
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
235c235 | |
< checkProp($value, $type, $path, undef, $_changing); | |
--- | |
> $self->checkProp($value, $type, $path, undef, $_changing); | |
283c283 | |
< checkProp($value, $schema->{'extends'}, $path, $i, $_changing); | |
--- | |
> $self->checkProp($value, $schema->{'extends'}, $path, $i, $_changing); | |
304,306c304,307 | |
< if (ref $schema->{'items'} eq 'ARRAY') |
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
nmap <F5> :call Run('perl')<CR> | |
cabbrev pyx call Run('python') | |
cabbrev perlx call Run('perl') | |
cabbrev rubyx call Run('ruby') | |
fu! NewThrowawayBuffer() | |
new | |
setlocal noswapfile | |
setlocal buftype=nowrite | |
setlocal bufhidden=delete |
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 perl | |
# Based on Randy Stauner's http://blogs.perl.org/users/randy_stauner/2011/06/exploratory-one-liners-with-less-typing.html | |
# and Marco Fontani's https://gist.github.com/1042504. | |
# To install all dependencies: | |
# sudo cpanm File::Slurp JSON::XS Data::Dump YAML::XS utf8::all Class::Autouse | |
# Installation: | |
# copy this file to ~/bin/p | |
# Example usage: | |
# p 'dd [File::Spec->path]' # dynamically load arbitrary modules | |
# p -pe 's/foo/bar/' foo.txt # use your favorite options like -lane |
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
my $factorial = sub { | |
my $val = shift; | |
return $val * __SUB__->($val - 1) if $val > 1; | |
return $val; | |
}; | |
print $factorial->(5); |
OlderNewer