TypeScript and Playground練習問題集更新情報
WIP
// https://www.youtube.com/watch?v=H8UqnTE3mUY より引用 | |
#define A for(int i=0;i<9;++i){int y=p>>((p>>19)+i&3),z=p*((878086607>>(i&7)*4)&15)*(510+1%5)>>14;if((p>>15&1<<(i&15))>0)s.y+=float(((y>>7&z*3|y>>11&z*6)&1023)-512)/3e4;} | |
vec2 mainSound(float t){int p=int(t*144e3);vec2 s;A;s.yx=s;p-=65536;A;return s*mat2(7,1,5,-3);} |
#version 410 core | |
uniform float fGlobalTime; // in seconds | |
uniform vec2 v2Resolution; // viewport resolution (in pixels) | |
uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq | |
uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients | |
uniform sampler1D texFFTIntegrated; // this is continually increasing | |
uniform sampler2D texChecker; | |
uniform sampler2D texNoise; |
(function() { | |
'use strict'; | |
var script = document.currentScript; | |
var pluginName = script.src.replace(/^.*\/(.*).js$/, function() { | |
return arguments[1]; | |
}); | |
console.log(pluginName); | |
})(); |
TypeScript and Playground練習問題集更新情報
WIP
const getInitials = (src: string[], length = 1) => | |
Array.from(new Set(src.map(v => v.substring(0, length)))); | |
export default (src: string[]) => | |
getInitials(src).map(initial => { | |
const list = src.filter(v => v.match(`^${initial}`)); | |
const rec = (prev: string, length = 2): string => { | |
const [word, ...{ length: l }] = getInitials(list, length); | |
return l || list[0].length < length ? prev : rec(word, length + 1); |
const https = require('https'); | |
const ifttt = event => `https://maker.ifttt.com/trigger/${event}/with/key/${process.env.IFTTT_WEBHOOK_KEY}`; | |
exports.handler = async (event) => { | |
const time = new Date(); | |
const valid = time.getHours() >= 18; | |
const eventId = valid ? 'night' : 'other'; | |
await new Promise(r => https.get(ifttt(eventId), r)); | |
const response = { statusCode: 200, body: eventId }; |
MobX (with Decorators) in create-react-app
MobXは、モダンアプリのステート管理に使います。
多くの場合、React.jsアプリに適用されますが、必ずしもReactにバインドされているわけではありません。
さらに、Reduxのステート管理ソリューションとして貴重な選択肢です。
create-react-appをボイラープレートとして使っている場合は、
MobXを設定する方法とcreate-react-appでデコレータを使う方法にぶつかります。
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0" /> | |
<title>Markdown preview</title> | |
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.8.0/github-markdown.min.css" /> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.6/marked.min.js" integrity="sha384-aP8BvMiS2buEdB040zV1ZNg4Yz3vzmY0biq0UhB05amexdPMAx3uPjIvFWKa7Jnz" crossorigin="anonymous"></script> | |
<script type="text/template" id="source"> | |
# Hello, world |
React: Unexpected use of 'location';
Solution: Use window.location
instead of bare location
.