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 luhnCheck($number) { | |
| $digits = str_split($number); | |
| for( $i = (count($digits) - 2); $i >= 0; $i -= 2 ) { | |
| $digits[$i] *= 2; | |
| } | |
| $digits = str_split(implode($digits)); | |
| return (array_sum($digits) % 10) === 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 | |
| /** | |
| * This is free and unencumbered software released into the public domain. | |
| * | |
| * Anyone is free to copy, modify, publish, use, compile, sell, or | |
| * distribute this software, either in source code form or as a compiled | |
| * binary, for any purpose, commercial or non-commercial, and by any | |
| * means. | |
| * |
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 Memoize($function) { | |
| $cache = array(); | |
| return function() use (&$cache, $function) { | |
| $args = func_get_args(); | |
| $serialized = serialize($args); | |
| if( isset($cache[$serialized]) ) | |
| return $cache[$serialized]; |
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
| .tip_shape { | |
| position: absolute; | |
| top: 22px; | |
| left: 7px; | |
| width: 10px; | |
| height: 10px; | |
| -webkit-border-radius: 20px; | |
| -moz-border-radius: 20px; | |
| border-radius: 20px; | |
| -webkit-box-shadow: 0 0 2px black; |
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
| # Template: A.html | |
| <html> | |
| <head></head> | |
| <body> | |
| {% block hello %} | |
| HELLO | |
| {% endblock %} | |
| </body> | |
| </html> |
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
| Drop in replace functions for setTimeout() & setInterval() that | |
| make use of requestAnimationFrame() for performance where available | |
| http://www.joelambert.co.uk | |
| Copyright 2011, Joe Lambert. | |
| Free to use under the MIT license. | |
| http://www.opensource.org/licenses/mit-license.php |
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 slugify(text) | |
| { | |
| return text.toString().toLowerCase() | |
| .replace(/\s+/g, '-') // Replace spaces with - | |
| .replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
| .replace(/\-\-+/g, '-') // Replace multiple - with single - | |
| .replace(/^-+/, '') // Trim - from start of text | |
| .replace(/-+$/, ''); // Trim - from end of text | |
| } |
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
| // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
| // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
| // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
| // MIT license | |
| (function() { | |
| var lastTime = 0; | |
| var vendors = ['ms', 'moz', 'webkit', 'o']; |
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
| ############################################################################ | |
| # Installing nodejs, npm, and all their pals on a Rackspace Ubuntu Server | |
| ############################################################################ | |
| # First get your tools together | |
| apt-get update | |
| apt-get install emacs | |
| apt-get install git | |
| apt-get install curl | |
| apt-get install libssl-dev |
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
| #include <SPI.h> | |
| #include <Ethernet.h> | |
| byte mac[] = { 0x00, 0xAB, 0xCB, 0xCD, 0xDE, 0x02 }; | |
| IPAddress ip(192,168,0,140); | |
| IPAddress server(173,194,70,103); | |
| EthernetClient client; |
OlderNewer