A very basic regex-based Markdown parser. Supports the
following elements (and can be extended via Slimdown::add_rule()):
- Headers
- Links
- Bold
| <?php | |
| define('PASSWORD_SHA256', '$5$'); | |
| define('PASSWORD_SHA512', '$6$'); | |
| define('PASSWORD_BCRYPT', '$2y$'); | |
| define('PASSWORD_SCRYPT', '$7$'); // made up here | |
| $password_algos = array(); | |
| function password_register_algo($prefix, Callable $create, Callable $validate) { |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
A very basic regex-based Markdown parser. Supports the
following elements (and can be extended via Slimdown::add_rule()):
| <?php | |
| // Originally by Andrew Moore | |
| // Src: http://stackoverflow.com/questions/4795385/how-do-you-use-bcrypt-for-hashing-passwords-in-php/6337021#6337021 | |
| // | |
| // Heavily modified by Robert Kosek, from data at php.net/crypt | |
| class Bcrypt { | |
| private $rounds; | |
| private $prefix; |
| <?php | |
| /** | |
| * Fibonacci: | |
| *============================================================================ | |
| * Class for computing fibonacci numbers using functional programming in PHP | |
| * Uses the formula at: http://jburrows.wordpress.com/2009/12/30/fibonacci/ | |
| */ | |
| class fibonacci { |
| { | |
| "text": "RT @PostGradProblem: In preparation for the NFL lockout, I will be spending twice as much time analyzing my fantasy baseball team during ...", | |
| "truncated": true, | |
| "in_reply_to_user_id": null, | |
| "in_reply_to_status_id": null, | |
| "favorited": false, | |
| "source": "<a href=\"http://twitter.com/\" rel=\"nofollow\">Twitter for iPhone</a>", | |
| "in_reply_to_screen_name": null, | |
| "in_reply_to_status_id_str": null, | |
| "id_str": "54691802283900928", |
| The regex patterns in this gist are intended to match any URLs, | |
| including "mailto:[email protected]", "x-whatever://foo", etc. For a | |
| pattern that attempts only to match web URLs (http, https), see: | |
| https://gist.github.com/gruber/8891611 | |
| # Single-line version of pattern: | |
| (?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])) |