Skip to content

Instantly share code, notes, and snippets.

View wilmer-data-days's full-sized avatar
🏠
Working from home

Wilmer Diaz wilmer-data-days

🏠
Working from home
View GitHub Profile
@wilmer-data-days
wilmer-data-days / start-end_methods_and_single_condition.py
Created March 1, 2024 04:03
startswith & endswith - String methods combined with Single Condition
# In this gist, I want to share 2 concepts:
# 1. Use startswith (similar with endswith) method.
# 2. Use single conditions instead of multiple conditions.
names = ["Wilmer", "Elong", "Linus", "Cristiano" ]
# classic use with or condition
for name in names:
if name.startswith("W") or name.startswith("Cr"):
@wilmer-data-days
wilmer-data-days / iffe.js
Created January 6, 2021 15:23
IFFE function in Js
// Función que se ejecuta inmediatamente y retorna la suma de un binomio con exponente c
(function(a,b,c){
console.log((a+b)**c)
})(3,2,2)
// Example (3+2)**2 =25
@wilmer-data-days
wilmer-data-days / Clousure Example Js
Created January 6, 2021 15:12
Example Scope in Js
function operacionescon(number){
let first_number = number
return {
suma: function (other_number){
return first_number + other_number
},
resta:function(other_number){
return first_number - other_number
},
@wilmer-data-days
wilmer-data-days / eslintrc.json
Created December 1, 2020 20:30
Node complements
{
"parserOptions": {
"ecmaVersion": 2018
},
"extends": [
"eslint:recommended",
"prettier"
],
"env": {
"es6": true,
def controller_time(func):
def wrapper(*args, **kwargs):
initial_time = time.time()
func(*args,**kwargs)
final_time = time.time()
seconds = final_time - initial_time
print(f'The function {func.__name__} took {seconds} seconds')
return wrapper
@wilmer-data-days
wilmer-data-days / gist:a5cc40d4f7b00844d434c93c0a2d1e78
Last active June 15, 2020 04:34
Delete spaces in strings (python)
#unclean
phrase= " h e l l o "
#remove external spaces
phrase= phrase.strip()
#remove all spaces
phrase= phrase.replace(" ", "")