Skip to content

Instantly share code, notes, and snippets.

View alfredobarron's full-sized avatar
😎
Working everyday

Alfredo Barron alfredobarron

😎
Working everyday
View GitHub Profile
@alfredobarron
alfredobarron / .bash_profile
Last active March 20, 2020 17:27
Show branch into Mac Terminal --> 1. nano ~/.bash_profile 2. Edit file 3. source ~/.bash_profile
if [ $PWD == $HOME ]
then
cd Code
fi
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\w\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
// Delete object
delete obj.item;
// Get index array|object
var index = obj.indexOf(item);
// is object
typeof obj === 'object'
// object length
// Print query
dd($query->toSql());
dd(DB::getQueryLog());
// Hash
php artisan tinker
Hash::make('secret');
@alfredobarron
alfredobarron / LAMP install
Created April 3, 2017 05:31
LAMP install
- digitalocean,
///// LAMP
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04
///// composer
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-14-04
///// phpmyadmin
@alfredobarron
alfredobarron / Config Virtual machine in Mac OSX Sierra version 10.12.3 - Abril, 2017
Last active February 26, 2018 19:57
Config Virtual machine in Mac OSX Sierra version 10.12.3 - Abril, 2017
Very good tutorials
--------------------
Jason McCreary, stackoverflow
///////
Configuring Apache Virtual Hosts on Mac OS X
https://jason.pureconcepts.net/2014/11/configure-apache-virtualhost-mac-os-x/
// Complementation of tutorial
@alfredobarron
alfredobarron / paths php5, mysql, mongodb & .composer
Last active February 26, 2018 19:57
paths php5, mysql, mongodb & .composer
// Edit
$ nano ~/.bash_profile
export PATH=/usr/local/php5/bin:$PATH;
export PATH=/usr/local/mysql/bin:$PATH;
export PATH=$HOME/.composer/vendor/bin:$PATH;
export PATH=/usr/local/mongodb/bin:$PATH;
// Restart
@alfredobarron
alfredobarron / $apply.js
Created August 15, 2016 16:22
Angular $apply
if (!$scope.$$phase) {
$scope.$apply(function() {
$scope.count = 0;
});
}
@alfredobarron
alfredobarron / select2-bootstrap3.js
Created August 19, 2015 21:59
width 100% in bootstrap 3 into tabs
/**
* Change line 4927
*/
Select2.prototype._resolveWidth = function ($element, method) {
var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
if (method == 'resolve') {
var styleWidth = this._resolveWidth($element, 'style');
if (styleWidth != null) {
@alfredobarron
alfredobarron / select2-bootstrap3.css
Created August 19, 2015 21:55
Height select 2 in bootstrap 3.3.4
/**
* Change three lines
*
/* line 11 */
.select2-container .select2-selection--single {
box-sizing: border-box;
cursor: pointer;
display: block;
height: 34px;
user-select: none;
$('button').click(function() {
if ($('form').smkValidate()) {
// Code here
}
});