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`. |
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
<?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 | |
*/ |