This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 'pincers' | |
require 'aws-sdk' | |
pincers = Pincers.for_webdriver :chrome | |
pincers.goto "www.nasa.gov" | |
menu = pincers.search("#nasa-main-menu > li:contains('Galleries')") | |
menu.search("a:first").hover | |
menu.search("a:contains('Image of the Day')").click |
This file contains hidden or 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 get(url, data, callback){ | |
if(typeof data === "function") { | |
callback = data; | |
data = {}; | |
} | |
var xhr = new XMLHttpRequest(); | |
xhr.open("GET", url, true); | |
xhr.setRequestHeader("Content-Type","application/json"); |
This file contains hidden or 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
angular | |
.module("") | |
.directive("repeatTimeLog", repeatTimeLog); | |
/* @ngInject */ | |
function repeatTimeLog($timeout, $log) { | |
var start, end; | |
return timeoutFunction; |
This file contains hidden or 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 getPage = function(params) { | |
$scope.tableParams.sortBy = params.sort.predicate || 'created_at'; | |
$scope.tableParams.sort = (params.sort.reverse) ? 'DESC' : 'ASC'; | |
var settings = $scope.tableParams; | |
return runsResource.$reset().$fetch(settings).$asPromise().then(function(_runs) { | |
return processData(_runs); | |
}); | |
}; | |
getPage(tableState).then(function(result) { |
This file contains hidden or 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() { | |
angular.module('validation', ['validation.provider', 'validation.directive']); | |
}).call(this); | |
(function() { | |
angular.module('validation.provider', []) | |
.provider('$validation', function() { | |
var $injector, |
This file contains hidden or 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
# source: http://unix.stackexchange.com/a/20413 | |
# prevent loading the alias if it's not an interactive shell | |
[ -z "$PS1" ] && return | |
function cd { | |
builtin cd "$@" && ls -F | |
} |
This file contains hidden or 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] |
NewerOlder