Skip to content

Instantly share code, notes, and snippets.

@kyleshevlin
kyleshevlin / machine.js
Created December 22, 2019 21:04
Generated by XState Viz: https://xstate.js.org/viz
const filterSubStates = filterName => ({
initial: "disabled",
states: {
disabled: {
on: { [`ENABLE_${filterName}`]: "enabled" }
},
enabled: {
initial: "asc",
on: {
[`DISABLE_${filterName}`]: "disabled"
@kyleshevlin
kyleshevlin / machine.js
Created December 4, 2019 23:56
Generated by XState Viz: https://xstate.js.org/viz
const assetManagerViewMachine = Machine(
{
id: "assetManagerView",
initial: "closed",
context: {
assetsSelected: 0
},
states: {
closed: {
on: {
@kyleshevlin
kyleshevlin / machine.js
Created November 27, 2019 00:17
Generated by XState Viz: https://xstate.js.org/viz
const toastMachine = Machine({
id: 'toast',
initial: 'poweredOff',
states: {
poweredOff: {
on: { POWER_ON: 'poweredOn.hist' }
},
poweredOn: {
on: { POWER_OFF: 'poweredOff' },
type: 'parallel',
@kyleshevlin
kyleshevlin / machine.js
Created November 20, 2019 03:07
Generated by XState Viz: https://xstate.js.org/viz
const lightBulbMachine = Machine({
id: 'lightBulb',
initial: 'unlit',
states: {
unlit: {
on: {
BREAK: 'broken',
TOGGLE: 'lit'
}
},
@Ciantic
Ciantic / example-typeorm-jest.test.ts
Created April 16, 2019 17:50
Example of testing TypeOrm with Jest and Sqlite in-memory database
import { createConnection, getConnection, Entity, getRepository } from "typeorm";
import { PrimaryGeneratedColumn, Column } from "typeorm";
@Entity()
export class MyEntity {
@PrimaryGeneratedColumn()
id?: number;
@Column()
name?: string;
// ==UserScript==
// @name Spotify ad skipper
// @version 1.0
// @namespace http://tampermonkey.net/
// @description Detects and skips ads on spotify
// @match https://*.spotify.com/*
// @grant none
// @run-at document-start
// @downloadURL https://gist.githubusercontent.com/Simonwep/24f8cdcd6d32d86e929004013bd660ae/raw
// @updateURL https://gist.githubusercontent.com/Simonwep/24f8cdcd6d32d86e929004013bd660ae/raw
package global;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.awt.AWTException;
import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException;
import java.awt.Rectangle;
@tiagosiebler
tiagosiebler / multi-ipn.php
Created February 2, 2017 20:25 — forked from anointed/multi-ipn.php
Paypal multiple IPN's
<?php
/*
* This is a PayPal IPN (Instant Payment Notification) broadcaster
* Since PayPal does not provide any straightforward way to add
* multiple IPN listeners we'll have to create a central IPN
* listener that will broadcast (or filter and dispatch) Instant
* Payment Notifications to different destinations (IPN listeners)
*
* http://codeseekah.com/2012/02/11/how-to-setup-multiple-ipn-receivers-in-paypal/
*
@brianmcallister
brianmcallister / vwap.js
Last active August 25, 2021 16:55
VWAP (Volume Weighted Average Price) function.
/**
* Calculate VWAP (volume weighted average price) for a list of bids.
*
* @param {number} total - Total shares bought.
* @param {Array<number, number>} positions - Tuples of position data. The first
* index is the amount of shares, the
* second index is the price of the
* shares.
*
* @example
@gyaresu
gyaresu / gootfet-bash.txt
Last active May 17, 2022 20:03
GoodFET failure
====== Inexplicably it just worked... I think. Those ff's are fairly ominous =====================
pentoo ~ # goodfet.bsl --dumpinfo > info.txt
Use -h for help
Use --fromweb to upgrade a GoodFET.
MSP430 Bootstrap Loader Version: 1.39-goodfet-8
Invoking BSL...
Transmit default password ...
Current bootstrap loader version: 2.13 (Device ID: f26f)
pentoo ~ # cat info.txt