Skip to content

Instantly share code, notes, and snippets.


Juho Vepsäläinen bebraw

View GitHub Profile
class Operation:
def __eq__(self, other):
return self.__class__ == other.__class__
def matches(self, line):
def zip_strs(a, b):
def separate(str):
return [char for char in str]
return zip(separate(a), separate(b))
self.match_args = []
View tinytest_example.php
function testSum() {
assert("sum(3, 5) == 8");
# -*- coding: utf-8 -*-
class MyList(list):
def __init__(self, items, more):
# modify items here
new_items = map(lambda x: x + '_hi', items)
super(MyList, self).__init__(new_items)
# assign rest here
self.more = more
View logo - example of syntax
P 2 # select pen 2
D # pen down
W 2 # draw west 2cm
N 1 # then north 1
E 2 # then east 2
S 1 # then back south
U # pen up
import Blender.BGL as GL
from scocca.frontend.blender.application import *
from scocca.frontend.blender.elements import *
except ImportError:
import OpenGL.GL as GL
from scocca.frontend.pyopengl.application import *
View gist:255407
from placidity.interpreter import Interpreter
def test_sum():
interpreter = Interpreter()
assert interpreter.interpret('1+1') == 2
def test_subtract():
interpreter = Interpreter()
View gist:255410
from placidity.interpreter import Interpreter
class TestInterpreter:
def setup_method(self, method):
interpreter = Interpreter()
self.interpret = interpreter.interpret
class TestAccessVariable:
View gist:255413
class TestUnsetVariable(TestInterpreter):
def test_unset_variable(self):
assert self.interpret('a') == 'null'
def test_variable_in_expression(self):
assert self.interpret('a+3') == 'null'
class Clean:
aliases = 'clean'
description = 'Cleans up stored variables'
def execute(self, variables):
>>> clean = Clean()
Cleaning empty vars should result in empty still
>>> variables = {}
from mock import Mock
from placidity.interpreter import Interpreter
from placidity.utils import Operations
def test_execute_commands():
def execute_with_commands(commands):
assert commands == [command, ]
return 'executed command'
def execute_with_variables(variables):