Skip to content

Instantly share code, notes, and snippets.

View jschuur's full-sized avatar
⌨️
Coding lots again

Joost Schuur jschuur

⌨️
Coding lots again
View GitHub Profile
"use client";
import {
Dialog,
DialogContent,
DialogTitle,
DialogTrigger
} from "@/components/ui/dialog";
import useDragDrop from "@/hooks/useDragDrop";
import { cn, formatBytes } from "@/lib/utils";
@sladg
sladg / Keystone6-Tailwind3-integration
Created February 7, 2022 17:46
Simple wrapper for custom Keystone6 routes to provide Tailwind styling for components. Supports core plugins and custom configuration (as long as not relying on additional plugins beside tailwind's core).
import React, { FC, useState } from 'react'
import { PageContainer } from '@keystone-6/core/admin-ui/components'
import Script from 'next/script'
import tailwindConfig from '../tailwind.config.js'
import Head from 'next/head'
import { ApolloProvider } from '@apollo/client'
import client from '../utils/graphql/apollo-client'
const styles = `
@tailwind base;
@tomfa
tomfa / NextJSComponentWithQueryStringState.tsx
Created May 20, 2021 22:24
NextJS string state in URL query param
import useQueryString from './useQueryString'
export const Component = () => {
const [cat, setCat] = useQueryString<string>({
key: 'cat',
defaultValue: 'Robert Paulson',
});
return <h1>His name is <strong>{cat}</strong></h1>
@islishude
islishude / node-mysql2-promise-query-stream.js
Created September 7, 2020 10:28
node-mysql2 query stream with Promise
// https://github.com/sidorares/node-mysql2/issues/677
const mysql = require("mysql2/promise");
const stream = require("stream");
const dbconn = mysql.createPool({
connectionLimit: 10,
host: "127.0.0.1",
user: "user",
password: "password",
database: "database",
/*
Do not modify this version of the file. It will be copied over when any of the project's targets are built.
If you wish to modify mraid.js, modify the version located at mopub-sdk-common/mraid/mraid.js.
*/
(function() {
var isIOS = (/iphone|ipad|ipod/i).test(window.navigator.userAgent.toLowerCase());
if (isIOS) {
console = {};
console.log = function(log) {
var iframe = document.createElement('iframe');
@lyzadanger
lyzadanger / gulp-strip-scripts.js
Last active June 28, 2022 08:58
Gulp plugin to strip inline scripts from HTML- or HTML-like files, stick 'em in a file property
/* global Buffer, console */
/**
* Strip inline <script> elements and push each
* <script> tag's contents to `file.scripts`
* (Array; each element is the contents of a script element)
*/
'use strict';
var through = require('through2');
var gutil = require('gulp-util');
var cheerio = require('cheerio');