I hereby claim:
- I am cciollaro on github.
- I am cciollaro (https://keybase.io/cciollaro) on keybase.
- I have a public key ASDueUTB2-oaIgtSLWsUyhVumh4IYwjYrcCSl0NEur7yygo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
public class ModExp { | |
public static void main(String[] args) { | |
System.out.println(modExp(4,13,497)); | |
} | |
public static int modExp(int a, int b, int n){ | |
int d = 1; | |
String k = Integer.toBinaryString(b); | |
for(int i = 1; i <= k.length(); i++){ |
I hereby claim:
To claim this, I am signing this object:
let's imagine you wanted to test Coin.js | |
1.) create test/coinTest.js | |
2.) write tests like these: http://pivotal.github.io/jasmine/. Jasmine is a really great library, go check out that page! :) | |
3.) when you've written your test, go to SpecRunner.html and include your test and dependencies like so: | |
<!-- include source files here... --> | |
<script type="text/javascript" src="js/Coin.js"></script> | |
<!-- include spec files here... --> | |
<script type="text/javascript" src="test/coinTest.js"></script> |
public class CountingSort{ | |
public static void main(String[] args){ | |
int[] a = {5,6,7,1,2,4,5,6,1,0,3,4,2}; | |
printArray(countingSort(a, 7)); | |
} | |
public static int[] countingSort(int[] a, int k){ | |
int[] b = new int[a.length]; | |
int[] c = new int[k + 1]; | |
for(int i = 0; i < a.length; i++) |
//There are 100 people sat at a circular table. | |
//You go around the table asking every second person to leave (starting by asking the guy at seat 1 to leave) until there is one person left. | |
//Which seat is left? | |
//usage: java Survivor 100 | |
class Survivor { | |
public static void main(String[] args){ | |
int n = Integer.parseInt(args[0]); | |
int result = eliminate(1, 1, n, false); | |
System.out.println(result); | |
} |
#!/bin/sh | |
if [ $# -eq 0 ] | |
then | |
echo "usage: explode <dir>" | |
exit 1 | |
fi | |
mv $1/* $1/.. | |
rm -r $1 |
FIND_PUTS = false | |
if FIND_PUTS | |
def puts(*args) | |
print("#{caller.first}: ") | |
super | |
end | |
end |
# Git pre-commit hook to check all staged Ruby (*.rb/haml/coffee) files | |
# for Pry binding references | |
# | |
# Installation | |
# | |
# ln -s /path/to/pre-commit.sh /path/to/project/.git/hooks/pre-commit | |
# | |
# Based on | |
# | |
# http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/ |