Skip to content

Instantly share code, notes, and snippets.


Devin Rhode devinrhode2

Block or report user

Report or block devinrhode2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
devinrhode2 / .zshrc
Created Apr 18, 2019
highlights from my zshrc
View .zshrc
# Make this your ~/.zshrc file and make sure to do the zgen install steps here:
# You'll also need to change the default shell to zsh:
export PATH=$PATH:/Users/rhoded/Desktop/Archive2/Visual\ Studio\
ulimit -n 10240 unlimited
devinrhode2 / update-your-mustache.js
Created Jul 8, 2012
Why not hookup mustache templates to auto-update?
View update-your-mustache.js
/* by Devin Rhode (@Devinrhode2)
Mustache templates are a one-time operation.
I realized this doesn't have a to be, and having them auto-update is *extremely trivial*
So, we have this mustache:
<p>Hello, {{username}}</p>
View console method extensions with sentry logging.html
<script src="" crossorigin="anonymous"
onerror="if(confirm('Connection lost\n\nReload?')) location.reload();"></script>
// String.includes polyfill from v1.0.0 by @mathias
if (!String.prototype.includes) {
(function() {
'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
var toString = {}.toString;
var defineProperty = (function() {
// IE 8 only supports `Object.defineProperty` on DOM elements
devinrhode2 / decorators.js
Created Nov 27, 2018 — forked from RSNara/decorators.js
An example of using decorators in ES5.
View decorators.js
function memoize(object, name, descriptor) {
var fn = descriptor.value;
var memoized = function() {
memoized.cache = memoized.cache || {};
var key = JSON.stringify(arguments);
return memoized.cache[key] = memoized.cache[key]
? memoized.cache[key]
: fn.apply(this, arguments);
descriptor.value = memoized;
devinrhode2 / StrictjQuery3.js
Last active Nov 27, 2018
warn on empty jquery selection badSelectorAction devinrhode2
View StrictjQuery3.js
// simple working copy pasta version (requires extendFunction.js, devinrhode2/extendFunction.js
window.failsafe = 'failsafe';
// Don't like throwing errors? Define $.badSelectorAction to be whatever you want.
function badSelectorAction( selector, context, originalResult ) {
if (window.console && console.warn) {
console.warn( '$(\''+selector+'\') selected nothing. Do $(sel, "failsafe") to silence warning. Context:', context);
devinrhode2 / StrictjQuery.js.markdown
Last active Nov 27, 2018
warn on empty jquery selection badSelectorAction devinrhode2
View StrictjQuery.js.markdown

warn on empty jquery selection

Graduated to github:

But for the simple version (quite possibly better): (wait no its broke use the one on GH)

Warns when you have an empty jQuery selection, unless you do $('foo', failsafe);

  $.badSelectorAction = function badSelectorActionFn( selector, context ) {
devinrhode2 / typeCheck.js
Last active Nov 19, 2018
Working on a typeCheck function
View typeCheck.js
function postTweet(tweet /*string*/, from /*string*/) {
postTweet('string', 'asdf');
postTweet('string', 222); //TypeError! run in console to see a nice error message!
function typeCheck(a) {
var newArr = [];
var types = [];
var f = a.callee.toString();
devinrhode2 / TraceKitSupplement.js
Last active Nov 19, 2018
Stuff I've added to my error reporting/handling stuff in addition to TraceKit.js, ideally in a few months I don't write any of this code
View TraceKitSupplement.js
function exceptionalException(message) {
'use strict';
if (exceptionalException.emailErrors !== false) {
exceptionalException.emailErrors = confirm('We had an error reporting an error! Please email us so we can fix it?');
//exceptionalException('try 1!');
//exceptionalException('try 2!');
devinrhode2 /
Last active Nov 18, 2018
git post/pre-push hook to upload changes over ftp

git pre-push/post-push ftp upload code

I'm looking to share what I've done and potentially get improvements on this code snippet from others - my pre-push hook for pushing to ftp:

$ code .git/hooks/pre-push

Works like a charm, but I'd love to not push unless I know there are no unmerged changes I should pull. I'm not sure how to do that. I know, if there are changes, a git hook should do exit 1 to abort the git push.

I searched around for a post-push hook but that proved to be a much more daunting task, because git does not have a post-push hook.

View force-globals-require.js
/** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 2.3.6 Copyright jQuery Foundation and other contributors.
* Released under MIT license,
//Not using strict: uneven strict support in browsers, #392, and causes
//problems with requirejs.exec()/transpiler plugins that may not be strict.
/*jslint regexp: true, nomen: true, sloppy: true */
/*global window, navigator, document, importScripts, setTimeout, opera */
You can’t perform that action at this time.