Skip to content

Instantly share code, notes, and snippets.

@simonsmith
simonsmith / git-log-graph
Last active December 24, 2015 09:49
Awesome detailed git log.
git log --graph --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''%C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit --all
Alias it to something like:
git config alias.graph = log --graph ..etc..
For a quick way to get an overview of your current branches etc, use a bash alias
alias gl='git graph -10'
Looks like: http://cl.ly/Ri9R
@simonsmith
simonsmith / vertical-spacing.scss
Created August 29, 2013 16:01
Vertical spacing classes for Sass. Useful with Bootstrap
// Vertical spacing classes
// ------------------------------------
@for $i from 1 through 30 {
$val: $i + 0px;
.mb#{$i} {
margin-bottom: $val;
}
.mt#{$i} {
margin-top: $val;
}
function deparam(str) {
var o = {};
var reg = /\\?([^?=&]+)(=([^&#]*))?/g;
str.replace(reg, function($0, $1, $2, $3) {
if (typeof $3 == 'string') {
o[decodeURIComponent($1)] = decodeURIComponent($3);
}
});
@simonsmith
simonsmith / jquery.measure.js
Created March 11, 2013 17:23
Re-make of MooTools Element.measure for jQuery. Taken from - http://stackoverflow.com/a/7351956/617615
!function(global) {
function definition($) {
$.fn.measure = function(fn) {
var clone = $(this).clone(), result;
clone.css({
visibility: 'hidden',
position: 'absolute'
});
clone.appendTo(document.body);
module.exports = withAjax;
function withAjax() {
'use strict';
this.get = function(url, options) {
this.ajax(url, options, 'get');
};
this.post = function(url, options) {
@simonsmith
simonsmith / loadScript.js
Last active December 12, 2015 07:58
Tiny script loader thing
function loadScript(url, callback) {
var script = document.createElement('script');
var entry = document.getElementsByTagName('script')[0];
var readyHandler;
script.async = true;
script.src = url;
entry.parentNode.insertBefore(script, entry);
if (script.addEventListener) {
script.addEventListener('load', callback, false);
{
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
"dictionary": "Packages/Language - English/en_GB.dic",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
".git",
".idea"
],
@simonsmith
simonsmith / deploy-git-php
Last active December 11, 2015 17:28
Basic script to git pull on the server
<?
$title = 'Deploy '. $_SERVER['SERVER_NAME'] . ' from GitHub';
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?= $title ?></title>
<style>
.container {
@simonsmith
simonsmith / amd-jquery-plugin.js
Last active April 29, 2020 15:28
AMD compatible plugin for jQuery
// UMD dance - https://github.com/umdjs/umd
!function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else {
factory(root.jQuery);
}
}(this, function($) {
'use strict';
@simonsmith
simonsmith / get_permalink_by_title
Created October 11, 2012 16:22
Get Wordpress page by title