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>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,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
SamFleming / gimage-search.js
Created Aug 27, 2012
Ajax google image search - random thumbnail
View gimage-search.js
$.ajax({
dataType: "jsonp",
url: 'http://ajax.googleapis.com/ajax/services/search/images',
data: {
v: "1.0",
rsz: 8,
q: "airplane"
},
success: function ( json ) {
var rand = Math.floor(Math.random() * json.responseData.results.length),
@SamFleming
SamFleming / gist:3350252
Created Aug 14, 2012
CakePHP custom checkbox values
View gist:3350252
<?php
echo $this->Form->checkbox('FIELD', array('value' => 'Checkbox checked', 'hiddenField' => 'Checkbox HAS NOT been checked'));
View html5_template.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Untitled</title>
<link rel="stylesheet" href="" />
</head>
<body>
</body>
View grooveshark_fluid.js
// ==UserScript==
// @name Grooveshark for Fluid
// @namespace clintxs@gmail.com
// @description Adds Growl notifications and iTunes-style track info to the dock menu. Also adds the controls: Play/Pause, Next, and Previous.
// @include http://*grooveshark.com/*
// @author Clint Strong
// ==/UserScript==
(function () {
if (window.fluid) {
@SamFleming
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
<?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 — forked from inanimatt/hash_pbkdf2.php
PHP PBKDF2 implementation
View hash_pbkdf2.php
<?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 Apr 22, 2012 — forked from jlong/uri.js
URI Parsing with Javascript
View uri.js
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"
@SamFleming
SamFleming / mod_rewrite redirection check
Created Mar 17, 2012
mod_rewrite - Not from a redirect
View mod_rewrite redirection check
RewriteCond %{ENV:REDIRECT_STATUS} ^$
You can’t perform that action at this time.