This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const ts = require('typescript'); | |
const csv = require('csv-stringify/sync'); | |
const cwd = process.cwd(); | |
const configJSON = require(path.join(cwd, 'tsconfig.json')); | |
const config = ts.parseJsonConfigFileContent(configJSON, ts.sys, cwd); | |
const program = ts.createProgram( | |
config.fileNames, | |
config.options, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /home/<user>/ | |
sudo apt-get install unzip | |
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip | |
unzip sdk-tools-linux-4333796.zip -d Android | |
rm sdk-tools-linux-4333796.zip | |
sudo apt-get install -y lib32z1 openjdk-8-jdk | |
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 | |
export PATH=$PATH:$JAVA_HOME/bin | |
printf "\n\nexport JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64\nexport PATH=\$PATH:\$JAVA_HOME/bin" >> ~/.bashrc | |
cd Android/tools/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
contract TestA { | |
struct Test { | |
address _address; | |
} | |
struct Test2 { | |
address account; | |
address _address; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function waitContractEventOnce(events, name, timeout = Infinity) { | |
return new Promise(function (accept, reject) { | |
if (typeof events[name] !== 'function') reject(new Error(`no event with name "${name}"`)); | |
const timerCb = () => { | |
if (watcher) watcher.stopWatching(); | |
watcher = null; | |
reject(new Error('timout has been expired')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fix it | |
const normFract = (c) => {if(c[1] === 0n || c[2] === 0n) { c[1] = c[2] = 0n; } return c;} | |
const divFract = (a, b) => { let _a = a[1] * b[2], _b = a[2] * b[1]; return normFract([_a === 0n || _b === 0n ? 0n : _a / _b, _a === 0n || _b === 0n ? 0n : _a % _b, _b]) } | |
const gcd = (a, b) => { if (b === 0n) return a; return gcd(b, a % b); } | |
const toFract = (a) => [0n, a[1] + a[0] * a[2], a[2]]; | |
const div = (a, b) => { let _a = divFract(toFract(a), toFract(b)); return [_a[0], _a[1] / (gcd(_a[1], _a[2]) || 1n), _a[2] / (gcd(_a[1], _a[2]) || 1n)]; } | |
div([5n, 3n, 4n], [0n, 3n, 4n]) // [7n, 2n, 3n] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function throwIfNotInstanse(instance, constructor) { | |
if (!(instance instanceof constructor)) { | |
throw new TypeError('object not instance of ' + constructor.name); | |
} | |
} | |
export function byId(list, id) { | |
return list.find((i) => i.id === id); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// context free grammar parser. example. | |
// Alphabet: ()[]E | |
// E = nonterminal | |
/* rules: | |
E -> (E) | |
E -> [E] | |
E -> EE | |
E -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.9) | |
// Compass (v1.0.1) | |
// ---- | |
@function em( $input:null, $em:16 ) { | |
$support-num: px em; | |
$support-str: auto; | |
$output: (); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.9) | |
// Compass (v1.0.1) | |
// ---- | |
@function only-types( $var, $types, $rec: true ) { | |
$support-arg-types: string list; | |
$support-types: number string bool list color; // map, null | |
$var-type: type-of( $var ); |