This gist provides polyfill code for the
[scrollIntoViewIfNeeded()][SIVIN] Element method found on WebKit
browsers.
There is no particular requirement on the position in the hierarchy of the
| # Auto list fields from django models - from https://djangosnippets.org/snippets/2533/#c5977 | |
| import inspect | |
| from django.utils.html import strip_tags | |
| from django.utils.encoding import force_text | |
| def process_docstring(app, what, name, obj, options, lines): | |
| # This causes import errors if left outside the function | |
| from django.db import models |
| const createStore = (reducer, state = reducer(undefined, {})) => { | |
| const subscribers = new Set() | |
| return { | |
| dispatch: (action) => { | |
| state = reducer(state, action) | |
| subscribers.forEach(func => func(action)) | |
| }, | |
| subscribe: (func) => { | |
| subscribers.add(func) | |
| return () => subscribers.delete(func) |
| <!doctype html> | |
| <meta charset="utf-8"> | |
| <title>Test JavaScript</title> | |
| <style> | |
| .turn-red { color: red; } | |
| .turn-green { color: green; } | |
| .turn-blue { color: blue; } | |
| </style> | |
| <h1>red</h1> | |
| <h1>green</h1> |
| import React from 'react'; | |
| import { container } from 'redux-relay'; | |
| @container({ | |
| variablesFromState: (state) => ({myVariable: state.myState}) | |
| fragments: { | |
| Relay.QL` | |
| viewer { |
| var touchstartX = 0; | |
| var touchstartY = 0; | |
| var touchendX = 0; | |
| var touchendY = 0; | |
| var gesuredZone = document.getElementById('gesuredZone'); | |
| gesuredZone.addEventListener('touchstart', function(event) { | |
| touchstartX = event.screenX; | |
| touchstartY = event.screenY; |
git-prebase improves on 'git rebase -i' by adding information per commit regarding which files it touched.
Add the executable to your path and git will automatically expose it as
| git log --all --numstat --pretty="%H" --author="author" --since=1.year | awk 'NF==3 {plus+=$1; minus+=$2} NF==1 {total++} END {printf("lines added: +%d\nlines deleted: -%d\ntotal commits: %d\n", plus, minus, total)}' |
| sudo su | |
| cat << EOF > /etc/apt/preferences | |
| Package: * | |
| Pin: release n=wheezy | |
| Pin-Priority: 900 | |
| Package: * | |
| Pin: release n=jessie | |
| Pin-Priority: 300 |
| class DisableMigrations(object): | |
| def __contains__(self, item): | |
| return True | |
| def __getitem__(self, item): | |
| return "notmigrations" | |
| MIGRATION_MODULES = DisableMigrations() |