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 / 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 / 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 / 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 / hashText.sh
Created September 13, 2016 11:40
Command to hash name in bash
echo -n "Carlos Oropesa" | md5sum
#5ccb46f23b0693211f76c3d325a9720b
@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 / 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 / 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 / toType.js
Last active March 5, 2018 16:49
'typeof' return de basic type. 'toType' return the specify type. EXAMPLE [object Date] return 'date', not 'object'.
var toType = function(obj) {
return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
}
toType({a: 4}); //"object"
toType([1, 2, 3]); //"array"
(function() {console.log(toType(arguments))})(); //arguments
toType(new ReferenceError); //"error"
toType(new Date); //"date"
toType(/a-z/); //"regexp"
function header_status($statusCode) {
static $status_codes = null;
if ($status_codes === null) {
$status_codes = array (
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing',
200 => 'OK',
201 => 'Created',
@oropesa
oropesa / native-fonts.css
Created March 1, 2018 12:11
Uses the native font of the operating system to get close to a native app feel.
.system-font-stack {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
/**
-apple-system. is San Francisco, used on iOS and macOS (not Chrome however)
BlinkMacSystemFont. is San Francisco, used on macOS Chrome
Segoe UI. is used on Windows 10
Roboto. is used on Android
Oxygen-Sans. is used on GNU+Linux