Skip to content

Instantly share code, notes, and snippets.

@salty-horse
salty-horse / animate_element_between_divs.js
Created February 28, 2024 08:04
BGA - animate element movement between divs
animateFrom: function(elem, oldPos, duration = 500) {
if (this.instantaneousMode || !elem.animate) {
return;
}
const newPos = elem.getBoundingClientRect();
const translateX = oldPos.x - newPos.x;
const translateY = oldPos.y - newPos.y;
if (translateX == 0 && translateY == 0)
return;
elem.animate([
@salty-horse
salty-horse / extract_display_names.py
Created November 14, 2022 06:50
Extract Twitter display names from the Wayback Machine
#!/usr/bin/env python
# gem install --user-install wayback_machine_downloader
# wayback_machine_downloader -c 20 -s http://twitter.com/haszombiesinit
# find . -type f -iname '*html' | xargs grep '<title[^>]*>' | sort | ./extract_display_names.py
#
# Filter 'Tweets with replies by' manually'
import fileinput
import html
@salty-horse
salty-horse / six-match.md
Created January 28, 2018 20:38
Six Match review

Six Match review

This game is weird. Fun, but weird.

I've reached a high score that I don't think I can, or want to beat, and I don't think I want to play the game again, even though I enjoyed it while I did. I'm also very confused about others' experiences. I have only played about 5 games, and reached a score of 9000+ twice.

I think this stems from me treating it as something other than what it was designed to be. Maybe I'm taking too seriously, and misinterpreting the intentions behind its design. Maybe both the designer and other players see it in another light.

@salty-horse
salty-horse / flash-comments.md
Last active July 30, 2016 16:18
flash-comments.md

I wrote a few bullet points after listening to the episode, and I've expanded them from memory. I'm sorry if I'm attributing anything to you that wasn't actually said. I'd like to offer a different perspective to some of the issues raised:

  1. Lack of preservation

You mention the lack of preservation compared to PC and console games. I agree, however I don't think it's mainly due to lack of interest, as there's a bigger hurdle, and a reason for the bias towards other games: Most flash games are transmitted online, and played from inside the browser, and weren't saved as files on the computer. There aren't as many copies of the games because there was no need to. You just visited the website.

Also, some games involved a dedicated website backed by a server. Those are even harder to preserve unless the source code is provided.

@salty-horse
salty-horse / process_followers.py
Created January 17, 2016 22:03
Process Twitter followers fetched with get_followers.py
#!/usr/bin/env python3
import re
import json
import glob
def print_user(user):
print(
user['id'],
user['screen_name'],
@salty-horse
salty-horse / get_followers.py
Created January 17, 2016 21:59
Fetches followers from Twitter
#!/usr/bin/env python
import json
import time
from datetime import datetime
from secret import TWITTER_API_KEY, TWITTER_API_SECRET, TWITTER_ACCESS_TOKEN, TWITTER_TOKEN_SECRET
import tweepy
USERNAME = 'YOUR_USERNAME_HERE'
@salty-horse
salty-horse / day24b.py
Created December 25, 2015 15:05
Advent of Code - Day 24b in Python
#!/usr/bin/env python3
from functools import reduce
def get_groups_of_total(collection, amount, total):
"""The collection must be sorted in ascending order"""
for (pos, elem) in enumerate(collection):
if elem > total:
break
@salty-horse
salty-horse / day24a.py
Created December 25, 2015 15:04
Advent of Code - Day 24a in Python
#!/usr/bin/env python3
from functools import reduce
def get_groups_of_total(collection, amount, total):
"""The collection must be sorted in ascending order"""
for (pos, elem) in enumerate(collection):
if elem > total:
break
@salty-horse
salty-horse / day22.py
Created December 25, 2015 00:09
Advent of Code - day 22 in Python 3
#!/usr/bin/env python3
class Spell():
def __init__(self):
self.timer = self.duration
def copy(self):
a_copy = type(self)()
a_copy.timer = self.timer
return a_copy
def apply_dispel(self, state):
@salty-horse
salty-horse / day21.py
Created December 24, 2015 19:01
Advent of Code - day 21 in Python 3
#!/usr/bin/env python3
import math
import itertools
class Stats(object):
def __init__(self, hp, damage, armor):
self.hit_points = hp
self.damage = damage
self.armor = armor