Skip to content

Instantly share code, notes, and snippets.

View gleuch's full-sized avatar
🏃‍♂️
Marathon

Greg Leuch gleuch

🏃‍♂️
Marathon
View GitHub Profile
@gleuch
gleuch / gist:2475825
Created April 24, 2012 02:58
Javascript documentfragment to string (w/ text selection)
// selection range
var range = window.getSelection().getRangeAt(0);
// plain text of selected range (if you want it w/o html)
var text = window.getSelection();
// document fragment with html for selection
var fragment = range.cloneContents();
// make new element, insert document fragment, then get innerHTML!
@gleuch
gleuch / README-prisma-findInBatches.md
Last active December 2, 2022 04:11
Prisma find in batches extension
@gleuch
gleuch / .deps...npm...zeppelin-solidity...contracts...token...ERC20...StandardToken.sol
Created November 29, 2021 13:01
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.18+commit.9cf6e910.js&optimize=false&runs=200&gist=
pragma solidity ^0.4.24;
import "./BasicToken.sol";
import "./ERC20.sol";
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
@gleuch
gleuch / RARIBLE-API-README.md
Last active November 8, 2021 22:45
How Picnic uses the Rarible API
@gleuch
gleuch / machine.js
Last active January 14, 2021 05:19
Generated by XState Viz: https://xstate.js.org/viz
const generateSectionMachines = () => null
const mach = Machine(
{
id: 'page',
initial: 'loading',
context: { page: {} },
on: {
SET: { target: 'ready', actions: 'setData' },
},
@gleuch
gleuch / README.md
Created November 18, 2020 19:16
Cross-platform cacheable method for NextJS

NextJS Cacheable storage

Store data in redis (server-side) or sessionStorage (client-side) with expiry time (seconds) using NextJS.

Installation

Add redis and redis-mock (for testing): yarn add redis redis-mock

Copy cacheable.js and redis.js to lib/.

@gleuch
gleuch / README.md
Last active November 18, 2020 18:53
Nprogress observers & NextJS route event listeners

Advanced nprogress support for NextJS route events

This code allow for smarter handling of nprogress using event observers that check progress of all observing events. This also adds ability to support error conditions when observeable callbacks fail.

Installation

Install nprogress: yarn add nprogress

Copy the nprogress.js file into lib/nprogress.js.

Keybase proof

I hereby claim:

  • I am gleuch on github.
  • I am gleuch (https://keybase.io/gleuch) on keybase.
  • I have a public key whose fingerprint is C946 8E6E EAA6 243D C39E 2780 533B BC98 03C5 8CAC

To claim this, I am signing this object:

@gleuch
gleuch / macchange.sh
Last active March 28, 2017 23:12
Alter your MAC address when connecting to WiFi networks. For OS X (Macbooks, etc.)
#
# MACchange
# v1.1
#
# Alter your MAC address when connecting to WiFi networks.
#
# -----------------------------------------------------------------------------
#
# - Works great for places that have 1 hour time limits on wifi access, as
# tracked by mac address
! version = 2.0
+ hello bot
- Hello, human!