Skip to content

Instantly share code, notes, and snippets.

@PaNaVTEC
PaNaVTEC / ArbitraryDeriving.scala
Last active October 26, 2022 06:46
Scala 3 - Arbitrary typeclass derivation
package me.panavtec.scalacheck
import org.scalacheck.Arbitrary
import org.scalacheck.Gen
import scala.compiletime.{erasedValue, summonInline}
import scala.deriving.*
object ArbitraryDeriving:
@PaNaVTEC
PaNaVTEC / KineticScroll.ts
Created April 21, 2018 15:23
KineticScroll for Phaser 3 in typescript (Ported from https://github.com/jdnichollsc/Phaser-Kinetic-Scrolling-Plugin)
// Original imp: https://github.com/jdnichollsc/Phaser-Kinetic-Scrolling-Plugin
// Adapted to phaser 3 By Christian Panadero
export default class KineticScroll {
private pointerId
private startX
private startY
private screenX
private screenY
@PaNaVTEC
PaNaVTEC / Proguard config
Last active May 17, 2018 22:02
Proguard config
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/panavtec/Documents/android-sdk-macosx/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
### Keybase proof
I hereby claim:
* I am panavtec on github.
* I am panavtec (https://keybase.io/panavtec) on keybase.
* I have a public key whose fingerprint is 293C 58BE C820 CD5E 3166 D681 88EF 58F8 8BE6 19F6
To claim this, I am signing this object:
package me.panavtec
import cats.free.Free
import cats.{Id, ~>}
import scala.io.StdIn
object UserInteractionApplication {
sealed trait UserInteraction[A]
@PaNaVTEC
PaNaVTEC / GuessTheSecretNumber.scala
Created March 11, 2017 10:37
Simple Free monad example
package me.panavtec
import cats.free.Free
import cats.{Id, ~>}
import scala.io.StdIn
object GuessTheSecretNumber {
sealed trait UserInteraction[A]
@PaNaVTEC
PaNaVTEC / Coordinator.java
Last active November 4, 2016 22:49
Coordinates various actions and fires a callback when all are complete
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
public class Coordinator {
private List<String> actions;
private Set<String> completedActions = new TreeSet<>();
private CoordinatorCompleteAction coordinatorCompleteAction;
import org.scalatest._
class CellTest extends FlatSpec with Matchers {
"a cell" should "die when has less than 2 neighbours" in {
val cell = Cell(1, true)
val isAliveNextGeneration = cell.nextGeneration()
isAliveNextGeneration shouldBe false
@PaNaVTEC
PaNaVTEC / Converter.py
Last active December 7, 2015 12:37
Converts "Los 40 principales" playlist to "Artist - Title" to use with playlist-converter.net for example and import to Deezer/Spotify
import requests
import re
import unicodedata
REGEX_LOS40 = "datos_cancion_\d+\['(titulo_cancion|nombre_artista)'\]\s*=\s*'([^\']*)'"
def removeAccents(data):
return unicodedata.normalize('NFKD', data).encode('ASCII', 'ignore').decode()
def sanitize(artist):
@PaNaVTEC
PaNaVTEC / Popular songs of Last.fm to iTunes library
Last active August 29, 2015 14:06
Popular songs of Last.fm to iTunes library