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
function getLargestArray(a, b) { | |
let as = a.map(_ => 'x').join(''); | |
let bs = b.map(_ => 'x').join(''); | |
let arx = new RegExp(as); | |
let brx = new RegExp(bs); | |
let aNotShorter = as.match(brx) !== null; | |
let bNotShorter = bs.match(arx) !== null; | |
let compare = aNotShorter - bNotShorter; | |
switch (compare) { | |
case -1: return b; |
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
use std::rc::Rc; | |
#[derive(Copy, Clone)] | |
struct IntInt { | |
x: i32, | |
y: i32, | |
} | |
struct Cons<T: Copy> { | |
elt: T, |
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 <vector> | |
#include <cstdio> | |
struct Node { | |
int value; | |
Node *next; | |
Node(int _value, Node *_next): value(_value), next(_next) {} | |
~Node() { |
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
fn make_test_evaluator() -> Box<Fn(YourTestCaseTypeHere)> { | |
use std::cell::RefCell; | |
struct EvalGuard(bool); | |
impl Drop for EvalGuard { | |
fn drop(&mut self) { | |
if !self.0 { | |
panic!("Did not actually evaluate test cases"); | |
} |
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
Rust… | |
- is functional | |
- but not pure, so you can printf-debug without IO() ALL THE FUNCTIONS | |
- has a strong Hindley-Milner type system | |
- but has convenient implicit coercions too, so you don't have to cast all over the place | |
- safe and high-level (with ownership, static/dynamic borrowing, Send and Sync) | |
- yet deterministic and fast with zero-/low-cost abstractions and RAII | |
- has a standard build system and dependency management | |
- but it doesn't force you to use it, and it has a simple Make-like CLI that doesn't hurt | |
- lets you write your code in the 'modern' IDE of your choice with all bells and whistles |
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
Békésen ülök a Mammut KFC-ben, mellettem két, 24-28 éves forma lány. Egyikük hevesen ecseteli | |
a pasizás terén véghezvitt hőstetteit. | |
Sztori #1: Volt egy barátja, annak egy húga. A húgnak volt egy pasija. A csaj ezzel a csávóval jött össze, | |
még mielőtt a barátjával szakított volna, ezért hetekig titkolóztak – amit a leányzó láthatóan roppant humorosnak tartott. | |
Sztori #2: Nagyon büszke volt arra is, hogy ezután (meg előtt) volt pár egyéjszakás kalandja is. (vajon közben is voltak…?) | |
Sztori #3: 2 hónapig volt egy 20 éves (!!!) barátja, aki állítása szerint 16-ként viselkedett. De legalább vicces volt! | |
Úgy látszik, azt, hogy – idézem "mások előtt is képtelen volt normálisan viselkedni" –, ez teljesen jól ellensúlyozta. | |
Na, ezek után végre kifújta magát, így hagyta a másik lányt is szóhoz jutni, aki erre: "Jé, ez olyan érdekes! Nekem |
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 <stdio.h> | |
#include "bmp.h" | |
typedef struct __attribute__((packed)) { | |
uint16_t bfType; // specifies the file type | |
uint32_t bfSize; // specifies the size in bytes of the bitmap file | |
uint16_t bfReserved1; // reserved; must be 0 | |
uint16_t bfReserved2; // reserved; must be 0 | |
uint32_t bfOffBits; // species the offset in bytes from the bitmapfileheader to the bitmap bits |
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
Learning TODO: | |
~~~~~~~~~~~~~~ | |
* Theoretical(-ish) Stuff: | |
------------------------ | |
- Computer Science, Algorithms, Data Structures (e.g. Finite Automata, | |
Classic Graph Algos, Searching and Sorting, Solutions to NP-Complete | |
Problems, Inventing and Using Heuristics, Complexity Theory in Depth, |
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
use std::ops::{Add,Sub,Mul,Div,Neg}; | |
use std::fmt; | |
use std::fmt::Display; | |
#[derive(Clone, Copy, Debug)] | |
struct Complex { | |
re: f32, | |
im: f32, | |
} |
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
1 + 0.000i 1 + 1.732i 1 - 1.732i | |
1 + 1.732i -2 + 3.464i 4 - 0.000i | |
1 - 1.732i 4 - 0.000i -2 - 3.464i |