Skip to content

Instantly share code, notes, and snippets.

View csenio's full-sized avatar
Open for freelance work

csen ⟐ csenio

Open for freelance work
View GitHub Profile
const tenses = {
present_tense: 'Presente',
preterite_tense: 'Pretérito',
imperfect_tense: 'Imperfecto',
future_tense: 'Futuro',
conditional_tense: 'Condicional',
subjunctive_mood: 'Subjuntivo',
}
// array of tuples of [input, output]
// full explanation here: https://jsco.dev/blog/undo-across-multiple-stores-in-svelte
/* Use like this:
* import undoable, { undoTracker } from "./undoable.js";
* const myStore = undoable(INITIAL_VALUE)
* if(undoTracker.can_undo) undoTracker.undo()
* if(undoTracker.can_redo) undoTracker.redo()
*/
import {writable, derived, get} from "svelte/store"
@csenio
csenio / machine.js
Created December 9, 2020 19:41
Generated by XState Viz: https://xstate.js.org/viz
const canvasMachine = Machine({
id: 'canvas',
initial: 'idle',
context: {
elements: [],
targetEl: null,
},
states: {
@csenio
csenio / data
Created November 25, 2020 14:54
[
{
"region":"Алтайский край",
"confirmed":[
0,
0,
0,
0,
0,
0,
@csenio
csenio / timezones.js
Created August 23, 2020 07:59
list of all timezone strings
const timezones = [
{
"label": "Africa/Abidjan",
"utc_offset": "+00:00"
},
{
"label": "Africa/Accra",
"utc_offset": "+00:00"
},
{
@csenio
csenio / linkedin accept bot
Created May 12, 2020 13:00
accept all linkedin requests except recruiters
[...document.querySelectorAll(".invitation-card")].forEach(t=>{/recruit/gi.test(t.querySelector(".invitation-card__subtitle").textContent)?t.querySelector(".artdeco-button--tertiary").click():t.querySelector(".artdeco-button--secondary").click()});
[
{
"time": "2019-10-06T20:19:53.000Z",
"title": "9 Projects you can do to become a Frontend Master in 2020",
"tags": [
"#react",
"#vue",
"#angular",
"#javascript"
],
[...document.querySelectorAll('.invitation-card')].forEach(card => {
const jobTitle = card.querySelector('.invitation-card__subtitle').textContent
const isRecruiter = /recruit/gi.test(jobTitle)
const acceptButton = card.querySelector('.artdeco-button--secondary')
const denyButton = card.querySelector('.artdeco-button--tertiary')
if(isRecruiter){
denyButton.click()
}else{
@csenio
csenio / randomColor.js
Created April 6, 2020 13:23
generates a random, highly distinguishable number for every number. Adjust
function selectColor(number) {
const hue = number * 137.508 // use golden angle approximation
const saturation = '100%'
const lightness = '50%'
return `hsl(${hue},${saturation},${lightness})`
}
@csenio
csenio / tween.js
Last active March 14, 2020 16:44
a basic tweening function, where the value is updated via cb. adjusted for perfect 60fps movement
const _raf =
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.msRequestAnimationFrame ||
window.oRequestAnimationFrame ||
function(f) {
window.setTimeout(f, 1e3 / 60);
};