Skip to content

Instantly share code, notes, and snippets.

View eduardonunesp's full-sized avatar

Eduardo Pereira eduardonunesp

View GitHub Profile
@eduardonunesp
eduardonunesp / staircase.js
Last active June 2, 2016 16:23
Staircase
/*
Your teacher has given you the task of drawing a staircase structure. Being an expert programmer, you decided to make a program to draw it for you instead. Given the required height, can you print a staircase as shown in the example?
Input
You are given an integer NN depicting the height of the staircase.
Output
Print a staircase of height NN that consists of # symbols and spaces. For example for N=6N=6, here's a staircase of that height:
#
@eduardonunesp
eduardonunesp / tomilitaryhour.js
Created April 15, 2016 15:04
Time Conversion
/*
Given a time in AM/PM format, convert it to military (2424-hour) time.
Note: Midnight is 12:00:00AM12:00:00AM on a 1212-hour clock, and 00:00:0000:00:00 on a 2424-hour clock. Noon is 12:00:00PM12:00:00PM on a 1212-hour clock, and 12:00:0012:00:00 on a 2424-hour clock.
Input Format
A single string containing a time in 1212-hour clock format (i.e.: hh:mm:ssAMhh:mm:ssAM or hh:mm:ssPMhh:mm:ssPM), where 01≤hh≤1201≤hh≤12.
Output Format
@eduardonunesp
eduardonunesp / esnextbin.md
Created April 27, 2016 17:40
esnextbin sketch
@eduardonunesp
eduardonunesp / curry_meia_boca.js
Created April 29, 2016 14:00
curry_meia_boca.js
Function.prototype.partial = function () {
var fn = this;
var first_args = Array.prototype.slice.call(arguments);
return function () {
var second_args = Array.prototype.slice.call(arguments);
first_args.forEach(function(args, index) {
if (!args) {
first_args[index] = second_args.shift();
}
});
const log = function(args) {
args = Array.isArray(args) ? args : Array.prototype.slice.call(arguments)
console.log.apply(console, args);
};
const tOut = function(time) {
return new Promise(function(resolve) {
setTimeout(() => {
resolve(time);
}, time);
@eduardonunesp
eduardonunesp / http.js
Last active May 17, 2016 01:09
Node HTTP + Ramda
'use strict'
const R = require('ramda');
const http = require('http');
const log = function() {
const args = [].slice.call(arguments);
if (R.all(v => v, args)) {
console.log.apply(console.log, args);
}
var arr = [
[-1, 1, -1, 0, 0, 0],
[ 0, -1, 0, 0, 0, 0],
[-1, -1, -1, 0, 0, 0],
[ 0, -9, 2, -4, -4, 0],
[-7, 0, 0, -2, 0, 0],
[ 0, 0, -1, -2, -4, 0]
];
const sum = (a, b) => a + b;
defmodule Pinger.Destiny do
@moduledoc """
Module responsible for the destiny struct,
which is the name and address of the ping target
"""
defstruct name: nil,
address: nil,
active: false

Keybase proof

I hereby claim:

  • I am eduardonunesp on github.
  • I am eduardonunesp (https://keybase.io/eduardonunesp) on keybase.
  • I have a public key whose fingerprint is 7CB8 C87F C76E 6606 6C2C 95B0 AD17 F281 4EE9 E408

To claim this, I am signing this object:

@eduardonunesp
eduardonunesp / keybase.md
Created November 1, 2017 02:20
keybase.md

Keybase proof

I hereby claim:

  • I am eduardonunesp on github.
  • I am eduardonunesp (https://keybase.io/eduardonunesp) on keybase.
  • I have a public key whose fingerprint is 86F2 9471 B6F1 5057 E7E1 85A1 36F2 A763 9C0C 2DF3

To claim this, I am signing this object: