Skip to content

Instantly share code, notes, and snippets.

@geastwood
geastwood / autoswitch.sh
Created November 10, 2019 09:40
Auto switch node version based on `.nvmrc` using fnm
# ZSH
autoload -U add-zsh-hook
# place default node version under $HOME/.node-version
load-nvmrc() {
DEFAULT_NODE_VERSION=`cat $HOME/.node-version`
if [[ -f .nvmrc && -r .nvmrc ]]; then
fnm use
elif [[ `node -v` != $DEFAULT_NODE_VERSION ]]; then
echo Reverting to node from "`node -v`" to "$DEFAULT_NODE_VERSION"
Linking my account geastwood on GitHub with my 0x3edb7060fc184424aeab05afd142f50464406f87 on Ethereum in social-linker-webapp.ci.litentry.io, and the challenge code is: 5001b02b4b9fc2c989b95d31adecdf4e.
sequenceDiagram
autonumber
participant U as User
participant E as Browser Extension
participant M as MCP App
participant B as MCP B/E
participant T as Twitter
U-)E: Trigger "Set Profile Picture"
E-)M: Redirect to MCP App
@geastwood
geastwood / gist:4493e4589c412553a07c7d9f517c76f2
Created September 20, 2021 11:53
MCP: set profile, show preview card
sequenceDiagram
autonumber
participant U as User
participant E as Browser Extension
participant B as MCP B/E
U-)E: Hover on "Profile picture"
E-)B: relay twitter account to B/E
alt Perform checks

Governance App Milestone 1

With this document, we intend to communicate with the community about the Governance App development progress (Milestone 1, original proposal can be found here). This document is divided into the following sections to allow reader to quickly navigate:

  1. Summary
  2. Detail rundowns according to tasks in milestone1
  3. Next steps
  4. Resources

Summary

@geastwood
geastwood / chunkwmrc
Last active March 15, 2019 16:38
chunkwm+khd
#!/bin/bash
#
# NOTE: specify the desired level of logging.
#
# - none, debug, warn, error
#
chunkc core::log_level error
@geastwood
geastwood / vim_cheat_sheet.md
Last active December 23, 2016 18:56
vim, cheatsheet

Vim CHEAT SHEET

Folding

Keystrokes Description
zc Close a fold
zo Open a fold
za Toggle a fold
zR Open all folds

pattern to replace setInterval with setTimeout

Register a task with setInterval and a interval is not desirable, since the task can take more time than the interval, so the compiler will skip through the current cycle. Replace setInterval with setTimeout with following pattern:

setInterval(function() {
    runSomething();
}, interval);

with

(function loop() {
@geastwood
geastwood / ns.js
Last active December 24, 2015 21:09
simple namespace function
// simple namespace function
// use: var newNs = namespace('this.is.a.new.namespace');
var namespace = function(namespace, context) {
if (!namespace) { throw 'namespace string is required' };
var ns = namespace.split('.');
var current = context || this;