Skip to content

Instantly share code, notes, and snippets.

Pirijan pketh

Block or report user

Report or block pketh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pketh
pketh / ManyToManyRelationships.md
Created Sep 20, 2019 — forked from elliette/ManyToManyRelationships.md
Describing `belongsToMany` and `hasMany` methods in Sequelize
View ManyToManyRelationships.md

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:

View easing.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
View random splatter.coffee
# 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 = ->
View static.coffee
# 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 / confetti.js
Created Dec 12, 2018
confetti pours on you after you buy something in glitch/hyperweb
View confetti.js
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
"use strict";
/* istanbul ignore next */
module.exports = function(canvas) {
View magic
(*・_・)ノ⌒*
(*・_・)⊃══✫⌒*・゚✲
View subscriptions.opml
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Subscriptions - pirijan@gmail.com</title>
</head>
<body>
<outline title="tomayko.com" xmlUrl="http://tomayko.com/writings/feed" type="rss" text="tomayko.com"/>
<outline title="-" xmlUrl="rss2.xml" type="rss" text="-"/>
<outline htmlUrl="http://scriptogr.am/blog" title="(title unknown)" xmlUrl="http://scriptogr.am/blog/feed" type="rss" text="(title unknown)"/>
<outline htmlUrl="http://ablogfromscratch.com/" title="* From Scratch" xmlUrl="http://ablogfromscratch.com/rss" type="rss" text="* From Scratch"/>
View keybase.md

Keybase proof

I hereby claim:

  • I am pketh on github.
  • I am pirijan (https://keybase.io/pirijan) on keybase.
  • I have a public key ASBBFhxt_pOH579ddv7ATEFc49Hd-5zWFpk5AiIcXH51xwo

To claim this, I am signing this object:

View rabbit.txt
| ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄|
|  spiders |
|__________|
(\__/) ||
(•ㅅ•) ||
/   づ
@pketh
pketh / circles.txt
Created Mar 14, 2017
scroll me quickly and weird things happen
View circles.txt
⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝
 ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝
⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝
 ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝
⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝
 ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝
⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝
 ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝ ⠀⃝
You can’t perform that action at this time.