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 April 12, 2024 22:00
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
@gnarf
gnarf / Vagrantfile
Last active February 7, 2023 15:39
multi-vagrant-ansible-setup
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
config_yml = YAML.load_file(File.open(File.expand_path(File.dirname(__FILE__)) + "/vagrant-config.yml"))
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
@gnarf
gnarf / jQuery.ajaxQueue.min.js
Created June 21, 2011 23:52
jQuery.ajaxQueue - A queue for ajax requests
/*
* 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)
@gnarf
gnarf / 2021.19.js
Last active December 22, 2021 20:35
Advent of Code 2021 - Day 19 Part 2 - Console Golfing
L=JSON.stringify
Z="map"
A=(x,y)=>Math.abs(x-y)**2
X='+!!!+!!!++!!!!-!+!+!!!-!!!-+!!!!+!-!!-!+!!!!+!!++!!!+!!+!+!!!!-!!-+!!!-!-!!!-!!!+-!!!!-!-!-!!!+!!!--!!!!+!+!!+!-!!!!+!!+-!!!-!!-!-!!!!-!!--!!!+!!!-!+!+!!!+!!!++!!!!+!-!+!!!-!!!-+!!!!-!-!-!!!-!!!+-!!!!+!+!-!!!+!!!--!!'
for(T=[],x=0;x<X.length;)z=()=>(+eval(X[x++]+1)),T.push([[z(),z(),z()],[z(),z(),z()],[z(),z(),z()]])
M=(m,t)=>m.map((_,i)=>m[0]*t[i][0]+m[1]*t[i][1]+m[2]*t[i][2])
Q=[];(await(await fetch("https://adventofcode.com/2021/day/19/input")).text()).split('\n').map(i=>i.replace(/ (\d+)/,(_,n)=>(q=n,Q[n]=[])).replace(/(-?\d+),(-?\d+),(-?\d+)/,(_,x,y,z)=>Q[q].push([+x,+y,+z])))
D=D=>D.map(o=>D.map(p=>A(o[0],p[0])+A(o[1],p[1])+A(o[2],p[2])))
for(R=Q[0],R.l=[0,0,0];Q.filter(q=>!q.l).find(q=>{H=[]
for(x in (e=D(R)))for(B in (d=D(q)))d[B].filter(a=>e[x].includes(a)).length>11&&H.push([x,B])
@gnarf
gnarf / 2021.21.golfed.js
Last active December 21, 2021 09:34
#AdventOfCode 2021 Day 21
I=(await(await fetch("https://adventofcode.com/2021/day/21/input")).text(w=W=0)).match(/(\d+)/g)
u=(c,...a)=>{for(let i in U=[,,,1,3,6,7,6,3,1])U[i]&&((r,c,p,P,s=0,S=0,t)=>(((s+=p=((p-1+r)%10)+1)>20)&&(t?W+=c:w+=c),s<21&&u(c,P,p,S,s,!t)))(+i,U[i]*c,...a)}
u(1,I[1],I[3])
w>W?w:W
@gnarf
gnarf / 2021.20.full.js
Created December 20, 2021 05:54
#AdventOfCode - Day 20 Part 2 (pre-golfing, but still ugly...)
// comment out top line if you are running it first time... don't blast that fetch!
// I=(await(await fetch("https://adventofcode.com/2021/day/20/input")).text());
// I=`..#.#..#####.#.#.#.###.##.....###.##.#..###.####..#####..#....#..#..##..###..######.###...####..#..#####..##..#.#####...##.#.#..#.##..#.#......#.###.######.###.####...#.##.##..#..#..#####.....#.#....###..#.##......#.....#..#..#..##..#...##.######.####.####.#.#...#.......#..#.#.#...####.##.#......#..#...##.#.##..#...##.#.##..###.#......#.#.......#.#.#.####.###.##...#.....####.#..#..#.##.#....##..#.####....##...##..#...#......#.#.......#.......##..####..#...#.#.#...##..#.#..###..#####........#..####......#..#
// #..#.
// #....
// ##..#
// ..#..
// ..###`;
[key,...rest]=I.split(/\n+/)
@gnarf
gnarf / sidebar.cs
Created May 10, 2019 22:39
sidebar.cs
static void RenderAbilityStatus( GameObject Player, int xp, int yp, ScreenBuffer _Buffer )
{
if( Player.HasPart( "ActivatedAbilities" ) )
{
ActivatedAbilities pAA = Player.GetPart("ActivatedAbilities") as ActivatedAbilities;
if( pAA.AbilityByGuid != null )
if( pAA.AbilityByGuid.Count > 0 )
{
int x = xp;
@gnarf
gnarf / auto-readme-real-source.js
Last active February 18, 2019 10:39
An example of how to use storybook-addon-info with real source files and readme support
const storyFiles = require.context('../src', true, /__stories__\/.+\.js$/)
const sources = require.context('!!raw-loader!../src', true,
/__stories__\/.+\.js$/)
const readme = require.context('!!raw-loader!../src', true, /README\.md$/)
const READMES = readme.keys().reduce((memo, key) => {
const [,baseName] = key.match(/^\.\/([^\/]+)\//)
memo[baseName] = readme(key)
return memo
}, {})
"detects no available moves": {
"comment": "The board looks like this:",
"boardDesc0": "123",
"boardDesc1": "231",
"boardDesc2": "312",
"state": {
diff --git a/apps/sms/js/recipients.js b/apps/sms/js/recipients.js
index c5803d0..5e377c8 100644
--- a/apps/sms/js/recipients.js
+++ b/apps/sms/js/recipients.js
@@ -963,7 +963,11 @@
var dialogBody = document.createDocumentFragment();
if (recipient.type) {
var typeElement = document.createElement('span');
- navigator.mozL10n.localize(typeElement, recipient.type);
+ if (!navigator.mozL10n.get(recipient.type)) {