Skip to content

Instantly share code, notes, and snippets.

// github gist Shortcode Usage: [gist id="" file=""]
function gist_shortcode( $atts ) {
extract(shortcode_atts(array(
'id' => '',
'file' => ''
), $atts));
return '<script src="https://gist.github.com/'.$id.'.js?file='.$file.'"></script>';
}
add_shortcode('gist', 'gist_shortcode');
// Conditionally Load jQuery (javascript)
// Source: https://gist.github.com/gists/902090/
var init, loadjQuery;
init = function() {
jQuery(document).ready(function() {
alert('Your Code Here');
});
};
@Nilpo
Nilpo / .bashrc
Created June 20, 2014 01:38 — forked from henrik/.bashrc
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
@Nilpo
Nilpo / gh_hook.php
Last active August 29, 2015 14:05 — forked from webjay/gh_hook.php
<?php
/**
* This file serves as a post receive hook for a GitHub repository. It should be placed in the root of the repository.
*
* To begin, you will need to store a secret key in an environmental variable on the server.
*
* export SECRET_TOKEN=your_token
*
*

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,