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
@scottgonzalez
scottgonzalez / github-irc.js
Created Nov 19, 2012
Update jQuery's GitHub IRC notifications to include push, pull_request, issues.
View github-irc.js
var https = require( "https" ),
async = require( "async" ),
username = "xxx",
password = "xxx";
function getRepos( user, fn ) {
var req = https.request({
host: "api.github.com",
port: 443,
path: "/users/" + user + "/repos",
@rmurphey
rmurphey / gist:3086328
Created Jul 10, 2012
What's wrong with Netmag's "Optimize your JavaScript" post
View gist:3086328

What's wrong with Netmag's "Optimize your JavaScript" post

Update: The original post on Netmag has been updated since this was written.

I tweeted earlier that this should be retracted. Generally, these performance-related articles are essentially little more than linkbait -- there are perhaps an infinite number of things you should do to improve a page's performance before worrying about the purported perf hit of multiplication vs. division -- but this post went further than most in this genre: it offered patently inaccurate and misleading advice.

Here are a few examples, assembled by some people who actually know what they're talking about (largely Rick Waldron and Ben Alman, with some help from myself and several others from the place that shall be unnamed).

Things that are just plain wrong

@gnarf
gnarf / example.js
Created Jun 1, 2011
$.fn.newContent
View example.js
// $.fn.newContent behaves kinda like .live(), it will act on elements that match the
// selector now, or in the future... It automatically runs on any elements immediately
// matched, and also runs once on document ready. You then call .newContent() on any
// freshly created content to trigger searching it
// It will call the given callback function in the context of a
// jQuery set that matches the selector...
$("li.test").newContent(function() {
this.css("color", "red");
@cowboy
cowboy / plus-brackets-only.js
Created May 21, 2011
What results can you get just using these characters: +[]
View plus-brackets-only.js
// What results can you get just using these characters: +[]
// I know this has been done before, but I don't have the link,
// and I don't want it (not yet, at least)
// basic numbers
0: +[]
1: ++[+[]][+[]]
2: ++[++[+[]][+[]]][+[]]
3: ++[++[++[+[]][+[]]][+[]]][+[]]
4: ++[++[++[++[+[]][+[]]][+[]]][+[]]][+[]]
@cowboy
cowboy / jquery.ba-oneonly.js
Created Mar 30, 2011
Like jQuery's .one but runs only once, across multiple elements and/or event types.
View jquery.ba-oneonly.js
/*!
* jQuery oneOnly - v0.1pre - 03/30/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){
You can’t perform that action at this time.