Skip to content

Instantly share code, notes, and snippets.

View phthhieu's full-sized avatar

Hieu Pham (Web platform) phthhieu

View GitHub Profile
@victorlin
victorlin / github-delete-stale-branches.js
Last active March 20, 2024 02:27
Delete stale branches from the GitHub repo's stale branches page (github.com/user/repo/branches/stale). Originally from https://stackoverflow.com/a/69089905
// Paste in browser console and run
async function deleteStaleBranches(delay=500) {
var stale_branches = document.getElementsByClassName('js-branch-delete-button');
for (var i = 0; i < stale_branches.length; i++)
{
stale_branches.item(i).click();
await new Promise(r => setTimeout(r, delay));
}
}
@AllenDang
AllenDang / gccemacs.md
Last active July 7, 2024 09:42
Build gccemacs on MacOS catalina with gcc 10 installed by homebrew.
@hanh090
hanh090 / memoize1.js
Last active March 18, 2020 02:26
Correct way to using memoize in EH project
// Import memoize from lodash fp package - it is convention in EH project
import memoize from 'lodash/fp/memoize';
// in lodash functional programming, memoize only have 1 argument
// this is code to changed to original API which support keyResolver
const memoizeWithResolver = memoize.convert({ fixed: false });
const keyResolver = (...args) => JSON.stringify(args);// Just sample code, you can choose method which you prefer
const withMemo = memoizeWithResolver((a,b) => doSomethingWith(a,b), keyResolver)
@toan2406
toan2406 / Post.re
Last active July 14, 2020 06:39
A Post component which fetches and displays title
open Relude.Globals;
module R = Relude;
let (>>=) = IO.(>>=);
let fetchPostById: string => IO.t(string, string) =
id =>
Fetch.fetch("https://jsonplaceholder.typicode.com/posts/" ++ id)
|> Js.Promise.then_(Fetch.Response.text)
@swlaschin
swlaschin / fsharpjobs.md
Last active September 19, 2024 22:48
My suggestions on how to look for F# jobs

How to find F# jobs

People often ask me how to find F# jobs. I don't have any special connections to companies using F#, and I don't have any special tricks either. I wish I did!

So, given that, here's my take on F# jobs.

Job hunting

For job hunting my suggestions are:

@blrobin2
blrobin2 / ord-sorts.js
Last active June 12, 2022 09:26
Ord-based Bubble, Merge, and Quick Sort
// A demonstration of sorting objects with Ord instances
// equals :: Setoid a => a ~> a -> Boolean
// lte :: Ord a => a ~> a -> Boolean
/*
* Data Constructors, and their Setoid and Ord instances
*/
// I'm using the daggy library to make constructors https://github.com/fantasyland/daggy
const daggy = require('daggy')
@viral-sh
viral-sh / lesserKnown.js
Last active June 28, 2021 01:19
A list of lesser know syntaxes and features of JavaScript
// void operator
void 0 // returns undefined
void (0) // returns undefined
void 'abc' // returns undefined
void {} // returns undefined
void (1 === 1) // returns undefined
void (1 !== 1) // returns undefined
void anyfunction() // returns undefined
@dferber90
dferber90 / visual-regression-testing.md
Last active July 2, 2023 08:45
Visual Regression Testing in Jest

Visual Regression Testing with Jest

This is a walkthrough of how to set up Visual Regression Testing with Jest for an application created with create-react-app.

The following walkthrough uses React as an example, but the approach should work for any modern frontend library! I assume it can be used with Angular, Vue, Cycle.js and more.

This gist walks you through a create-react-app application as an example of how to set up Visual Regression Testing in Jest using libraries I wrote recently which enable this: jsdom-screenshot, jest-transform-css and jest-transform-file.

@karubabu
karubabu / .Xmodmap
Created November 4, 2017 17:29
dvorak settings
keycode 8 =
keycode 10 = 1 exclam
keycode 11 = 2 at at
keycode 12 = 3 numbersign
keycode 13 = 4 dollar dollar
keycode 14 = 5 percent
keycode 15 = 6 asciicircum
keycode 16 = 7 ampersand braceleft
keycode 17 = 8 asterisk bracketleft
keycode 18 = 9 parenleft bracketright
@busypeoples
busypeoples / PhantomTypeReasonML.md
Last active February 6, 2024 21:29
Phantom types in ReasonML

Phantom types in ReasonML

Introduction

"A phantom type is a parametrised type whose parameters do not all appear on the right-hand side of its definition..." Haskell Wiki, PhantomType

The following write-up is intended as an introduction into using phantom types in ReasonML.

Taking a look at the above definition from the Haskell wiki, it states that phantom types are parametrised types where not all parameters appear on the right-hand side. Let's try to see if we can implement a similar example as in said wiki.