Skip to content

Instantly share code, notes, and snippets.

@Kos
Kos / shaderlines.py
Created January 15, 2013 18:40
This module shows... a) how GLSL error locations are presented depending on how the shader source is passed (one string vs array of strings), b) whether a single token can spread across several source strings.
'''
This module shows...
a) how GLSL error locations are presented depending on how the shader source is passed
(one string vs array of strings),
b) whether a single token can spread across several source strings.
'''
import ctypes
from OpenGL import GL
@Kos
Kos / gist:4442668
Created January 3, 2013 11:02
How to make your coworkers angry: Decorators. (Who likes nested functions?)
import operator
commands = {}
@operator.attrgetter('__get__')
def command(name, func):
commands[name] = func
return func
@Kos
Kos / 01_backend.py
Created November 22, 2014 21:04
Dajaxice replacement idea
from rest_framework.decorators import api_view
from rest_framework.response import Response
import ajaxmelt
@ajaxmelt.register('POST')
@api_view
@login_required
def edit_name(request):
campaign = get_object_or_404(Campaign.objects.visible_to(request.user), id=campaign_id)
@Kos
Kos / UglifyJSCompressor.py
Created February 28, 2014 12:48
Source maps with Django Compressor
import os
import shutil
import subprocess
import tempfile
import uuid
from compressor import base
from compressor.conf import settings as compressor_settings
from compressor.js import JsCompressor
from django.conf import settings
from django.core.files import File