Skip to content

Instantly share code, notes, and snippets.

View ninhxuanluu's full-sized avatar
🏠
Working from home

Luu Ninh ninhxuanluu

🏠
Working from home
View GitHub Profile
@ninhxuanluu
ninhxuanluu / enzyme_render_diffs.md
Created September 18, 2020 10:59 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@ninhxuanluu
ninhxuanluu / mac-setup-redis.md
Created September 12, 2020 09:19 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@ninhxuanluu
ninhxuanluu / _spacing-helpers.scss
Created June 18, 2020 04:33 — forked from jacurtis/_spacing-helpers.scss
SASS Margin and Padding Helpers Loop. Generates .m-t-10 type helper classes.
/*
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects.
It will generate several classes such as:
.m-r-10 which gives margin-right 10 pixels.
.m-r-15 gives MARGIN to the RIGHT 15 pixels.
.m-t-15 gives MARGIN to the TOP 15 pixels and so on.
.p-b-5 gives PADDING to the BOTTOM of 5 pixels
.p-l-40 gives PADDING to the LEFT of 40 pixels
@ninhxuanluu
ninhxuanluu / index.js
Created April 3, 2019 10:18
Read all names and version in node_modules, generate package.json
/**
* Created by ninh on 6/17/16.
*/
var fs = require("fs");
function main() {
fs.readdir("./node_modules", function (err, dirs) {
if (err) {
console.log(err);
return;
@ninhxuanluu
ninhxuanluu / docker-cleanup-resources.md
Created July 24, 2018 10:35 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@ninhxuanluu
ninhxuanluu / README.md
Created April 26, 2018 08:44 — forked from twolfson/README.md
Node.js job queue evaluation

We are building a Node.js service which will need asynchronous support for tasks like sending emails. Here's our evaluation:

# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@ninhxuanluu
ninhxuanluu / hsvToRgb.js
Created March 28, 2018 04:14 — forked from eyecatchup/hsvToRgb.js
HSV to RGB color conversion - JavaScript-Port from the excellent java algorithm by Eugene Vishnevsky at http://www.cs.rit.edu/~ncs/color/t_convert.html
/**
* HSV to RGB color conversion
*
* H runs from 0 to 360 degrees
* S and V run from 0 to 100
*
* Ported from the excellent java algorithm by Eugene Vishnevsky at:
* http://www.cs.rit.edu/~ncs/color/t_convert.html
*/
function hsvToRgb(h, s, v) {
@ninhxuanluu
ninhxuanluu / introrx.md
Created September 12, 2017 09:16 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
var Col = require('react-bootstrap/lib/Col')
var PageHeader = require('react-bootstrap/lib/PageHeader')
var React = require('react')
var Row = require('react-bootstrap/lib/Row')
var {connect} = require('react-redux')
var {reduxForm} = require('redux-form')
var DateInput = require('./DateInput')
var FormField = require('./FormField')
var LoadingButton = require('./LoadingButton')