Skip to content

Instantly share code, notes, and snippets.

<!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" xml:lang="en" lang="en">
<head>
<meta name="color:Background" content="#000"/>
<meta name="color:Title" content="#444"/>
<meta name="color:Description" content="#777"/>
<meta name="color:Post Title" content="#6498cc"/>
<meta name="color:Text" content="#444"/>
<meta name="color:Inline Link" content="#6498cc"/>
<meta name="color:Quote" content="#888"/>
@tanelpuhu
tanelpuhu / index.html
Created March 5, 2010 20:45
Twitter Search Ticker vms
<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<style>
.tweet {
background-color:#dfdfdf;
padding:5px;
$(function(){
$('input.default').each(function(){
input = $(this);
input.data("val", input.val());
input.click(function(){
input = $(this);
if(input.val() == input.data("val")) {
input.val("");
# -*- coding: utf-8 -*-
"""FOR FUNNS ONLY!!! :)"""
from simplejson import loads
from urllib import urlopen, quote
from time import sleep
from string import rjust
from sys import argv
url = 'http://search.twitter.com/search.json'
if len(argv)< 2:
import xml.etree.ElementTree as etree
#<doc>
# <nimi>NIMI</nimi>
# <subb>
# <teineSub>wohoo</teineSub>
# </subb>
#</doc>
tree = etree.parse('xml.xml')
root = tree.getroot()
Number.prototype.formatMoney = function(c, d, t){
var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
};
document.write((123456.78).formatMoney(2, ',', ' ')) //123 456,78
a = """
tekst
%s
tekst
%s
""" % (1,2)
#or
a = """
limit_arguments = {
'peer-limit': int(config.get('peer-limit', 30)),
'uploadLimit': int(config.get('uploadLimit', 25)),
'uploadLimited': [False,True][int(config.get('uploadLimit', 25)) > 0],
'seedRatioLimit':float(config.get('seedRatioLimit', 1.5)),
'seedRatioMode':[0,1][float(config.get('seedRatioLimit', 1.5)) > 0],
'seedRatioLimited':[False,True][float(config.get('seedRatioLimit', 1.5)) > 0],
'ids':[]
}
...
@tanelpuhu
tanelpuhu / get_filename.py
Created February 14, 2011 07:01
kas on piisav?
import os
#Nii funkab ka
def get_filename(value):
if isinstance(value, basestring):
i = max(value.rfind('/'), value.rfind('\\'))
if i > 0:
value = value[i+1:]
return value
import unittest
class myTest(unittest.TestCase):
def testTest(self):
self.assertTrue(True)
self.assertFalse(False)
self.assertEquals(1,1)
tests = unittest.TestSuite()
tests.addTest(unittest.makeSuite(myTest))