Skip to content

Instantly share code, notes, and snippets.

View pketh's full-sized avatar
🐢
https://kinopio.club

Pirijan pketh

🐢
https://kinopio.club
View GitHub Profile
@pketh
pketh / static.coffee
Created February 7, 2019 22:03
dynamic static
# viewportWidth = window.innerWidth
# viewportHeight = window.innerHeight
# totalPixels = viewportWidth * viewportHeight
# staticPixels = Math.round(totalPixels * 0.05) # 5 percent static
# staticCanvas = undefined
# staticContext = undefined
# staticCanvasImage = undefined
# frames = Array.from(Array(24)) # 24 variations
window.onload = ->
@pketh
pketh / random splatter.coffee
Created February 7, 2019 22:05
random splatters
# addRandomSplatter = ->
# maxX = window.innerWidth
# maxY = window.innerHeight
# x = _.random 0, maxX
# y = _.random 0, maxY
# if consecutiveRandomSplatters < MAX_CONSECUTIVE_SPLATTERS
# consecutiveRandomSplatters += 1
# addSplatter x, y
#
# autoSplatter = ->
@pketh
pketh / easing.js
Created June 21, 2019 14:21
easings js
easing (percentComplete, elaspedTime) {
const duration = lockingDuration
const startValue = 0
const endValue = 1
// https://stackoverflow.com/questions/8316882/what-is-an-easing-function
// x percentComplete,
// t elaspedTime,
// b startValue,
// c endValue,
// d duration
@pketh
pketh / ManyToManyRelationships.md
Created September 20, 2019 17:21 — forked from elliette/ManyToManyRelationships.md
Describing `belongsToMany` and `hasMany` methods in Sequelize

Defining Many-to-Many Associations in Sequelize

Reference: Sequelize docs on association

Let’s say we have two models: Films and Festivals

We know that a film can be shown at many film festivals and that, conversely, a festival can show many films. This is what is known as a many-to-many relationship.

Knowing this, we can set up our associations:

@pketh
pketh / hi.md
Created December 17, 2019 19:42
Kinopio Reliability Fixes dec 17 2019

Reliability Fixes

I just released some client/server patches that should address issues reported, (be sure to refresh next time you use kinopio). here's the list of what's fixed:

🐛Reported Issue:

  • when you clicked the space selection button and were seeing extra spaces that would flash and then go away.

🏥Resolution:

@pketh
pketh / cache.js
Created March 26, 2020 03:03
kinopio ls cache system
// local storage cache interface for currentUser and spaces
import utils from '@/utils.js'
export default {
storeLocal (key, value) {
try {
window.localStorage[key] = JSON.stringify(value)
} catch (error) {
console.warn('storeLocal Could not save to localStorage')
꒰◍ᐡᐤᐡ◍꒱ ␈␈␈␈␈␈␈␈
moveZeros([1, 2, 0, 1, 0, 0, 3, 6])
const moveZeroes = (numbers) => {
let zeroes = []
numbers = numbers.filter(number => {
if (number === 0) {
zeroes.push(number)
} else {
return true
}
@pketh
pketh / kinopio-search.js
Last active August 27, 2020 20:52
search snippet for kinopio cards
// edit search and paste me into your browser console
search = 'my cool search';
// this will only work for the spaces you have cached
// i.e. you've opened the space on this device recently
spaces = Object.keys(localStorage);
spaces = spaces.filter(space => space.startsWith('space-'));
spaces = spaces.map(space => JSON.parse(localStorage[space]));
matchingSpaces = spaces.filter(space => {
if (!space.name) { return };
︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿
︵‿︵‿ poolside fm ︵‿︵‿︵‿︵‿︵‿
︵‿︵‿︵‿︵‿︵‿︵‿ for iphone ‿︵‿
︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿
in the app store ⓝⓞⓦ 🏝Mobile phone http://cellular.poolside.fm