Skip to content

Instantly share code, notes, and snippets.

Creating a Happy Git Environment on OS X

Step 1: Install Git

Configure things:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global alias.co checkout

git config --global apply.whitespace nowarn

<< Project Name >>

<< Project description >>

Branch structure for submodules

There are two branches to this repository, master and production, these make it easier to use the same repository for developing as well as for sharing the code as a Git submodule.

The master Branch

body {
font-size: 100%;
}
body, caption, th, td, input, textarea, select, option, legend, fieldset, h1, h2, h3, h4, h5, h6 {
font-size-adjust: 0.5;
}
#page {
font-size: 1em;
@Nilpo
Nilpo / Sublime Text 2 HTML5 Boilerplate Snippet
Last active January 4, 2016 23:16 — forked from keithforsythe/Sublime Text 2 HTML5 Boilerplate Snippet
Sublime Text 2 HTML5 Boilerplate snippet. Creates an HTML5 page structure based on the HTML5 Boilerplate project - with all the components included - when you type ht5, tab. To use: 1. Copy this text into a new doc with the syntax mode set to xml. 2. Then save it to "/Packages/User/html5-boilerplate.sublime-snippet". Document must be in HTML syn…
<snippet>
<content><![CDATA[<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>${1:Project Name}</title>

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@Nilpo
Nilpo / luhn.js
Last active August 29, 2015 14:25 — forked from ShirtlessKirk/luhn.js
Luhn validation algorithm
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,
@Nilpo
Nilpo / Log-.md
Last active September 4, 2015 01:19 — forked from bgrins/Log-.md
Prevent errors on console methods when no console present and expose a global 'log' function.

Javascript log Function

Every time I start a new project, I want to pull in a log function that allows the same functionality as the console.log, including the full functionality of the Console API.

There are a lot of ways to do this, but many are lacking. A common problem with wrapper functions is that the line number that shows up next to the log is the line number of the log function itself, not where log was invoked. There are also times where the arguments get logged in a way that isn't quite the same as the native function.

This is an attempt to once and for all document the function that I pull in to new projects. There are two different options:

  • The full version: Inspired by the plugin in HTML5 Boilerplate. Use this if you are writing an application and want to create a window.log function. Additionally,
@Nilpo
Nilpo / call-apply-bind-proxy.js
Last active September 16, 2015 04:00 — forked from branneman/call-apply-bind-proxy.js
JavaScript call() vs apply() vs bind() vs $.proxy()
var fn = function(arg1, arg2) {
var str = '<p>aap ' + this.noot + ' ' + arg1 + ' ' + arg2 + '</p>';
document.body.innerHTML += str;
};
var context = {
'noot': 'noot'
};
var args = ['mies', 'wim'];
// Calls a function with a given 'this' value and arguments provided individually.
@Nilpo
Nilpo / playingcards.js
Created September 22, 2015 23:24
Playing Cards in JavaScript
// Create a function for shuffling the elements in an array
Array.prototype.shuffle = function(repeat) {
repeat = (repeat === undefined) ? 1 : repeat;
for (var i = 0; i < repeat; i++) {
// Implement the Fisher-Yates Shuffle
var currentIndex = this.length, temporaryValue, randomIndex;
@Nilpo
Nilpo / android_material_design_colours.xml
Last active October 26, 2015 00:40 — forked from daniellevass/android_material_design_colours.xml
Android Material Design Colours
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>