Skip to content

Instantly share code, notes, and snippets.

Mx Corey Frang gnarf

Block or report user

Report or block gnarf

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
@gnarf
gnarf / ..git-pr.md
Last active Sep 2, 2019
git pr - Global .gitconfig aliases for Pull Request Managment
View ..git-pr.md

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@gnarf
gnarf / jquery deferred api calls.js
Created Oct 31, 2012 — forked from fission6/jquery deferred api calls
complex use case for API calls utilizing jQuery deferreds
View jquery deferred api calls.js
// outer IIFE - gives us $ === jQuery!, also, makes every var/function inside "private"!
window.MYAPI = (function($) {
function processSiteRequest( data ) {
var sites = data.response.sites;
// loop through each site given back for the paginated result set
$.each( sites || [], function(index, site) {
debugPrint("Site: " + site.name);
@gnarf
gnarf / gitvars.sh
Created Jul 5, 2012
bash script to copy author and hash from current commit
View gitvars.sh
gitvars() {
export author="$(git log --format='%an <%ae>' HEAD -n1)"
export hash="$(git log --format='%H' HEAD -n1)"
echo "\$author=\"$author\""
echo "\$hash=\"$hash\""
}
@gnarf
gnarf / simpleSlideshow.js
Created Jul 2, 2012
Just a slideshow I hacked out for someone a year or two ago
View simpleSlideshow.js
/*! simple slideshow example
* gnarf
* This work is licensed under a Creative Commons Attribution 3.0 Unported License
* http://creativecommons.org/licenses/by/3.0/
*/
(function($) {
$(function() {
var timeout,
ss = $(".slideshow"),
images = ss.find("li"),
View main.js
$(document).ready(function(){
function stopprop( event ) { event.stopPropagation(); }
function starhover( event ) {
console.log( event.type );
this.src = ( event.type === "mouseenter" ) ? 'images/stardown.png' : 'images/starup.png';
}
$('#leftTab').on({
// When hovered
View gist:1323953
//based on https://gist.github.com/07a297472f182f7a7132/79d3dea1e3dc7ce2d065a42316b83ec820671634
;(function($, undefined) {
$.notify = function(options) {
if(options.timeOut > 0)
{
//add the timer to the message
console.log($(options.message).find('.countDown'));
if($(options.message).find('.countDown').length > 0){
@gnarf
gnarf / deferreds_pipe
Created Oct 13, 2011 — forked from dmethvin/deferreds_pipe
Use of deferreds and pipe
View deferreds_pipe
fetchCurrentPosition()
.then(updateLocationDisplay)
.pipe(fetchWeatherAtThisLocation)
.then(updateWeatherDisplay)
.pipe(determineWeatherType)
.then(updateRecommendations)
.then(updateAppTile);
function fetchCurrentPosition()
{
View gist:1220819
var rwhitespace = /\s+/;
// These hooks are used by animate to expand properties
$.each({
margin: "margin*",
padding: "padding*",
borderWidth: "border*Width"
}, function( property, expandTemplate ) {
// order is important!
View gist:1217560
// assumptions:
// link = the markdown to inject
// textarea = jQuery() of the node
textarea.val( function( _, value ) {
var range,
begin = value.length;
if ( this.setSelectionRange ) {
begin = this.selectionStart;
} else if ( document.selection && document.selection.createRange ) {
@gnarf
gnarf / jQuery.ajaxQueue.min.js
Created Jun 21, 2011
jQuery.ajaxQueue - A queue for ajax requests
View jQuery.ajaxQueue.min.js
/*
* jQuery.ajaxQueue - A queue for ajax requests
*
* (c) 2011 Corey Frang
* Dual licensed under the MIT and GPL licenses.
*
* Requires jQuery 1.5+
*/
(function(a){var b=a({});a.ajaxQueue=function(c){function g(b){d=a.ajax(c).done(e.resolve).fail(e.reject).then(b,b)}var d,e=a.Deferred(),f=e.promise();b.queue(g),f.abort=function(h){if(d)return d.abort(h);var i=b.queue(),j=a.inArray(g,i);j>-1&&i.splice(j,1),e.rejectWith(c.context||c,[f,h,""]);return f};return f}})(jQuery)
You can’t perform that action at this time.