Skip to content

Instantly share code, notes, and snippets.

View bonjourmauko's full-sized avatar

Mauko Quiroga-Alvarado bonjourmauko

View GitHub Profile
@bonjourmauko
bonjourmauko / basic_income.py
Created July 17, 2021 12:59
Example condition check rule with OpenFisca
class basic_income_age_condition(Variable):
value_type = bool
entity = Person
definition_period = MONTH
label = "Age eligibility condition for basic income"
reference = "https://law.gov.example/basic_income/eligibility/age"
def formula(persons, period, parameters):
input_age = persons("age", period)
threshold = parameters(period).general.age_of_majority
@bonjourmauko
bonjourmauko / .eslintrc
Created May 5, 2019 17:39
.eslintrc nextjs v1
{
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 9,
"ecmaFeatures": {
"jsx": true,
},
"sourceType": "module",
},
"env": {
@bonjourmauko
bonjourmauko / namedtuple.py
Last active February 28, 2019 08:51
NamedTuple
from __future__ import annotations
from typing import NamedTuple
import numpy
import time
class Rectangle(NamedTuple):
height: float
@bonjourmauko
bonjourmauko / phantomjs
Last active September 19, 2017 13:53 — forked from deviantony/phantomjs
PhantomJS Upstart
#! /bin/sh
# Init. script for phantomjs, based on Ubuntu 12.04 skeleton.
# Author: Anthony Lapenna <[email protected]>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Phantomjs service"
NAME=phantomjs
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
@bonjourmauko
bonjourmauko / curl_bousole.beta.gouv.fr
Last active April 11, 2017 10:20
curl --head boussole.beta.gouv.fr
* Rebuilt URL to: boussole.beta.gouv.fr/
* Trying 149.202.165.43...
* Connected to boussole.beta.gouv.fr (149.202.165.43) port 80 (#0)
> HEAD / HTTP/1.1
> Host: boussole.beta.gouv.fr
> User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Firefox/31.0
> Accept: */*
> Referer:
>
< HTTP/1.1 301 Moved Permanently
{
"color_scheme": "Packages/User/Monokai Soda.tmTheme",
"dictionary": "Packages/Language - English/en_GB.dic",
"font_size": 11.0,
"ignored_packages":
[
"Batch File",
"LaTeX",
"PHP",
"Groovy",
const WORD_LEN = 8;
class Hangman {
Hangman() {
rounds = 0;
charsguessed = 0;
generateWord();
}
#------------------------------------------------------------------------------
# Returncode.
#------------------------------------------------------------------------------
function returncode
{
returncode=$?
if [ $returncode != 0 ]; then
echo "[$returncode]"
else
echo ""
# config/jugdeme.yml
development:
url: "http://localhost:3001"
api_key: "sdfsafsafasfasdfsafdfds"
production:
url: "http://api.judgeme.com"
api_key: "sdfsafsafasfasdfsafdfds"
@bonjourmauko
bonjourmauko / params_filter.rb
Created June 20, 2012 19:57
A function to filter the params sent to a REST API endpoint
class Hash
# Public: Filters a hash to check only for those elements desired
#
# Examples
#
# hash = { uno: "uno", dos: "dos", tres: "tres" }
# whitelist = [ :uno, :dos ]
# hash.filter whitelist
# # => { uno: "uno", dos: "dos" }
#