Skip to content

Instantly share code, notes, and snippets.

View DougAnderson444's full-sized avatar
🕸️
Open Web, all the way

Doug A DougAnderson444

🕸️
Open Web, all the way
View GitHub Profile
@ralfr
ralfr / iota_zmq.js
Created January 11, 2018 13:55
IOTA ZeroMQ Snippet
const zmq = require('zeromq')
const config = require('./config')
var sock = zmq.socket('sub')
sock.connect('tcp://' + config.zmq_url)
sock.subscribe('')
sock.on('message', function(topic) {
@gliheng
gliheng / .cargo|config
Last active January 20, 2021 16:16
export rust function to javascript using cwrap
[target.wasm32-unknown-emscripten]
rustflags = [
"-Clink-args=-s EXPORTED_FUNCTIONS=['_draw'] -s ASSERTIONS=1",
]
@ow
ow / Chromium flags for PWAs.md
Last active January 27, 2021 23:42
Chromium flags for PWAs

Upcoming flags to enable link capturing and other PWA features. Enable these flags by copying and pasting the following, then searching for the below chrome://flags/

Enable full desktop integration:
chrome://flags/#enable-desktop-pwas

Capture URLs in their scope, such as twitter URLs for the Twitter PWA:
chrome://flags/#enable-desktop-pwas-link-capturing chrome://flags/#enable-desktop-pwas-stay-in-window

Get a pop-up that offers to allow the PWA to open certain URLs:

@tplooker
tplooker / did-github-proof.jsonld
Created November 21, 2020 10:02
DID to Github Account Linkage Proof
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
{
"sameAs": "https://www.w3.org/TR/owl-ref/#sameAs-def"
}
],
"issuer": "did:key:z6MkkWRMquVJsLaqsD45TYzhhDRJWJGDBx8jUkFGt6zvLc3R",
"issuanceDate": "2020-11-21T10:02:39.501Z",
"type": [
@samuelclay
samuelclay / radix_trie.js
Created January 30, 2013 16:55
A Radix Trie (aka PATRICIA trie) implemented in JavaScript. Play with it at this interactive JS fiddle: http://jsfiddle.net/jCYAw/
var RadixTrie = function(words) {
this.T = {};
this.initialize(words);
};
RadixTrie.prototype = {
initialize: function(words) {
var self = this;
words = words || [];
@andrewosh
andrewosh / README.md
Created May 11, 2020 02:44
A smal,l end-to-end example of using Hyperdrive/Hyperswarm to replicate a drive

Note: To keep this even smaller, we're using a small helper module called the hyperswarm replicator, which wraps a few Hyperswarm setup details.

#define _GNU_SOURCE
#include <errno.h>
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
@ncochard
ncochard / babel-webpack.md
Last active September 29, 2023 05:15
The correct way to compile ES6 using babel...

When you create a npm package, remember it might be used in a browser or a server, or even a command line utility… For each package you create, please pay attention at what it will be used for:

  1. Is it going to be used as a dependency to a nodejs application that is not bundled? (e.g. command line utilities)
  2. Is it going to be used as a dependency to a nodejs application that is bundled? (e.g. AWS Lambdas)
  3. Is it going to be used as a dependency to a browser application (always bundled)?.
  • In cases 2) and 3) you want to allow for tree shaking.
  • In cases 1) and 2) you want to benefit from the "ES6"/"ES next" features supported natively by nodejs.
  • In case 3) you also want to benefit from the native support of "ES6" from your browser.
@TheLoneRonin
TheLoneRonin / ARWEAVE.GQL.MD
Last active December 11, 2023 13:18
Arweave Query Guide

Arweave GraphQL Guide

Retrieving Data

In order to retrieve data from Arweave, you can use the following example query to retrieve the entire transaction output.

query {
    transactions {
        cursor
@AnalyzePlatypus
AnalyzePlatypus / lambda-gmail-compose.md
Created May 13, 2020 08:11
Use serverless function to send low-volume emails without 3rd party mail services.

Sending email with serverless functions

You can deploy this function on any of the serverless platforms - AWS Lambda, Google Cloud Functions, Azure Functions, Netlify, Cloudflare Workers, etc.

  1. Create a new function and paste in the following code.
  2. You will need to add nodemailer to your package.json (npm i nodemailer), and follow your platform's instructions on bundling dependencies.
  3. Obtain Gmail API credentials for your account. You will need clientID, clientSecret, and refreshToken. Follow this YouTube tutorial
  4. Expose these credentials as the follwing environment variables:
GMAIL_EMAIL_ADDRESS