Skip to content

Instantly share code, notes, and snippets.

View leecade's full-sized avatar
🎯
Focusing

斯人 leecade

🎯
Focusing
View GitHub Profile
@leecade
leecade / fs_trie.rs
Created February 28, 2024 13:53 — forked from sevagh/fs_trie.rs
Rust trie that serializes to filesystem
//! # A trie that can be saved to and loaded from a file
//!
//! This crate implements a Trie with char keys.
//! The trie can be saved to and loaded from a file on the local filesystem.
//! This allows the user to persist the trie between executions.
//!
//! Basic example:
//!
//! ```ignore
//! let trie_file = "/path/to/trie-file";
@leecade
leecade / export-syntax.js
Created May 9, 2020 05:44 — forked from caridy/export-syntax.js
ES6 Module Syntax Table
// default exports
export default 42;
export default {};
export default [];
export default foo;
export default function () {}
export default class {}
export default function foo () {}
export default class foo {}
@leecade
leecade / tutorial.md
Created July 23, 2018 02:58 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

@leecade
leecade / GoConcurrency.md
Created November 1, 2017 10:31 — forked from rushilgupta/GoConcurrency.md
Concurrency in golang and a mini Load-balancer

INTRO

Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".

Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).

Let's dig in:

Goroutines

@leecade
leecade / story.md
Created September 11, 2017 12:06 — forked from posener/go-shebang-story.md
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@leecade
leecade / Samsung Browser
Created May 24, 2017 22:35 — forked from NielsLeenheer/Samsung Browser
Samsung Browser
Note: Some older devices such as the Galaxy S III did not get the Chromium based browser with
the update to Android 4.2 or later. When Samsung later introduced the Galaxy S3 Neo it did get
the new browser.
Note: With the Android 4.3 release and version 1.5 of the Chromium browser, Samsung did not
enable WebAudio API for the Note 3. All other devices did get the WebAudio API.
Note: Samsung did not update the browser version with the upgrade from Android 4.3 to 4.4,
but did add getUserMedia and WebRTC functionality.
@leecade
leecade / HTC Sense Browser
Created May 24, 2017 22:35 — forked from NielsLeenheer/HTC Sense Browser
HTC Sense Browser
Note: All versions of the HTC Sense browser listed below send the following header: X-Requested-With: com.htc.sense.browser
Note: The difference between the two WebKit based versions are mostly which form field types are supported
Webkit
368 / 555
https://html5test.com/results/related/127d2c84dc7e495a6ed4ddd8ceccac2a.html
@leecade
leecade / LG Browser
Created May 24, 2017 22:35 — forked from NielsLeenheer/LG Browser
LG Browser
Chromium 30
458 / 555
https://html5test.com/results/related/7c791b543cbd7705f547a0a30e5404cf.html
- G Pad 8.3 Android 4.4.2
- G Pro 2 Android 4.4.2
- G2 Android 4.4.2
- G2 mini Android 4.4.2
- L65 Android 4.4.2
- L70 Android 4.4.2
@leecade
leecade / Sony
Created May 24, 2017 22:35 — forked from NielsLeenheer/Sony
Google Chrome on Sony devices
Sony devices ship with Google Chrome as the default browser. Google Chrome is baked
into the firmware of the device. Different versions of the firmware come with different
versions of Google Chrome.
Usually the version that comes with the firmware is updated using Google Play, however...
When first starting up the device Sony does not ask the user to log into Google Play.
This means that unless you manually open Google Play and log in, the devices does not
receive any updates using Google Play. In this case Google Chrome is only updated when
the user installs a firmware update.
@leecade
leecade / Native app communication
Created May 24, 2017 22:34 — forked from NielsLeenheer/Native app communication
How a web app running on HTTPS can communicatie with local services
I have a web app that needs to talk to point of sale hardware: receipt printers, customer displays,
cash drawers and payment terminals. Direct communication from the web app with these devices is
impossible, so I created a native app that can be installed on the computer that can talk to the
devices. The app runs a web server that exposes these devices using a REST api.
The native app registers itself upon startup with a webservice. It sends its own IP address on
the local network and the server also sees the external IP address of the network. The web app
sends a discovery request to the webservice and it receives all the local IP addresses which
have the same external IP address.