Skip to content

Instantly share code, notes, and snippets.

View tnibert's full-sized avatar

Timothy Nibert tnibert

View GitHub Profile
@seungjin
seungjin / imageRotate.js
Created June 17, 2009 01:33
image ratate javascript (rotate image 90 degree....)
/* image rotate javascript */
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Benoit Asselin | http://www.ab-d.fr */
function rotate(p_deg) {
if(document.getElementById('canvas')) {
/*
Ok!: Firefox 2, Safari 3, Opera 9.5b2
@rumblestrut
rumblestrut / rotate.js
Created May 4, 2011 21:11
Rotating images with javascript
Oh sure, you could do this with jQuery, but in my early days, this is what I used ...
<script>
<!--
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 8000
// Duration of crossfade (seconds)
var crossFadeDuration = 3
@sindresorhus
sindresorhus / simplexhr.js
Created January 9, 2012 15:19
Simple XMLHttpRequest wrapper
var xhr = function() {
var xhr = new XMLHttpRequest();
return function( method, url, callback ) {
xhr.onreadystatechange = function() {
if ( xhr.readyState === 4 ) {
callback( xhr.responseText );
}
};
xhr.open( method, url );
xhr.send();
@peymano
peymano / gist:2047968
Created March 16, 2012 00:47
Restore from a binary Postgres dump file
pg_restore --clean --no-acl --no-owner -d <database> -U <user> <filename.dump>
@ibeex
ibeex / foo.log
Created August 4, 2012 13:46
Flask logging example
A warning occurred (42 apples)
An error occurred
@almost
almost / glacier.py
Created August 21, 2012 17:59
Amazon Glacier from Python. There's now a branch for this, see here: https://github.com/almost/boto/tree/glacier
# Thomas Parslow http://almostobsolete.net
# Just a work in progress and adapted to what I need right now.
# It does uploads (via a file-like object that you write to) and
# I've started on downloads. Needs the development version of Boto from Github.
#
# Example:
#
# glacierconn = GlacierConnection(AWS_ACCESS_KEY, AWS_SECRET_ACCESS_KEY)
# writer = GlacierWriter(glacierconn, GLACIER_VAULT)
# writer.write(somedata)
@ndarville
ndarville / settings.py
Last active December 16, 2024 16:14
Django on Travis CI
"""A basic database set-up for Travis CI.
The set-up uses the 'TRAVIS' (== True) environment variable on Travis
to detect the session, and changes the default database accordingly.
Be mindful of where you place this code, as you may accidentally
assign the default database to another configuration later in your code.
"""
import os
@yxkelan
yxkelan / limit_file_size.py
Created November 2, 2012 06:15
Limit the uploaded file size Django
#In form.py
#The original source for this : http://djangosnippets.org/snippets/1303/
from django import forms
from django.template.defaultfilters import filesizeformat
from django.utils.translation import ugettext_lazy as _
# 2.5MB - 2621440
# 5MB - 5242880
# 10MB - 10485760
@evansneath
evansneath / crc.py
Created January 27, 2013 22:29
Performs a cyclic redundancy check implemented in Python 3.3 with examples. More about CRC can be found here: http://en.wikipedia.org/wiki/Cyclic_redundancy_check
#!/usr/bin/env python3
def crc(msg, div, code='000'):
"""Cyclic Redundancy Check
Generates an error detecting code based on an inputted message
and divisor in the form of a polynomial representation.
Arguments:
msg: The input message of which to generate the output code.
@Schnouki
Schnouki / movmd.py
Created February 25, 2013 08:20
.mov/.mp4 metadata (date/time) editor
#!/usr/bin/env python3
# -*- mode: python -*-
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law. You can redistribute it and/or modify it under
# the terms of the Do What The Fuck You Want To Public License, Version 2, as
# published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
# details.
# Some useful resources: