Skip to content

Instantly share code, notes, and snippets.

View oropesa's full-sized avatar
🙂
I'm chachon

Oropesa oropesa

🙂
I'm chachon
View GitHub Profile
@oropesa
oropesa / steps.bash
Created February 15, 2017 13:30
Add git-branch name in bash
# ~$> gedit ~/.bashrc
# Add this lines
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ ";
# Remember, only one 'export' line, separated by ';'
@oropesa
oropesa / README.js
Last active December 21, 2016 15:42
Recoger Array de Emojis de ListaUnicode
"http://unicode.org/emoji/charts/full-emoji-list.html"
//http://unicodey.com/
//Navigator Console
//$0 === table
//Quitar fila titulo
$0.children[0].children[0].remove();
//Quitar dos primeras columnas
@oropesa
oropesa / contadores.css
Created September 30, 2016 07:53
Counters change their number randomly with nice css effect, starting from a selected number.
.landing-bloque-contadores.parallax_section_holder {
padding: 10em 0;
background-size: cover;
}
.landing-bloque-contadores .q_counter_holder {
opacity: 1;
text-shadow: 0 0 12px rgb(0, 0, 0);
}
@oropesa
oropesa / hashText.sh
Created September 13, 2016 11:40
Command to hash name in bash
echo -n "Carlos Oropesa" | md5sum
#5ccb46f23b0693211f76c3d325a9720b
@oropesa
oropesa / number2commaString.js
Created September 12, 2016 12:29
Cast a number to String. This new string separate miles (each 3 digits) by a comma (,)
/**
* @param {number} numero
* @returns {String}
*/
var number2commaString = function( number ) {
var parts = number.toString().split( "." );
parts[ 0 ] = parts[ 0 ].replace( /\B(?=(\d{3})+(?!\d))/g, "," );
return parts.join(".");
};
@oropesa
oropesa / num2camelString.js
Created February 19, 2016 11:09
Cast Number to String. The last digit is separated by a stripe
var num2camelString = function( numero ) {
var string = numero + ""; // 4 23 132 30
if( string.length === 1 ) { // t f f f
string = "0" + string; // 04 23 132 30
}
string = string.substring( 0, string.length - 1 ) // 0 2 13 3
+ "-" // - - - -
+ string.substr( string.length - 1, 1 ); // 4 3 2 0
if( string.lastIndexOf( "0" ) === string.length -1 ) {
@oropesa
oropesa / functions.php
Created August 24, 2015 19:02
Hide adminbar in WordPress frontpage
<?php
/**
* Hide adminbar in frontpage
*/
add_filter( 'show_admin_bar', function() { return false; } );
@oropesa
oropesa / Add WP Users Table Register Sortable Column
Last active August 29, 2015 14:16
Add in Users Table from Wordpress Dashboard a new sortable column with user_registered datum (Register Date).
<?php
function alisios_add_user_column_registered( $columns ) {
$columns[ 'user_registered' ] = 'Register Date';
return $columns;
}
add_filter( 'manage_users_columns', 'alisios_add_user_column_registered' );
function alisios_add_user_sortable_column_registered( $columns ) {
$columns[ 'user_registered' ] = 'user_registered';
return $columns;
@oropesa
oropesa / WP FTP SSH wp-config.php
Created December 15, 2014 14:29
Edit wp-config.php to update WP by FTP-SSH2
1. Install SSH2 and PHP mod, and restart Apache2
|- #> sudo apt-get install libssh2-1-dev libssh2-php
\- #> sudo service apache2 restart
2. Generate RSA keys, Create authorized_keys, and Update permissions
|- #> ssh-keygen
|- TIP: do not save them in your web directory
|- #> cd .ssh/
|- #> cp id_rsa.pub authorized_keys
|- #> cd ../
|- #> chmod 775 .ssh
@oropesa
oropesa / Ignore .idea from git
Last active October 1, 2019 10:43
Ignore .idea folder from git in PHPStorm
1. Make PHPStorm ignore .idea folder
|- File > Settings > Version Control > Ignored Files > Add(+) > Ignored all files under > select directory .idea
2. Clean PhpStorm Git Cache
|- Open Terminal (Left+Down) #> "C:\Program Files (x86)\Git\cmd\git.exe" rm -f --cached .idea/*
or
|- Open Terminal (Left+Down) #> git rm -f --cached .idea/*
3. Reboot PhpStorm
\- Done!