Skip to content

Instantly share code, notes, and snippets.

View stephenjudkins's full-sized avatar

Stephen Judkins stephenjudkins

View GitHub Profile
Hello world!
@stephenjudkins
stephenjudkins / gist:801de2af854245e9f14f
Created May 20, 2014 17:48
Hacky fix to IE11 multiple adjacent text nodes problem for Angular
isText = (node) -> node && node.nodeType == Node.TEXT_NODE
normalizeNode = (node) ->
lastSibling = null
for child in (node?.childNodes || [])
if isText(child) and isText(lastSibling)
combined = lastSibling.nodeValue + child.nodeValue
child.nodeValue = combined
node.removeChild(lastSibling)
sealed trait Interact[A]
case class Ask(prompt: String)
extends Interact[String]
case class Tell(msg: String)
extends Interact[Unit]
trait Monad[M[_]] {
def pure[A](a: A): M[A]

Keybase proof

I hereby claim:

  • I am stephenjudkins on github.
  • I am stephenjudkins (https://keybase.io/stephenjudkins) on keybase.
  • I have a public key whose fingerprint is 22EE 3CFF 0422 A3BC 7AB6 C844 8C82 B078 346A A229

To claim this, I am signing this object:

require 'csspool'
require 'pp'
site = Scraper.scrape "http://www.aboutus.org"
doc = site.front_page.doc
style = RealInternet.get('http://www.aboutus.org/support/style.css').body
sac = CSS::SAC::Parser.new
css = sac.parse(style)
a = doc.search("a.logo").first
require 'electric_sheep/whois/parser_wrapper'
require 'dm_test'
class Contact
include DataMapper::Resource
property :page_id, Integer, :key => true
property :address, String
property :city, String
property :state, String
def self.group_by(method_name)
define_method :"group_by_#{method_name}" do
inject([]) do |_, v|
k = yield(v)
if _.empty? || !_.last.send(method_name, k)
_ << [v]
else
_.last << v
end
_
@stephenjudkins
stephenjudkins / gist:116269
Created May 22, 2009 17:56
the most beautiful ruby code ever produced.
MW_PARSER_VERSION = "1.6.1"
RLH_FOR_UPDATE = 1
OT_HTML = 1
OT_WIKI = 2
OT_MSG = 3
OT_PREPROCESS = 4
SFH_NO_HASH = 1
STRIP_COMMENTS = "HTMLCommentStrip"
HTTP_PROTOCOLS = "http:\\/\\/|https:\\/\\/"
EXT_LINK_URL_CLASS = "[^][<>\"\\x00-\\x20\\x7F]"
location /Special/graphic_protection {
proxy_intercept_errors on;
rewrite ^/Special/graphic_protection/(.*)$ /$1 break;
proxy_pass http://au-graphic-protection.s3.amazonaws.com;
error_page 404 = $uri;
}
jruby --fast --server -J-Djruby.objectspace.enabled=false -J-Xmx1024m -J-Xms1024m -J-Xmn512m