Skip to content

Instantly share code, notes, and snippets.

View fredemmott's full-sized avatar

Fred Emmott fredemmott

View GitHub Profile
===== HTML mode =====
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<p>
Hello,
</p>
<br>
$ ./hello.rb
===== HTML mode =====
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<p>
Hello,
</p>
module Rxhp
module Html
module Attributes
GLOBAL = {
:accesskey => String,
:class => String,
:contenteditable => %w'true false inherit',
:contextmenu => String,
:dir => %w'ltr rtl auto',
:draggable => %w'true false',
#!/usr/bin/env ruby
$LOAD_PATH.push './lib'
n = 1000
begin
require 'continuation'
rescue LoadError
# Ignore, Ruby 1.8
end
$ rvm use 1.8.7@rxhp
Using /Users/fred/.rvm/gems/ruby-1.8.7-p352 with gemset rxhp
$ ./bm.rb
1000 loads: 0.09695s
1000 creations: 0.047529s
1000 renders: 0.529924s
1000 ugly renders: 0.498918s
1000 tiny renders: 0.481867s
$ rvm use 1.9.3@rxhp
Using /Users/fred/.rvm/gems/ruby-1.9.3-preview1 with gemset rxhp
#!/usr/bin/env ruby
require 'rubygems'
require 'json' # 'gem install --user-install json' if this fails
require 'cgi'
require 'net/http'
require 'net/https'
require 'optparse'
require 'uri'
group_id = 201636233240648
@fredemmott
fredemmott / dupe.rb
Created January 28, 2012 13:19
Look for dupes in facebook.com/groups/animatedgifs - only works for objects with type => link, not type => status
#!/usr/bin/env ruby
require 'rubygems'
require 'json' # 'gem install --user-install json' if this fails
require 'cgi'
require 'net/http'
require 'net/https'
require 'optparse'
require 'uri'
group_id = 201636233240648
@fredemmott
fredemmott / clone-everything.rb
Created March 16, 2012 13:56
Clone all your github repositories
#!/usr/bin/env ruby
# Copyright (c) 2012, Fred Emmott <mail@fredemmott.co.uk>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
#!/usr/bin/env ruby
# encoding: utf-8
# === requires ===
require 'find'
require 'set'
require 'shellwords'
require 'taglib2' # ruby-taglib2 gem
require 'tempfile'