Skip to content

Instantly share code, notes, and snippets.

View Wilo's full-sized avatar
🍻
Prost!

William Méndez Wilo

🍻
Prost!
View GitHub Profile
@Wilo
Wilo / factorial.ex
Created July 19, 2019 22:09
Factorial Elixir
defmodule Math do
@spec factorial(pos_integer) :: pos_integer
@doc "Compute factorial"
def factorial(0), do: 1
def factorial(n) when n > 0 do
n * factorial(n - 1)
end
end
Math.factorial(10)
@Wilo
Wilo / vueenter.vue
Created June 22, 2018 22:14
send by enter
<div id="app">
<input @keyup.enter="trigger" placeholder="Reply here" class="fb-comment-input" v-model="buffer_input" />
<i class="fb-send" @click="enterClicked" ref="sendReply">&#x21E8;</i>
<div>{{ dato }}</div>
</div>
new Vue({
el:'#app',
data: {
buffer_input: '',
@Wilo
Wilo / lastdnidigit.kt
Created November 5, 2017 20:17
This snippet contains a method for obtain the last digit of the ecuadorian dni
package com.lab.experiment
fun nextTen( itemDigit: Int ): Int {
return ( ( itemDigit / 10 ) + 1 ) * 10
}
fun validationDigit( itemDigit: Int ): Int {
@Wilo
Wilo / ping.py
Created September 21, 2017 04:34 — forked from pklaus/ping.py
A pure python ping implementation using raw socket.
#!/usr/bin/env python2
"""
Other Repositories of python-ping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* https://github.com/l4m3rx/python-ping supports Python2 and Python3
* https://bitbucket.org/delroth/python-ping
@Wilo
Wilo / pyramid.rs
Created September 4, 2017 01:49
Triangle of asterisk with Rustlang
fn main() {
for index in 0..10 {
println!("{}", "*".repeat(index));
}
}
/**
Standard Output
*
@Wilo
Wilo / .iex.exs
Created August 13, 2017 13:21
Elixir custom prompt config file
IEx.configure(
colors: [ enabled: true],
default_prompt: [
"\e[G", # move to column 1
"\e[35m", # magenta
"λ(%counter)", #%prefix show the iex name iex(1)> in the console
">",
"\e[0m" # reset
] |> IO.chardata_to_string
)
@Wilo
Wilo / clock.vue
Created April 19, 2017 14:36 — forked from ironicnet/clock.vue
<template>
<div class="clock">
{{ tiempos }}
</div>
</template>
<script>
import moment from 'moment'
moment.locale('es')
const defaultFormat ='D. MMMM YYYY H:mm:ss'
var data = {
@Wilo
Wilo / multiply.rs
Created April 2, 2017 04:54
Multiples of 3 and 5
fn multiply(num: i32) -> i32 {
// time to code
(1..num).filter(|x| x % 3 == 0 || x % 5 == 0 ).sum()
}
fn main(){
println!("{}",multiply(10));
}
@Wilo
Wilo / webp2png.py
Last active March 18, 2020 14:27
convertidor de imágenes webp a png
from PIL import Image
def webp2png(webpfile):
image = Image.open(webpfile)
filename = image.filename.split('.')[0]
filepath = "/tmp/{}.png".format(filename)
image.save(filepath, 'png')
@Wilo
Wilo / pyramid.rb
Created December 27, 2016 15:16
A Pyramid of asterisk using ruby with 2 lines of code
pyramid = lambda{|rows| rows.times do |i| puts '*'*(i+1) end}
pyramid.(10)
=begin
My output
[wilo@developer ~]$ ruby pyramid.rb
*
**
***
****