Skip to content

Instantly share code, notes, and snippets.

Avatar

Chet Corcos ccorcos

View GitHub Profile
@ccorcos
ccorcos / node.log
Created Nov 20, 2019
Garbage Collection Issue.
View node.log
This file has been truncated, but you can view the full file.
~/C/j/js-avl-tree ❯❯❯ node --trace-gc build/bench/treedb.js
[81445:0x103b26000] 42 ms: Scavenge 2.5 (4.2) -> 2.2 (5.2) MB, 0.8 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
[81445:0x103b26000] 52 ms: Scavenge 2.8 (5.2) -> 2.7 (6.2) MB, 0.9 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
[81445:0x103b26000] 77 ms: Scavenge 4.0 (6.2) -> 3.9 (9.2) MB, 0.5 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
starting
0
[81445:0x103b26000] 176 ms: Scavenge 6.6 (11.2) -> 5.6 (12.2) MB, 0.6 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
[81445:0x103b26000] 184 ms: Scavenge 7.1 (12.2) -> 5.7 (12.7) MB, 0.5 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
[81445:0x103b26000] 191 ms: Scavenge 7.6 (12.7) -> 5.9 (16.7) MB, 0.5 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
@ccorcos
ccorcos / selenium-framework.ts
Created Sep 19, 2019
Using Selenium for browser testing as an alternative to Cypress.
View selenium-framework.ts
/* =============================================================================
Selenium Framework
Example:
```
it("browser test", async () => {
await withBrowser(async browser => {
await browser.visit("/login")
await browser.clickText("Login with email")
View DataType.ts
import * as _ from "lodash"
/** This is how DataTypes are serialized. */
export type DataType =
| { type: "string" }
| { type: "number" }
| { type: "boolean" }
| { type: "literal"; value: string | number | boolean }
| { type: "array"; inner: DataType }
// Tuple types are not quite working yet.
View ios_webkit_debug_proxy
❯❯❯ ios_webkit_debug_proxy -d
ss.add_server_fd(3)
Listing devices on :9221
ss.add_fd(4)
ss.add_server_fd(5)
ss.remove_server_fd(5)
ss.recv fd=4 len=981
ss.add_server_fd(5)
ss.add_fd(9)
wi.send_packet[174]:
View ios_webkit_debug_proxy output.txt
❯❯❯ ios_webkit_debug_proxy -d
ss.add_server_fd(3)
Listing devices on :9221
ss.add_fd(4)
ss.add_server_fd(5)
ss.remove_server_fd(5)
ss.recv fd=4 len=981
ss.add_server_fd(5)
ss.add_fd(9)
@ccorcos
ccorcos / com.demo.daemon.plist
Last active Oct 24, 2018
Simple launchd template
View com.demo.daemon.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.demo.daemon.plist</string>
<key>RunAtLoad</key>
<true/>
View gadt.re
type state = int;
type action =
| Inc
| IncBy int
| Dec
| DecBy int
| Reset;
let update state action =>
View nth2.re
let rec nth l n =>
switch l {
| [] => None
| [h, ...t] => n === 0 ? Some h : nth t (n - 1)
};
let x = nth [0, 1, 2, 3] 999; /* option int: None */
switch x {
| Some i => print_int i
View nth.re
let nth l n =
if n < 0 then invalid_arg "List.nth" else
let rec nth_aux l n =
match l with
| [] -> failwith "nth"
| a::l -> if n = 0 then a else nth_aux l (n-1)
in nth_aux l n
View reason3.re
let rec firstN n l =>
switch (n, l) {
| (0, _) => []
| (_, []) => []
| (n, [h, ...t]) => [h, ...firstN (n - 1) t]
};
firstN 2 [1, 2, 3, 4, 5]; /* => list int: [1, 2] */
You can’t perform that action at this time.