This file contains hidden or 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
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using UnityEditor; | |
| using UnityEditor.UIElements; | |
| using UnityEditor.Experimental.GraphView; | |
| using UnityEngine.UIElements; | |
| using GraphProcessor; | |
| [NodeCustomEditor(typeof(MapOutputNode))] |
This file contains hidden or 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
| SRCS=$(wildcard *.c) | |
| OUTDIR=dist | |
| TARGET=$(OUTDIR)/app | |
| all: $(TARGET) $(TARGET).exe | |
| clean: | |
| rm -f $(OUTDIR) | |
| $(OUTDIR): |
This file contains hidden or 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
| upstream foo { | |
| server foo-container:80; | |
| } | |
| upstream bar { | |
| server bar-container:3000; | |
| } | |
| map $subdomain $container { | |
| foo foo; |
This file contains hidden or 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
| # Runtime type checking concept | |
| from functools import wraps | |
| def signature(*types): | |
| def decorator(func): | |
| @wraps(func) | |
| def wrapper(*args, **kwargs): | |
| for i, t in enumerate(types): | |
| if i >= len(args): |
This file contains hidden or 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 random | |
| import pprint | |
| import sys | |
| # 7 Prisoners, 1 designated counter | |
| prisoners = [ | |
| {"seen": False, "is_counter": False, "messaged": False}, | |
| {"seen": False, "is_counter": False, "messaged": False}, | |
| {"seen": False, "is_counter": False, "messaged": False}, |
This file contains hidden or 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
| SET FOREIGN_KEY_CHECKS=0; | |
| truncate table `auth_user_user_permissions`; | |
| truncate table `auth_permission`; | |
| truncate table `django_content_type`; | |
| SET FOREIGN_KEY_CHECKS=1; |
This file contains hidden or 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
| # Returns "*" if the current git branch is dirty. | |
| _parse_git_dirty() | |
| { | |
| [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] && echo "*" | |
| } | |
| # Get the current git branch name (if available) | |
| _git_prompt() | |
| { | |
| local ref=$(git symbolic-ref HEAD 2>/dev/null | cut -d'/' -f3) |
This file contains hidden or 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
| # Standard django choices style | |
| CHOICE_APPLE = 'apple' | |
| CHOICE_BANANA = 'banana' | |
| CHOICE_ORANGE = 'orange' | |
| FRUIT_CHOICES = ( | |
| (CHOICE_APPLE, 'Apple'), | |
| (CHOICE_BANANA, 'Banana'), | |
| (CHOICE_ORANGE, 'Orange'), | |
| ) |
This file contains hidden or 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.db import models | |
| from django.db.models.signals import post_save | |
| from django.db.models.loading import get_model | |
| from cachemodel.decorators import cached_method | |
| def model2label(obj): | |
| return ("%s.%s" % (obj._meta.app_label, obj._meta.object_name)) | |
This file contains hidden or 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 tastypie.validation import CleanedDataFormValidation | |
| def pick(d, keys): | |
| """Based on http://underscorejs.org/#pick""" | |
| return dict((key, val) for key, val in d.items() if key in keys) | |
| class BaseFormValidation(CleanedDataFormValidation): | |
| """ |
NewerOlder