Skip to content

Instantly share code, notes, and snippets.

View draeton's full-sized avatar

Matthew Kimball-Cobbs draeton

View GitHub Profile
@draeton
draeton / checkImage.example.js
Last active January 1, 2023 03:30
Check the existence of an image file at `url` by creating a temporary Image element.
// Example Use
(function () {
function success() {
console.log("success: ", this.src);
}
function failure() {
console.log("failure: ", this.src);
}
:instabug-reactnative:generateDebugRFile
:instabug-reactnative:generateDebugSources
/Users/matthewcobbs/projects/2019/1212_tvi_what2watch_client/node_modules/instabug-reactnative/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java:2051: error: cannot find symbol
Instabug.setViewsAsPrivate(arrayOfViews);
^
symbol: method setViewsAsPrivate(View[])
location: class Instabug
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
@draeton
draeton / aliases.sh
Created November 28, 2018 15:58
git aliases
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --date=relative"
@draeton
draeton / jquery.getUrlVars.js
Last active November 8, 2017 13:18
returns object with url variables
/**
* jQuery.getUrlVars
*
* Copyright 2013, Matthew Cobbs
* MIT Licensed
*/
/*global jQuery */
(function (window, $) {
"use strict";
f=(n,i=(function*(a=0,b=1,c){while(true){c=b+a;a=b;b=c;yield c;}})())=>Array(n).fill().map(()=>i.next().value)
@draeton
draeton / params.js
Created January 15, 2014 20:26
Processing url parameters...
var Parameter = function (name /* , value* */) {
this.name = name;
this.values = [].slice.call(arguments, 1);
};
Parameter.prototype.toString = function () {
return this.values.map(function (value) {
return this.name + '=' + value;
}.bind(this)).join('&');
};
@draeton
draeton / debug-var-set.js
Created October 4, 2013 19:50
Rooting out little intractable, hair-pulling, teeth-clenching bugs caused by unforeseen variable overwrites
(function () {
var module;
Object.defineProperty(window, "module", {
get: function () {
return module;
},
set: function (val) {
debugger;
@draeton
draeton / deferred.js
Last active November 5, 2015 19:28
Simple deferred
(() => {
'use strict';
function Deferred() {
this.promise = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
@draeton
draeton / album.js
Last active October 8, 2015 12:48
Perfect Albums Queue
var Queue = function (list) {
this.list = [].concat(list);
};
Queue.prototype = {
constructor: Queue,
random: function () {
var length = this.list.length;
var index = -1;
@draeton
draeton / name.js
Created August 8, 2012 05:50
Test implementation for ES6 Name module
(function (undefined) {
"use strict";
const MIN_STR_LEN = 0x10;
const MAX_STR_LEN = 0xF0 - MIN_STR_LEN;
const MIN_CHAR_CODE = 0x0;
const MAX_CHAR_CODE = 0xFFFF - MIN_CHAR_CODE;