Skip to content

Instantly share code, notes, and snippets.

View varmais's full-sized avatar

Teemu Tiilikainen varmais

View GitHub Profile
var jooh = ['image', 'images', 'slideshows', 'sectionFrontImages'];
angular.forEach(jooh, function (jo) {
if (articleData.hasOwnProperty(jo)) {
angular.forEach(articleData[jo], function (image, index) {
if(image.crops){
if(image.crops.mediumThreeByTwo440 && image.id) {
$scope.imageHolder[image.id] = image.crops.mediumThreeByTwo440.url;
}
}
# Port forward 80 to 8080 in OS X Yosemite
# Add this line to /etc/pf.anchors/<anchor name>
rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 80 -> 127.0.0.1 port 8080
# Save and test if it has any errors
$ sudo pfctl -vnf /etc/pf.anchors/<anchor name>
@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"
/* 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 / 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
]);
});
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
this.getMapSize = function()
{
var s = 0;
for (var i in this.attachedMap)
{
s++;
}
return s;
}
@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
@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 / 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'