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
from flask import Flask | |
from marshmallow import fields | |
from webargs.flaskparser import use_args | |
app = Flask(__name__) | |
hello_args = { | |
'name': fields.Str(required=True) | |
} |
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
#compdef ped | |
# vim: ft=zsh sw=2 ts=2 et | |
_ped() { | |
local curcontext="$curcontext" state line | |
integer NORMARG | |
typeset -A opt_args | |
_arguments -C -s -n \ | |
'(- -h --help)'{-h,--help}'[Show help message]' \ |
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
/** Sugar for creating a React component from a mithril-like module. */ | |
var defcomponent = function(module) { | |
var component = { | |
componentWillMount() { | |
if (module.hasOwnProperty('controller')) { | |
this.ctrl = new module.controller(this.props, this.props.children); | |
} | |
}, | |
render() { | |
return module.view.call(this, this.ctrl, this.props, this.props.children); |
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
/** | |
* Provides sugar for creating a mithril component | |
* tweaked from @mindeavor's imlementation here: https://gist.github.com/mindeavor/25b8aa6810b244665a2e | |
*/ | |
var defcomponent = function (component) { | |
return function(props, content) { return m.component(component, props, content); } | |
}; | |
// DEFINING COMPONENTS |
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
from smore.apispec import APISpec | |
spec = APISpec( | |
title='Swagger Petstore', | |
version='1.0.0', | |
description='This is a sample server Petstore server. You can find out more ' | |
'about Swagger at <a href=\"http://swagger.wordnik.com\">http://swagger.wordnik.com</a> ' | |
'or on irc.freenode.net, #swagger. For this sample, you can use the api ' | |
'key \"special-key\" to test the authorization filters', |
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
"""Proof of concept for converting 3rd-party validators to marshmallow validators, | |
demonstating multiple possible implementations. | |
""" | |
from marshmallow import fields | |
from marshmallow.exceptions import UnmarshallingError, ValidationError | |
import pytest | |
class Converter(object): | |
__name__ = 'Converter' |
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
from marshmallow import Schema, fields | |
class FooSchema(Schema): | |
author_name = fields.Nested('UserSerializer') | |
class Meta: | |
fields = ('id', 'author_name') | |
foos = Foo.query.all() | |
schema = FooSchema(many=True) |
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
- name: test csf | Port scans are denied | |
connection: local | |
sudo: no | |
# doalarm runs a command and returns an error if no output was captured in | |
# 3 seconds | |
# Here, a portscan is attempted; CSF should hang the connection, so doalarm() should | |
# return an error | |
command: doalarm () { perl -e 'alarm shift; exec @ARGV' "$@"; } && doalarm 3 nc -z 192.168.111.111 1-1023 | |
register: portscan_result | |
failed_when: portscan_result.stdout |
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
<button data-areyousure>Default</button> | |
<button data-areyousure="¿Está seguro?" | |
data-confirm="Sí" | |
data-cancel="No">Custom Text</button> | |
<button id="callbacks">Callbacks</button> | |
<script> | |
$("#callbacks").areyousure({ yes: function() {alert('Sure.');}, |
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
Show hidden characters
{ | |
"auto_complete_selector": "source - comment, meta.tag - punctuation.definition.tag.begin", | |
"auto_complete_triggers": | |
[ | |
{ | |
"characters": "$", | |
"selector": "source.coffee, source.js, source.js.embedded.html" | |
} | |
], | |
"bold_folder_labels": true, |