Skip to content

Instantly share code, notes, and snippets.

View ruheni's full-sized avatar
💣
(╯°□°)╯ ︵ ┻━┻

Alex Ruheni ruheni

💣
(╯°□°)╯ ︵ ┻━┻
View GitHub Profile
@ruheni
ruheni / context.js
Created December 14, 2021 14:12
Using JsDoc to annotate types to your JavaScript Code when working with Prisma
const prisma = require('@prisma/client')
/**
*
* @typedef { import("@prisma/client").PrismaClient } PrismaClient
* @typedef {{prisma: PrismaClient}} Context
*/
/**
*
@ruheni
ruheni / schema.prisma
Created October 19, 2021 07:48
Prisma `groupBy` dates snippet
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = "file:./dev.db"
}
model User {
@ruheni
ruheni / vue
Created December 2, 2020 09:33
Blog
<template>
<div class="page">
<h1>My Blog</h1>
<main></main>
<p v-if="$fetchState.pending">
<span class="loading"></span>
</p>
<p v-else-if="$fetchState.error">Error while fetching feed 🤬</p>
<ul v-else>
<li v-for="post in feed" :key="post.id">
const express = require('express');
const router = express.Router();
const options = {
apiKey: process.env.AT_API_KEY,
username: 'sandbox'
}
const shortCode = '32531'
(function($) { // Begin jQuery
$(function() { // DOM ready
// If a link has a dropdown, add sub menu toggle.
$('nav ul li a:not(:only-child)').click(function(e) {
$(this).siblings('.nav-dropdown').toggle();
// Close one dropdown when selecting another
$('.nav-dropdown').not($(this).siblings()).hide();
e.stopPropagation();
});