Skip to content

Instantly share code, notes, and snippets.

View DefiantBidet's full-sized avatar
🐷

James Dean DefiantBidet

🐷
View GitHub Profile
@DefiantBidet
DefiantBidet / gist:5293463
Created April 2, 2013 16:09
this is sample code to attempt to launch native applications from mobile browsers with a fallback to the html page if the native application is not installed on the users device. NOTE: this code sample is not DRY - and can be optimized. This is an amalgamation of several SO postings on the subject matter.
var clickedAt = +new Date(),
timeout, iframe, webURI, nativeURI;
// '+newDate()' is the equivalent of calling valueOf method
// of the Date Object. + is a unary operator.
// see: http://xkr.us/articles/javascript/unary-add/
if (navigator.userAgent.match(/Android/)) {
// Jelly Bean with Chrome browser
if (navigator.userAgent.match(/Chrome/)) {
// Jelly Bean with Chrome browser
@DefiantBidet
DefiantBidet / index.html
Created May 15, 2013 21:01
A CodePen by James Dean. Sample D3 Stacked Area Chart - attempting to refactor live example using csvParse
<div id="chart"></div>
@DefiantBidet
DefiantBidet / webpack.config.js
Last active September 2, 2015 15:18
getting sinon and fetch-mock to work with webpack.
// ...
module: {
loaders: [
// AMD Hacktory has naming collision. cease using AMD loader.
{
test: /sinon.*\.js$/,
loader: 'imports?define=>false',
},
// ...
@DefiantBidet
DefiantBidet / wrap-as-arg.sublime-snippet
Created May 25, 2017 03:45
sublime text snippet to wrap selection in a function call similar to the existing wrap with tag.
<snippet>
<content><![CDATA[${1:fn}($SELECTION)]]></content>
<tabTrigger>WrapAsArg</tabTrigger>
<description>Wraps Selection With Function Call</description>
</snippet>