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 create_user(request): | |
redirect_to = request.POST.get(REDIRECT_FIELD_NAME, | |
request.GET.get(REDIRECT_FIELD_NAME, urlresolvers.reverse(user_panel))) | |
group = get_object_or_404(GroupDomain, domain=request.META['HTTP_HOST']).group | |
verification_methods = group.groupdomain.verification_method | |
ctx_forms = {'grade': forms.GradeForm} | |
# Get the appropriate forms based on the domain settings | |
if GroupDomain.USERNAME in verification_methods: |
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 django import forms | |
from django.utils.translation import ugettext_lazy as _ | |
from django.contrib.auth import forms as auth_forms, authenticate, get_user_model | |
from django.utils.text import capfirst | |
UserModel = get_user_model() | |
class DynamicAuthenticationForm(auth_forms.AuthenticationForm): | |
""" |
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
INSTRUMENTS = [ | |
'Acoustic Grand Piano', | |
'Bright Acoustic Piano', | |
'Electric Grand Piano', | |
'Honky-tonk Piano', | |
'Electric Piano 1', | |
'Electric Piano 2', | |
'Harpsichord', | |
'Clavi', | |
'Celesta', |
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
# pip install delegator.py zproc | |
# (python3.6 only!) | |
# | |
# python aplay_player.py | |
# (remember to set path to an audio file of your choice at bottom) | |
import atexit | |
import os | |
import signal | |
from pathlib import Path |
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(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'MyApp', | |
initialRoute: '/', |
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
$ flutter doctor --verbose | |
[✓] Flutter (Channel beta, v0.5.1, on Linux, locale en_US.utf8) | |
• Flutter version 0.5.1 at /home/dev/Apps/flutter | |
• Framework revision c7ea3ca377 (6 weeks ago), 2018-05-29 21:07:33 +0200 | |
• Engine revision 1ed25ca7b7 | |
• Dart version 2.0.0-dev.58.0.flutter-f981f09760 | |
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.1) | |
• Android SDK at /home/dev/Android/Sdk | |
• Android NDK location not configured (optional; useful for native profiling support) |
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
somevar = 60 | |
def outer(): | |
somevar = -1 | |
def inner(num): | |
return "My answer is " + str(num + 1) | |
return fnhash(inner) | |
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 pos_safe(fn): | |
def wrapper(self): | |
old = self._pos.copy() | |
fn(self) | |
for i in range(2): | |
if not (0 <= self._pos[i] <= self.bounds[i]): | |
self._pos = old | |
raise ValueError("Robot shall not pass!") | |
self.curpos() | |
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
.idea | |
zproc/*.c | |
zproc/*.so | |
# Created by https://www.gitignore.io/api/python,pycharm | |
### PyCharm ### | |
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm | |
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 |
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 roundrobin(pending): | |
remaining = set(pending) | |
index = 0 | |
while remaining: | |
for requester in list(remaining): | |
try: | |
if process_success(requester, pending[requester][index]): | |
del pending[requester][index] | |
except IndexError: |
OlderNewer