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 inrange( maxx, maxy ): | |
def func( point ): | |
x,y = point | |
return x >= 0 and x <= maxx and y >= 0 and y <= maxy | |
return func | |
class Game: | |
def __init__(self): | |
self.board = [ |
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
/* | |
* | |
* Wikipedia: | |
* | |
* The final digit of a Universal Product Code is a check digit computed as follows: | |
* | |
* 1) Take digits up to but not including the check digit. | |
* 2) Sum the digits in the odd-numbered positions (first, third, fifth, etc.) together and multiply by three. | |
* 3) Add the sum of digits in the even-numbered positions (0th, 2nd, 4th, 6th, etc.) to the result. | |
* 4) Take result modulo 10 |
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
/* | |
* | |
* Return SQLite3 query results as a Nodejs stream, sensitive to backpressure. | |
* | |
* Assumes a foo.db file with a lot of rows - I used 1000 with a number & a string | |
*/ | |
const stream = require('stream'); | |
const sqlite = require('sqlite3'); | |
class DBStream extends stream.Readable { |
NewerOlder