Skip to content

Instantly share code, notes, and snippets.

@jculvey
jculvey / minimal-html.js
Created April 30, 2018 03:39
Barebones html page
<!doctype html>
<html>
<head>
<title>Not fit for human consumption</title>
</head>
<body>
<script type="text/javascript" src="./path/to/my/script.js"></script>
</body>
</html>
@jculvey
jculvey / cssReset.js
Created April 8, 2018 19:40
Meyer CSS reset for emotion
import { injectGlobal } from 'react-emotion';
injectGlobal(`
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
@jculvey
jculvey / sql_cheatsheet
Created October 20, 2016 21:59
cheesy sql cheatsheet
-- sqlite
.tables
-- mysql
-- psql
\c students -- connect to student db
\d -- shows all tables
\d foo -- shows info about foo table
\i tables.sql -- import and run entire file
@jculvey
jculvey / regex
Created October 20, 2016 21:48
Regex in a nutshell
# egrep -i '^q[u]' testfile
# egrep -i '^q[^u]' testfile
quarter
qatre
A quarter mile.
# egrep -i '3[-./]19[-./]12' testfile
3/19/12
3-19-12
3.19.12
@jculvey
jculvey / subclassing.js
Created September 30, 2016 01:20
Subclassing (the old school way) in js
function Person(fname, lname) {
this.fname = fname;
this.lname = lname;
}
Person.prototype.fullName = function() {
return this.fname + ' ' + this.lname;
@jculvey
jculvey / singleton.js
Created September 30, 2016 01:07
Basic Singleton in javascript
var GreetingManager = (function () {
var instance;
function init() {
var greeting = 'yo';
return {
greet: function() {