Skip to content

Instantly share code, notes, and snippets.

View bulkan's full-sized avatar
🇯🇵

Savun Bulkan Evcimen bulkan

🇯🇵
View GitHub Profile
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))

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

@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
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);
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.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');
};
@bulkan
bulkan / mtest.html
Last active December 17, 2015 06:09
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
window.CocoonJS_ENV = true;
window.onload = function()
{
// Create a canvas and draw something in it.
type LinkedList struct {
head *node
}
func (ll *LinkedList) AddToHead(data int) {
ll.head = &node{data: data, next: ll.head}
}

MEN stack for Python/Django developers

I've always advocated that as a developer, a programming language is just a tool and you should be able to choose the right tool for the right job. Sometimes the circumstances will choose the tool for you. Imagine that time where you need a flat head screw driver and instead used a knife.

For the past five years I've worked with Python and Django. This had the effect of me specializing in Python and being deeply involved in Django. But I've been lucky to be hired as a Software Engineer and I've been working with the MEN stack which includes MongoDB,ExpressJS and Node.js. Which are all new technologies so I've been learning alot.

This post is to help other developers with a similair background as mine to make the jump from Python to Node.js.

Environment

How to create a reusable JavaScript module for Python developers

Most Python developers will have this notion that JavaScript sucks and it's horrible. It's really easy to blame the language than to learn the quirks. It's true that JavaScript has it's quirks like Python. Each to their own.

Also, as Python developer we spend most of our time writing server side code. Creating a new Django view, updating a Model or debugging a SQL query. As developers we always believed that we are horrible at frontend prettyness. There might be truth to this statement, but if you believe you can't do something or try to improve you will always stay away from it.

I have seen as a Pythonista that when frontend work is needed, we quickly hack away at cobbling together a few $.ajax calls with a few $(elem).fadeIn() without ever thinking of maintainability, readability and abstracting certain functionality into components or modules. With Django we will u