Skip to content

Instantly share code, notes, and snippets.

View Youmoo's full-sized avatar

youmoo Youmoo

  • 浙江杭州
View GitHub Profile

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@Youmoo
Youmoo / README.md
Last active November 28, 2016 09:32
favorite words && 喜欢的单词

收集一些自己喜欢的单词

// 格式化为es批量插入格式
[...$$('[itemprop=text] p')]
  .map(v=>v.textContent)
  .slice(1)
  .map(v=>`{"create":{"_index":"ym","_type":"words","_id":"${v}"}}
{ "word":"${v}", "sentence":"", "def":"", "created":"2016-11-28"}`).join('\n')
@pathikrit
pathikrit / README.md
Last active April 24, 2021 17:36
My highly opinionated list of things needed to build an app in Scala
@ericclemmons
ericclemmons / example.md
Last active April 24, 2024 18:09
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here
@bdchauvette
bdchauvette / .babelrc
Last active June 21, 2021 17:44
Minimal babel boilerplate
{
"presets": [ "es2015" ]
}
@bellbind
bellbind / tcp-echo.js
Last active May 31, 2018 08:26
[nodejs] TCP example
"use strict";
const net = require("net");
const port = process.env.PORT || 44444;
const once = !!process.env.ONCE || false;
function echo(socket) {
const server = this;
const {remoteAddress, remoteFamily, remotePort} = socket;
@bellbind
bellbind / udp-echo.js
Last active May 31, 2018 08:26
[nodejs]UDP example
"use strict";
const dgram = require("dgram");
const port = process.env.PORT || 44444;
const once = !!process.env.ONCE || false;
const opts = {type: "udp4", reuseAddr: true};
const socket = dgram.createSocket(opts, (msg, info) => {
// msg: Buffer, info: {address, family, port, size}
@olih
olih / jq-cheetsheet.md
Last active May 15, 2024 22:26
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

Pattern Matching

This is a strawman proposal for adding pattern matching to ECMAScript. Pattern matching is useful for matching a value to some structure in a similar way to destructuring. The primary difference between destructuring and pattern matching are the use cases involved - destructuring is useful for binding pieces out of larger structures whereas pattern matching is useful for mapping a value's structure to data or a set of behaviors. In practice this means that destructuring tends to allow many shapes of data and will do its best to bind something out of it, whereas pattern matching will tend to be more conservative.

Additionally, the power of pattern matching is increased substantially when values are allowed to participate in the pattern matching semantics as a matcher as well as a matchee. This proposal includes the notion of a pattern matching protocol - a symbol method that can be implemented by objects that enables developers to use those values in pattern matching. A common scenario w

@fratuz610
fratuz610 / decrypt.js
Created November 20, 2015 04:27
Encrypt from Java and decrypt on Node.js - aes 256 ecb
// we determine the key buffer
var stringKey = "example";
var cipherText = ".........";
// we compute the sha256 of the key
var hash = crypto.createHash("sha256");
hash.update(stringKey, "utf8");
var sha256key = hash.digest();
var keyBuffer = new Buffer(sha256key);