This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Snippet to know when is the next pay day (quincena) | |
// The rules are: | |
// -Pay day is on the 15th and the last day of the month | |
// -- If that day is not a weekday (Mon-Fri) pay day falls on the previous Friday | |
// Of course, without additional effort this won't take into consideration holidays | |
// January is 0 and so on | |
var daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31]; | |
function isLeapYear(year) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The only small improvement from challange #3 was | |
// manipulating the elevator light | |
{ | |
init: function(elevators, floors) { | |
elevators.forEach(function(elevator){ | |
elevator.on("floor_button_pressed", function(floorNum) { | |
elevator.goToFloor(floorNum); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Command line utility to send attachments to your kindle | |
# It supports sending a PDF in both regular form and with the convert option | |
# and sending to the regular (@kindle.com) or free Kindle mail (@free.kindle.com) | |
# The only argument it has is the name of the file to send. It will detect if | |
# it is a pdf and treat it accordingly. | |
## Preferences | |
# If true, send one version with pdf as-is, another with 'convert' subject | |
# else, just send the pdf version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# // XX/YYY + XX/YY = 7 | |
import random | |
numbers = [1,2,3,4,5,6,7,8,9] | |
res = 0 | |
target = 7 | |
def pop_random (num): | |
res = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
WTF behavior in C. At least not what I expected. | |
Prints full matrix with just one call to the index | |
*/ | |
#include "stdio.h" | |
#include "stdlib.h" | |
void print_square_matrix(int* matrix, int size); |