Skip to content

Instantly share code, notes, and snippets.

View varmais's full-sized avatar

Teemu Tiilikainen varmais

View GitHub Profile
@varmais
varmais / gist:6218608
Created August 13, 2013 07:15
Disable mouse acceleration OS X
defaults write .GlobalPreferences com.apple.mouse.scaling -1
<section id="amica-camera" class="side-section row">
<div class="span4">
<header>
<h2>Ruokajono</h2>
</header>
<article>
<img src="http://proto59.haaga-helia.fi/~ruokalakamera/picture.jpg">
<p>Kuva ruokalasta päivittyy 2 min välein ma-pe klo 10.15 - 15.00.</p>
</article>
</div>
@varmais
varmais / safkat.py
Last active December 21, 2015 18:58
#!/usr/bin/env python
#coding: utf-8
from BeautifulSoup import BeautifulSoup
from urllib2 import urlopen
viikonsafkat = {}
def haeLista2():
url = 'http://www.amica.fi/paaraide#Ruokalista'
@varmais
varmais / gist:6426283
Created September 3, 2013 16:35
reaktori
function (input) {
var nums = input.split(''), highest = 0;
for(var i = 4; i < nums.length; i++) {
var number = parseInt(nums[i-4]) * parseInt(nums[i-3]) * parseInt(nums[i-2]) * parseInt(nums[i-1]) * parseInt(nums[i]);
highest = number > highest ? number : highest;
}
return highest
}
@varmais
varmais / gist:6462368
Created September 6, 2013 10:59
jooh
curl -s http://mtv3.mobi/section/ajaxGetChatData\?chat_id\=chat_gay | sed 's/<.*>\[[0-9]*\:[0-9]*\]\(.*\)<\/.*>/\1/' | head -1 | php -R 'echo html_entity_decode($argn, ENT_COMPAT | ENT_HTML401, "UTF-8");' | say
this.getMapSize = function()
{
var s = 0;
for (var i in this.attachedMap)
{
s++;
}
return s;
}
from pylab import *
from scipy.stats import *
# tilastokeskus 2011
num_adults = 4530e3
# tyottomyyspvrh 2014 * 5 pv / vk * 52 vk
basic_income = 32.66*5*52
# tilastokeskus 2011
@varmais
varmais / ga.js
Created April 10, 2014 19:07
Track Javascript errors with Google Analytics
window.addEventListener('error', function(event) {
_gaq.push([
'_trackEvent',
'JS Error',
event.message,
event.filename + ': ' + event.lineno,
true
]);
});
/* RIBBON BANNERS */
.ribbon {
position: absolute;
top: 0;
right: 0;
}
/* reset certain elements (in case of conflicting CSS for classes, links, etc.) */
.ribbon .text,
@varmais
varmais / random_tweet.py
Created July 15, 2014 17:36
Random Tweet Bot
#!/usr/bin/env python
import gspread, tweepy, random, sys
CONSUMER_KEY = "TWITTER_CONSUMER_KEY"
CONSUMER_SEC = "TWITTER_CONSUMER_SECRET"
ACCESS_KEY = "TWITTER_ACCESS_KEY"
ACCESS_SEC = "TWITTER_ACCESS_SECRET"
GOOGLE_USER = "GOOGLE_USERNAME"
GOOGLE_PASS = "GOOGLE_PASSWORD"