Skip to content

Instantly share code, notes, and snippets.

View futurist's full-sized avatar

James Yang futurist

  • China
View GitHub Profile
@futurist
futurist / index.html
Created June 5, 2018 08:23
service-worker pub/sub iframe test
<div><iframe src=pub.html></iframe></div>
<div><iframe src=pub.html></iframe></div>
@futurist
futurist / hide.html
Created June 29, 2018 00:53
hide text using css
<style>
.z{
float:right;
font-size:.001px;
color:transparent;
display:inline-block;
width:0px;
}
</style>
@futurist
futurist / nested-component.js
Created July 24, 2018 02:20
Meiosis nested component
/**
<script src="https://unpkg.com/patchinko/overloaded.js"></script>
<script src="https://unpkg.com/mithril-stream"></script>
<script src="https://unpkg.com/react/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom/umd/react-dom.development.js"></script>
<div id=APP></div>
<script src="index.js"></script>
*/
@futurist
futurist / hc-bee-hot-reload.js
Created July 25, 2018 08:50
hc-bee with SSE Hot reload
// honeypack: middleware.js
// LINE 69
middleware.waitUntilValid(stats=>{
app.emit('webpack.valid', stats)
})
// app.js
const Honeybee = require('hc-bee');
const app = new Honeybee();
@futurist
futurist / test.ipynb
Last active September 24, 2018 07:02
jupyter notebooks
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
function arrayKV (obj, k, v, reverse, unique) {
let prevVal = _.get(obj, k)
if(!Array.isArray(prevVal)) {
prevVal = prevVal === undefined ? [] : [prevVal]
_.set(obj, k, prevVal)
}
if (unique && prevVal.indexOf(v) > -1) return
return reverse ? prevVal.unshift(v) : prevVal.push(v)
}
@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 / 从Node到Deno.md
Last active October 31, 2023 14:11
从Node到Deno

从Node到Deno,你需要知道的

* 第一部分:安装

以MacOS系统为例,说明安装的不同

A. Node安装

涉及的文件:node, npm, npx, node_modules 文件夹