This file contains 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
def test_creation | |
test_ob = TestObject.new | |
test_ob.save | |
# Do some assertions | |
# about saving here | |
end | |
def test_deletion | |
test_ob = TestObject.new | |
test_ob.save |
This file contains 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
#!/usr/bin/python3 | |
from PIL import Image, ImageDraw | |
from random import randrange, choice | |
COLORS = ['black', 'red', 'blue', 'green', 'yellow'] | |
HEIGHT=1000 | |
WIDTH=800 | |
def draw_hline(draw): | |
y = randrange(HEIGHT) |
This file contains 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> | |
<head> | |
<body> | |
<div class="highlighter-coderay"><div class="CodeRay"> | |
<div class="code"><pre><span class="line-numbers"><a href="#n1" name="n1">1</a></span><span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">hello</span> | |
<span class="line-numbers"><a href="#n2" name="n2">2</a></span> <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">'</span><span style="color:#D20">World!</span><span style="color:#710">'</span></span> | |
<span class="line-numbers"><a href="#n3" name="n3">3</a></span><span style="color:#080;font-weight:bold">end</span> | |
</pre></div> | |
</div> | |
</div> |
This file contains 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
> ct = [1, 2] | |
=> [1, 2] | |
> sp = [1, 2] | |
=> [1, 2] | |
> catspec = [[2, 2], [1, 2]] | |
=> [[2, 2], [1, 2]] | |
> csz = ct.zip sp | |
=> [[1, 1], [2, 2]] | |
> catspec & csz | |
=> [[2, 2]] |
This file contains 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
@app.before_request | |
def get_default_context(): | |
g.login_form = forms.LoginForm() | |
flashes = get_flashed_messages(with_categories=True) | |
g.messages = { 'notice': [ msg for cat, msg in flashes if cat == 'notice' ], | |
'error': [ msg for cat, msg in flashes if cat == 'error' ] } | |
#================================================================================ | |
class User(Base, Model, UserMixin): |
This file contains 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
@cli.command() | |
def app(): | |
from profile_list.app import app | |
from profile_list.assets import compile_stylus, css_path | |
import logging | |
from watchdog.observers import Observer | |
from watchdog.events import PatternMatchingEventHandler, LoggingEventHandler | |
logging.basicConfig(level=logging.INFO, | |
format='%(asctime)s - %(message)s', |
This file contains 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
def compile_stylus(): | |
def start_compiler(): | |
# Forming args | |
args.insert(0, os.path.join(_node_bin_path, 'stylus')) | |
with TemporaryDirectory(suffix='styl') as tmpdir: | |
args.append(tmpdir) | |
sp.call(args) | |
sh.copyfile(os.path.join(tmpdir, 'app.css'), | |
os.path.join(css_path, '.app_styl.css')) |
This file contains 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
LoadError - cannot load such file -- ejs: | |
activesupport (4.2.6) lib/active_support/dependencies.rb:274:in `block in require' | |
activesupport (4.2.6) lib/active_support/dependencies.rb:240:in `load_dependency' | |
activesupport (4.2.6) lib/active_support/dependencies.rb:274:in `require' | |
sprockets (3.5.2) lib/sprockets/autoload/ejs.rb:1:in `<top (required)>' | |
activesupport (4.2.6) lib/active_support/dependencies.rb:274:in `block in require' | |
activesupport (4.2.6) lib/active_support/dependencies.rb:240:in `load_dependency' | |
activesupport (4.2.6) lib/active_support/dependencies.rb:274:in `require' | |
sprockets (3.5.2) lib/sprockets/ejs_processor.rb:27:in `block in call' | |
sprockets (3.5.2) lib/sprockets/cache.rb:85:in `fetch' |
This file contains 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
#!/usr/bin/env python3 | |
HTML = True | |
NAME = 'Artemiy' | |
POKEMON = [ | |
{ | |
'species': 'Quilava', | |
'type': 'fire', | |
'moves': [ | |
'flamethrower', |
This file contains 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
const permissionElements = (permissions) => { | |
return AvailablePermissions.map( (p) => { | |
if(permissions[p]) { | |
return <td key={p}>Y</td>; | |
} else { | |
return <td key={p}>N</td>; | |
} | |
}); | |
}; |
OlderNewer