with a hat tip to Sublime Text 2 Shortcuts
| ⌘; | autocomplete |
| ⌘⌥B | instant replay |
| ⌘⌥E | search across all tabs |
| 'use strict'; | |
| var gulp = require('gulp'); | |
| var gutil = require('gulp-util'); | |
| var del = require('del'); | |
| var uglify = require('gulp-uglify'); | |
| var gulpif = require('gulp-if'); | |
| var exec = require('child_process').exec; | |
| var notify = require('gulp-notify'); |
| #!/usr/bin/env python | |
| from flask import Flask, abort, request | |
| from uuid import uuid4 | |
| import requests | |
| import requests.auth | |
| import urllib | |
| CLIENT_ID = None # Fill this in with your client ID | |
| CLIENT_SECRET = None # Fill this in with your client secret | |
| REDIRECT_URI = "http://localhost:65010/reddit_callback" |
with a hat tip to Sublime Text 2 Shortcuts
| ⌘; | autocomplete |
| ⌘⌥B | instant replay |
| ⌘⌥E | search across all tabs |
This is what we did to setup a few dashboards at platanus
| def AbstractClassWithoutFieldsNamed(cls, *excl): | |
| """ | |
| Removes unwanted fields from abstract base classes. | |
| Usage:: | |
| >>> from oscar.apps.address.abstract_models import AbstractBillingAddress | |
| >>> from koe.meta import AbstractClassWithoutFieldsNamed as without | |
| >>> class BillingAddress(without(AbstractBillingAddress, 'phone_number')): | |
| ... pass |
| import collections | |
| def dict_merge(dct, merge_dct): | |
| """ Recursive dict merge. Inspired by :meth:``dict.update()``, instead of | |
| updating only top-level keys, dict_merge recurses down into dicts nested | |
| to an arbitrary depth, updating keys. The ``merge_dct`` is merged into | |
| ``dct``. | |
| :param dct: dict onto which the merge is executed | |
| :param merge_dct: dct merged into dct |
| from django.utils.safestring import mark_safe | |
| from markdown import markdown | |
| from pygments import highlight | |
| from pygments.formatters import get_formatter_by_name | |
| from pygments.lexers import get_lexer_by_name | |
| from wagtail.wagtailcore import blocks | |
| class CodeBlock(blocks.StructBlock): |
| #! /usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """This module's docstring summary line. | |
| This is a multi-line docstring. Paragraphs are separated with blank lines. | |
| Lines conform to 79-column limit. | |
| Module and packages names should be short, lower_case_with_underscores. | |
| Notice that this in not PEP8-cheatsheet.py |
| from .models import Post, Category | |
| from .decorators import action_form | |
| class PostCategoryForm(forms.Form): | |
| title = 'Update category for the selected posts' | |
| myfile = forms.FileField() | |
| category = forms.ModelChoiceField(queryset=Category.objects.all()) | |
| # django | |
| from django import forms | |
| from django.contrib.staticfiles.templatetags.staticfiles import static | |
| from django.forms import Media, widgets | |
| from django.utils.functional import cached_property | |
| # wagtail | |
| from wagtail.utils.widgets import WidgetWithScript | |
| from wagtail.wagtailcore import blocks |