Skip to content

Instantly share code, notes, and snippets.

View gnarf's full-sized avatar

Mx Corey Frang gnarf

View GitHub Profile
@gnarf
gnarf / ..git-pr.md
Last active October 17, 2024 18:48
git pr - Global .gitconfig aliases for Pull Request Managment

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 November 19, 2012 22:34
Update jQuery's GitHub IRC notifications to include push, pull_request, issues.
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 July 10, 2012 21:23
What's wrong with Netmag's "Optimize your JavaScript" post

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 June 1, 2011 23:53
$.fn.newContent
// $.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 21:55
What results can you get just using these characters: +[]
// 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 March 30, 2011 18:27
Like jQuery's .one but runs only once, across multiple elements and/or event types.
/*!
* 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($){