Skip to content

Instantly share code, notes, and snippets.

View johnteee's full-sized avatar

John Lee johnteee

  • Taipei
View GitHub Profile
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/handsontable/0.38.1/handsontable.full.min.css" integrity="sha256-e7GfXjCNVdZOjk1j8xbbZKQ9yDgx1acnLPTOOuPRJso=" crossorigin="anonymous" />
</head>
<body>
function addScript(attribute, text) {
return new Promise(function(resolve, reject) {
var script = document.createElement('script');
for (var attr in attribute) {
var value = attribute[attr];
if (value) {
script.setAttribute(attr, value);
}
}
@johnteee
johnteee / python
Created April 19, 2018 14:23 — forked from fanglinlo/python
pinpon_game
import tkinter
import random
import time
tk=tkinter.Tk()
tk.title("Game") #窗口名稱
tk.resizable(0,0) #表示畫面大小不能被拉
tk.wm_attributes("-topmost",1) #視窗移到最上層
canvas=tkinter.Canvas(tk,width=700,height=700,bd=0)
@johnteee
johnteee / gist:f9a5539dd56a22d84a555eb988870f2d
Created May 28, 2018 08:55 — forked from mahan/gist:6256149
Atomic boolean for golang
/* Atomic boolean for golang
A process-atomic boolean that can be used for signaling between goroutines.
Default value = false. (nil structure)
*/
package main
import "sync/atomic"
@johnteee
johnteee / bifunctor-profunctor.js
Created June 22, 2018 00:49 — forked from i-am-tom/bifunctor-profunctor.js
The main examples from the "Bifunctor + Profunctor" post.
const { Left, Right } = require('fantasy-eithers')
const daggy = require('daggy')
Function.prototype.map = function (f) {
return x => f(this(x))
}
//- Where everything changes...
const login = user =>
user.name == 'Tom'
@johnteee
johnteee / package.json
Created June 25, 2018 08:01 — forked from mburakerman/package.json
Webpack 4 config.js (SCSS to CSS and Babel) 👌 The Simplest Usage 👌
{
"name": "webpack-sass",
"version": "1.0.0",
"scripts": {
"start": "webpack-dev-server --open --mode development",
"build": "webpack -p"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
@johnteee
johnteee / nodejs.errno.h
Created June 25, 2018 10:51 — forked from pbojinov/nodejs.errno.h
node.js errno descriptions. Useful for debugging.
/* Pulled from https://github.com/joyent/node/blob/master/deps/uv/include/uv.h */
/* Expand this list if necessary. */
#define UV_ERRNO_MAP(XX) \
XX(E2BIG, "argument list too long") \
XX(EACCES, "permission denied") \
XX(EADDRINUSE, "address already in use") \
XX(EADDRNOTAVAIL, "address not available") \
XX(EAFNOSUPPORT, "address family not supported") \
XX(EAGAIN, "resource temporarily unavailable") \
XX(EAI_ADDRFAMILY, "address family not supported") \
@johnteee
johnteee / fib.js
Created June 28, 2018 04:36
fib.js
function fibonacci(n) {
return Math.round((Math.pow((1 + Math.sqrt(5)) / 2, n) - Math.pow(-2 / (1 + Math.sqrt(5)), n)) / Math.sqrt(5));
}
function trampoline(f) {
return function (...args){
var result = f( ...args )
while (typeof result === "function") {
result = result()
}
@johnteee
johnteee / blackmagic.rs
Created July 12, 2018 04:02 — forked from huonw/blackmagic.rs
do-while loops in Rust
while {
let x = foo();
bar(x);
x != 0
} {}
@johnteee
johnteee / index.html
Created July 14, 2018 17:16 — forked from BluEagle/index.html
A CodePen by Dick.K.
<canvas id="sakura"></canvas>
<div class="btnbg">
<button type="button" onclick="toggleAnimation(this)">Stop</button>
</div>
<!-- sakura shader -->
<script id="sakura_point_vsh" type="x-shader/x_vertex">
uniform mat4 uProjection;
uniform mat4 uModelview;
uniform vec3 uResolution;