This file contains hidden or 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
local tok = require("proxy.tokenizer") | |
function read_query(packet) | |
if (string.byte(packet) == proxy.COM_QUERY) then | |
local replacement_tokens = {} | |
local tokens = tok.tokenize(packet:sub(2)) | |
local modified_p = false | |
print("-----") | |
print(packet:sub(2)) | |
print(tok.normalize(tokens)) |
This file contains hidden or 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 ruby | |
# | |
# Script to turn "pomodoro mode" on/off in Gnome. | |
# | |
# Gnome has a little-known feature to put a timer around "typing | |
# breaks". This script makes it easy to turn on and off from the | |
# command line (or gnome-do, or what-have-you). | |
# | |
current_value = %x{gconftool --get /desktop/gnome/typing_break/enabled}.chomp |
This file contains hidden or 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
From 641e1e0bebdea1cf5ad4e156afe0ecb6a91241c4 Mon Sep 17 00:00:00 2001 | |
From: Mike Dalessio <[email protected]> | |
Date: Fri, 13 May 2011 08:53:49 -0400 | |
Subject: [PATCH] Test for table join across databases (connections). | |
--- | |
.../test/cases/associations/join_model_test.rb | 11 +++++++++++ | |
1 files changed, 11 insertions(+), 0 deletions(-) | |
diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb |
This file contains hidden or 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
# ---------- ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux] ---------- | |
# --- | |
# warnings: [] | |
# | |
# ruby: | |
# engine: mri | |
# version: 1.8.7 | |
# platform: x86_64-linux | |
# libxml: |
This file contains hidden or 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
user system total real | |
json 3.260000 0.030000 3.290000 ( 3.320897) | |
xml (noko-dom) 21.080000 0.040000 21.120000 ( 21.412431) | |
xml (via Nokogiri DOM parsing) came in at only 6.4x slower than JSON. | |
codes at https://github.com/flavorjones/fairy-wing-throwdown |
This file contains hidden or 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
define session-ruby | |
source ~/.gdb/session-ruby | |
end |
This file contains hidden or 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
# | |
# Tired of Rails constructing SQL queries to keep loading the same | |
# small set of records over and over again? | |
# | |
# Well, cache those records in memory using ActiveHash! | |
# * https://github.com/zilkey/active_hash | |
# | |
require 'active_record' | |
require 'active_hash' |
This file contains hidden or 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
foo: foo.o | |
$(CC) foo.o -g -o foo -lxml2 | |
foo.o: foo.c | |
$(CC) foo.c -g -Wall -c -o foo.o -I/usr/include/libxml2 | |
clean: | |
rm -f foo foo.o |
This file contains hidden or 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 ruby | |
require 'rubygems' | |
require 'nokogiri' | |
html = "<html><body><div>hello</div></body></html>" | |
doc = Nokogiri::HTML html | |
div = doc.at_css "div" |
This file contains hidden or 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
# String Encoding, Nokogiri and You: A Primer | |
## First: A Few Thing To Consider | |
1. It is common for HTML pages to declare | |
1. Without information instructing it differently, Nokogiri's core library ([libxml2][]) will | |
[libxml2]: http://xmlsoft.org/ | |
[meta-bug]: https://bugzilla.gnome.org/show_bug.cgi?id=579317 |