Skip to content

Instantly share code, notes, and snippets.

View hoanganh25991's full-sized avatar

Anh Le hoanganh25991

  • Vietnam
View GitHub Profile
lucduong / .gitconfig
Last active January 9, 2019 04:24
Git Config
View .gitconfig
st = status
ci = commit -v
co = checkout
up = pull origin
info = remote -v
d = diff
df = diff
dfc = diff --cached
dc = diff --cached
geoffreydhuyvetters /
Last active January 13, 2023 06:49
What is React Fiber? And how can I try it out today?
geuis / gist:8b1b2ea57d7f9a9ae22f80d4fbf5b97f
Last active February 25, 2023 22:43
Get Youtube video urls
View gist:8b1b2ea57d7f9a9ae22f80d4fbf5b97f
// Run from the dev tools console of any Youtube video
// Accurate as of July 2, 2020.
// Copy and paste this into the dev console in a browser with the desired video loaded.
// NOTE: Some Youtube videos do not directly expose the video url in the response.
// This script doesn't currently attempt to handle those. It will work for most other general video types though.
(async () => {
const html = await fetch(window.location.href).then((resp) => resp.text()).then((text) => text);
LiveOverflow /
Last active March 15, 2023 02:54
GoogleCTF2018 - JS Safe 2
import random
import re
# python3
stage1 = 'Ӈ#7ùª9¨M¤ŸÀ.áÔ¥6¦¨¹.ÿÓÂ.։£JºÓ¹WþʖmãÖÚG¤…¢dÈ9&òªћ#³­1᧨'
out = ""
key = "\x82\x1e\x0a\x9a"
cpsubrian / db.js
Last active June 13, 2023 06:59
Mock knex database for Jest
View db.js
/* eslint-env jest */
import _ from 'lodash'
import path from 'path'
import fs from 'fs'
import callsites from 'callsites'
import knex from 'knex'
import hash from 'object-hash'
import conf from '<conf>'
// Get the db config.
augbog / Free O'Reilly
Last active July 19, 2023 21:23
Free O'Reilly Books
View Free O'Reilly

Free O'Reilly books and convenient script to just download them.

Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post

How to use:

  1. Take the file and put it into a directory where you want the files to be saved.
  2. cd into the directory and make sure that it has executable permissions (chmod +x should do it)
  3. Run ./ and wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.
HarishChaudhari / country-code-to-currency-code-mapping.csv
Last active July 26, 2023 16:35
Country, Country Code, Currency code mapping in CSV format Taken from Contains 249 countries.
View country-code-to-currency-code-mapping.csv
Country CountryCode Currency Code
New Zealand NZ New Zealand Dollars NZD
Cook Islands CK New Zealand Dollars NZD
Niue NU New Zealand Dollars NZD
Pitcairn PN New Zealand Dollars NZD
Tokelau TK New Zealand Dollars NZD
Australian AU Australian Dollars AUD
Christmas Island CX Australian Dollars AUD
Cocos (Keeling) Islands CC Australian Dollars AUD
Heard and Mc Donald Islands HM Australian Dollars AUD
chantastic / on-jsx.markdown
Last active August 8, 2023 05:10
JSX, a year in
View on-jsx.markdown

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

sebmarkbage / Enhance.js
Last active September 21, 2023 08:13
Higher-order Components
View Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
componentDidMount() {
this.setState({ data: 'Hello' });
render() {
branneman /
Last active September 26, 2023 22:28
Better local require() paths for Node.js

Better local require() paths for Node.js


When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions