Skip to content

Instantly share code, notes, and snippets.

View j0rdm4n's full-sized avatar

Abou Mohamed j0rdm4n

  • Morroco
View GitHub Profile
@j0rdm4n
j0rdm4n / gist:265d3bfa57d2149edb04
Last active August 29, 2015 14:08
Generic detail view must be called with either an object pk or a slug
#Django error :Generic detail view must be called with either an object pk or a slug
#http://computernerddiaries.wordpress.com/
class PostView(DetailView):
template_name = 'post_detail.html'
context_object_name = 'post'
model = Post
class Post(models.Model):
title = models.CharField(max_length=50, unique=True)
@j0rdm4n
j0rdm4n / rAF.js
Created April 3, 2014 13:08 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
##Loading data from a CSV File
#Slow
#Memory expensive
#Buggy
##DATABASE
#A different program;
#Create a string that describes what you want and send it to the database;
#You could have the database on a different machine/different country, all you need to send to it is a query string;
var util = require('util');
var events = require('events');
var redis = require('redis');
var RedisQueueConsumer = function (port, host) {
events.EventEmitter.call(this);
this.port = port || 6379;
this.host = host || '127.0.0.1';
};

IMPORTANT! Remember to check out the wiki page at https://github.com/bebraw/jswiki/wiki/Game-Engines for the most up to date version. There's also a "notes" column in the table but it simply does not fit there... Check out the raw version to see it.

This table contains primarily HTML5 based game engines and frameworks. You might also want to check out the [[Feature Matrix|Game-Engine-Feature-Matrix]], [[Game Resources]] and [[Scene Graphs]].

Name Size (KB) License Type Unit Tests Docs Repository Notes
Akihabara 453 GPL2, MIT Classic Repro no API github Intended for making classic arcade-style games in JS+HTML5
AllBinary Platform Platform Dependent AllBinary 2D/2.5D/3D n
@j0rdm4n
j0rdm4n / models.py
Created February 15, 2014 17:32 — forked from treyhunner/models.py
# This code is under the MIT license.
# Inspired by this StackOverflow question:
http://stackoverflow.com/questions/3295405/creating-django-objects-with-a-random-primary-key
import struct
from Crypto.Cipher import DES
from django.db import models
def base36encode(number):
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
<!DOCTYPE html>
<html>
<head>
<title>Self-expanding textarea</title>
</head>
<body>
<textarea id="expand" rows="8" cols="40"></textarea>
<script type="text/javascript" charset="utf-8">
var textarea = document.getElementById('expand')
var div = document.createElement('div')