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
file = ARGV[0] | |
2.times do | |
lines, bytes = 0,0 | |
start = Time.now | |
contents = File.open(file,'rb'){ |f| f.read } | |
contents.scan(/.+/) do |line| | |
lines += 1 | |
bytes += line.size | |
end | |
elapsed = Time.now-start |
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
function stackData(plot, s, datapoints) { | |
if (s.stack == null) | |
return; | |
/******************************************************************************************** | |
* series:{ reverseStack:true } causes the first series to be stacked at the top, | |
* the last series at the bottom. (Vertical ordering matches the legend.) | |
* | |
* Does not properly support excluding specific series from stacking; it's all or none. | |
* |
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
require 'nokogiri' | |
xml = <<ENDXML | |
<top> | |
<node1> | |
<value>mmm</value> | |
<value>zzz</value> | |
<value>ccc</value> | |
</node1> | |
<anothernode> | |
<value>zzz</value> |
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
var versionByLevelAndDigits = { | |
L : { | |
41 : 1, | |
77 : 2, | |
127 : 3 | |
}, | |
M : { | |
34 : 1, | |
63 : 2, | |
101 : 3 |
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
// http://phrogz.net/SVG/convert_path_to_polygon.xhtml | |
function pathToPolygon(path,samples){ | |
if (!samples) samples = 0; | |
var doc = path.ownerDocument; | |
var poly = doc.createElementNS('http://www.w3.org/2000/svg','polygon'); | |
// Put all path segments in a queue | |
for (var segs=[],s=path.pathSegList,i=s.numberOfItems-1;i>=0;--i) segs[i] = s.getItem(i); | |
var segments = segs.concat(); |
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
class Foo | |
@@foo = nil | |
def self.seti( value ) | |
@foo = value | |
end | |
def self.setc( value ) | |
@@foo = value | |
end | |
def self.geti | |
@foo |
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
# Include this in a class and define your own #variation method that | |
# makes returns a new instance that might be better. | |
# | |
# Use #add_annealing_constraint to add constraints | |
module SimulatedAnnealing | |
def self.included(base) base.extend(ClassMethods) end | |
module ClassMethods | |
def annealing_constraints | |
@annealing_constraints ||= {} |
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 SMF | |
// Replaces the currently selected text with the passed text. | |
function replaceText(text, textarea) | |
{ | |
// Attempt to create a text range (IE). | |
if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange) | |
{ | |
var caretPos = textarea.caretPos; | |
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text; |
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
C:\>"\Program Files\PostgreSQL\9.0\bin\psql.exe" -U postgres -p 5434 uxt | |
psql (9.0.4) | |
WARNING: Console code page (437) differs from Windows code page (1252) | |
8-bit characters might not work correctly. See psql reference | |
page "Notes for Windows users" for details. | |
Type "help" for help. | |
uxt=# \dt | |
List of relations | |
Schema | Name | Type | Owner |