Skip to content

Instantly share code, notes, and snippets.

class PostListView(SiteRootView, TemplateView):
template_name = 'posts.html'
def get_context_data(self, **kwargs):
context = super(PostListView, self).get_context_data(**kwargs)
context['posts'] = cm.Post.objects.all().order_by('-updated_at')
return context
{
"name": "Indiepen",
"version": "0.0.3",
"main": "path/to/main.css",
"ignore": [
".jshintrc",
"**/*.txt",
"**/.*",
"node_modules",
"bower_components",
@neuman
neuman / EmbeddedMixin.py
Created March 5, 2014 22:03
EmbeddedMixin
class EmbeddedMixin(object):
def get_embedded(self, hierarchy, key, value, depth=0, indexes=False):
"""get a list containing the ordered indexes of embedded documents.
A recursive depth first search replacing the nested for loops normally required
to iterate through nested objects contained within lists to find a single object
that has a specific value for a specific key.
Keyword Arguments:
hierarchy -- a list of keys needed to access the list containingthe next level of objects to search
@neuman
neuman / texture_inside.shader
Last active August 29, 2015 14:05
texture_inside.shader
Shader "Custom/texture_inside" {
Properties {
_Color("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans(A)", 2D)="white"{}
}
SubShader {
Tags { "RenderType" = "Opaque" }
@neuman
neuman / tours.json
Last active August 29, 2015 14:07
tours
{
"initial_id":"alpha",
"spheres":[
{
"id":"alpha",
"title":"dining",
"projection_image_url":"https://s3.amazonaws.com/projectastraltours/highgarden/dining_4096.jpg",
"width":4096,
"height":2048,
"doors":[
class KensView(MessageView):
def get_context_data(self, **kwargs):
kens_var = request.POST.get("kens_thing", "")
messages.info(request, 'kens message here')
# Call the base implementation first to get a context
context = super(MessageView, self).get_context_data(**kwargs)
# Add in a QuerySet of all the books
context['message'] = self.message
return context
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
using System.Collections;
using System.Collections.Generic;
using System;
public class WebImageDisplay : MonoBehaviour
{
SqueakyModel.TwitterAccount: (models.E004) 'id' can only be used as a field name if the field also sets 'primary_key=True'.
@neuman
neuman / gist:d328a996198e4000cc4b
Last active August 29, 2015 14:16
score format
{
"scores":[
{
"title":"Score Summary",
"value":87,
"subscores":[
{
"title":"FIT",
"value":50,
"subscores":[
@neuman
neuman / gist:53e3ee878a2c29e09681
Created February 24, 2015 22:03
heroku settings
"""
Django settings for coffeed project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""