Skip to content

Instantly share code, notes, and snippets.

nhducit nhducit

  • Ho Chi Minh
Block or report user

Report or block nhducit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View custem-vscode.css
.monaco-shell {
font-family: 'Operator Mono', 'Fira code', 'Inconsolata', monospace;
letter-spacing: 0.5px;
}
.vs-dark .monaco-panel-view .panel > .panel-header > .title {
font-weight: normal;
letter-spacing: 1px;
}
.vs-dark .monaco-workbench > .part.titlebar > .window-title {
color: #fafafa;
@nhducit
nhducit / rebase-latest-master.sh
Last active May 29, 2018
rebase latest master for lazy people
View rebase-latest-master.sh
#!/usr/bin/env bash
cd <projectDir>
currentBranch=$(git rev-parse --abbrev-ref HEAD)
git checkout master
git pull
git checkout $currentBranch
git rebase master
View 0 reconciler.js
import Reconciler from 'react-reconciler'
import omit from 'lodash/omit'
import capitalize from 'lodash/capitalize'
import { actions as elementActions } from './store/elements'
import * as Elements from './elements'
const roots = new Map()
const emptyObject = {}
const Renderer = Reconciler({
@nhducit
nhducit / Regex maskify.md
Created Dec 8, 2016
write a function maskify, which changes all but the last four characters into '#'
View Regex maskify.md

Question:

write a function maskify, which changes all but the last four characters into '#'
Eg:
maskify('4556364607935616') # should return '############5616'
maskify('64607935616')      # should return '#######5616'
maskify('1')                # should return '1'
maskify('')                 # should return ''
@nhducit
nhducit / check-duplicated-id-element.js
Last active Oct 31, 2016
Detect all duplicated element id in page
View check-duplicated-id-element.js
var nodes = document.querySelectorAll('[id]');
var ids = {};
var totalNodes = nodes.length;
for(var i=0; i<totalNodes; i++) {
var currentId = nodes[i].id ? nodes[i].id : "undefined";
if(!ids[currentId]) {
ids[currentId] = [];
}
ids[currentId].push(nodes[i]);
@nhducit
nhducit / Child.js
Created Aug 27, 2016 — forked from eyesofkids/Child.js
Simple React Lifecycle methods test
View Child.js
import React from 'react'
var Child = React.createClass({
getInitialState: function(){
console.log('Child getInitialState');
return { value: 'start'}
},
getDefaultProps: function(){
console.log('Child getDefaultProps');
View GoogleApi.js
export const GoogleApi = function(opts) {
opts = opts || {}
const apiKey = opts.apiKey;
const libraries = opts.libraries || [];
const client = opts.client;
const URL = 'https://maps.googleapis.com/maps/api/js';
const googleVersion = '3.22';
let script = null;
@nhducit
nhducit / README.md
Created Jul 13, 2016 — forked from agnoster/README.md
My ZSH Theme
View README.md

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

View remove array item by index
Array.prototype.remove = function(from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
http://ejohn.org/blog/javascript-array-remove/
@nhducit
nhducit / introrx.md
Created Oct 2, 2015 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md
You can’t perform that action at this time.