Skip to content

Instantly share code, notes, and snippets.

View cnguy's full-sized avatar
🎮
10k requests/sec only

Chau cnguy

🎮
10k requests/sec only
View GitHub Profile

Introduction to the why

At uSwitch we constantly strive to deliver better value for our customers faster. Ocassionally that means evaluating new tools and technologies. One technology that recently caught our attention is ReasonML. It promises a good, but not overly complex statically types language combined with very solid

Roberto is a recent Set the task mission.

Why use static typing?

@swankjesse
swankjesse / MoshiKotlinExample.kt
Created May 14, 2017 17:15
Demo how to use Moshi with Kotlin
import com.squareup.moshi.Json
import com.squareup.moshi.KotlinJsonAdapterFactory
import com.squareup.moshi.Moshi
import com.squareup.moshi.Rfc3339DateJsonAdapter
import java.util.Date
val json = """
{
"url": "https://api.github.com/repos/square/okio/issues/156",
"id": 91393390,
@ljharb
ljharb / array_iteration_thoughts.md
Last active October 2, 2025 14:17
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@davidkwan95
davidkwan95 / question1.1
Created December 29, 2015 06:19
Cracking the Coding Interview (My solution)
Cracking the Coding Interview, 5th Edition
Question 1.1
Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures?
My Solution:
Brute force solution
============================================================================================
Idea: For each character, check whether there is a same character for the rest of the string
@hacksalot
hacksalot / gist:72517b9b1c145116e89e
Created March 17, 2015 02:01
Delete GitHub wiki revisions
# Delete prior revisions from a GitHub wiki so that only the most-recent
# version of the content is available.
# Clone the wiki.
git clone https://github.com/[user]/[repo].wiki.git
# Remove the .git folder.
rm -rf .git
# Reconstruct the local repo with only latest content
@japgolly
japgolly / eg.scala
Last active September 1, 2017 14:32
An Example of Functional Programming
// http://japgolly.blogspot.com.au/2014/09/an-example-of-functional-programming.html
sealed trait Validity
case object Valid extends Validity
case class Invalid(e1: String, en: List[String]) extends Validity
case class Validator[A](f: A => Validity) {
@inline final def apply(a: A) = f(a)
def +(v: Validator[A]) = Validator[A](a =>
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active September 17, 2025 08:07
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@jashkenas
jashkenas / semantic-pedantic.md
Last active September 5, 2025 05:32
Why Semantic Versioning Isn't

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active October 12, 2025 06:38
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\