Skip to content

Instantly share code, notes, and snippets.

View wangzuo's full-sized avatar
🎯
Focusing

Wang Zuo wangzuo

🎯
Focusing
View GitHub Profile
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H0M26.091S" maxSegmentDuration="PT0H0M5.000S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://dashif.org/guidelines/dash264">
<Period duration="PT0H0M26.091S">
<AdaptationSet segmentAlignment="true" maxWidth="720" maxHeight="900" maxFrameRate="30" par="720:900" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
<Representation id="17880936458342364vd" mimeType="video/mp4" codecs="avc1.64001F" width="720" height="900" frameRate="30" sar="1:1" startWithSAP="1" bandwidth="231005" FBQualityClass="hd" FBQualityLabel="720w" FBPlaybackResolutionMos="0:100.00,360:92.83,480:92.00,720:88.18,1080:83.23">
<BaseURL>https://scontent-hkt1-2.cdninstagram.com/v/t50.2886-16/233536622_215662053824013_242533827639734245_n.mp4?_nc_ht=scontent-hkt1-2.cdninstagram.com&amp;_nc_cat=1&amp;_nc_ohc=AYsseZVpQrgAX8kokRa&amp;edm=AABBvjUBAAAA&amp;ccb=7-4&amp;oh=6dc8990b2f41fcf9f710bac9af8d4cdb
@wangzuo
wangzuo / typography.css
Created April 26, 2019 10:50
typography.css
html {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
}
article,
aside,
const assert = require('assert');
// Given an array of integers, more than half of which are the same integer. Please print out that integer.
// Moore’s Voting Algorithm
// time: O(n)
// space: O(1)
// https://leetcode.com/problems/majority-element/
// more than n/2 times
// hash counter solution? space O(n)
const major1 = function(a) {
let cnt = 0,
@wangzuo
wangzuo / readme.md
Created October 20, 2018 03:42
hermes

Frontend

  • npm & yarn
  • webpack & dev server npm start (vendor.js)
  • react repl
  • styling & css module

Backend

@wangzuo
wangzuo / mad.js
Created October 16, 2018 07:26
Minimum Absolute Difference
// Minimum Absolute Difference in an Array
// comparing each pair O(n^2)
// sort first O(nlogn) + O(n)
exports.mad = function(arr) {
const a = arr.sort((a, b) => a - b);
let min = -1;
for (let i = 0, l = a.length; i < l - 1; i++) {
const d = Math.abs(a[i] - a[i + 1]);
if (min < 0 || d < min) {
@wangzuo
wangzuo / bot-pr.js
Created June 29, 2018 06:46
Github bot pr
GitHub.prototype.writeFile = function (filePath, data, branch, commitTitle) {
branch = branch || this.options.branch
commitTitle = commitTitle || 'Add Staticman file'
return this.api.repos.createFile({
user: this.options.username,
repo: this.options.repository,
path: filePath,
content: Buffer.from(data).toString('base64'),
message: commitTitle,
export interface IRPCProvider {
getNetVersion(): Promise<string>;
ping(): Promise<boolean>;
getBalance(address: string): Promise<Wei>;
estimateGas(tx: Partial<IHexStrTransaction>): Promise<Wei>;
getTransactionCount(address: string): Promise<string>;
getTransactionByHash(txhash: string): Promise<TransactionData>;
getTransactionReceipt(txhash: string): Promise<TransactionReceipt>;
sendRawTx(tx: string): Promise<string>;
sendCallRequest(txObj: TxObj): Promise<string>;
@wangzuo
wangzuo / accounting.js
Last active June 12, 2018 06:14
opaque types in flow
// @flow
export opaque type AccountBalance = number;
export opaque type AccountNumber: number = number;
export opaque type PaymentAmount: number = number;
// export opaque type AccountNumber = number;
// export opaque type PaymentAmount = number;
type Account = {
accountNumber: AccountNumber,
balance: AccountBalance,
@wangzuo
wangzuo / web-servers.md
Created June 26, 2017 06:01 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
### Keybase proof
I hereby claim:
* I am wangzuo on github.
* I am wangzuo (https://keybase.io/wangzuo) on keybase.
* I have a public key ASDILDRXcYHkQy6BMHRZifQ9sx63vh2ezWuskninGdITzwo
To claim this, I am signing this object: