Skip to content

Instantly share code, notes, and snippets.

View airbr's full-sized avatar
🏠
Working from home

Morgan Murrah airbr

🏠
Working from home
View GitHub Profile
@airbr
airbr / self-eq-this-vs-bind.md
Created February 16, 2017 20:21 — forked from jashmenn/self-eq-this-vs-bind.md
Javascript var self = this; vs. .bind

The Problem

In Javascript this is bound in unexpected ways. Functions, in particular, create a new 'this' and so when you want to keep a reference to an "outer" object you sometimes see the pattern:

var self = this;

as in:

var self = this;
pi@raspberrypi:~/Documents/RaspAlarm $ webpack
Hash: 37ee781105d39d10c02e
Version: webpack 1.14.0
Time: 29708ms
Asset Size Chunks Chunk Names
public/bundle.js 1.39 MB 0 [emitted] main
+ 357 hidden modules
ERROR in ./app/components/Main.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../../private/keys.js in /home/pi/Documents/RaspAlarm/app/components
@airbr
airbr / README-Template.md
Created March 29, 2017 01:27 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@airbr
airbr / morgangrep.txt
Created May 11, 2017 21:54
Personal Grep Cheatsheet
// Searches current directory recursively using extended regular expressions for Hex Codes i.e. :
// Single or double quote group+maybe a # sign+xdigits with a range of 6+ single or double quote group
grep -rE --color "(\'|\")#?[[:xdigit:]]{6,6}(\'|\")" .
@airbr
airbr / gist:5544e4da6d89aeb81cfffd6c783312bf
Created May 23, 2017 02:46
Handy IP/ Address print to console
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
@airbr
airbr / gist:cd7344da8df3d7a7eed697ac6faee3bb
Created June 24, 2017 16:21
Find all file types/sort
find ~/<directory> -exec file -b --mime-type {} + | sort | uniq -c | sort -nr
@airbr
airbr / change-favicon.js
Created November 16, 2017 16:04 — forked from mathiasbynens/change-favicon.js
Dynamically changing favicons with JavaScript
/*!
* Dynamically changing favicons with JavaScript
* Works in all A-grade browsers except Safari and Internet Explorer
* Demo: http://mathiasbynens.be/demo/dynamic-favicons
*/
// HTML5™, baby! http://mathiasbynens.be/notes/document-head
document.head || (document.head = document.getElementsByTagName('head')[0]);
function changeFavicon(src) {
@airbr
airbr / bling.js
Created March 4, 2018 20:54 — forked from paulirish/bling.js
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@airbr
airbr / remove_spaces_unix
Created March 12, 2018 18:20
Remove spaces from files in a given directory
for f in *; do mv "$f" `echo $f | tr ' ' '_'`; done
@airbr
airbr / svndiffmodified.txt
Created May 8, 2018 17:23
Svn Diff All Modified files
svn st | awk '$1 == "M"{print $2;}'| xargs svn diff