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
@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
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
# 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'
@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)})
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 / osx-mongodb-rlimits-fix.md
Created March 7, 2016 14:02 — forked from tamitutor/osx-mongodb-rlimits-fix.md
Fix Mongodb "soft rlimits" Warning On Mac OS X (Yosemite)

If you are seeing Mongo soft rlimits warnings in your logs, or a WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 when you login to mongo shell via mongo from the commandline, or any mysterious/unexplained mongo connection errors... follow this how-to exactly and it will resolve the issue for you.

(Source of this how to found at basho/basho_docs#1402)

First file: sudo vi /Library/LaunchDaemons/limit.maxfiles.plist

...containing:

@tiendq
tiendq / InlineBlock.html
Created July 31, 2013 04:10
How to fight inline blocks space and heigh 100%
<!doctype html>
<html>
<head>
<style>
.parent {
width: 600px;
box-sizing: border-box;
margin: 0;
padding: 0;
background-color: yellow;
var cmd = "MSBuild";
var sourcePath = "C:\\Store.Web\\";
var profile = "Release";
var buildPath = "C:\\Build";
// Temporary folder must ends with slash.
var tempPath = buildPath + "\\Temp\\";
var outputPath = buildPath + "\\Output\\Store.zip";
FOR /F "tokens=1-4 delims=/ " %%I IN ('DATE /t') DO SET CurrentDate=%%L%%J%%K
@tiendq
tiendq / getFileSize
Created August 14, 2012 10:03
Get file size of file in file input control.
// file: file input control e.g. $("#file")[0]
function getFileSize(file)
{
if (0 === file.value.length)
return 0;
// Non-IE browsers
if (file.files)
{
if (file.files.length > 0)