Skip to content

Instantly share code, notes, and snippets.

View leminh111's full-sized avatar

Minh Le Nguyen leminh111

  • OffspringDigital
  • Hanoi
View GitHub Profile
@leminh111
leminh111 / git-clean
Created November 9, 2018 04:05 — forked from markSci5/git-clean
Delete all untracked files and folders in git
git clean -f
If you want to also remove directories, run git clean -f -d.
If you just want to remove ignored files, run git clean -f -X.
If you want to remove ignored as well as non-ignored files, run git clean -f -x.
Note the case difference on the X for the two latter commands.
If clean.requireForce is set to "true" (the default) in your configuration, then unless you specify -f nothing will actually happen, with a recent enough version of git.
@leminh111
leminh111 / Install-Mcrypt.md
Created October 1, 2018 16:08 — forked from idleberg/Install-Mcrypt.md
Install Mcrypt on macOS

Setup php-mycrypt on macOS (and versions of Mac OS X)

These steps should have been mentioned in the prerequisites of the Laravel Installation Guide, since I'm surely not the only person trying to get Laravel running on macOS.

Install

Install Mcrypt using Homebrew

# PHP 7
@leminh111
leminh111 / tab.fish
Created June 1, 2018 07:11 — forked from drewthorp/tab.fish
Fish shell function to open a new tab in OS X terminal and run a series of commands. Usage tab cmd1 cmd2....
function tab
set -l ascmd "osascript -e 'tell application \"Terminal\" to activate' -e 'tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down'"
for arg in $argv
set ascmd "$ascmd -e 'tell application \"Terminal\" to do script \"$arg\" in selected tab of the front window'"
end
set -l ascmd "$ascmd;"
eval $ascmd
end
@leminh111
leminh111 / autogrow.js
Created February 1, 2018 00:52 — forked from enapupe/autogrow.js
Auto Grow/Shrink textarea directive for AngularJS (credits to this gist https://gist.github.com/thomseddon/4703968, specially @huyttq)
angular.module("myApp").directive("autoGrow", function(){
return function(scope, element, attr){
var update = function(){
element.css("height", "auto");
var height = element[0].scrollHeight;
if(height > 0){
element.css("height", height + "px");
}
};
scope.$watch(attr.ngModel, function(){
@leminh111
leminh111 / gist:130bf9548332ff39751fd53d2ffc2e85
Created February 1, 2018 00:52 — forked from thomseddon/gist:4703968
Auto Expanding/Grow textarea directive for AngularJS
/**
* The MIT License (MIT)
*
* Copyright (c) 2013 Thom Seddon
* Copyright (c) 2010 Google
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@leminh111
leminh111 / bass fish nvm function to use nvm
Created November 29, 2017 12:33
to run nvm in fish, we use bass to export/source the nvm like in bash to use it normally
function nvm
bass source ~/.nvm/nvm.sh ';' nvm $argv
end
git log --oneline --all --graph --decorate $(git reflog | awk '{print $1}')
git log -G"regex" -p --follow /path/to/file
@leminh111
leminh111 / php_object_to_array.php
Created August 19, 2016 19:37 — forked from victorbstan/php_object_to_array.php
recursively cast a PHP object to array
<?php
/*
This function saved my life.
found on: http://www.sitepoint.com/forums//showthread.php?t=438748
by: crvandyke
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?!
*/
$array = json_decode(json_encode($object), true);
@leminh111
leminh111 / super-tip.txt
Created December 29, 2015 05:02 — forked from ericdouglas/super-tip.txt
Change 4 spaces to 2 spaces indentation - Vim tip
%s;^\(\s\+\);\=repeat(' ', len(submatch(0))/2);g