Skip to content

Instantly share code, notes, and snippets.

View bulkan's full-sized avatar
🇯🇵

Savun Bulkan Evcimen bulkan

🇯🇵
View GitHub Profile
goog.provide('events_tutorial.Events');
goog.require('goog.events.Event');
goog.require('goog.events.EventTarget');
events_tutorial.Events = new goog.events.EventTarget();
events_tutorial.Events.ChangeColorEvent = function() {
goog.events.Event.call(this, 'CHANGECOLOR');
};
goog.provide('events_tutorial');
goog.require('lime.Director');
goog.require('lime.Scene');
goog.require('lime.Layer');
goog.require('lime.Label');
goog.require('lime.animation.FadeTo');
goog.require('lime.animation.Spawn');
goog.require('lime.animation.ScaleTo');
goog.provide('events_tutorial.ColoredSprite');
goog.require('lime.Sprite');
goog.require('lime.animation.ColorTo');
goog.require('events_tutorial.Events');
events_tutorial.ColoredSprite = function(width, height) {
goog.base(this);
@bulkan
bulkan / Italiano.md
Last active December 15, 2015 03:29
Italian notes
Person Present
io sono
tu sei
lui/lei è
noi siamo
voi siete
loro sono

how to do things in git

interactive adding of hunks

git add -p <filename>

add upstream original repo

git remote add upstream <upstream git url>

##Undo a commit

from django.template import loader, Context
from django.utils.safestring import mark_safe
class MyWidget(forms.RadioSelect.renderer):
def render(self):
'''Outputs radios'''
t = loader.get_template('my_widget.html')
c = Context({"radios": self,
"name": self.name})
return mark_safe(t.render(c))
from datetime import datetime, timedelta
created_at = datetime(2012, 12, 19, 13, 5, 20, 213002)
if created_at >= datetime.now - timedelta(days=14):
print "two weeks has past since created_at"
def getLocationMap():
locations=Location.objects.all().order_by('-date')
location_array={}
for location in locations:
location_array[location.id]=[str(location.longitude),(location.latitude),location.note,location.title]
return location_array
//JAVASCRIPT
var location_array= $.parseJSON("{{ location_array }}");
@bulkan
bulkan / gist:4221633
Created December 6, 2012 03:48
How To Create a Django MultiWidget

What are MultiWidgets ?

A MultiWidget is a widget that contains more than one widget and bundles it into one. Sometimes you require two or more inputs from the user where the data is not mutually exclusive. For example the expiry date on a credit card or a phone number with the area code.

This blog post will show and explain how to create a MultiWidget for an expiry date that accepts a month and a year.

I heard you like Widgets so I put a Widget into your Widget so you can Widget

Creating a MultiWidget is similar to creating a custom Widget. Here is the code for an expiry date multiwidget that accepts two values the month and year that a credit card expires.

server {
listen 80;
server_name <url>;
root /var/www/html;
location / {