Skip to content

Instantly share code, notes, and snippets.

View jesgundy's full-sized avatar

Jesse Gundy jesgundy

View GitHub Profile
@jesgundy
jesgundy / gulpfile.js
Created June 3, 2020 20:32 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@jesgundy
jesgundy / log.js
Created March 6, 2018 16:21
Log Client Events
// log client side errors
window.onerror = function (message, url, lineNumber) {
// line number is useless since it is compiled
$.post(Kin.RootUrl + 'api/log/javascripterror', { message: message }, function (resp) {
});
return false; // continue to call the default handler
};
@jesgundy
jesgundy / lodashify.js
Created November 28, 2017 21:15
to import lodash into chrome dev tools console
var el = document.createElement('script');
el.src = "https://cdn.jsdelivr.net/lodash/4.11.1/lodash.min.js";
el.type = "text/javascript";
document.head.appendChild(el);
// Use the following in a bookmarklet:
javascript:var el=document.createElement('script');el.src="https://cdn.jsdelivr.net/lodash/4.11.1/lodash.min.js";el.type = "text/javascript";document.head.appendChild(el);
@jesgundy
jesgundy / google-analytics-amd.js
Created August 19, 2016 17:41 — forked from ismyrnow/google-analytics-amd.js
Google Analytics AMD Module
define(function (require) {
var module;
// Setup temporary Google Analytics objects.
window.GoogleAnalyticsObject = "ga";
window.ga = function () { (window.ga.q = window.ga.q || []).push(arguments); };
window.ga.l = 1 * new Date();
// Immediately add a pageview event to the queue.
@jesgundy
jesgundy / autosave.js
Last active August 18, 2016 21:38 — forked from d3nj3ll/autosave.js
Client-side Autosave Using localStorage
// Retrieve the object from storage onReady
var autosave = localStorage.getItem('file');
// parses the string (btw. its UTF-8)
var text = JSON.parse(autosave);
//modifies the textarea with the id="inputTextArea"
$("textarea#inputTextArea").val(text);
// Autosave on keystroke works in offline mode
@jesgundy
jesgundy / Helpers.md
Last active February 22, 2023 16:24
Git Helpers

Remove References to Remote branches that don't exist

git remote prune origin

Delete all local branches that don't have a remote

git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
@jesgundy
jesgundy / checkvisible.js
Created June 18, 2014 15:39
Check Visible - jQuery function to test presence of element on screen.
function checkvisible( elm ) {
var vph = $(window).height(), // Viewport Height
st = $(window).scrollTop(), // Scroll Top
y = $(elm).offset().top;
// test if element is on screen or has been scrolled past
return (y < (vph + st));
// test if element is on screen
// return (y > st) && (y < (vph + st));
@jesgundy
jesgundy / html.html
Created June 12, 2014 19:20
Conditional HTML classes.
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
@jesgundy
jesgundy / delay.js
Created May 8, 2014 18:24
D3 scalable delayed transition effect.
// …
.transition()
.delay(function(d, i) {
return i / dataset.length * 1000; // <-- Where the magic happens
})
.duration(500)
// …
@jesgundy
jesgundy / line-height.scss
Created April 7, 2014 19:59
Firefox input line-height fix.
input::-moz-focus-inner {
border: 0;
padding: 0;
margin-top:-2px;
margin-bottom: -2px;
}