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
<?php | |
//http://www.ranks.nl/resources/stopwords.html | |
return $stop_words = array( | |
'a', | |
'about', | |
'above', | |
'after', | |
'again', | |
'against', | |
'all', |
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
## | |
# My solution is not the shortest, but it makes sense to me. | |
## | |
def print_abacus(value): | |
abacus, rod, slices = '', '00000*****', [] | |
for char in str(value): | |
# is there any reason not to use a list of dictionaries? | |
slices.append({'left': (10 - int(char)), 'right': (10 - (10 - int(char)))}) | |
rows = len(slices) # does it make sense to cache here? | |
if rows < 10: |
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
// http://net.tutsplus.com/tutorials/javascript-ajax/meet-crockford%E2%80%99s-jscheck/ | |
(function () { | |
var PasswordScorer = {}; | |
PasswordScorer.score = function (password) { | |
var len = password.length, | |
lengthScore = 0, | |
letterScore = 0, | |
chars = {} | |
if (len >= 21) { lengthScore = 7; } |
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/php | |
<?php | |
$profile = function() { | |
static $start = '0'; | |
list($timestamp, $microseconds) = split(' ', microtime()); | |
$current = bcadd($timestamp, $microseconds, 4); | |
if ($start === '0') { | |
$start = $current; | |
return; | |
} |
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
<?php | |
/** | |
* SplClassLoader implementation that implements the technical interoperability | |
* standards for PHP 5.3 namespaces and class names. | |
* | |
* http://groups.google.com/group/php-standards/web/final-proposal | |
* | |
* // Example which loads classes for the Doctrine Common package in the | |
* // Doctrine\Common namespace. |
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
function Rot13() { | |
var result = ""; | |
var decode = false; | |
var lookup = function(char, i) { | |
var lt1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "; | |
var lt2 = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm "; | |
var orig = (decode) ? lt2: lt1; | |
var enc = (decode) ? lt1: lt2; |
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
//http://en.wikipedia.org/wiki/Rot13 | |
//var name = "Brian Teachman"; | |
//var token = "Oevna Grnpuzna"; | |
function rot13(name) { | |
var lt1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "; | |
var lt2 = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm "; | |
var result = ""; |
NewerOlder