{{ message }}

Instantly share code, notes, and snippets.

Created Oct 1, 2015
A snippet to know when is the next pay day
View next_quincena.js
 // 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) {
Last active Aug 29, 2015
My strategy for elevator saga http://play.elevatorsaga.com/
View Elevator saga
 // 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); });
Created Jan 14, 2014
Send files to your Amazon Kindle via the Command Line Interface.
View kindle.sh
 # 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
Created Nov 16, 2013
Script to solve the problem described in http://orsaibonsai.com/blog/post/gran_7 XX/XXX + XX/XX = 7 With numbers from 1 to 9, fill all the slots without repeating numbers to sum 7
View gran_7
 #! /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 = []
Last active Dec 21, 2015
[WTF] Unexpected behavior in C, prints full matrix, no warnings
View print_matrix.c
 /* 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);
You can’t perform that action at this time.