Skip to content

Instantly share code, notes, and snippets.

View tiendq's full-sized avatar
🌳
Code for a Living

Tien Do tiendq

🌳
Code for a Living
View GitHub Profile
import React from "react";
const numeral = require("numeral");
const BACKSPACE_KEY = 8, TAB_KEY = 9, ENTER_KEY = 13, NUMBER_0 = 48, NUMBER_9 = 57;
class KilometerInput extends React.Component {
constructor() {
super();
this.keyPressHandler = this.keyPressHandler.bind(this);
@tiendq
tiendq / css_debugger.js
Created November 5, 2017 04:27
CSS debugger
[].forEach.call(document.querySelectorAll("*"),function(a){a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)})
# https://github.com/mjkonarski/oh-my-git-aliases
alias g='git'
alias gst='g status'
# alias gfe='g fetch'
alias gco='g checkout'
# alias gcd='gco develop'
This seems to be a more modern version (copied from https://stackoverflow.com/a/36593218/2066118):
# Remove the submodule entry from .git/config
git submodule deinit -f path/to/submodule
# Remove the submodule directory from the superproject's .git/modules directory
rm -rf .git/modules/path/to/submodule
# Remove the entry in .gitmodules and remove the submodule directory located at path/to/submodule
git rm -f path/to/submodule
@tiendq
tiendq / delete_git_submodule.md
Created January 3, 2019 04:28 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@tiendq
tiendq / install-cmake.md
Created April 10, 2019 05:08
Install the latest CMake on Ubuntu
// https://davidwalsh.name/essential-javascript-functions
let getAbsoluteUrl = (function () {
let a;
return function (url) {
if (!a)
a = document.createElement('a');
a.href = url;
return a.href;
// Testing EventEmitter and Promise, async/await
const EventEmitter = require('events');
const http = require('http');
const fs = require('fs').promises;
const myEmitter = new EventEmitter();
async function handler3() {
console.log('handler3: myevent was fired! test Promise');
let seedDate = Date.now();
let sampleDateStrings = [];
let sampleDateValues = [];
const TOTAL_SAMPLE = 1000000;
for (let i = 0; i < TOTAL_SAMPLE; ++i) {
sampleDateStrings.push((new Date(seedDate + i)).toISOString());
sampleDateValues.push(seedDate + i);
}