Skip to content

Instantly share code, notes, and snippets.

View xavvvier's full-sized avatar

Javier Gonzalez xavvvier

View GitHub Profile
def column_winner?(_, _, _, 4) do
true
end
def column_winner?(_, 1, _, _) do
false
end
def column_winner?(player, row, col, count) do
@xavvvier
xavvvier / download.py
Last active December 13, 2018 19:36
Python script to download mp3 files from public url folders
import urllib.request
import urllib.parse
import html
import re
import sys
def main():
if len(sys.argv) < 2:
print_usage()
sys.exit(1)
defmodule Factorial do
def of(number) do
of(number, 1)
end
defp of(n, product) when n<= 1 do
product
end
defp of(number, product) do
of(number-1, product * number)
end
@xavvvier
xavvvier / anki_importer_generator.py
Last active October 31, 2019 22:24
Generates a text file ready to import in anki software using a list of minimal pairs as base input. Also downloads audio files from wordreference.com
#execute as: python3 anki_importer_generator.py < input.txt
#where input.txt is a list of minimal pairs words separated by space:
#it eat
#bit beat
import fileinput
import urllib.request
import re
def makeline(word1, word2, ipaword1, ipaword2, file1, file2):
@xavvvier
xavvvier / docker-compose.yml
Last active March 1, 2020 19:43
wordpress cli
#Based on: https://medium.com/@tatemz/using-wp-cli-with-docker-21b0ab9fab79
# run in detached mode as:
# docker-compose up -d
# stop as:
# docker-compose down
# Run wp-cli commands as:
# docker exec my-wp wp post list
#
# Navigate to http://localhost:8080 or http://localhost/wp-admin
version: '3.1'
@xavvvier
xavvvier / Dockerfile
Created March 11, 2020 13:06
Wordpress cli + gulp-cli
FROM tatemz/wp-cli
RUN curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - \
&& sudo apt-get install nodejs \
&& npx ---version \
&& npm install --global gulp-cli \
&& rm -rf /var/lib/apt/lists/*
@xavvvier
xavvvier / prime_number.ex
Last active September 17, 2021 10:35
An elixir function to calculate the nth prime number
defmodule PrimeNumber do
def is_prime(2), do: true
def is_prime(number) do
not Enum.any?(2..number-1, fn x -> rem(number, x) == 0 end)
end
def prime(n) do
Stream.interval(1)
|> Stream.filter(&is_prime/1)
|> Enum.take(n)
@xavvvier
xavvvier / input.scss
Created September 29, 2021 12:45
Generated by SassMeister.com.
@mixin generator($prefix, $properties) {
// List of sizes to generate for each variant
$sizes: [.25, .5, 1, 1.5, 3];
// Loop through all of the sizes
// use @for to access the current index
@for $i from 1 through length($sizes) {
$size: nth($sizes, $i);
@xavvvier
xavvvier / input.scss
Last active September 29, 2021 14:00
Generated by SassMeister.com.
@mixin generator($prefix, $properties) {
// List of sizes to generate for each variant
//$sizes: [.25, .5, 1, 1.5, 3];
$sizes: [ 1, 3];
// Loop through all of the sizes
// use @for to access the current index
@for $i from 1 through length($sizes) {
$size: nth($sizes, $i);
{
"TotalCount": 432,
"TotalPages": 1,
"PageNumber": 0,
"Result": [
{
"ID": "532bfc12-9491-419d-8f12-e7d7a02bcf86",
"StartTime": "2021-11-08T05:00:00-04:00",
"EndTime": "2021-11-08T23:30:00-04:00",
"Subject": "Fitness Scanning Access",