Skip to content

Instantly share code, notes, and snippets.

View michaelBenin's full-sized avatar
🏠
Remote

Michael Benin michaelBenin

🏠
Remote
View GitHub Profile
var closureEx = (function iterate(param)
{
if(param>1)
{
setTimeout(iterate, 1000);
param--;
log(param);
this.call(param);
}
})(10);
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<script>
console.log("test");
var countdown = (function(){
var index;
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<script>
console.log("test");
var countdown = (function(){
var index;
*/
function Being () {
this.living = true;
}
Being.prototype.breathes = function () {
return true;
};
Robert.prototype = new Being;
function Robert () {
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<script>
var thomas = new Person('Thomas');
var amy = new Person('Amy');
(function()
{
function User()
{
var user = this;
this.set = function(key, value)
{
user[key] = value;
}
this.get = function(arg)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<canvas id='canvas' style="width:100%; height:100%;"></canvas>
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
function NameSpace()
{
var e, t, n, r, i, s, o, u = arguments;
for (n = 0, r = u.length; n < r; n++)
{
@michaelBenin
michaelBenin / mustache.py
Created June 10, 2013 22:18
Problem: Sharing templates between backbonejs and django. I found that Backbone never needs to actually render out a whole page, only specific views, this allows me to render those views with the same templating language. If it is initial pageload, Backbone js just binds events and allows SEO and a faster page load time, as well as the page func…
from django import template
from django.conf import settings
import pystache
# Needed to register a custom template tag
register = template.Library()
# Decorator to register a tag that takes the context
@register.simple_tag(takes_context=True)
# Function which takes the django context class and the template string
@michaelBenin
michaelBenin / gist:5753378
Created June 10, 2013 23:28
Problem: Sharing templates between backbonejs and django. I found that Backbone never needs to actually render out a whole page, only specific views, this allows me to render those views with the same templating language. If it is initial pageload, Backbone js just binds events and allows SEO and a faster page load time, as well as the page func…
from django import template
from django.conf import settings
import pystache
# Needed to register a custom template tag
register = template.Library()
# Decorator to register a tag that takes the context
@register.simple_tag(takes_context=True)
# Function which takes the django context class and the template string