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
import nox | |
@nox.session | |
@nox.parametrize("flask", ["0.12.4", "1.0.2"]) | |
@nox.session(python=["2.7", "3.6"]) | |
def lint(session): | |
session.install(f"flask=={flask}") | |
session.install("-r", "requirements.txt") | |
session.run('pytest') |
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 deploy(ctx): | |
pull_result = ctx.run("git pull") | |
if is_task_file_changed(pull_result): | |
sys.exit("Pyinvoke task file(s) is changed. Please re-run this task.") | |
ctx.run("pip install -r requirements.txt") | |
ctx.run("python manage.py makemigrations") | |
ctx.run("python manage.py migrate") | |
ctx.run("python manage.py collectstatic --noinput") | |
# Reload application. | |
ctx.run("touch ../reload") |
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
# settings.py | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.mysql', | |
'OPTIONS': { | |
'read_default_file': '/path/to/my.cnf', | |
}, | |
} | |
} |
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
async def application(scope, receive, send): | |
event = await receive() | |
... | |
await send({"type": "websocket.send", ...}) |
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 some_asgi_library import AmazingMiddleware | |
application = AmazingMiddleware(application) |
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 get_hits_on_name(name): | |
""" | |
Accepts a `name` of a mathematician and returns the number | |
of hits that mathematician's Wikipedia page received in the | |
last 60 days, as an `int` | |
""" | |
# url_root is a template string that is used to build a URL. | |
url_root = 'URL_REMOVED_SEE_NOTICE_AT_START_OF_ARTICLE' | |
response = simple_get(url_root.format(name)) |
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
import 'package:flutter/material.dart'; | |
void main() => runApp(new MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( | |
title: 'Login Demo Asap', | |
theme: new ThemeData( |
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
import "package:flutter/material.dart"; | |
import "package:graphql_flutter/graphql_flutter.dart"; | |
class GraphQLConfiguration { | |
static HttpLink httpLink = HttpLink( | |
uri: "http://127.0.0.1:8000/graphql", | |
); | |
ValueNotifier<GraphQLClient> client = ValueNotifier( | |
GraphQLClient( |
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
class QueryMutation { | |
String register(String email, String user, String password){ | |
return """ | |
mutation { | |
register( | |
email: "$email", | |
username: "$user", | |
password1: "$password", | |
password2: "$password", | |
) { |
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
import 'package:flutter/material.dart'; | |
import "package:graphql_flutter/graphql_flutter.dart"; | |
import 'graphQLConf.dart'; | |
import 'queryMutation.dart'; | |
GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); | |
void main() { | |
WidgetsFlutterBinding.ensureInitialized(); | |
runApp( GraphQLProvider( | |
client: graphQLConfiguration.client, |
OlderNewer