Skip to content

Instantly share code, notes, and snippets.

View juliomatcom's full-sized avatar

Julio César juliomatcom

View GitHub Profile
@juliomatcom
juliomatcom / php-functional-programming-example-1.php
Created January 1, 2017 13:11
Functional Programming example in PHP - 1
// Functional Programming example in PHP
<?php
function myFoo($foo){
return function ($bar) use ($foo){
return "Foo is ${foo} and Bar is ${bar}";
};
}
//first call set $foo = 'Asd'
$myBarAsd = myFoo('Asd');
@juliomatcom
juliomatcom / functions_are_objects_in_javascript.js
Created July 9, 2017 08:46
functions are Objects in JavaScript
Function instanceof Object // true
Boolean instanceof Function // true
Number instanceof Function // true
String instanceof Function // true
@juliomatcom
juliomatcom / new_boolean_number_string.js
Created July 9, 2017 08:57
Using Boolean, Number and String with new operator
var b = new Boolean(false); // { [[PrimitiveValue]]: false }
var n = new Number(10); // { [[PrimitiveValue]]: 10 }
var s = new String('foo'); // { 0: "f", 1: "o", 2: "o", length: 3, [[PrimitiveValue]]: "foo" }
@juliomatcom
juliomatcom / function_boolean_number_string.js
Created July 9, 2017 09:05
Using Boolean, Number and String as functions
var b = Boolean(false); // false
var n = Number(10); // 10
var s = String("foo"); // "foo"
@juliomatcom
juliomatcom / conversion_boolean_number_string.js
Created July 9, 2017 09:09
Type conversion with Boolean, Number and String
Boolean(""); // false
Boolean(0); // false
Boolean(1); // true
Number("10"); // 10
Number("foo"); // NaN
String(10); // "10"
var stuff = ["", 1, undefined, { foo: "bar" }];
Boolean(myVar) === !!myVar // true
@juliomatcom
juliomatcom / curry.js
Last active February 28, 2018 10:12
curry implementation
function curry(f) {
return function currify() {
const args = Array.prototype.slice.call(arguments);
return args.length >= f.length ?
f.apply(null, args) :
currify.bind(null, ...args)
}
}
@juliomatcom
juliomatcom / .zshrc
Last active March 16, 2021 08:50
change colors in terminal zsh - macOS Big Sur
# Comment next lines depending on your environment
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# COLORS PROFILES START
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
autoload -U colors && colors
@juliomatcom
juliomatcom / example.sh
Created May 5, 2021 15:51
ignore errors using git submodule foreach
# example for node
git submodule foreach "npm i || :"
@juliomatcom
juliomatcom / Mariana.sublime-color-scheme
Last active November 22, 2022 09:02
Mariana.sublime-color-scheme syntax improved for JS, JSX, ES6+
// Documentation at https://www.sublimetext.com/docs/color_schemes.html
{
"variables":
{
"yellow": "#F0DB4F",
"function_argument": "#79b8ff",
"variable_blue": "#9ecbff",
},
"globals":
{