Skip to content

Instantly share code, notes, and snippets.

View ustun's full-sized avatar

Ustun Ozgur ustun

View GitHub Profile
@LucasRoesler
LucasRoesler / middleware.py
Last active June 27, 2023 17:01
A Django middleware that process JSON data into the appropriate GET or POST variable. I use this with AngularJS, by default POST requests are sent as JSON instead of the urlencoded data expected by Django.
class JSONMiddleware(object):
"""
Process application/json requests data from GET and POST requests.
"""
def process_request(self, request):
if 'application/json' in request.META['CONTENT_TYPE']:
# load the json data
data = json.loads(request.body)
# for consistency sake, we want to return
# a Django QueryDict and not a plain Dict.
@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 {
---
- name: Register New Relic repository.
get_url: url=http://download.newrelic.com/debian/newrelic.list
dest=/etc/apt/sources.list.d/newrelic.list
- name: Download repo key.
apt_key: url=http://download.newrelic.com/548C16BF.gpg
- name: Install New Relic.
apt: pkg=newrelic-sysmond update_cache=yes
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',
@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; }
@nyergler
nyergler / kenobi.el
Created July 28, 2013 20:31
Personal Emacs configuration for detecting virtual environments, adding egg directories, and allowing extra paths to be added to the Jedi auto-completion server.
(add-hook 'hack-local-variables-hook 'run-local-vars-mode-hook)
(defun run-local-vars-mode-hook ()
"Run a hook for the major-mode after the local variables have been processed."
(run-hooks (intern (concat (symbol-name major-mode) "-local-vars-hook"))))
(defun detect_buffer_venv (buffer-name)
(let ((buffer-dir (file-name-directory buffer-name)))
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active April 30, 2024 19:21
5 entertaining things you can find with the GitHub Search API
@killercup
killercup / pandoc.css
Created July 3, 2013 11:31
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active June 5, 2024 06:45
A badass list of frontend development resources I collected over time.
@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;}