Skip to content

Instantly share code, notes, and snippets.

View radelmann's full-sized avatar

Rob Adelmann radelmann

View GitHub Profile
@radelmann
radelmann / Ignore .DS_Store forever
Created December 1, 2016 21:47 — forked from linuslundahl/Ignore .DS_Store forever
Make git always ignore .DS_Store
$ git config --global core.excludesfile ~/.gitignore
$ echo .DS_Store >> ~/.gitignore
@radelmann
radelmann / css.background.img
Last active November 9, 2015 23:12
CSS - add a background image that stretches to fit the screen and has a fixed (non scrolling) position.
body {
background-image: url('{img-url}');
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-attachment: fixed;
}
@radelmann
radelmann / html5.sublime-snippet
Last active November 9, 2015 20:54
sublime snippet - html document template
<snippet>
<content><![CDATA[
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Title</title>
</head>
@radelmann
radelmann / tdd.expect.sublime-snippet
Created November 2, 2015 23:47
sublime snippet - javascript - tdd - expect
<snippet>
<content><![CDATA[
it("${1:expects}", function() {
expect(${2:test}).to.equal(${3:result});
});
]]></content>
<description>tdd</description>
<tabTrigger>expect</tabTrigger>
<scope>source.js</scope>
</snippet>
@radelmann
radelmann / tdd.describe.sublime-snippet
Created November 2, 2015 23:46
sublime snippet - javascript - tdd - describe
<snippet>
<content><![CDATA[
describe("${1:describe}", function() {
${2:it}
});
]]></content>
<description>tdd</description>
<tabTrigger>describe</tabTrigger>
<scope>source.js</scope>
</snippet>
@radelmann
radelmann / shell.cp.gitrepo.exclude.git
Last active October 28, 2015 19:21
copy a local git repo folder, excluding all git info
rsync -r --exclude='.git*' sourceDir/ targetDir/
@radelmann
radelmann / randomIntMinMax.js
Created October 27, 2015 03:22
javascript - generate a random integer between the min and mix inputs
function getRandomInt (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
@radelmann
radelmann / getTimeDiff.js
Created October 26, 2015 22:25
return how long ago a date occured in days, hours, or mins.
var getTimeDiff = function(date) {
//input: js date object
//output: returns how long ago the input date occured in a user friendly format
var now = new Date().getTime();
var ms = (now - date.getTime());
var days = Math.round(ms / 86400000); // days
var hrs = Math.round((ms % 86400000) / 3600000); // hours
var mins = Math.round(((ms % 86400000) % 3600000) / 60000); // minutes
if (days > 0) {
@radelmann
radelmann / formatLongDate.js
Last active October 26, 2015 22:19
Format javascript date object into a user friendly long date string
var formatLongDate = function(date) {
//input: js date object
//output: user friendly long date string, eg: Monday, Oct 26, 2015, 3:11 PM
var options = {
weekday: "long",
year: "numeric",
month: "short",
day: "numeric",
hour: "2-digit",
minute: "2-digit"
@radelmann
radelmann / gist:43f135a15eac8c88ccdc
Last active October 27, 2015 20:42 — forked from lucasfais/gist:1207002
Sublime Text 2 - OSX shortcut cheat sheet

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt