Skip to content

Instantly share code, notes, and snippets.

@crebma
crebma / TennisKata.md
Last active September 28, 2017 13:55
Tennis Scoring Kata

Write a program to output correct score for a tennis game. Here is the summary of tennis scores:

A game is won by the first player to if the player has won at least four points in total and at least two points more than the opponent.

  • The running score of each game is describe as 'Love', 'Fifteen', 'Thirty' and 'Forty' for points from zero to three.
  • If at least three points is scored by both players and the scores are equal, the score is 'Deuce'.
  • If at least three points is scored by both players and a player has one more point than his opponent, the score of the game is 'Advantage' for the player with more points.
  • Sets and matches are out of scope. We only need to report the score for the current game.

Problem Description

User Story 1

You work for a bank, which has recently purchased an ingenious machine to assist in reading letters and faxes sent in by branch offices. The machine scans the paper documents, and produces a file with a number of entries which each look like this:

    _  _     _  _  _  _  _
  | _| _||_||_ |_   ||_||_|
 ||_ _| | _||_| ||_| _|
fn prime_factors(num: i64) -> Vec<i64> {
let mut number = num;
let mut primes = vec![];
for candidate in 2..number + 1 {
while number % candidate == 0 {
primes.append(&mut vec![candidate]);
number = number/candidate
}
}
primes
@crebma
crebma / Prereqs.md
Last active January 3, 2016 07:09
module PrimeFactors (primeFactors) where
primeFactors :: Integer -> [Integer]
primeFactors 1 = []
primeFactors x = primeFactors' x 2
where primeFactors' x n =
| x < n = []
| x `mod` n == 0 && x > n = [n] ++ primeFactors' (x `div` n, n + 1)
| otherwise = [x]
@crebma
crebma / Code of Conduct.md
Last active August 29, 2015 14:17
Detroit Software Slack Code of Conduct

Note: “DS” in this document refers to the Detroit Software Slack organization at det-software.slack.com. “The administrators” refers to the administrators on this organization, a list is available at the top of the Team Directory (must be a member of the organization to view).

DS is dedicated to providing a harassment-free experience for everyone. We do not tolerate harassment of participants in any form.

This code of conduct applies to all DS spaces, including public channels, private channels and direct messages, both online and off. Anyone who violates this code of conduct may be sanctioned or expelled from these spaces at the discretion of the administrators.

Some DS spaces may have additional rules in place, which will be made clearly available to participants. Participants are responsible for knowing and abiding by these rules.

###Harassment includes:

  • Offensive comments related to gender, gender identity and expression, sexual orientation, disability, mental illness, neuro(a)typicality, physical
@crebma
crebma / gist:10952120
Created April 17, 2014 04:05
keybase.md
### Keybase proof
I hereby claim:
* I am crebma on github.
* I am crebma (https://keybase.io/crebma) on keybase.
* I have a public key whose fingerprint is BA68 F9A9 B932 5C7C 0146 BF86 9AE2 6329 115D F87B
To claim this, I am signing this object:
some kind of awesome intro that does not suck, perhaps mention that obj-c is a superset of c, so if you know c, it ain't no thang
“I can’t teach you Obj-C *and* show you an iOS demo in an hour, so I’m taking you straight down this happy path so you can see working code.”
meet xcode! now minimize it. meet appcode! it has awesome refactoring and code navigation support! but you still need xcode.
iOS looks weird. let's get over that now! some differences and hopefully helpful translations:
NS vs packages
headers & implementations vs one class file
protocols vs interfaces?
properties vs dumb getters & setters
@crebma
crebma / gist:4614651
Created January 23, 2013 22:15
Using the prototype to isolation test backbone stuff
MyView = Backbone.View.extend({
initialize: function() {
//stuff I don't want to happen
},
render: function() {
this.yourMom();
},