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 / kinopio-markdown-userscript.js
Last active January 3, 2021 04:08 — forked from danreeves/kinopio-markdown-userscript.js
kinopio.club markdown userscript
// ==UserScript==
// @name Kinopio Markdown
// @namespace https://kinopio.club/kinopio-markdown-userscript-Q9qnmvXEPaagLx5Ufytlx
// @version 0.1
// @description convert text in cards to markdown
// @author Pirijan (forked from dnrvs)
// @match https://kinopio.club/kinopio-markdown-userscript-Q9qnmvXEPaagLx5Ufytlx
// @grant none
// ==/UserScript==
@pketh
pketh / asciiputsonglasses
Created September 10, 2020 14:30 — forked from staringispolite/asciiputsonglasses
Ascii art sunglasses meme
Puts on glasses:
(•_•)
( •_•)>⌐■-■
(⌐■_■)
Takes off glasses ("mother of god..."):
(⌐■_■)
( •_•)>⌐■-■
@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 / server.rb
Last active August 29, 2015 14:19 — forked from clody69/server.rb
require 'sinatra'
require 'haml'
$users = {'john' => {:roles => [:user] }, 'mike' => {:roles => [:user, :admin] } }
$tokens = {'123' => {:username => 'john', :expires_at => Time.now+60}}
helpers do
def authenticate_user!
@auth_token = auth_token
if $tokens.has_key?(@auth_token) && !$tokens[@auth_token][:expires_at].nil? && $tokens[@auth_token][:expires_at] > Time.now