Skip to content

Instantly share code, notes, and snippets.

View shearichard's full-sized avatar

Richard Shea shearichard

View GitHub Profile
@raydot
raydot / basic-ts-config
Last active August 22, 2022 04:12
Basic typescript.config file, with explanations
{
"compilerOptions": {
// project options
"lib": [
"ESNext",
"dom"
], // specifies which default set of type definitions to use ("DOM", "ES6", etc.)
"outDir": "lib", // .js (as well as .d.ts, .js.map, etc.) The directory where your files will be created
"removeComments": true, // Strips all comments from TypeScript files when converting to JavaScript
"target": "ES6", // Target environment
@marttp
marttp / App.js
Created February 9, 2020 05:06
Example of Server-Sent Events in Client (React)
import React, { useState } from "react";
import axios from 'axios';
import "./App.css";
export default function App() {
const [process, setProcess] = useState({});
const [message, setMessage] = useState({});
const [listening, setListening] = useState(false);
const statusMessage = {
@thebouv
thebouv / ducks.sh
Last active May 7, 2024 08:33
ducks: linux command for the 10 largest files in current directory
du -cks * | sort -rn | head -11
# Usually set this up in my bash profile as an alias:
# alias ducks='du -cks * | sort -rn | head -11'
# Because it is fun to type ducks on the command line. :)
@milancermak
milancermak / pre-commit.sh
Created October 7, 2012 19:24
Python pre-commit hook
#!/bin/sh
# make sure requirements.txt is up to date with every commit
# by comparing the output of pip freeze
pip freeze | diff requirements.txt - > /dev/null
if [ $? != 0 ]
then
echo "Missing python module dependencies in requirements.txt. Run 'pip freeze > requirements.txt' to update."
exit 1
fi
@noonien
noonien / async_loader.js
Created July 16, 2012 17:36
Asynchronous Javascript/CSS loader.
AL = function(type, url, callback) {
var el, doc = document;
switch(type) {
case 'js':
el = doc.createElement('script');
el.src = url;
break;
case 'css':
el = doc.createElement('link');
@johnnyreilly
johnnyreilly / PdfGenerator.cs
Created April 9, 2012 05:58
C# Wrapper for WKHTMLtoPDF
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Web;
using System.Web.Hosting;
namespace PdfGenerator
{
public class PdfGenerator
@darcyparker
darcyparker / vimModeStateDiagram.svg
Last active June 21, 2024 22:01
Vim Modes Transition Diagram in SVG https://rawgithub.com/darcyparker/1886716/raw/eab57dfe784f016085251771d65a75a471ca22d4/vimModeStateDiagram.svg Note, most of the nodes in this graph have clickable hyperlinks to documentation.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mbostock
mbostock / .block
Last active November 14, 2023 03:46
Google Maps + D3
license: gpl-3.0