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
/** | |
* @see http://www.mozilla.org/rhino/ | |
* @see http://www.dabeaz.com/coroutines/ | |
* @see http://www.python.org/dev/peps/pep-0342/ | |
* | |
* @author Ionut G. Stan <ionut.g.stan ~ gmail.com> | |
* @license New BSD license | |
*/ | |
var coroutine = function (f) { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>JavaScript Coroutines</title> | |
<script type="application/javascript;version=1.8"> | |
/** | |
* @see http://www.mozilla.org/rhino/ | |
* @see http://www.dabeaz.com/coroutines/ | |
* @see http://www.python.org/dev/peps/pep-0342/ |
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
DELIMITER $$ | |
CREATE PROCEDURE `report`() | |
BEGIN | |
DECLARE col_number INT(2) DEFAULT 0; | |
DECLARE counter INT(2) DEFAULT 0; | |
DECLARE done INT(1) DEFAULT 0; | |
DECLARE last_prod VARCHAR(128) DEFAULT ""; | |
DECLARE prod_name VARCHAR(128); | |
DECLARE cross_prod_name VARCHAR(128); |
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
;PSPad user HighLighter definition file | |
[Settings] | |
Name=JavaScript 1.8 | |
HTMLGroup=0 | |
Label=1 | |
FileType=*.js | |
CommentString= | |
SlashComment=1 | |
CComment=1 | |
SlashComment=1 |
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
-- Copyright (c) 2009, Ionut Gabriel Stan. All rights reserved. | |
-- | |
-- Redistribution and use in source and binary forms, with or without modification, | |
-- are permitted provided that the following conditions are met: | |
-- | |
-- * Redistributions of source code must retain the above copyright notice, | |
-- this list of conditions and the following disclaimer. | |
-- | |
-- * Redistributions in binary form must reproduce the above copyright notice, | |
-- this list of conditions and the following disclaimer in the documentation |
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
/** | |
* Call constructor with a variable number of arguments. | |
*/ | |
var Ctor = function (a, b) { | |
if (arguments.length === 0) { | |
return; | |
} | |
this.a = a; |
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
module CNP (validCnp) where | |
validCnp :: String -> Bool | |
validCnp (x:xs) = validGenderDigit x && validBirthDate x (take 6 xs) && validControlDigit (x:xs) | |
validGenderDigit :: Char -> Bool | |
validGenderDigit x | x `elem` "123456" = True | |
| otherwise = False | |
validBirthDate :: Char -> String -> Bool |
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
# Always load the Range addon | |
Range | |
# Source: http://ozone.wordpress.com/2006/03/15/blame-it-on-io/ | |
Object unless := method(condition, | |
if(condition not, call evalArgAt(1), call evalArgAt(2)) | |
) | |
Object slotsLike := method(slotName, | |
self slotNames select(containsAnyCaseSeq(slotName)) |
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
-- Strongly inspired from here: http://www.experts-exchange.com/Database/Miscellaneous/Q_24608444.html | |
SELECT | |
COUNT(*) AS total, | |
CASE | |
WHEN age >= 35 THEN 35 | |
WHEN age >= 30 THEN 30 | |
WHEN age >= 25 THEN 25 | |
WHEN age >= 20 THEN 20 | |
ELSE 0 | |
END as age_interval |
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
/** | |
* DERIVING THE Y COMBINATOR IN 7 EASY STEPS | |
* | |
* Ionut G. Stan | ionut.g.stan@gmail.com | http://igstan.ro | http://twitter.com/igstan | |
* | |
* | |
* The Y combinator is a method of implementing recursion in a programming | |
* language that does not support it natively (actually, it's used more for | |
* exercising programming brains). The requirement is the language to support | |
* anonymous functions. |