Skip to content

Instantly share code, notes, and snippets.

View raineorshine's full-sized avatar

Raine Revere raineorshine

  • New York, NY
View GitHub Profile
@raineorshine
raineorshine / human-readable-hash-comparisons.md
Last active April 26, 2024 13:52
An aesthetic comparison of a few human-readable hashing functions.

An Aesthetic Comparison of Human-Readable
Hashing Functions

The following compares the output of several creative hash functions designed for human readability.

sha1's are merely used as arbitrary, longer, distributed input values.

input 1 word output 2 word output 3 word output
@raineorshine
raineorshine / yjs-faq.md
Created January 15, 2024 16:37
YJS FAQ

Frequently asked questions on https://discuss.yjs.dev

How to set initial data without duplication?

The recommended approach is to have the client (or server) who creates the Doc populate it with initial data. All other clients should sync before editing.

Full discussion: https://discuss.yjs.dev/t/initial-offline-value-of-a-shared-document/465

As far as I know it's not possible to selectively apply or broadcast some updates and not others. As soon as you skip an update, that Doc has a "hole" in it. No other updates will work as YJS will wait for the missing update, ensuring that updates are not applied out-of-order.

@raineorshine
raineorshine / cheatsheet-git.sh
Last active December 22, 2023 15:59
Cheatsheet: git commands
# adding and committing
git add -A # stages All
git add . # stages new and modified, without deleted
git add -u # stages modified and deleted, without new
git commit --amend # Add staged changes to previous commit. Do not use if commit has been pushed.
git commit --amend --no-edit # Do so without having to edit the commit message.
# remotes - pushing, pulling, and tracking
git fetch # gets remote objects and refs. Needed if new branches were added on the remote.
git remote -v # Lists all remotes (verbose)
@raineorshine
raineorshine / commit-author.sh
Created October 12, 2017 17:09
Set git commit author for a single repository
git config user.name "ShapeShift-Public"
git config user.email "mail@hshapeshift.io"
https://help.github.com/articles/setting-your-username-in-git/#setting-your-git-username-for-a-single-repository
@raineorshine
raineorshine / _chrome-ext-auth-identity.md
Last active November 10, 2023 23:57
How to set up user authentication for a Chrome Extension using the Chrome Identity API

How to set up user authentication for a Chrome Extension using the Chrome Identity API

  1. Create a private key file, from which you can create the manifest key and Application ID, as detailed here: https://stackoverflow.com/questions/23873623/obtaining-chrome-extension-id-for-development
  2. Add the manifest key to "key" in manifest.json
  3. Create a new project in Google Developer Console https://console.developers.google.com/project
  4. Go to "APIs & auth > Credentials" and create new client id for a Chrome Application using the Application ID generated in step 3.
  5. Copy the Client ID to oauth2.client_id in the manifest.json

Deprecated?

@raineorshine
raineorshine / built-in.md
Created March 12, 2014 18:23
55 Must Know Built-In Javascript Methods and Operators
@raineorshine
raineorshine / package.json
Last active October 23, 2023 15:35
Raine's initial package.json
{
"name": "",
"description": "",
"version": "0.0.0",
"author": {
"name": "Raine Revere",
"email": "raine.revere@pm.me",
"url": "https://github.com/raineorshine"
},
"engines": {
@raineorshine
raineorshine / inject.js
Last active October 21, 2023 22:15
Simple script to inject a file into a README idempotently.
/**
Usage:
1. Add <!-- TEMPLATE: myfile.txt --> to your README.md.
2. Run `node inject.js README.md`.
*/
import fs from 'fs'
@raineorshine
raineorshine / raw-rpc-request.js
Created February 11, 2017 15:02
Send a raw RPC request with web3
web3.currentProvider.sendAsync({
jsonrpc: “2.0”,
method: “evm_increaseTime”,
params: [60], // 60 seconds, may need to be hex, I forget
id: new Date().getTime() // Id of the request; anything works, really
}, function(err) {
// ...
});
@raineorshine
raineorshine / staticRegistry.json
Created August 17, 2023 13:09
Static registry for npm-check-updates test
{
"ncu-test-v2": "99.9.9"
}