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
public static CardType fromCardNumber( String cardNumber ) { | |
if ( cardNumber == null ) | |
return CardType.Null; | |
if ( cardNumber.matches( "^4[0-9]*$" ) ) | |
return CardType.Visa; | |
if ( cardNumber.matches( "^5[1-5][0-9]*$" ) ) | |
return CardType.MasterCard; | |
if ( cardNumber.matches( "^3[47][0-9]*$" )) | |
return CardType.Amex; | |
if ( cardNumber.matches( "^6(?:011|5)[0-9]*$" )) |
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
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); | |
return v.toString(16); | |
}); |
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
"J"+(([]===[])+/-/)[1]+/\[[^1]+\]/[([]+![])[1<<1<<1]+(/|/[(1+{})[1+11>>>1]+[[]+{}][+!1][1]+([]+1/[])[1<<1>>1]+([1<1]+[])[1+11>>>1+1]+[[!!1]+1][+[]][1-1]+([]+!!/!/)[1|1]+(/1/[1]+[])[!1%1]+(-{}+{})[-1+1e1-1]+(1+[!!1])[1]+([]+1+{})[1<<1]+[!!/!!/+[]][+[]][1&1]]+/=/)[1e1+(1<<1|1)+(([]+/-/[(!!1+[])[1>>1]+(!!1+[])[1<<1^1]+(!1+[])[1|1<<1]+(!!1+[])[1^1]])[1^1]==+!1)]+(!![]+{})[1|1<<1]+[1+{}+1][!1+!1][(11>>1)+1]](([]+/-/[(!!1+[])[1>>1]+(!!1+[])[1<<1^1]+(!1+[])[1|1<<1]+(!!1+[])[1^1]]))[1&.1][11>>>1]+(([]===[])+/-/)[1]+([1<1]+[])[1+11>>>1+1]+(1+{})[1+11>>>1]+[!!/!!/+[]][+[]][1&1]+/\[[^1]+\]/[([]+![])[1<<1<<1]+(/|/[(1+{})[1+11>>>1]+[[]+{}][+!1][1]+([]+1/[])[1<<1>>1]+([1<1]+[])[1+11>>>1+1]+[[!!1]+1][+[]][1-1]+([]+!!/!/)[1|1]+(/1/[1]+[])[!1%1]+(-{}+{})[-1+1e1-1]+(1+[!!1])[1]+([]+1+{})[1<<1]+[!!/!!/+[]][+[]][1&1]]+/=/)[1e1+(1<<1|1)+(([]+/-/[(!!1+[])[1>>1]+(!!1+[])[1<<1^1]+(!1+[])[1|1<<1]+(!!1+[])[1^1]])[1^1]==+!1)]+(!![]+{})[1|1<<1]+[1+{}+1][!1+!1][(11>>1)+1]](([]+/-/[(!!1+[])[1>>1]+(!!1+[])[1<<1^1]+(!1+[])[1|1<<1]+(!!1+[])[ |
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
# Handle line endings automatically for files detected as text | |
# and leave all files detected as binary untouched. | |
* text=auto | |
# Force the following filetypes to have unix eols, so Windows does not break them | |
*.* text eol=lf | |
# Windows forced line-endings | |
/.idea/* text eol=crlf |
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
################# | |
## Eclipse | |
################# | |
*.pydevproject | |
.project | |
.metadata | |
bin/ | |
tmp/ | |
*.tmp |
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
$(document).ready( function(){ | |
// Thank you underscorejs | |
var debounce = function(func, wait, immediate) { | |
var timeout, result; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { | |
timeout = null; | |
if (!immediate) result = func.apply(context, args); |
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
<?php | |
/** | |
* Executes a prepared query | |
* | |
* @param string $query the query to execute | |
* @param string $types the types of the bind (s: string or d: integer for each value) | |
* @param mixed[] $values array of values | |
* @param string $error referenced error variable | |
* @returns null|boolean|integer|mixed[] the results | |
*/ |
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
<?php | |
function regex_attributes( &$element ) { | |
$matches = array(); | |
$pattern = '/\s*(?P<key>[^\s=\'"]+)(?:=(?:([\'"])(?P<value>[^\'"]+)[\'"])|\s|$)\s*/sm'; | |
if ( !preg_match_all( $pattern, $element->attributes_raw, $matches, PREG_OFFSET_CAPTURE ) ) | |
return; | |
foreach ( $matches[0] as $key => $match ) | |
$element->attributes[ $matches['key'][$key][0] ] = $matches['value'][$key][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
<?php | |
function regex_nested( $content ) { | |
$pattern = "/\[(?P<type>[^\]\s]+)(?P<props>[^\]]*?)((?P<tagclose>\s*\/\])|". | |
"(\](?P<inner>([^\[]*|\<\!\-\-.*?\-\-\>|(?R))*)\[\/\\1\s*\]))/sm"; | |
if ( !preg_match_all($pattern, $content, $matches, PREG_OFFSET_CAPTURE) ) | |
return $content; | |
$elements = array(); | |
foreach ( $matches[0] as $key => $match ) { | |
array_push( $elements, (object)array( |
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
.inline-block-hack { | |
/* Other css */ | |
zoom:1; /* << sets has layout */ | |
*display:inline; /* << but inline (with layout = inline-block) */ | |
} |