Skip to content

Instantly share code, notes, and snippets.

Sam Fleming SamFleming

Block or report user

Report or block SamFleming

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>JS Bin</title>
<link href=',300' rel='stylesheet' type='text/css'>
<style id="jsbin-css">
body {
background: #8bbec9;
background: -moz-linear-gradient(left, #8bbec9 0%, #97cbd6 100%);
View gist:6250460

Removing a git submodule

To remove a submodule you need to:

  1. Delete the relevant section from the .gitmodules file.
  2. Stage the .gitmodules changes git add .gitmodules
  3. Delete the relevant section from .git/config.
  4. Run git rm --cached path_to_submodule (no trailing slash).
  5. Run rm -rf .git/modules/submodule_name
SamFleming / gimage-search.js
Created Aug 27, 2012
Ajax google image search - random thumbnail
View gimage-search.js
dataType: "jsonp",
url: '',
data: {
v: "1.0",
rsz: 8,
q: "airplane"
success: function ( json ) {
var rand = Math.floor(Math.random() * json.responseData.results.length),
SamFleming / gist:3350252
Created Aug 14, 2012
CakePHP custom checkbox values
View gist:3350252
echo $this->Form->checkbox('FIELD', array('value' => 'Checkbox checked', 'hiddenField' => 'Checkbox HAS NOT been checked'));
View html5_template.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8" />
<link rel="stylesheet" href="" />
View grooveshark_fluid.js
// ==UserScript==
// @name Grooveshark for Fluid
// @namespace
// @description Adds Growl notifications and iTunes-style track info to the dock menu. Also adds the controls: Play/Pause, Next, and Previous.
// @include http://**
// @author Clint Strong
// ==/UserScript==
(function () {
if (window.fluid) {
SamFleming / pagination.ctp
Created Jun 8, 2012 — forked from slywalker/pagination.ctp
pagination element for CakePHP on twitter bootstrap - without first/last and using htmlentities
View pagination.ctp
if (!isset($modules)) {
$modulus = 11;
if (!isset($model)) {
$models = ClassRegistry::keys();
$model = Inflector::camelize(current($models));
<div class="pagination">
SamFleming / hash_pbkdf2.php
Created May 29, 2012 — forked from inanimatt/hash_pbkdf2.php
PHP PBKDF2 implementation
View hash_pbkdf2.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 / uri.js
Created Apr 22, 2012 — forked from jlong/uri.js
URI Parsing with Javascript
View uri.js
var parser = document.createElement('a');
parser.href = "";
parser.protocol; // => "http:"
parser.hostname; // => ""
parser.port; // => "3000"
parser.pathname; // => "/pathname/"; // => "?search=test"
parser.hash; // => "#hash"; // => ""
SamFleming / mod_rewrite redirection check
Created Mar 17, 2012
mod_rewrite - Not from a redirect
View mod_rewrite redirection check
You can’t perform that action at this time.