Skip to content

Instantly share code, notes, and snippets.

View erikkaplun's full-sized avatar

Erik Kaplun erikkaplun

  • UXO
  • Tallinn, Estonia
View GitHub Profile
@erikkaplun
erikkaplun / output
Created January 25, 2011 21:57
Paydays
Monday, 31.01.2011 Wednesday, 19.01.2011
Monday, 28.02.2011 Tuesday, 15.02.2011
Thursday, 31.03.2011 Tuesday, 15.03.2011
Friday, 29.04.2011 Friday, 15.04.2011
Tuesday, 31.05.2011 Wednesday, 18.05.2011
Thursday, 30.06.2011 Wednesday, 15.06.2011
Friday, 29.07.2011 Friday, 15.07.2011
Wednesday, 31.08.2011 Monday, 15.08.2011
Friday, 30.09.2011 Thursday, 15.09.2011
Monday, 31.10.2011 Wednesday, 19.10.2011
@erikkaplun
erikkaplun / testcase1.py
Created January 26, 2011 13:03
Seleniumi test case'id
import re
import time
import unittest
import selenium
class TestCase1(unittest.TestCase):
def setUp(self):
self.verification_errors = []
@erikkaplun
erikkaplun / foo.py
Created January 26, 2011 19:29
Moodulite importimine
def hello():
print('Hello!')
def say_greetings(name):
print('Greetings, %s!' % name)
# Python 3:
# print('Greetings, {0}!'.format(name))
@erikkaplun
erikkaplun / foo.py
Created January 26, 2011 19:47
Maagiline muutuja __name__
print('Inside file foo.py; and __name__ is %s' % __name__)
# ekraanile ilmub tekst:
# Inside file foo.py; and __name__ is foo
# kui foo.py käivitatakse otse, ilmub foo asemel:
# Inside file foo.py; and __name__ is __main__
def do_something_cool():
print('Doing something cool...')
<!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>Täheaabits</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>img</title>
<link rel="stylesheet" href="css/supersized.css" type="text/css" media="screen" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript" src="js/supersized.3.1.3.min.js"></script>
@erikkaplun
erikkaplun / index.html
Created April 21, 2011 12:20
Ideelabor pildirakendus
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>img</title>
<link rel="stylesheet" href="css/supersized.css" type="text/css" media="screen" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Selver</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="reset.css" type="text/css" media="screen, print, projection" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen, print, projection" />
<script type="text/javascript" src="jquery-1.4.3.min.js"></script>
<link href="jquery.loadmask.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.loadmask.min.js"></script>
@erikkaplun
erikkaplun / selfdocumenting.py
Created January 30, 2012 14:31
@selfdocumenting decorator
import inspect
def selfdocumenting(f):
f.__doc__ = inspect.getsource(f)
return f
# well written method
@selfdocumenting
@erikkaplun
erikkaplun / Fact.java
Created March 8, 2012 13:31
Cython factorial bench
public class Fact {
static private int factorial(int n) {
int ret = 1;
for (int j = n; j > 0; j -= 1) {
ret *= j;
}
return ret;
}
static private void bench() {