Skip to content

Instantly share code, notes, and snippets.

View omg.rb
require 'nokogiri'
doc = Nokogiri.HTML DATA
doc.xpath('//div//text()').map { |x| x.content = x.to_s }
p doc.serialize(:save_with => Nokogiri::XML::Node::SaveOptions::NO_DECLARATION)
View bertmark.rb
require 'rubygems'
require 'bert'
require 'json'
require 'yajl'
require 'benchmark'
ITER = 1_000
tiny = t[:ok, :awesome]
small = t[:ok, :answers, [42] * 42]
View autobench_grapher.rb
# Used to graph results from autobench
# Usage: ruby autobench_grapher.rb result_from_autobench.tsv
# This will generate three svg & png graphs
require "rubygems"
require "scruffy"
require 'csv'
require 'yaml'
View gist:199473
== Signal handling
In general, signals need only be sent to the master process. However,
the signals Unicorn uses internally to communicate with the worker
processes are documented here as well.
=== Master Process
* HUP - reload config file, app, and gracefully restart all workers
View something.js
<script type="text/javascript">
MyUpdater = {
since:'<%= @since.to_f %>',
u: function() {
new Ajax.PeriodicalUpdater('notes','/poller', {
View FUGPL.txt
The FUGPL License
Free software should be truly free. The GPL and its derivatives infringe
upon the freedoms of the licensee by forcing distribution of code with
distribution of software. This license is a protest against anti-business,
anti-freedom licenses such as the GPL.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View jabber.rb
module Jabber
size = $"n").first
def self.write(success)
answer = success ? 1 : 0
token = [2, answer].pack("nn")