Skip to content

Instantly share code, notes, and snippets.

@jaredcacurak
jaredcacurak / deer-lakes-youth-soccer-u10-girls-sprint-schedule-2016.md
Last active May 8, 2016 15:07
2016 Deer Lakes Youth Soccer U10 Girls Spring Schedule
@jaredcacurak
jaredcacurak / setTimeout.js
Last active August 29, 2015 13:57
Shim setTimeout
(function () {
'use strict';
var _setTimeout = setTimeout;
setTimeout = function (fn/*, delay, callbackParm1, callbackParm2, etc. */) {
var delay, callbackParameters;
delay = arguments[1] || 0;
callbackParameters = Array.prototype.slice.call(arguments, 2);
@jaredcacurak
jaredcacurak / GetDateOfMostRecent.cs
Created July 6, 2012 14:05
Get the most recent DateTime extension method.
public static DateTime GetDateOfMostRecent(this DayOfWeek dayOfWeek, DateTime date) {
return date.DayOfWeek.Equals(dayOfWeek) ? date.Date : GetDateOfMostRecent(dayOfWeek, date.AddDays(-1));
}
@jaredcacurak
jaredcacurak / gist:2783962
Created May 24, 2012 20:19
Remove all but the five most recent text files starting with the prefix "boo" in the working directory without prompting.
for i in `ls -t boo*.txt | sed '1,5d'`; do rm -f $i; done
function LuhnyBin(creditCard, minLength, maxLength, maskWithChar) {
if (this instanceof LuhnyBin) {
this.creditCard = creditCard;
this.minLength = minLength || 14;
this.maxLength = maxLength || 16;
this.maskWithChar = maskWithChar || 'X';
this.output = this.process(creditCard);
} else {
return new LuhnyBin(creditCard, minLength, maxLength, maskWithChar);
}
@jaredcacurak
jaredcacurak / NumberMuncher.java
Created February 24, 2011 02:37
A Groovy + Java solution for Project Euler - Problem 30
class NumberMuncher {
private final Integer value;
NumberMuncher(Integer value) {
this.value = value;
}
List<Integer> digitsToThePowerOf(int power) {
List<Integer> listOfPowers = new ArrayList<Integer>();
List<Integer> digits = toDigits();
@jaredcacurak
jaredcacurak / euler1.groovy
Created February 24, 2011 02:34
A Groovy solution for Project Euler - Problem 1
(1..<1000).findAll { it % 3 == 0 || it % 5 == 0 }.sum()
@jaredcacurak
jaredcacurak / euler6.groovy
Created February 24, 2011 02:33
A Groovy solution for Project Euler - Problem 6
(1..100).sum() ** 2 - (1..100).collect { it ** 2 }.sum()
@jaredcacurak
jaredcacurak / euler2.groovy
Created February 24, 2011 02:32
A Groovy solution for Project Euler - Problem 2
def list = [0, 1]
while (list.last() < 4000000) {
list << list[-1] + list[-2]
}
list.findAll { it % 2 == 0 }.sum()
@jaredcacurak
jaredcacurak / euler3.groovy
Created February 24, 2011 02:31
A Groovy solution for Project Euler - Problem 3
def largestPrimeFactorOf = { BigInteger it, divisor = 1, factors = [] ->
while (it > 1) {
divisor += 1
while (it % divisor == 0) {
factors << divisor
it /= divisor
}
}
factors.last()
}