Skip to content

Instantly share code, notes, and snippets.

class A(object):
def __init__(self, key, value):
self.key = key
self.value = value
@property
def double_value(self):
return self.value * 2
@Hamatti
Hamatti / file.txt
Created September 9, 2014 02:05
Example file for Beauty of the Pipe blog post
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris aliquet metus non nunc scelerisque pretium. Nunc eu lobortis neque. Praesent vehicula feugiat consectetur. Morbi sit amet sapien in odio faucibus tristique eget quis leo. In auctor arcu ac venenatis aliquet. Sed imperdiet elementum mauris, nec semper justo vestibulum at. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eleifend non ante at iaculis. Suspendisse at magna metus. Duis sit amet est enim. Integer sem lorem, varius sed erat et, cursus placerat nunc. Donec egestas eros sollicitudin neque suscipit, eu porttitor est dignissim. In erat quam, tincidunt et molestie at, condimentum ut velit.
Fusce tempor dolor augue, ut tincidunt ligula laoreet et. In placerat, justo in pharetra molestie, erat justo suscipit lorem, non vestibulum tellus magna tincidunt mauris. Aliquam erat volutpat. Suspendisse potenti. Interdum et malesuada fames ac ante ipsum primis in faucibus. Donec in nisi gravida, mollis est sit amet, condimentum mi. Duis
@Hamatti
Hamatti / bbpr-bookmarklet.js
Last active August 29, 2015 14:06
A JS Bookmarklet to show difference in lines of codes for a BitBucket pull request
javascript:(function(){alert(([].slice.call(document.querySelectorAll('.lines-added, .lines-removed')).reduce(function (a, el){return a + Number(el.innerHTML);},0)+' loc').replace(/^(?!-)/, '+'))})()
@Hamatti
Hamatti / alias.sh
Created March 7, 2020 16:00
Asus ZenScreen rotation aliases
# You can find out your display id with displayplacer list
# Find displayplacer at https://github.com/jakehilborn/displayplacer
alias asusportrait='displayplacer "id:[your_display_id] degree:90 origin:(1920, 0)"'
alias asuslandscape='displayplacer "id:[your_display_id] degree:0 origin:(1920, 0)"'
@Hamatti
Hamatti / on24-bookmarklet.js
Created November 9, 2020 18:01
A bookmarklet to add keyboard / presentation clicker support to ON24.com webinar platform
/**
* @author Juha-Matti Santala / @hamatti
*
* This code is a bookmarklet that adds support to ON24.com's presentator view for arrow right/left and page down/up keys
* to switch slides.
*
* If your presentation clicker sends different keys to the computer when clicking next/prev, you can adjust the code by
* changing the if clauses
*/
@Hamatti
Hamatti / areena.js
Created December 6, 2020 15:32
Bookmarklet for removing YLE Areena's live chat
// This bookmarklet is for removing the live chat from YLE Areena
// Copy-paste the line below into the URL field of a new bookmark
javascript:(function() { document.getElementById('yle-livefeed').remove() })()
@Hamatti
Hamatti / pattern_match_example.py
Created March 11, 2021 10:26
Python pattern matching for Pokemon cards. Works on Python 3.10a6
class Card:
def __init__(self, id, name, supertype, subtype):
self.id = id
self.name = name
self.supertype = supertype
self.subtype = subtype
charizard = Card('ex3-100', 'Charizard', 'Pokemon', 'Stage 2')
lapras = Card('ex3-103', 'Lapras', 'Pokemon', 'Basic')
muscle_band = Card('xy1-121', 'Muscle Band', 'Trainer', 'Item')
@Hamatti
Hamatti / pattern_match_example-nesting.py
Last active March 11, 2021 11:46
Nested pattern matching in Python 3.10a6
class Card:
def __init__(self, id, name, supertype, subtype):
self.id = id
self.name = name
self.supertype = supertype
self.subtype = subtype
def play_card(card):
match card:
@Hamatti
Hamatti / bot.js
Last active August 2, 2021 14:45
Very simple Discord bot skeleton
const Discord = require('discord.js');
const cron = require('cron');
const client = new Discord.Client();
client.login(process.env.BOT_TOKEN);
const job = new cron.CronJob("00 00 10 * * *", () => {
client.channels.cache.get("[channel id]").send("Tick tock");
});
@Hamatti
Hamatti / README.md
Last active December 8, 2021 21:43
Liiga.fi customizations