Skip to content

Instantly share code, notes, and snippets.

View mailtruck's full-sized avatar
👨‍✈️

Brian Danowski mailtruck

👨‍✈️
  • Ferndale, MI
View GitHub Profile
@Himanshu-Mishr
Himanshu-Mishr / theme
Created May 6, 2015 07:36
126 Themes for Terminal (Elementary OS)
#!/bin/bash
# Download it.
# Name it as 'theme'
# Place it in /usr/bin/
# shell_prompt$ theme
echo '
3024 Day ( 1) 3024 Night ( 2) AdventureTime ( 3)
Afterglow ( 4) AlienBlood ( 5) Argonaut ( 6)
Arthur ( 7) Atom ( 8) Belafonte Day ( 9)
Belafonte Night ( 10) BirdsOfParadise ( 11) Blazer ( 12)
@prognostikos
prognostikos / app.js
Created September 11, 2012 13:45
AngularJS & Rails
/**
* Angular needs to send the Rails CSRF token with each post request.
*
* Here we get the token from the meta tags (make sure <%= csrf_meta_tags %>
* is present in your layout.)
*/
angular.module('myapp',[]).
// configure our http requests to include the Rails CSRF token
config(["$httpProvider", function(p) {
var m = document.getElementsByTagName('meta');
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 26, 2024 23:26 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 22, 2024 20:20
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@mailtruck
mailtruck / readme.md
Created April 23, 2012 03:53 — forked from chriseppstein/readme.md
How to integrate Compass with Rails 3.1 asset pipeline

This gist is no longer valid. Please see Compass-Rails for instructions on how to install.

@mailtruck
mailtruck / colormeter.js
Created April 18, 2012 07:09 — forked from krypton/colormeter.js
Calculate difference in percentage between 2 hex colors
function color_meter(cwith, ccolor) {
if (!cwith && !ccolor) return;
var _cwith = (cwith.charAt(0)=="#") ? cwith.substring(1,7) : cwith;
var _ccolor = (ccolor.charAt(0)=="#") ? ccolor.substring(1,7) : ccolor;
var _r = parseInt(_cwith.substring(0,2), 16);
var _g = parseInt(_cwith.substring(2,4), 16);
var _b = parseInt(_cwith.substring(4,6), 16);

shiminy: minimal es5-shim

Looking at the ES5 compatibility table, several browsers provide everything often used (i. e. not Object.freeze() and friends) except Function.prototype.bind. So I just inline that. Browsers that don't provide other functions also don't include Object.getOwnPropertyNames, so I used it as my test for including the entire shim.

Note that I haven't tested it yet, and it doesn't work for the six Object functions next to each other in the Safari 5 part of the compatibility chart (Safari 5 is deemed good enough).

Update: I added JSON for IE <= 7. JSON is used in a good number of node.js modules.

@clauswitt
clauswitt / ClickToSplit.js
Created July 4, 2011 19:14
Click to Split
function onclick(e) {
var range;
if (document.caretRangeFromPoint) {
range = document.caretRangeFromPoint(e.pageX, e.pageY);
} else if (e.rangeParent) {
range = document.createRange();
range.setStart(e.rangeParent, e.rangeOffset);
}
var textContainer = range.startContainer;