This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Taken from row 21 in https://github.com/emilybache/Refactoring-Katas/blob/master/Tennis/python/tennis.py | |
result = { | |
0 : "Love-All", | |
1 : "Fifteen-All", | |
2 : "Thirty-All", | |
3 : "Forty-All", | |
}.get(self.p1points, "Deuce") | |
# The .get(key, default)-part returns the value with key key if found, else the default. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Vanlig textruta --> | |
<input type="text" value="" /> | |
<br /> | |
<!-- Checkbox --> | |
<input type="checkbox" value="" /> | |
<br /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from django.core.management import setup_environ | |
from <project_name> import settings | |
import os, os.path, sys | |
setup_environ(settings) | |
sys.path.append('/the/path/where/the/apps/are') | |
from app.models import Image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gör såhär för att skapa ett konto så att du kan uppdatera informationen: | |
1. Registrera dig med ett konto på Sveroks forum. Detta konto kan du | |
använda för att logga in på hitta.sverok.se, men även på här på wikin | |
(det vore jätteroligt om du hade lust att skapa en sida om din | |
förening här, eller om något annat som har med spel att göra) och på | |
Sveroks bildbank. Kontot ska alltså vara ditt personliga, inte ett | |
föreningskonto. | |
2. När du har gjort det ska du koppla föreningens rättigheter till | |
ditt forumkonto. Logga in med forumkontot på hitta.sverok.se och |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 portioner: 3 dl mjölk, 3 msk socker, 2 msk kakao, 1 msk vaniljsocker. vispa ihop i kastrull och koka upp och låt koka tills den blir tjock. häll i vattensköljda skålar och kyl tills den är kall. jag brukar trycka plastfolie på hela ytan så att den inte får skinn också. :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def save(self, *args, **kwargs): | |
if self.slug == '': | |
self.slug = slugify(self.<field_you_want_to_base_the_slug_on>) | |
super(<ClassName>, self).save(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import Main2 as M2 | |
>>> M2.declaredMethods | |
array(java.lang.reflect.Method, [public static void Main2.main(java.lang.String[]), private static boolean Main2.login(java.lang.String,java.lang.String), private static void Main2.fetch_users()]) | |
>>> M2.declaredMethods[-1] | |
private static void Main2.fetch_users() | |
>>> fu = M2.declaredMethods[-1] | |
>>> fu.accessible = True | |
>>> fu.invoke(M2) | |
>>> M2.declaredFields | |
array(java.lang.reflect.Field, [private static java.lang.String Main2.username, private static java.lang.String Main2.password]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# -*- coding: utf-8 -*- | |
from random import choice, randint | |
from time import sleep | |
from twisted.words.protocols import irc | |
from twisted.internet import protocol, reactor | |
import sys | |
memory = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kwargs = {k : v for k,v in zip(('etag', 'modified'), map(lambda x: getattr(self, x), ('etag', 'last_visited'))) if v} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reset_password(request): | |
form = PasswordForm(request.POST or None) | |
fluff = { 'page_title' : u'Återställ lösenord', | |
'button_text' : 'Skicka nytt lösenord', | |
'form' : form | |
} | |
if request.method == 'POST': | |
if form.is_valid(): |
OlderNewer