Skip to content

Instantly share code, notes, and snippets.

View yornaath's full-sized avatar
🔥
buidling

Yornaath yornaath

🔥
buidling
View GitHub Profile
@ctrlaltdylan
ctrlaltdylan / [[...slug.js]].js
Created February 25, 2021 13:44
Bullboard with Next JS
import nc from "next-connect";
const { setQueues, BullAdapter, router } = require("bull-board");
import emailQueue from 'queues/emailQueue'; // or wherever your queues lie
setQueues([
new BullAdapter(emailQueue),
]);
const handler = nc().use(
@chadwilken
chadwilken / Document.jsx
Created March 2, 2020 18:20
React PDF w/ UGC
import React, { useMemo } from 'react';
import {
Document as PDFDocument,
StyleSheet,
Page,
Font,
} from '@react-pdf/renderer';
import dig from 'lodash.get';
import PageFooter from './PageFooter';
import CoverPage from './CoverPage';
module Main where
import Prelude
import Control.Monad.Reader (Reader, runReader, ReaderT(..), runReaderT, ask, class MonadAsk)
import Effect (Effect)
import Effect.Class (class MonadEffect, liftEffect)
import Effect.Console (log)
---------------------------------------------------------
@pelotom
pelotom / existential.ts
Last active May 18, 2022 10:08
Encoding of existential types in TypeScript
type StackOps<S, A> = {
init(): S
push(s: S, x: A): void
pop(s: S): A
size(s: S): number
}
type Stack<A> = <R>(go: <S>(ops: StackOps<S, A>) => R) => R
const arrayStack = <A>(): Stack<A> =>
@schabluk
schabluk / DraftLineNumbers.js
Last active March 31, 2023 15:45
Display line numbers is Draft-JS Editor
// Required Draf-js version: 0.10.
// Live example: https://jsfiddle.net/schabluk/gh2gt22n/
import React from 'react'
import ReactDOM from 'react-dom'
import {Editor, EditorState, EditorBlock} from 'draft-js'
class Line extends React.Component {
render () {
const blockMap = this.props.contentState.getBlockMap().toArray()
@ryanlabouve
ryanlabouve / environment.js
Last active March 1, 2016 05:03
Ember CLI - contentSecurityPolicy
// config/environment.js
// This is not for production. But it will get your
// console to stop screaming errors if your messing
// around with ember cli
module.exports = function(environment) {
//lots of stuff
// <Add this chunk>
@JedWatson
JedWatson / notes.md
Last active February 20, 2020 13:01
Notes on how to create a new field type for Keystone

Creating new Field Types for KeystoneJS

We're currently working on making it easier to add new field types to KeystoneJS as plugins.

In the meantime, if you'd like to work on your own field type, hopefully this guide will point you in the right direction.

Keystone fields require the following:

  • a {fieldType}.js file in ./lib/fieldTypes that controls the field and encapsulates options support, underscore functions, validation and updating
  • the {fieldType}.js file needs to be included by ./lib/fieldTypes/index.js
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt