Skip to content

Instantly share code, notes, and snippets.

View tacomanator's full-sized avatar

Drew Goodwin tacomanator

View GitHub Profile
@rphlmr
rphlmr / clear-db.ts
Last active May 13, 2024 18:51
Drizzle snippets
// Credits to Louistiti from Drizzle Discord: https://discord.com/channels/1043890932593987624/1130802621750448160/1143083373535973406
import { sql } from "drizzle-orm";
const clearDb = async (): Promise<void> => {
const query = sql<string>`SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
AND table_type = 'BASE TABLE';
`;
@julianocomg
julianocomg / AffixWrapper.jsx
Last active May 17, 2024 04:24
A simple affix React component.
/**
* @author Juliano Castilho <julianocomg@gmail.com>
*/
var React = require('react');
var AffixWrapper = React.createClass({
/**
* @type {Object}
*/
propTypes: {
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@dieseltravis
dieseltravis / iisexpress.bat
Last active January 5, 2016 13:35
Add a shortcut to your Send To menu to launch a folder in IISExpress
@echo off
:: normalize folder
SET folder=%~1
IF %folder:~-1%==\ SET folder=%folder:~0,-1%
:: random number from 8000 to 9999
SET /a port=(%random%)*1999/32767+8000
:: start the web server for the random port starting at the passed-in directory