Skip to content

Instantly share code, notes, and snippets.

View futurist's full-sized avatar

James Yang futurist

  • China
View GitHub Profile
@futurist
futurist / README.md
Created July 6, 2017 14:17 — forked from joyrexus/README.md
Form/file uploads with hapi.js

Demo of multipart form/file uploading with hapi.js.

Usage

npm install
npm run setup
npm run server

Then ...

@futurist
futurist / es6-partial-application.md
Created May 14, 2018 07:41 — forked from JamieMason/es6-partial-application.md
ES6 Partial Application in 3 Lines

ES6 Partial Application in 3 Lines

const pApply = (fn, ...cache) => (...args) => {
  const all = cache.concat(args);
  return all.length >= fn.length ? fn(...all) : pApply(fn, ...all);
};

Example

@futurist
futurist / omega.js
Created May 14, 2018 08:01 — forked from CrossEye/omega.js
Functional compostion using fake operator overloading
// Based on a discussion with Michael Haufe:
// https://groups.google.com/group/jsmentors/browse_thread/thread/d028fb0041f93a27
// Not really recommended for anything but the fun of knowing it can be done!
var omega = function() {
var queue = [];
var valueOf = Function.prototype.valueOf;
Function.prototype.valueOf = function() {
queue.push(this);
return 1; // not needed now, but could be used later to distinguish operators.
@futurist
futurist / JSIObject.cpp
Created April 23, 2020 08:29 — forked from axemclion/JSIObject.cpp
React Native JSI Example
// This sample is a Work in Progress for JSI , and specific functions may change.
#pragma once
#include <string>
#include <unordered_map>
#include <jsi/jsi.h>
// This SameplJSIObject needs to inheric from HostObject, and this is the object that will be exposed to JS.
rustup component add rust-src
export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"
@futurist
futurist / curl-websocket.sh
Created September 16, 2020 10:22 — forked from htp/curl-websocket.sh
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@futurist
futurist / GettingStartedTutorial1Commands.txt
Created December 3, 2020 02:31 — forked from bassem-mf/GettingStartedTutorial1Commands.txt
Getting Started With Graph Databases, Apache TinkerPop, and Gremlin - Tutorial 1
// Create an instance of the "Modern" toy graph
graph = TinkerFactory.createModern()
// Create the traversal source
g = graph.traversal()
// Get all vertices
@futurist
futurist / example.prf
Created December 18, 2020 15:12 — forked from mattes/example.prf
unison profile
root = /Users/matthias/somedir
root = ssh://matthias@host:9000/somedir
auto = true
log = true
logfile = /Users/matthias/.unison/unison.log
maxbackups = 5
backup = Name *
@futurist
futurist / docker-compose.yml
Created March 22, 2021 07:11 — forked from heysamtexas/docker-compose.yml
Pristine config for Traefik 2.0, Docker, and LetsEncrypt with sample container. Includes a HTTP to HTTPS redirect
version: '3'
services:
traefik:
container_name: traefik
image: traefik:v2.0
command:
- "--api.insecure=true"
- "--providers.docker=true"