Skip to content

Instantly share code, notes, and snippets.

View fmaylinch's full-sized avatar

Ferran Maylinch fmaylinch

View GitHub Profile
// Last change: updates when phase changes
// import React from 'react' // imports don't work here
const tokens = [
"+1", 0, 0, -1, -1, -1,
-2, -2, -3, -4,
"💀", "💀", "🧙", "🦑", "🌟"
];
// This code is displays a counter above.
// The code is transpiled with Babel and run with eval().
const { useState } = React; // imports don't work here
function Counter() {
const [count, setCount] = useState(0);
return (
<div style={{margin: 20}}>
fade("#title", "Привет!")
fade("#text1", "Вот " + link("песня", "https://disk.yandex.ru") + " я написал для тебя")
fade("#text2", "Пожалуйста скажи как тебе)")
@fmaylinch
fmaylinch / arkham-horror.js
Last active March 17, 2024 16:40
Arkham Horror for fmaylinch.github.io
let version = "v0.5.12 token color";
$("#main").css({padding: "0.5em"});
//$('#main-button').click();
let tokens = [
'+1',
0, 0, -1, -1, -1, -2, -2,
-3, -4,
"Skull", "Skull", "Cape",
@fmaylinch
fmaylinch / fmaylinch.github.io-code.js
Last active March 3, 2024 23:09
Code to execute in fmaylinch.github.io
$('#main-button').click(); // click the "MAIN" button (scrolls up)
setTimeout(changeTexts, 1000); // run after 1 second (to give time to scrolling)
function changeTexts() {
fade("#title", "Practice coding")
const action = random(["try", "run", "execute", "modify"])
const js = link("JavaScript", "https://developer.mozilla.org/docs/Web/JavaScript")
fade("#text1", "You can " + action + " the " + js + " code below")
const functions = join(["fade", "join", "link", "random"]);
/**
* This is an example of a basic node.js script that performs
* the Client Credentials oAuth2 flow to authenticate against
* the Spotify Accounts.
*
* For more information, read
* https://developer.spotify.com/web-api/authorization-guide/#client_credentials_flow
*/
var request = require('request'); // "Request" library
import java.util.*; // This is necessary to use collections like List, Set, Map
public class Collections {
public static void main(String... args) {
// Wrapper classes ( use them between angle brackets < > )
// Integer, Double, Boolean
// Long, Character, Float
import java.util.*;
public class Example {
// TODO: Exercise:
// Write a function that given a list of words and a number n, returns list of the words longer than n.
public static void main(String[] args) {
List<String> words;
package tech.bts.javaexamples;
/**
* Basic exercises to practice variable declarations and assignments.
*/
public class BasicsExercises {
public static void main(String[] args) {
/*
package sample;
import java.util.*; // Allow us to use classes from java.util package (List, Map, etc.) without their full name
/**
* Summary of the building blocks of a programming language.
* (Note: this is a class comment)
*/
public class ProgrammingBuildingBlocks {