Skip to content

Instantly share code, notes, and snippets.

@rouge8
rouge8 / fields.py
Created April 23, 2013 16:28
Django REST Framework JSON Field
import json
from rest_framework import serializers
class JSONField(serializers.WritableField):
def to_native(self, obj):
return json.dumps(obj)
def from_native(self, value):
return json.loads(value)
@rouge8
rouge8 / git-status-prompt.sh
Created December 30, 2020 19:40
git status prompt in zig vs bash
#!/bin/bash
# Format 'git status' output for use in my prompt
set -eu
untracked=""
modified=""
for line in $(command git status --porcelain=v1 2> /dev/null | command cut -c-2); do
if [[ $line == ?? ]]; then
@rouge8
rouge8 / .coveragerc
Last active November 13, 2018 04:28
pytest, coverage.py, multi-line set/dict/generator comprehensinos
[run]
source = test_foo
branch = True
[report]
show_missing = True
@rouge8
rouge8 / conf.py
Created July 13, 2017 04:42
sphinx-build -W treats non-sphinx warnings as errors
# -*- coding: utf-8 -*-
#
# Foo documentation build configuration file, created by
# sphinx-quickstart on Wed Jul 12 21:34:14 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
@rouge8
rouge8 / links.rst
Created October 12, 2016 00:51
how to do links in rst
@rouge8
rouge8 / .gitignore
Last active July 29, 2016 18:03
flake8 PicklingError
*.pex
.tox
@rouge8
rouge8 / flows.ipfix
Last active December 29, 2015 01:09
yaf ipfix
@rouge8
rouge8 / conftest.py
Created August 1, 2013 18:47
py.test selenium fixtures
import os
import pytest
from selenium import webdriver
browsers = {
'firefox': webdriver.Firefox,
'chrome': webdriver.Chrome,
}
@pytest.fixture(scope='session', params=browsers.keys())
  1. First, you're going to create a new branch to track the new feature. First, sync up to make sure your local copy has the latest production version of the website:

$ cd ~/git/project $ git fetch origin $ git checkout staging $ git reset --hard origin/staging


Then create the new feature branch:
@rouge8
rouge8 / example.js
Last active December 18, 2015 00:58
angular.module('plunker', ['ui.bootstrap']);
var PaginationDemoCtrl = function ($scope, $location) {
$scope.numPages = 7;
console.log('page should be', $location.search().page);
$scope.currentPage = $location.search().page;
};