Skip to content

Instantly share code, notes, and snippets.

{
"React Hook: Use State": {
"prefix": "us",
"body": [
"const [${1:Value}, set${1/(.*)/${1:/capitalize}/}] = useState($2);",
],
"description": "useState"
},
"React Hook: Use Effect": {
"prefix": "ue",
@nbar1
nbar1 / HackerNewsNewTab.js
Created April 11, 2019 22:26
Open HN story and comment links in a new tab
// ==UserScript==
// @name HackerNews New Tab
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Open story and comment links in a new tab
// @author Nick Barone
// @match https://news.ycombinator.com/*
// ==/UserScript==
(function() {
@nbar1
nbar1 / nysdmv-defensive-driving-course.js
Last active August 18, 2023 14:12
NYS DMV Defensive Driving Course Clicker
// ==UserScript==
// @name UCEUSA NY IPIRP DMV Defensive Driving Course Clicker
// @namespace http://nickbar.one
// @version 0.3
// @author nbar1
// @match https://*.uceusa.com/course-players/courses/*
// ==/UserScript==
(function() {
'use strict';
@nbar1
nbar1 / remove_git_tag
Created July 12, 2017 01:16 — forked from dearaujoj/remove_git_tag
git remove tag locally and remote
git tag -d TagName && git push origin :refs/tags/TagName
@nbar1
nbar1 / socks.js
Created March 2, 2015 02:49
socks.js
function wash(socks) {
var socksYouHave = [];
var sockSizes = ['small', 'medium', 'large'];
socks.forEach(function(sock) {
// Weird socks never survive
if(sockSizes.indexOf(sock) === -1) return;
// One in ten socks never make it out alive
if(Math.floor(Math.random() * 10) === 0) return;
@nbar1
nbar1 / cisco_ipphone_weather_service_softkey.xml
Created May 5, 2014 22:59
Cisco IP Phone Weather Service SoftKey
<CiscoIPPhoneExecute>
<ExecuteItem URL="Key:AppMenu" />
<ExecuteItem URL="Key:KeyPad6" />
<ExecuteItem URL="Key:KeyPad1" />
</CiscoIPPhoneExecute>
@nbar1
nbar1 / konami_code
Created April 29, 2014 19:37
JQuery Konami Code
var kkeys = [], kcode = "38,38,40,40,37,39,37,39,66,65";
$('body').on('keydown', function(e) {
kkeys.push(e.keyCode);
if(kkeys.toString().indexOf(kcode) >= 0) {
$(document).unbind('keydown', arguments.callee);
$("body").addClass('konami');
}
});
@nbar1
nbar1 / vigit
Created November 18, 2013 20:30
Opens all modified files in tabs in vi
vi -p `git status -s | cut -c4-`