A very basic regex-based Markdown parser. Supports the
following elements (and can be extended via Slimdown::add_rule()):
- Headers
- Links
- Bold
| /** | |
| * $.parseParams - parse query string paramaters into an object. | |
| */ | |
| (function($) { | |
| var re = /([^&=]+)=?([^&]*)/g; | |
| var decodeRE = /\+/g; // Regex for replacing addition symbol with a space | |
| var decode = function (str) {return decodeURIComponent( str.replace(decodeRE, " ") );}; | |
| $.parseParams = function(query) { | |
| var params = {}, e; | |
| while ( e = re.exec(query) ) { |
| // NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension | |
| { | |
| // Settings | |
| "passfail" : false, // Stop on first error. | |
| "maxerr" : 100, // Maximum error before stopping. | |
| // Predefined globals whom JSHint will ignore. | |
| "browser" : true, // Standard browser globals e.g. `window`, `document`. |
| <?php | |
| /** | |
| * Turn all URLs in clickable links. | |
| * | |
| * @param string $value | |
| * @param array $protocols http/https, ftp, mail, twitter | |
| * @param array $attributes | |
| * @return string | |
| */ | |
| public function linkify($value, $protocols = array('http', 'mail'), array $attributes = array()) |
| /* 1. write it out for older browsers */ | |
| /* 2. use the vendor prefix for webkit */ | |
| /* 3. use the vendor prefix for moz */ | |
| /* 4. include the un-prefixed version last */ | |
| #foo { | |
| width: 200px; | |
| width: -webkit-calc(50% - 100px); | |
| width: -moz-calc(50% - 100px); | |
| width: calc(50% - 100px); |
| /** | |
| * A little script to play the ACSII Star Wars, but with a hidden | |
| * cursor, since over telnet the cursor remains visible | |
| */ | |
| var net = require('net') | |
| var cursor = require('ansi')(process.stdout) | |
| // connect to Star Wars server |
| <?php | |
| include "utils.php"; | |
| $fp = parse_fp($_GET['fp']); | |
| $dbh = new PDO('mysql:host=localhost;dbname=fingerprint', 'fingerprint'); | |
| $dbh->beginTransaction(); | |
| $sth = $dbh->prepare("INSERT INTO fp (length) VALUES (?)"); |
A very basic regex-based Markdown parser. Supports the
following elements (and can be extended via Slimdown::add_rule()):
#Node - Processes
To launch an external shell command or executable file you can use the child_process. Apart from command line arguments and environment variables you cannot communicate with the process using child_process.exec. However you can use child_process.spawn to create a more integrated processes.
##Executing Child Processes
###To launch an external shell command
var child_process = require('child_process');
var exec = child_process.exec;| /** | |
| * Creates an OpenSSL certificate | |
| * @param $dn Array Associative array "key"=>"value" | |
| * @param $duration int Number of days which the certificate is valid | |
| * @throws Exception If there are any errors | |
| * @return Array Associative array with the security elements: "cer"=>self signed certificate, "pem"=>private key, "file"=>path to the files | |
| * | |
| * @see http://www.php.net/manual/en/function.openssl-csr-new.php | |
| * @author Pep Lainez | |
| */ |
⇐ back to the gist-blog at jrw.fi
Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.
I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.
This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso