Skip to content

Instantly share code, notes, and snippets.

View adisuryadi's full-sized avatar

Adi Luhung Suryadi adisuryadi

View GitHub Profile

Testing TypeScript examples

Challenges:

  • Testing expected static errors. In JavaScript, expected dynamic errors can be tested via:
    • assert.throws(() => eval('const myVar;'), SyntaxError);
    • assert.throws(() => null.someProp, TypeError);
  • Testing expected inferred types.

Approach:

@ribice
ribice / log.go
Last active May 8, 2023 19:36
Golang logging middleware
package log
import (
"context"
"net/http"
"net/http/httptest"
"net/http/httputil"
"os"
"time"
@bumbeishvili
bumbeishvili / .block
Created February 2, 2018 09:24 — forked from micahstubbs/.block
mixed mode rendering (Canvas + SVG)
license: CC0-1.0
@gyribeiro
gyribeiro / tmux_italic.md
Last active October 6, 2024 18:56
enable italic font on tmux
@hew
hew / _readme.md
Last active June 10, 2022 19:13
Operator Mono w/ Italics on OSX VIm

Operator Mono w/ Italics on OSX Vim

@markerikson
markerikson / tableRenderingExample.js
Last active June 25, 2024 22:31
React expandable table rows example
class ParentComponent extends Component {
constructor() {
super();
this.state = {
data : [
{id : 1, date : "2014-04-18", total : 121.0, status : "Shipped", name : "A", points: 5, percent : 50},
{id : 2, date : "2014-04-21", total : 121.0, status : "Not Shipped", name : "B", points: 10, percent: 60},
{id : 3, date : "2014-08-09", total : 121.0, status : "Not Shipped", name : "C", points: 15, percent: 70},
{id : 4, date : "2014-04-24", total : 121.0, status : "Shipped", name : "D", points: 20, percent : 80},
@esseti
esseti / Timer
Created January 14, 2016 22:08
TimerApp script to set slack "Do Not Disturb" during a pomodor and rest when finished.
#replace xoxp-*****000 with your token from here https://api.slack.com/web#authentication
# for the start
do shell script "curl 'https://slack.com/api/dnd.setSnooze?token=xoxp-*****000&num_minutes=$duration'"
# for the end and interuption
do shell script "curl https://slack.com/api/dnd.endSnooze?token=xoxp-*****000"
@pjan
pjan / private.xml
Last active November 11, 2020 08:00
Karabiner private.xml for Topre REALFORCE 87U on Mac
<?xml version="1.0"?>
<root>
<item>
<name>For Topre REALFORCE 87 Users</name>
<devicevendordef>
<vendorname>TopreCorporation</vendorname>
<vendorid>0x0853</vendorid>
</devicevendordef>
<item>
@ohanhi
ohanhi / frp.md
Last active May 6, 2024 05:17
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@gaearon
gaearon / combining.js
Created June 3, 2015 18:03
Combining Stateless Stores
// ------------
// counterStore.js
// ------------
import {
INCREMENT_COUNTER,
DECREMENT_COUNTER
} from '../constants/ActionTypes';
const initialState = { counter: 0 };