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
import java.util.Arrays; | |
import java.util.List; | |
import java.util.ArrayList; | |
// The following are required for implementing the Iterable and Iterator interfaces. | |
import java.lang.Iterable; | |
import java.util.Iterator; | |
import java.util.NoSuchElementException; | |
public class SeekableList<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
// Pointers | |
int a = 3, b = 4; | |
int c = 1, d = 2; | |
int* pa = &a; | |
int e = *pa; |
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
public boolean compare(Grid<T> grid2) { | |
if(this.row != grid2.row || this.col != grid2.col) { | |
return false; | |
} | |
for(Grid<T>.Element tmpElem : this.elements()) { | |
Grid<T>.Element tmpElem2 = grid2.getElement(tmpElem.pos()); | |
T v1 = tmpElem.value(); | |
T v2 = tmpElem2.value(); |
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
<html> | |
<style> | |
//put all styles here | |
body { | |
background: brown; | |
} | |
</style> | |
<body> | |
<!-- Put all html here --> | |
horse |
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
import random #definitely a good thing to see at the top of a multiple-dispatch implementation! | |
import abc | |
import itertools | |
class ArgValidator: | |
@classmethod | |
def validate(cls, *args, mro_distances=None): | |
if mro_distances is None: | |
mro_distances = [] | |
#disqualify validation rules with the wrong number of arguments |
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
from chatto_transform.schema.schema_base import cat | |
from libc.string cimport memcpy | |
from cpython cimport array | |
import array | |
import numpy as np | |
cimport numpy as np | |
import pandas as pd | |
from libc.stdlib cimport malloc, free |
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
from functools import wraps | |
def do(lift_func=iter): | |
""" | |
Decorator that allows python generators to behave a bit like Haskell's do blocks. | |
The basic intuition to follow is that the Haskell "x <- y" syntax is mimicked in python by "x = yield y", | |
if it occurs inside a generator function decorated by @do(). | |
By passing different arguments to @do(), you can change which monad type is mimicked. |
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
from distributed import Client, Queue, Variable, get_client, secede, rejoin, wait, fire_and_forget | |
from time import sleep | |
import gc | |
from functools import partial | |
from collections import Counter, defaultdict, namedtuple | |
from tornado import gen | |
import pandas as pd |
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
import pickle | |
import importlib | |
import pkg_resources | |
from operator import attrgetter | |
from functools import reduce | |
import io | |
from contextlib import ExitStack | |
from collections import defaultdict | |
""" |
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
import sys | |
import functools | |
""" | |
Python Atrocity: Structural Pattern Matching built on Exception Handling Syntax | |
Daniel Spitz | |
(Python 3.7+ only) | |
The goal of this Python Atrocity is to implement extensible, composable pattern |