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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <cc65.h> | |
#include <conio.h> | |
#include <tgi.h> | |
#include <nes.h> | |
#include <joystick.h> | |
#define TGI_COLOR_BLACK 0x00 | |
#define TGI_COLOR_GREEN 0x01 |
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
/*****************************************************************************\ | |
** mandelbrot sample program for cc65. ** | |
** ** | |
** (w) 2002 by groepaz/hitmen, TGI support by Stefan Haubenthal ** | |
\*****************************************************************************/ | |
#include <stdlib.h> | |
#include <time.h> |
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
#include <stdlib.h> | |
#include <string.h> | |
#include <conio.h> | |
#include <joystick.h> | |
#include <nes.h> | |
static const char text[] = "get on that nesdev"; | |
int main(void) | |
{ |
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
// ========================== Generic (limited) curry function: | |
func curry<A, B, C>(_ f: @escaping (A, B) -> C) -> (A) -> (B) -> C { | |
return { a in { b in f(a, b) }} | |
} | |
// ========================== Example 1: | |
let add = curry((+) as ((Int, Int) -> Int)) | |
let add2 = add(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
// Higher order functions, being curried. Considered pure functional, because they don't have any side effects | |
// (mutate any given data). They just derive data from data. | |
let plus = { (first: Int) in { (second: Int) in first + second } } | |
let multiplesOf = { (first: Int) in { (second: Int) in second % first != 0 } } | |
// Just a simple first class function, not per se functional. Usable to reduce a collection of integers into the total. | |
let total: (Int, Int) -> Int = { $0 + $1 } | |
let calculation = (1...30) | |
.map(plus(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
const fs = require("fs"); | |
const lineLength = 126; | |
const sizeInKb = process.argv[2] || 100; | |
let data = ""; | |
for(var i = 0; i < sizeInKb * 1024; i++) { | |
if (i && i % lineLength === 0) { | |
data += "\n"; | |
} else { |
This file has been truncated, but you can view the full file.
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
19063699041183922230424640119986913758023341770758751642047601347737139606611941581352175797681575117149435847472379921576378 | |
82010873314125910417098681679467651061196703036344503828425038021866296075656578591024747456403918197240660392231867709196530 | |
05547299081771122978128893134012025555840439838755861696435926779779011155301553716406948852775421829267789075611169229413304 | |
42028620073205237675530442721666962286683534927131293735270935475331266785352417198234822645786435208887529004886675157771888 | |
87716254578233139050956841337551473116293899780647416270305365091493516756140179109318676578254373967658333126619554398248807 | |
73901335039931398874577719039802288956276828455645089612214856059038950787855805249688802161731552101060793394882144824301838 | |
80013352318345613661078428780673839967965501913764666716551387847921893809223464453567368379243079836222406059944397498046708 | |
72409291568897359376555992566277167049359808026761803186968491038946326201866824309514704973489863815255632689038911077381036 | |
1679702913915218 |
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
function BatchQueue(concurrentTasks) { | |
this.concurrency = concurrentTasks; | |
this.running = 0; | |
this.queue = []; | |
} | |
BatchQueue.prototype.pushTask = function(task, callback) { | |
this.queue.push(task); | |
this.next(); | |
} |
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
class Optional<T> { | |
private value: T | null = null; | |
private constructor(value: T | null) { | |
this.value = value; | |
} | |
public static some<T>(value: T): Optional<T> { | |
return new Optional(value); |
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
// tslint:disable | |
declare namespace Express { | |
export interface Request { | |
locals: { | |
data: unknown; | |
} | |
} | |
} |