Skip to content

Instantly share code, notes, and snippets.

View SamFleming's full-sized avatar

Sam Fleming SamFleming

View GitHub Profile
@SamFleming
SamFleming / html5_template.html
Created July 17, 2012 09:19 — forked from nathansmith/html5_template.html
Simple HTML5 Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Untitled</title>
<link rel="stylesheet" href="" />
</head>
<body>
</body>
@SamFleming
SamFleming / pagination.ctp
Created June 8, 2012 10:24 — forked from slywalker/pagination.ctp
pagination element for CakePHP on twitter bootstrap - without first/last and using htmlentities
<?php
if (!isset($modules)) {
$modulus = 11;
}
if (!isset($model)) {
$models = ClassRegistry::keys();
$model = Inflector::camelize(current($models));
}
?>
<div class="pagination">
@SamFleming
SamFleming / hash_pbkdf2.php
Created May 29, 2012 11:19 — forked from mattattui/hash_pbkdf2.php
PHP PBKDF2 implementation
<?php
/* PHP PBKDF2 implementation
*
* PBKDF2 is a key derivation function defined in RFC2898. It's used to
* generate longer and more secure passwords from short, human-entered
* passwords. The number of rounds can be increased to keep ahead of
* improvements in CPU/GPU performance.
*
* You should use a different salt for each password (it's safe to store it
@SamFleming
SamFleming / uri.js
Created April 22, 2012 09:51 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"