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
| // naive quicksort | |
| function qsort(a) { | |
| var len = a.length; | |
| if ( !len || len === 1 ) | |
| return a; | |
| var pivot = a[0], |
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 node | |
| (function () { | |
| var npm = require('npm'); | |
| function done( error ) { | |
| process.exit( error === null ? 1 : 0 ); | |
| } | |
| function test() { |
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 iter( iters ) { | |
| values = mw.config.values; | |
| iters = iters || 100000; | |
| var hits = 0; | |
| for ( var i = 0; i < iters; i++ ) { | |
| values['wgArticleId'] = i + ''; | |
| if (isEligible()) { | |
| hits++; | |
| } | |
| } |
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 bash | |
| LOGDIR="/var/log" # destination for log files | |
| # Reads lines from standard input. For each line, write into a log file whose | |
| # name is generate from the first field in the line and the current date. | |
| # Fields are whitespace-delimited. For example, the line "foo bar buzz 123" | |
| # will be recorded in the file "foo-2012-06-06.log" | |
| while read -r line ; do |
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
| 95:42:94:48:75 |
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 bucketCookies = $.getBuckets(); | |
| bucketCookies['lastModified'][0] = 'expr1'; | |
| $.cookie('userbuckets', $.toJSON( bucketCookies ) , { expires: 365 }); //expires in 1 year |
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
| select page_id, page_title from page where page_id in (220, 252, 292, 445, 606, 792, 1004, 1047, 1048, 1076, 1252, 1430, 1448, 1501, 1504, 1567, 1734, 1752, 1771, 1929, 2431, 2659, 2673, 2691, 2823, 2872, 2991, 3009, 3065, 3185, 3249, 3294, 3305, 3375, 3427, 3856, 3859, 4133, 4232, 4430, 4609, 4815, 4854, 4888, 5568, 5749, 5853, 6210, 6298, 6359, 6446, 6816, 7179, 7636, 7919, 8003, 8053, 8191, 8378, 8759, 8785, 8792, 9001, 9427, 9682, 9891, 9897, 9995, 10028, 10076, 10270, 10495, 10669, 10943, 10958, 11468, 11578, 11863, 11970, 12074, 12087, 12335, 12375, 13224, 13307, 13625, 13751, 14101, 14180, 14619, 14858, 15147, 15463, 15480, 15515, 15615, 15697, 15899, 16718, 17051); |
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 bucketCookies = $.getBuckets(); | |
| bucketCookies['lastModified'][0] = 'expr1'; | |
| $.cookie('userbuckets', $.toJSON( bucketCookies ) , { expires: 365 }); //expires in 1 year |
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 stringToByteArray( str ) { | |
| var codepoint, stack, bytes = []; | |
| for ( var i = 0; i < str.length; i++ ) { | |
| codepoint = str.charCodeAt( i ); | |
| stack = []; | |
| do { | |
| // Get 8 lowest bits of character g | |
| stack.unshift( codepoint & 0xff ); |
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 onBeforePageDisplay( &$out, &$skin ) { | |
| global $wgRequest; | |
| global $wgUser; | |
| global $wgOut; | |
| if ( $wgRequest->getCheck('postedit') ) { | |
| $wgOut->addJsConfigVars( array ( | |
| "wgUserEditCount" => $wgUser->getEditCount(), | |
| "wgArticleUpdate" => true | |
| ) ); |