Skip to content

Instantly share code, notes, and snippets.

View deanrad's full-sized avatar
🎯
Staying On Target

Dean Radcliffe deanrad

🎯
Staying On Target
View GitHub Profile
@JoshCheek
JoshCheek / observer_async_options.js
Last active March 6, 2019 14:54
Three variations on async
// based on https://github.com/deanius/async-gen-vs-events/blob/3ad02c4af7ab7c56178e4614bb1585220ccec8db/walk_dir_tree_with_events.js
// three different algorithms on async, with a fake file system that's easy to modify
const { agent } = require("rx-helper");
// Timer (useful for understanding how output gets processed)
const start = new Date()
const log = (whatevz) => console.log(new Date() - start, whatevz)
// Fake slow file system:
@JoshCheek
JoshCheek / async_ruby.rb
Created March 6, 2019 04:48
Asynchronous Ruby
# some of the syntax requires Ruby 2.5+
module Async
refine BasicObject do
def async(&block)
Async::Context.new(&block).run!
end
def enqueue(&block)
::Fiber.yield [:append, block]
end
import React, {useState, useEffect} from 'react';
import {of, observable, interval} from 'rxjs';
import {map} from 'rxjs/operators';
import {ajax} from 'rxjs/ajax';
import './App.css';
const api = `https://randomuser.me/api/?results=5&seed=rx-react&nat=us&inc=name&noinfo`;
const getName = user => `${user.name.first} ${user.name.last}`;
# git-auto-rebase
# git-auto-rebase --force-push
function git-auto-rebase() {
target="master"
if [[ $@ = "--force-push" ]]
then
push=true
else
push=false
@fukaoi
fukaoi / memo-exmaple.js
Last active July 24, 2022 22:54
solana-program-library-memo
const {
Keypair,
Transaction,
TransactionInstruction,
PublicKey,
Connection,
sendAndConfirmTransaction,
LAMPORTS_PER_SOL,
} = require("@solana/web3.js");
@webbower
webbower / multi-var-set.js
Created July 2, 2021 17:16
HTML/CSS/JS Patterns
// Option 1
let var1, var2, var3;
if (someCondition) {
var1 = 'value1';
var2 = 'value2';
var3 = 'value3';
} else {
var1 = "other1";
var2 = "other2";
var3 = "other3";