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
@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 / 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 ''
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 / 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 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;
You can’t perform that action at this time.