Skip to content

Instantly share code, notes, and snippets.

http://reinh.com/blog/2009/03/02/a-git-workflow-for-agile-teams.html
- git checkout -b NUMBER_BRANCH_DESCRIPTION
- git commit // Multiple times
- git rebase -i origin/master // Compress down all the commits into a single one. Pick first line, squash rest
- git checkout master
- git merge NUMBER_BRANCH_DESCRIPTION
- git push origin master // Send everything back to github
- git branch -d NUMBER_BRANCH_DESCRIPTION
@bmease
bmease / gist:2820527
Created May 28, 2012 18:29
Example formset
def liquid_comment_add(request, liquid_id):
liquid = get_object_or_404(Liquid, pk=liquid_id)
if request.method == "POST":
formset = CommentForm(request.POST)
if formset.is_valid():
liquid.comments.create(
@bmease
bmease / gist:2820857
Created May 28, 2012 19:41
got rid of factory
# views.py
def add_tip(request):
if request.method == "POST":
formset = AddTipForm(request.POST)
if formset.is_valid():
formset.save()
else:
formset = AddTipForm()
@bmease
bmease / gist:3813550
Created October 1, 2012 18:29
When trying to parse underscore templates with lxml.html it is dropping the underscore variable tags.
>>> import lxml.html
>>> content = "<html><%= SoftwareName %></html>"
>>> doc = lxml.html.fromstring(content)
>>> lxml.html.tostring(doc)
'<html></html>'
@bmease
bmease / scrape.py
Created March 15, 2013 12:34
Example scraping of alice in vapeland.
import requests
from lxml import html
def get_list():
"""Finds all the liquids from the index page"""
# Make the request to the website
request = requests.get('https://aliceinvapeland.com/e-juices')
# Parse the request into some fancy structure
from django.views.generic import ListView, DetailView
from .models import Drink
class DrinkListView(ListView):
model = Drink
class DrinkDetailView(DetailView):
model = Drink
@bmease
bmease / Readme.md
Last active February 15, 2017 18:03
A dashing widget that displays tickets for Freshdesk.com

Description

A dashing widget that displays tickets for Freshdesk.com

  • Displays unassigned tickets subject and time.
  • Displays Ticket counts assigned to Agents.
  • Time for each ticket changes color depending on age.

Preview

Freshdesk Dashing Widget

@receiver(post_save, sender=User)
def create_default_shelves(sender, **kwargs):
'''Creates default shelves for a user'''
if kwargs['created'] is True:
user = kwargs['instance']
for name, slug in DEFAULT_SHELF_NAMES:
shelf = Shelf(name=name, slug=slug, user=user)
shelf.save()
Initial state: Input(DVI), Output(DVI)
Goal state: Output(VGA)
Actions:
VGAAdapter(DVI, VGA)
Preconditions: Output(DVI)
Postconditions: !Output(DVI), Output(VGA)
@bmease
bmease / gist:8771232
Created February 2, 2014 16:49
Unable to pull Shipyard
(2.7)[11:44][brad:~]$ sudo docker run -i -t -v /var/run/docker.sock:/docker.sock shipyard/deploy setup
Unable to find image 'shipyard/deploy' (tag: latest) locally
Pulling repository shipyard/deploy
773d91471724: Error pulling image (latest) from shipyard/deploy, endpoint: https://cdn-registry-1.docker.io/v1/, link /var/lib/docker/devicemapper/mnt/b56cd19da7ba384351e680ec2b0035916d21268bd416dc42b93bb39311050cbf/rootfs/.wh..wh.plnk/278.3440042 /var/lib/docker/devicemapper/mnt/b773d91471724: Error pulling image (latest) from shipyard/deploy, link /var/lib/docker/devicemapper/mnt/b56cd19da7ba384351e680ec2b0035916d21268bd416dc42b93bb39311050cbf/rootfs/.wh..wh.plnk/278.3440042 /var/lib/docker/devicemapper/mnt/b56cd19da7ba384351e680ec2b0035916d21268bd416dc42b93bb39311050cbf/rootfs/var/lib/dpkg/available-old: no such file or directory
b56cd19da7ba: Pulling metadata
2014/02/02 11:45:01 Could not find repository on any of the indexed registries.