Skip to content

Instantly share code, notes, and snippets.

View kad3nce's full-sized avatar

Jedidiah Hurt kad3nce

View GitHub Profile
@kad3nce
kad3nce / lodash-imports-codemod.js
Created February 2, 2023 02:57 — forked from chintan9/lodash-imports-codemod.js
A jscodeshift codemod for converting any Lodash imports into direct imports
export default (fileInfo, api) => {
const j = api.jscodeshift;
const root = j(fileInfo.source);
let specifiers = [];
root
.find(j.ImportDeclaration, isLodashImport)
.forEach((path) => specifiers.push(...path.node.specifiers.map((specifier) => specifier.local.name)))
.remove();
@kad3nce
kad3nce / machine.js
Created February 22, 2021 23:58
Generated by XState Viz: https://xstate.js.org/viz
const networkStatusMachine = Machine({
id: 'networkStatus',
initial: 'uninitialized',
states: {
uninitialized: {
on: {
// NETWORK_REQUEST_SUCCESS: 'online',
// NETWORK_REQUEST_ERROR: 'offline',
WEBSOCKET_MESSAGE_RECEIVED: 'online',
},
!wr{yf@vmKds2QAl6kdL8nMb5xVE
@kad3nce
kad3nce / uninstall.sh
Created November 29, 2018 19:37
BM Desktop Video Uninstaller
#!/bin/sh
BASE=$(dirname "$0")
# On 10.6, perl is (finally) compiled 64bit but the Mac::Processes module is
# still 32bit only. According to the perl man page, this is the recommended
# way to get perl to run in 32bit mode.
export VERSIONER_PERL_PREFER_32_BIT=yes
# Ask Launch Services what the preferred application path is for a given
# creator code, bundle ID and application name. This is the application that
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
</head>
<body>
<div class="pigeonhole-iframe"></div>
<script type="text/javascript">
(function(p,i,g,e,o,n,s){p[o]=p[o]||function(){(p[o].q=p[o].q||[]).push(arguments)},

Keybase proof

I hereby claim:

  • I am kad3nce on github.
  • I am jhurt (https://keybase.io/jhurt) on keybase.
  • I have a public key ASBg-qSocU-E2BtkC8vAs7wsKFlO6chnu-DtmY79f3MptAo

To claim this, I am signing this object:

@kad3nce
kad3nce / page-scroller.js
Last active November 12, 2015 18:53
Automatic Page Scroller
var scrollElement = function (element, scrollDistance, scrollDuration) {
var style = element.style;
// setup CSS transition duration and easing function
style.webkitTransition =
style.transition = scrollDuration + 's';
style.webkitTransitionTimingFunction =
style.TransitionTimingFunction = 'ease-in-out';
// use translate3d to force hardware acceleration
@kad3nce
kad3nce / crash.log
Created May 2, 2015 17:22
Terraform 0.4.2 Crash Report
2015/05/02 11:18:35 [INFO] Terraform version: 0.4.2 8175d7f82134d378234a407e529853da681af07e+CHANGES
2015/05/02 11:18:35 Detected home directory from env var: /Users/jedidiah
2015/05/02 11:18:35 [DEBUG] Discovered plugin: atlas = /usr/local/bin/terraform/terraform-provider-atlas
2015/05/02 11:18:35 [DEBUG] Discovered plugin: aws = /usr/local/bin/terraform/terraform-provider-aws
2015/05/02 11:18:35 [DEBUG] Discovered plugin: cloudflare = /usr/local/bin/terraform/terraform-provider-cloudflare
2015/05/02 11:18:35 [DEBUG] Discovered plugin: cloudstack = /usr/local/bin/terraform/terraform-provider-cloudstack
2015/05/02 11:18:35 [DEBUG] Discovered plugin: consul = /usr/local/bin/terraform/terraform-provider-consul
2015/05/02 11:18:35 [DEBUG] Discovered plugin: digitalocean = /usr/local/bin/terraform/terraform-provider-digitalocean
2015/05/02 11:18:35 [DEBUG] Discovered plugin: dme = /usr/local/bin/terraform/terraform-provider-dme
2015/05/02 11:18:35 [DEBUG] Discovered plugin: dnsimple = /usr/local/bin/terraform/te
@kad3nce
kad3nce / ch3.md
Created April 3, 2015 15:28
# You Don't Know JS: ES6 & Beyond

You Don't Know JS: ES6 & Beyond

Chapter 3: Organization

Some of the most important changes in ES6 involve improved support for the patterns we already commonly use to organize JavaScript functionality. This chapter will explore Iterators, Generators, Modules, and Classes.

Iterators

An iterator is a structured pattern for pulling information from a source in one-at-a-time fashion. This pattern has been around programming for a long time. And to be sure, JS developers have been ad hoc designing and implementing iterators in JS programs since before anyone can remember, so it's not at all a new topic.

What ES6 has done is introduce an implicit standardized interface for iterators. Many of the built in data structures in JavaScript will now expose an iterator implementing this standard. And you can also construct your own iterators adhering to the same standard, for maximal interoperability.