This file contains hidden or 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 <chrono> | |
| uint64_t millis() | |
| { | |
| return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count(); | |
| } | |
| uint64_t micros() | |
| { | |
| return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();; |
This file contains hidden or 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
| using namespace physics; | |
| class Drawable { | |
| public: | |
| Vector2D position; | |
| Vector2D velocity; | |
| Drawable() { | |
This file contains hidden or 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 <iostream> | |
| #include <vector> | |
| #include <cstring> | |
| #include <algorithm> | |
| using namespace std; | |
| class Mamal { | |
| public: | |
| virtual void move() = 0; |
This file contains hidden or 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 Person | |
| property name : String | |
| def initialize(@name : String); end | |
| end | |
| struct Human | |
| property name : String | |
| def initialize(@name : String); end |
This file contains hidden or 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
| <?php | |
| class Project { | |
| public $id; | |
| public static $lastId = 1; | |
| public $projects = []; | |
This file contains hidden or 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
| void ClampBodyToScreenArea(float *axis, const float maxAxisDistanceFromCenter, const float velocity, const float screenAxisLength) { | |
| if (velocity > 0) { | |
| *axis = maxAxisDistanceFromCenter + 1; | |
| } else { | |
| *axis = screenAxisLength - maxAxisDistanceFromCenter - 1; | |
| } | |
| } |
This file contains hidden or 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 <iostream> | |
| #include <map> | |
| #include <vector> | |
| #include <string> | |
| using namespace std; | |
| struct Entry { | |
| int id; | |
| string category; |
This file contains hidden or 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
| macro for(definition, condition, incrimentation, &block) | |
| {{definition}} | |
| while {{condition}} | |
| {{block.body}} | |
| {{incrimentation}} | |
| end | |
| end | |
| macro for(expr) | |
| ({{expr.args.first.args.first}}).each do |{{expr.name.id}}| |
This file contains hidden or 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
| /// <reference path="../node_modules/assemblyscript/index.d.ts" /> | |
| declare type u64 = number; | |
| // It’s time for constant time complexity! | |
| var memory = new Map<u64, u64>(); | |
| // Fibonacci wrapper for memory | |
| export function fib(n: u64): u64 { |
This file contains hidden or 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
| /// <reference path="../node_modules/assemblyscript/index.d.ts" /> | |
| declare type u64 = number; | |
| // Recursive Fibonacci function | |
| export function fib(n: u64): u64 { | |
| if (n <= 1) { | |
| return n; |