Skip to content

Instantly share code, notes, and snippets.

View ustun's full-sized avatar

Ustun Ozgur ustun

View GitHub Profile
from django.core.conf import settings
class DbgResponse(object):
def process_response(self, request, response):
"""Add html, head, and body tags so debug toolbar will activate."""
if request.GET.get('dbg') and settings.DEBUG:
cnt = response.content
if '<body>' not in cnt:
response.content = '<html><head></head><body>%s</body></html>' % cnt
if 'content_type' in response._headers:
anonymous
anonymous / settings_example.py
Created January 8, 2013 23:41
Django Rotating File Log
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'formatters':{
'simple': {
@bennadel
bennadel / copy.htm
Created January 16, 2013 14:50
Rendering DOM Elements With ngRepeat In AngularJS
<!doctype html>
<html ng-app="Demo" ng-controller="DemoController">
<head>
<meta charset="utf-8" />
<title>Rendering DOM Elements With ngRepeat In AngularJS</title>
</head>
<body>
<h1>
@cloudchen
cloudchen / oocss.css
Last active December 17, 2015 14:39
Simplified OOCSS definitions and some helpers
/*template.css*/
.main{display:table-cell;*display:block;width:auto;}
.row,.main{*zoom:1;}
.row:after,.main:after{clear:both;display:block;visibility:hidden;overflow:hidden;height:0 !important;line-height:0;font-size:xx-large;content:" x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x ";}
.page{margin:0 auto;width:950px;_text-align:left;} /* wraps other template elems to set width */ /* text-align IE5.5 */
.liquid{width:auto;margin:0;}
/* ====== Columns ====== */
.leftCol{float:left;width:250px;_margin-right:-3px;}
.rightCol{float:right;width:300px;_margin-left:-3px;}
@denibertovic
denibertovic / Makefile
Last active January 12, 2016 21:10
Easily start a local Postgres instance for your development environment using docker
DATA_DIR="__data"
POSTGRES_VERSION=9.3
PORT=5432
.PHONY: docker-check postgres
docker-check:
@command -v docker >/dev/null 2>&1 || \
{ echo >&2 "Docker needs to be installed and on your PATH. Aborting."; exit 1; }
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var concat = require('gulp-concat');
var styl = require('gulp-styl');
var refresh = require('gulp-livereload');
var lr = require('tiny-lr');
var server = lr();
var paths = {
js: 'src/**/*.js',
@danharper
danharper / BorderedInput.js
Last active May 16, 2016 20:31
BorderedInput, with Material design style focus animation. Preview: https://i.imgur.com/Fek7rXF.gif
// note there may be a better way to abuse flexbox than this :)
var React = require('react-native')
var { View, TextInput } = React
var BorderedInput = React.createClass({
getInitialState() {
return { i: 0 }
},
const t = require("tcomb");
// imstruct is a tcomb type builder that internally builds an
// Immutable.Record object, but applies tcomb's type system to it
const imstruct = require("../util/imstruct");
const Person = imstruct({
name: t.String,
age: t.Number
});
@davidosomething
davidosomething / README.md
Last active April 12, 2017 09:37
Nightwatch/Selenium test vs CasperJS/PhantomJS test

This is roughly the same test run in both casper and nightwatch.

@brigand
brigand / app.js
Last active June 29, 2017 15:52
React JS Event-Emitter Mixin and Example
var React = require("react"), Dom = React.DOM;
var LogOutButton = require('./src/logout');
var events = require('api/events');
var Main = React.createClass({
// this mixin provides this.emitLogout, and if we set onLogout it'll be called when "logout" is emitted
mixins: [events.mixinFor("logout")],
getInitialState: function(){
return {