Skip to content

Instantly share code, notes, and snippets.

Avatar

Christian De Martino christ776

  • Buenos Aires, Argentina
View GitHub Profile
View clicks.js
/*
You are in charge of a display advertising program. Your ads are displayed on websites all over the internet. You have some CSV input data that counts how many times that users have clicked on an ad on each individual domain. Every line consists of a click count and a domain name, like this:
counts = [ "900,google.com",
"60,mail.yahoo.com",
"10,mobile.sports.yahoo.com",
"40,sports.yahoo.com",
"300,yahoo.com",
"10,stackoverflow.com",
"20,overflow.com",
View keybase.md

Keybase proof

I hereby claim:

  • I am christ776 on github.
  • I am christian776 (https://keybase.io/christian776) on keybase.
  • I have a public key ASDd9jVHfzDhy3z_lIslZ5H5zZs-q5iHIrxsW6Q3dENA4Ao

To claim this, I am signing this object:

View flatten.js
function flattenArray(arr) {
if (arr === undefined || arr === null) {
throw new Error('Bad argument type:', arr);
}
const flattenedArray = [].concat(...arr)
for(const m of flattenedArray) {
if (m instanceof Array) {
return flattenArray(flattenedArray);
}
}
View dolar_hoy.py
#!/usr/bin/env python3
import requests
from requests.exceptions import ConnectionError
import json
import locale
from bs4 import Tag, NavigableString, BeautifulSoup
"""
Set locale to es_ES
View gist:2ce863ecf843ddbda52831904a3cbfe4
curl -s https://www.bancogalicia.com/cotizacion/cotizar\?currencyId\=02\&quoteType\=SU\&quoteId\=999 | python -c "import sys, json; obj = json.load(sys.stdin);print('Dolar compra: ' + obj['buy']); print('Dolar venta: '+ obj['sell'])"
View combinationsjs
//You have an array of characters (string) that may be '1', '0' o '*'. e.g. 10*00*0. The program needs to
//generate an output of all the possible combinations by replacing * with an 0 and 1. I.e. input> 10**0
//output> 10000, 10010, 10100, 10110. Input > *0 output > 00, 10.
function findOcurrencesOf(character = "*", array) {
let occ = [];
for (let i = 0; i < array.length; i++) {
if (array[i] === character) {
occ.push(i);
}
View combinations.js
//You have an array of characters (string) that may be '1', '0' o '*'. e.g. 10*00*0. The program needs to
//generate an output of all the possible combinations by replacing * with an 0 and 1. I.e. input> 10**0
//output> 10000, 10010, 10100, 10110. Input > *0 output > 00, 10.
function findOcurrencesOf(character = "*", array) {
let occ = [];
for (let i = 0; i < array.length; i++) {
if (array[i] === character) {
occ.push(i);
}
View gist:d204cab6814b4788cad449e34a86f2c5
{
"categoriesToShow": [
"Key Concepts",
"Mathematical Practices",
"Learning Objectives"
],
"questionTagsById": [
{
"id": 568229,
"question_type": "questions/multiple_choice",
View supermodel3 OSX Makefile
##
## Supermodel
## A Sega Model 3 Arcade Emulator.
## Copyright 2011-2016 Bart Trzynadlowski, Nik Henson
##
## This file is part of Supermodel.
##
## Supermodel is free software: you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation, either version 3 of the License, or (at your option)
View Reachability.swift
// The MIT License (MIT)
//
// Copyright (c) 2015 Isuru Nanayakkara
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: