Skip to content

Instantly share code, notes, and snippets.

View jonchretien's full-sized avatar
📷

Jon C. jonchretien

📷
View GitHub Profile
@jonchretien
jonchretien / gist:4565081
Created January 18, 2013 14:56
Sublime Text 2 Key Bindings (User)
[
{
// Code Formatting
// The argument allows the command to also work on the entire file in addition to a selection.
"keys": ["command+option+["],
"command": "reindent",
"args": {
"single_line": false
}
}
@jonchretien
jonchretien / gist:4635290
Last active December 11, 2015 17:29
Temp fix to deal with CRLF line endings. Located in REPO/.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
safecrlf = false
@jonchretien
jonchretien / mixins.scss
Last active December 12, 2015 08:09
Sass Grid Calculator
// Grid System
// -------------------------
@function calculateRowMargin($gridGutterWidth) {
@return ($gridGutterWidth * -1);
}
@function calculateColumnWidth($i, $gridColumnWidth, $gridGutterWidth) {
@return ($i * $gridColumnWidth) + (($i - 1) * $gridGutterWidth);
}
/**
* Calculate the height of the document.
* http://stackoverflow.com/questions/1145850/get-height-of-entire-document-with-javascript
*/
function calculateDocumentHeight() {
var body = document.body,
html = document.documentElement,
height;
height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
return height;
@jonchretien
jonchretien / documentScroller.js
Last active December 12, 2015 08:18
Uses the requestAnimationFrame API. TODO: Add easing to the animation.
/**
* @author Jon Chretien
* @overview User clicks on a navigation link and document scrolls to element with matching DOM id.
* @copyright 2013
*/
/*jshint asi: true, browser: true, curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, strict: true, undef: true, sub: true */
(function( window, undefined ) {
@jonchretien
jonchretien / subClass.js
Created April 2, 2013 13:58
Spotify Tech Talk
function inherit(Subclass, Superclass) {
function F() {}
F.prototype = Superclass.prototype;
Subclass.prototype = new F();
return Subclass;
}
function Person() {
// do complex stuff here
}
@jonchretien
jonchretien / notes.md
Last active December 15, 2015 18:09
JavaScript Presentations
@jonchretien
jonchretien / Gruntfile.js
Last active December 15, 2015 23:19
Default Gruntfile (v0.4.x).
module.exports = function(grunt) {
// project configuration.
grunt.initConfig({
dirs: {
dest: '_dist'
},
file: 'index.html',
pkg: grunt.file.readJSON('package.json'),
clean: {
[user]
email = test@test.com
name = Jon Chretien
[alias]
k = log --oneline --graph --decorate
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
[core]
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = /Users/jchretien/.gitignore_global
[color]