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 consumer1() -> int: | |
... | |
... = producer("A") | |
... | |
def consumer2() -> int: | |
... | |
... = producer("B") | |
... |
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
# Because the strands are very long, in order to sequence DNA, | |
# labs will first split the strands into many small overlapping pieces. | |
# Once they're sequenced, the pieces need to be recombined. | |
# Write a function that recombines overlapping pieces into a single strand of DNA. | |
# Each sequenced piece contains Adenine, Thynine, Cystosine and Guanine represented by 'A', 'T', 'C', and 'G', respectively. | |
# Two pieces can connect if they overlap at least one base pair. | |
# Assume that there is only one way to combine all the pieces into a single strand. | |
from functools import reduce, partial |
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 eastward(level, position): | |
return (2**(level - 1)) * (int(position) % 2) | |
def southward(level, position): | |
if int(position) < 2: | |
return 0 | |
else: | |
return 2**(level - 1) | |
def absolute_position(quadkey, x=0, y=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
north_south = { | |
'0': '2', | |
'2': '0', | |
'1': '3', | |
'3': '1' | |
} | |
east_west = { | |
'2': '3', | |
'3': '2', |
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
### Keybase proof | |
I hereby claim: | |
* I am desmondrawls on github. | |
* I am desmond22 (https://keybase.io/desmond22) on keybase. | |
* I have a public key ASATQfxOZQvwbbvfaK23X3PKMxL_MVkvz3eDlKI5yP8aMwo | |
To claim this, I am signing this object: |
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
import {fizzbuzz} from './fizzbuzz' | |
describe('fizzbuzz', () => { | |
describe('numbers that are not multiples of 3 or 5', () => { | |
it.each([1,2,4,7,8,11])('returns %j unchanged', input => { | |
expect(fizzbuzz(input)).toEqual(input) | |
}) | |
}) | |
describe('numbers that are multiples of 3 but not 5', () => { |
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
export const fizzbuzz = (i) => { | |
var thingsItsNotDivisibleBy = [] | |
var stringI = i.toString() | |
var tempI = i | |
var elementsOfStringI = () => { | |
var elements = [] | |
for(i = 0; i < stringI.length; i++) | |
if(parseInt(stringI[i]) != 0) elements = [...elements, parseInt(stringI[i])] | |
return elements | |
} |
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
import { Path, State, initialState } from "./PathFinder"; | |
describe('PathFinder', () => { | |
it('works', () => { | |
let actual = new Path<State>(initialState).path("driverInfo").path("gender").action("unicorn"); | |
expect(actual.payload).toEqual({ "driverInfo": { "gender": "unicorn" } }); | |
}); | |
}); |
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
package main | |
import ( | |
"errors" | |
"fmt" | |
"strings" | |
) | |
func main() { | |
fmapOutcome, err := fmap(getName, isValidName)() |
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
interface Either<V> { | |
map: <T>(f: (V) => T) => Either<T> | |
fold: <L,R>(l: (V) => L, r: (V) => R) => L | R | |
} | |
function left<V>(x: V): Either<V> { | |
return { | |
map: _ => left(x), | |
fold: (l, r) => l(x) | |
} |
NewerOlder