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
def get_serve_pattern(queue, barbers) | |
min = barbers.min | |
freq = barbers.map { |b| (b / min).ceil } | |
count = 0 | |
0.upto(queue).each do |n| | |
puts "count is #{count}" | |
count += 1 | |
barbers.each_with_index do |b, i| | |
if n % freq[i] == 0 |
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
require 'pry' | |
file = File.new(ARGV[0], "r") | |
# delete current output file | |
if File.exist?("output.txt") | |
File.delete("output.txt") | |
end | |
# number of cases | |
cases = file.gets |
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
// Returns an arrary with the name of the previous seven days (?) | |
var getPreviousWeek = function(){ | |
// get day index monday => 0, tuesday => 1, ... | |
var today = (new Date().getDay()-1); | |
//0 index based array, monday => 0, tuesday => 1 and so on | |
var days = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]; | |
// range returns [1, 2, 3, 4, 5, 6, 7] |
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
cd /usr/share/sounds/ubuntu/stereo/ | |
sudo mv desktop-login.ogg desktop-login.ogg.old | |
sudo wget "https://dl.dropboxusercontent.com/s/i75iiy70gomutka/desktop-login.ogg?dl=1&token_hash=AAGc5mdNY5DqejjSoiJNGxiU2gvnuTSz-M8akFxucX9KKA" | |
sudo mv desktop-login.ogg\?dl=1\&token_hash=AAGc5mdNY5DqejjSoiJNGxiU2gvnuTSz-M8akFxucX9KKA desktop-login.ogg |
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
/** | |
* Created with IntelliJ IDEA. | |
* User: paulomcnally | |
* Date: 10/30/13 | |
* Time: 8:53 PM | |
* To change this template use File | Settings | File Templates. | |
*/ | |
var crypto = require('crypto'); | |
var mssql = require('mssql'); |
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
/* | |
String Calculator | |
1- The program can take 0, 1 or 2 numbers and will | |
return their sum, (for an empty string it will return 0) | |
for example "" or "1" or "1,2" -> 0, 1, 3 | |
2- Allow the Add method to handle an unknown amount | |
of numbers |
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
var flatten = function(){ | |
var reduce = function (array) { | |
return array.reduce(function(r,e){ | |
return r.concat( (e instanceof Array) ? reduce(e) : e ); | |
},[]); | |
} | |
return reduce(Array.prototype.slice.call(arguments)); | |
} |
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
configurations { | |
all*.exclude group: 'com.android.support', module: 'support-v4' | |
} |
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
function format_date($date,$format) { | |
$es_months = array("Ene", "Abr", "Ago", "Dic"); | |
$en_months = array("Jan", "Apr", "Aug", "Dec"); | |
$timestamp = strtotime(str_replace($es_months,$en_months,$date)); | |
return str_replace($en_months,$es_months,date($format,$timestamp)); | |
} |
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
#!/bin/bash | |
# License: Public Domain. | |
# Author: Joseph Wecker, 2012 | |
# | |
# -- DEPRICATED -- | |
# This gist is slow and is missing .bashrc_once | |
# Use the one in the repo instead! https://github.com/josephwecker/bashrc_dispatch | |
# (Thanks gioele) | |
# | |
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile? |
NewerOlder