Skip to content

Instantly share code, notes, and snippets.

View DaveEveritt's full-sized avatar

David Everitt DaveEveritt

View GitHub Profile

Keybase proof

I hereby claim:

  • I am daveeveritt on github.
  • I am daveeveritt (https://keybase.io/daveeveritt) on keybase.
  • I have a public key ASC4zlUh5jhdD13Bwm14IuVafyeDZhB3oGVjMTiAA-Rbigo

To claim this, I am signing this object:

@DaveEveritt
DaveEveritt / querySelectorAll-pure-js-shortcut.html
Last active July 14, 2019 17:09
A pure JavaScript document.querySelectorAll shortcut
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>A Vanilla JavaScript querySelectorAll shortcut</title>
</head>
<body>
<h1>A querySelectorAll shortcut</h1>
<section class="mydiv">a div</section>
const [...elArray] = document.getElementsByClassName('class-name');
elArray.forEach( (el) => {
el.addEventListener("click", function() {
el.classList.toggle('some-class');
});
});
@DaveEveritt
DaveEveritt / intro-meteor.js.md
Last active March 21, 2016 09:38 — forked from shrop/intro-meteor.js.md
Introduction to Meteor.js
@DaveEveritt
DaveEveritt / sqlite_camping_test.rb
Created May 2, 2012 14:05
Test an SQLite connection for Camping
require 'camping'
Camping.goes :Sqltest
module Sqltest::Models
class User < Base
end
class CreateTables < V 1.0
def self.up # should this now be self.change ?
create_table :sqltest_users, :force => true do |t|
@DaveEveritt
DaveEveritt / weekdays-from-today.js
Created September 4, 2011 17:18
Javascript: return 7 days in order with today first
//returns 7 day names with today first
function startday() {
var days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
var today = new Date();
var start = today.getDay(); //gets day number
if (start == 0) { //if Sunday, days are in order
return days
}
else { //if not Sunday, start days with today
return days.slice(start).concat(days.slice(0,start))
@DaveEveritt
DaveEveritt / gist:1123083
Created August 3, 2011 16:33
Simple MongoDB install on OS X

Summary

The 'quickstart' for OS X on the MongoDB site could be clearer. Here's a condensed version with more info.

Details

Copy the download URL on the MongoDB site (don't click) for the latest download for your system:
www.mongodb.org/downloads

Open Terminal and go to where you keep source files (good to create a directory if you don't have it already with mkdir src) e.g.:

@DaveEveritt
DaveEveritt / tm_bundle.sh
Created May 31, 2011 13:16
Installing TextMate bundles
#!/bin/sh
############################################################################
# Run from your 'Home' folder.
# Replace 'Bundle Name' with exact name (include spaces but not ".tmbundle")
# ./tm_bundle.sh Bundle Name
#
# This script is adapted from the scripts in this list of bundles:
# http://netcetera.org/cgi-bin/tmbundles.cgi
# the 'official' bundle list with extensions is at:
@DaveEveritt
DaveEveritt / gist:489445
Created July 25, 2010 09:31
regex to fix unquoted html/xhtml width/height attributes

Simple-as-possible regular expression to fix unquoted html/xhtml width/height attributes:

find: (width|height)=([\d]+)

replace: $1="$2"

Example result:

@DaveEveritt
DaveEveritt / Add field to an existing Django app with South
Created June 25, 2010 20:48
quickly add field(s) to existing Django models with South
====================================================================
Simple-as-possible instructions to add a field (or more) using South
to an existing Django model with existing data.
====================================================================
Two versions:
1. Super-condensed (the bare minimum - jfdi)
2. Detailed-but-brief (if you want more information).
Notes: