Skip to content

Instantly share code, notes, and snippets.

@vojd
vojd / example.test.js
Created January 12, 2015 10:16
Jasmine test example
(function(){
'use strict';
describe('Auth services test', function(){
var AuthInterceptor, AuthService, $httpProvider, $q, $window, $location;
var $httpBackend;
beforeEach( function () {
/**
@vojd
vojd / clj-libgdx.sh
Last active January 3, 2016 01:48
Creates a skeleton for using Clojure and libGDX. Usage: ``sh clj-libgdx.sh name_of_project``
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo 'Please give your project a name'
exit 0
fi
echo "Creating new clojure-project with libgdx"
git clone git@github.com:vojd/libgdx-skeleton-clj.git
cd libgdx-skeleton-clj
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.utils.cache import patch_response_headers
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page, never_cache
from django.views.decorators.csrf import csrf_exempt
class NeverCacheMixin(object):
@method_decorator(never_cache)
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.utils.cache import patch_response_headers
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page, never_cache
from django.views.decorators.csrf import csrf_exempt
class NeverCacheMixin(object):
@method_decorator(never_cache)
@vojd
vojd / image_rotate.py
Last active December 17, 2015 06:48
Rotate image based on EXIF tags. Useful for iphone uploads
from PIL import Image
def rotate_image(image):
"""
Rotates an image based on EXIF information. Used to mitigate non-rotated landscape photos taken from iPhone.
:Args ``image`` Image, opened using PIL:
"""
ANGLES = {
6: -90,
@vojd
vojd / linuxmint.md
Created April 12, 2013 18:05
Create LinuxMint bootable USB

Creating a bootable USB stick with LinuxMint 14 (works on both Debian and Ubuntu versions)

For OSX

hdiutil convert -format UDRW -o linuxmint-14.1-mate-dvd-64bit.img linuxmint-14.1-mate-dvd-64bit.iso

remove auto-appended .dmg file extension

mv linuxmint-14.1-mate-dvd-64bit.img.dmg linuxmint-14.1-mate-dvd-64bit.img

diskutil list

@vojd
vojd / .slate
Created April 2, 2013 07:42
Slate configuration
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
# Resize Bindings
bind right:cmd;alt resize +10% +0
bind left:cmd:alt resize -10% +0
bind up:cmd;alt resize +0 -10%
bind down:cmd;alt resize +0 +10%
bind right:ctrl;cmd;alt resize -10% +0 bottom-right
@vojd
vojd / summing.py
Last active December 14, 2015 04:29
Mundane summing from lists
objects = [
[{'price' : 100}],
[{'price' : 200}],
[{'price' : 300}]
]
the_sum = 0
for o in objects:
for i in o:
the_sum += i['price']
@vojd
vojd / fibonacci.py
Created January 8, 2013 15:54
fibonacci
def fib(n):
if n < 2:
return n
else:
return fib(n-1) + fib(n-2)
@vojd
vojd / gist:4364500
Created December 23, 2012 17:11
.inputrc
# Autocompletion without case sensitivity
# ---------------------------------------
set completion-ignore-case on
# Word jumping
# ------------
# CTRL left/right arrow
"\e[1;5D": backward-word
"\e[1;5C": forward-word