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 validateIBAN(iban) { | |
var newIban = iban.toUpperCase(), | |
modulo = function (divident, divisor) { | |
var cDivident = ''; | |
var cRest = ''; | |
for (var i in divident ) { | |
var cChar = divident[i]; | |
var cOperator = cRest + '' + cDivident + '' + cChar; |
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 validateNIB(t, max_len) | |
{ | |
var pesos = [0, 1, 10, 3, 30, 9, 90, 27, 76, 81, 34, 49, 5, 50, 15, 53, 45, 62, 38, 89, 17, 73, 51, 25, 56, 75, 71, 31, 19, 93, 57], | |
validateValue = t.toString(), | |
s = validateValue.split(''), | |
r = s.reverse(), | |
tot = 0; | |
if (t == undefined) { | |
return false; |
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
<!-- | |
Inspired on Dr.Nic ruby-tmbundle (https://github.com/drnic/ruby-tmbundle/blob/master/Snippets/Insert%20ERb's%20%3C%25%20__%20%25%3E%20or%20%3C%25%3D%20__%20%25%3E.tmSnippet) | |
In your Sublime Text 2 User folder (Sublime Text 2/Packages/User), create this file and give a name "erb.sublime-snippet". | |
Than open a Ruby on Rails view file like HAML or ERB, type "erb" command and tab key. | |
This create ERB tag on your view file. | |
--> | |
<snippet> | |
<content><![CDATA[<%= ${0} %>]]></content> | |
<tabTrigger>erb</tabTrigger> |
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 | |
define('_ROOT', dirname(realpath(__FILE__))); | |
function assets_include_tag($assets, $tmpl, $options) | |
{ | |
if (empty($assets)) { | |
return false; | |
} |
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 bubbleSort ($items) { | |
$size = count($items); | |
for ($i=0; $i<$size; $i++) { | |
for ($j=0; $j<$size-1-$i; $j++) { | |
if ($items[$j+1] < $items[$j]) { | |
arraySwap($items, $j, $j+1); | |
} | |
} | |
} | |
return $items; |
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
// From http://javascript.crockford.com/prototypal.html | |
// This way we are follow the true nature of Javascript. | |
if (typeof Object.create !== 'function') { | |
Object.create = function (o) { | |
function F() {} | |
F.prototype = o; | |
return new 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
Show hidden characters
{ | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/Color Scheme - Default/Railscasts.tmTheme", | |
"default_encoding": "ISO-8859-1", | |
"detect_indentation": false, | |
"draw_minimap_border": true, | |
"font_face": "Bitstream Vera Sans Mono", | |
"font_size": 10, | |
"highlight_line": true, | |
"highlight_modified_tabs": true, |
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 cycle($obj) | |
{ | |
static $key = -1; | |
static $last_obj = array(); | |
if(count(array_diff_assoc($obj, $last_obj)) > 0) | |
$key = 0; | |
else | |
$key++; |
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 color_meter(cwith, ccolor) { | |
if (!cwith && !ccolor) return; | |
var _cwith = (cwith.charAt(0)=="#") ? cwith.substring(1,7) : cwith; | |
var _ccolor = (ccolor.charAt(0)=="#") ? ccolor.substring(1,7) : ccolor; | |
var _r = parseInt(_cwith.substring(0,2), 16); | |
var _g = parseInt(_cwith.substring(2,4), 16); | |
var _b = parseInt(_cwith.substring(4,6), 16); |
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 | |
/* | |
Adaptation by Marco Arment <[email protected]>. | |
Adapted from Portable PHP Password Hashing Framework (phpass) version 0.3: | |
http://www.openwall.com/phpass/ | |
phpass was by Solar Designer <solar at openwall.com> in 2004-2006 and is in | |
the public domain. This adaptation is also in the public domain. |
NewerOlder