Skip to content

Instantly share code, notes, and snippets.

@phanhaiquang
phanhaiquang / functional calculator
Last active March 18, 2019 03:28
python generator sample
#!/bin/python
OPERATORS = ['+', '-', '*', '/']
def maybe(func):
"""Turns Exceptions into return values."""
@phanhaiquang
phanhaiquang / comprehensions
Last active March 18, 2019 03:35
Python function programming
#!/bin/python
# copied from https://udemy.com/learning-path-python-functional-programming-with-python/learn/v4/t/lecture/8723246?start=0
from math import sqrt
##### List #####
# loop
a = [sqrt(i) for i in range(5)]
a = map(sqrt, range(5))
@phanhaiquang
phanhaiquang / .eslintrc.js
Last active March 18, 2024 16:10
Setup ESLint for VIM ALE
module.exports = {
"parser": "@babel/eslint-parser",
"env": {
"browser": true,
"es2021": true
},
"extends": "plugin:react/recommended",
"parserOptions": {
"requireConfigFile": false,
"ecmaFeatures": {