Discover gists
This file contains 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
/** | |
* Helper object to parse the query string variables from | |
* <script> element's src attribute. | |
* | |
* For example, in test.html: | |
* | |
* <script src="test.js?name=value"></script> | |
* | |
* and in test.js, you can get query as name/value pairs: | |
* |
This file contains 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/ruby | |
require 'webrick' | |
include WEBrick | |
def start_webrick(config = {}) | |
config.update(:Port => 5001) | |
server = HTTPServer.new(config) | |
yield server if block_given? |
This file contains 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
creating the Subversion repository | |
% svnadmin create --fs-type fsfs path-to-svn-repos | |
% mkdir tmp | |
% cd tmp | |
% mkdir webframework | |
% cd webframework | |
% mkdir trunk branches tags | |
% cd .. | |
% svn import . file:///path-to-svn-repos --message 'Initial repository layout' | |
This file contains 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 Array | |
# Array#product | |
# ------------- | |
# Returns the cartesian product of the receiver and the arrays given as arguments. | |
# | |
# Usage: | |
# [1, 2, 3].product([4, 5]) # => [[1, 4], [1, 5], [2, 4], [2, 5], [3, 4], [3, 5]] | |
# [1, 2].product([1, 2]) # => [[1, 1], [1, 2], [2, 1], [2, 2]] | |
# [1, 2].product([3, 4],[5, 6]) # => [[1, 3, 5], [1, 3, 6], [1, 4, 5], [1, 4, 6], |
This file contains 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
diff -ur ./Python-2.5.1.orig/Lib/locale.py ./Python-2.5.1/Lib/locale.py | |
--- ./Python-2.5.1.orig/Lib/locale.py 2006-05-18 11:06:40.000000000 +0900 | |
+++ ./Python-2.5.1/Lib/locale.py 2007-09-09 12:50:14.000000000 +0900 | |
@@ -485,7 +485,7 @@ | |
""" | |
_setlocale(category, _build_localename(getdefaultlocale())) | |
-if sys.platform in ('win32', 'darwin', 'mac'): | |
+if sys.platform in ('win32', 'mac'): | |
# On Win32, this will return the ANSI code page |
This file contains 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
/* | |
* The JavaScript implementation of the Secure Hash Algorithm 1 | |
* | |
* Copyright (c) 2008 Takanori Ishikawa <takanori.ishikawa@gmail.com> | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* |
This file contains 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
/* | |
* A Simple BDD (Behaviour Driven Development) library for JavaScript. | |
* | |
* Copyright (c) 2008 Takanori Ishikawa <takanori.ishikawa@gmail.com> | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* |
This file contains 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
import array | |
for byte in array.array('B', "ABCDEFG"): | |
print byte # prints 65, 66, 67, 68, ... and so on. |
This file contains 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
def _mangle_name(self, name): | |
""" | |
Any identifier of the form __spam (at least two leading underscores, | |
at most one trailing underscore) is textually replaced with | |
_classname__spam, where classname is the current class name with | |
leading underscore(s) stripped. | |
Truncation may occur when the mangled name would be longer than | |
255 characters. When the class name consists of only underscores, | |
no mangling occurs. |
This file contains 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
// ==UserScript== | |
// @name chain test | |
// @namespace gomaxfire.dnsdojo.com | |
// @require http://jqueryjs.googlecode.com/files/jquery-1.2.6.js | |
// @require http://gomaxfire.dnsdojo.com/jsrails/chain.js | |
// @include * | |
// ==/UserScript== | |
function log(s){console.log(s)}; | |
//function log(s){document.write(s)}; |