Skip to content

Instantly share code, notes, and snippets.

View eevee's full-sized avatar
🦊

Eevee eevee

🦊
View GitHub Profile
@eevee
eevee / __output__
Created July 1, 2014 06:23
proof of concept of fancy-ass yaml schema (this code is a travesty)
glaceon: !!python/object/apply:collections.OrderedDict
dictitems:
base-happiness: 70
capture-rate: 45
color: blue
hatch-counter: 0
identifier: glaceon
is-dimorphic: false
types: [ice]
this is an egregiously long line, meant only as a test of whether a gist will wrap long lines of plain text when it knows for sure that the language is plain english text
@eevee
eevee / gist:8da6845886c524bc3e86
Created July 27, 2014 03:59
logging configuration brought to you by configparser
# Begin logging configuration
[loggers]
keys = root, veekun_pokedex, sqlalchemy
[handlers]
keys = console
[formatters]
keys = generic
@eevee
eevee / gist:78e52d55f171c78def0e
Created August 26, 2014 22:17
plumbum patch to fix TEE with a stderr redirect
diff --git a/plumbum/commands/modifiers.py b/plumbum/commands/modifiers.py
index 30f8dbf..1a5f8e6 100644
--- a/plumbum/commands/modifiers.py
+++ b/plumbum/commands/modifiers.py
@@ -151,12 +151,26 @@ class TEE(ExecutionModifier):
with cmd.bgrun(retcode=self.retcode, stdin=None, stdout=PIPE, stderr=PIPE) as p:
outbuf = []
errbuf = []
+ buffers = {}
+ tee_to = {}
@eevee
eevee / gist:9cf655e617859d2765f7
Created September 4, 2014 00:40
outline shader for THREE.js
var outline_shader = {
uniforms: {
"linewidth": { type: "f", value: 0.3 },
},
vertex_shader: [
"uniform float linewidth;",
"void main() {",
"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
"vec4 displacement = vec4( normalize( normalMatrix * normal ) * linewidth, 0.0 ) + mvPosition;",
"gl_Position = projectionMatrix * displacement;",
@eevee
eevee / frozenobject.py
Created September 12, 2014 00:37
frozenobject
class FrozenMeta(type):
"""Metaclass for freezing a type after construction. Only ``__init__``
will be allowed to assign to attributes.
"""
def __call__(cls, *args, **kwargs):
obj = super(FrozenMeta, cls).__call__(*args, **kwargs)
obj.__frozen__ = True
return obj
@eevee
eevee / gist:e6fa8cde4df38f234664
Created September 19, 2014 19:53
notes on config var usage in pyscss
[ok] DEBUG: only used by scss.legacy
VERBOSITY: used in scss.util?
PROJECT_ROOT: only used as a default in scss.config and in a couple tests
[ok] LOAD_PATHS: only used in scss.legacy and scss.tool
ASSETS_ROOT:
- compass.images, as place to search for image-url()
- compass.sprites, as place to write out sprite-map()
- extra, as place to write out background-noise(), background-brushed(), etc.
- fonts, as place to write out font-sheet()
CACHE_ROOT:
@eevee
eevee / gist:4dcfe41ae4b1d906adee
Last active August 29, 2015 14:06
mutable hash keys in ruby
irb(main):001:0> h = {}
=> {}
irb(main):002:0> a = [1, 2, 3]
=> [1, 2, 3]
irb(main):003:0> h[a] = 5
=> 5
irb(main):004:0> h
=> {[1, 2, 3]=>5}
irb(main):005:0> h[[1, 2, 3]]
=> 5
@eevee
eevee / inform7.py
Created October 22, 2014 01:22
Flax collision detection ported to inform 7 style
@Walk.check(Solid)
def cant_walk_through_solid_objects(event, _):
event.cancel()
@Walk.check(DoorPhysics)
def cant_walk_through_closed_doors(event, _):
if not IOpenable(event.target).open:
event.cancel()
@eevee
eevee / gist:6a257a9d42400e2d03f9
Last active July 26, 2018 09:18
Pokédex schema versioning problem

Schema versioning

I have some problems related to how core data in the Pokémon games has changed over time. "Time" here is a discrete quantity, where each game is a point in time.

Well actually

I just said each game is a point in time and I am lying. Many of the games come in pairs, which come out simultaneously. So Red and Blue are distinct