Skip to content

Instantly share code, notes, and snippets.

@mojombo
mojombo / omg.rb
Created January 6, 2011 05:44 — forked from tenderlove/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)
__END__
<div>&nbsp;<span>x</span></div>
require 'rubygems'
require 'bert'
require 'json'
require 'yajl'
require 'benchmark'
ITER = 1_000
tiny = t[:ok, :awesome]
small = t[:ok, :answers, [42] * 42]
# 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'
== 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
asdasdas
asfsgasgsgasg
<script type="text/javascript">
MyUpdater = {
since:'<%= @since.to_f %>',
u: function() {
new Ajax.PeriodicalUpdater('notes','/poller', {
asynchronous:false,
frequency:'4',
method:'get',
parameters:"since="+MyUpdater.since,
insertion:'top',
@mojombo
mojombo / FUGPL.txt
Created September 25, 2008 19:07 — forked from schacon/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
module Jabber
def self.read
size = $stdin.read(2).unpack("n").first
$stdin.read(size).split(':')
end
def self.write(success)
answer = success ? 1 : 0
token = [2, answer].pack("nn")
$stdout.write(token)