Skip to content

Instantly share code, notes, and snippets.

View simonsmith's full-sized avatar

Simon Smith simonsmith

View GitHub Profile
var Component = React.createClass({
render: function() {
return (
<div className="Component">
// More content here
</div>
)
}
});
@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;
}
@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);
@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 / get_permalink_by_title
Created October 11, 2012 16:22
Get Wordpress page by title
@simonsmith
simonsmith / get_nav_items_by_name
Created October 11, 2012 16:20
Get Wordpress nav items by name
/**
* Get menu items based on name
*
* @param $menu_name
* @return mixed|null
*/
function get_nav_items_by_name($menu_name) {
$locations = get_nav_menu_locations();
if (!isset($locations[$menu_name])) {
@simonsmith
simonsmith / ResponsiveClasses
Created September 5, 2012 14:24
Mobile first responsive classes, taken from Bootstrap
@tablet: 46.875em; // Approx 750px - Larger Tablets upwards
@desktop: 75em; // Approx 1200px - Desktops
.mobile() {
.visible-phone { display: block; }
.visible-tablet { display: none; }
.visible-desktop { display: none; }
.hidden-phone { display: none; }
.hidden-tablet { display: block; }
.hidden-desktop { display: block; }