Skip to content

Instantly share code, notes, and snippets.

@jasonalderman
jasonalderman / index.html
Created November 13, 2018 17:33
CK Art Show Label Generator
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>art show label generator</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Playfair+Display:400,400i,900,900i" rel="stylesheet">
<link rel="stylesheet" href="./main.css" />
</head>
@jasonalderman
jasonalderman / getTimeAgo.js
Last active November 29, 2017 22:02
Subtracts a date from the current time, and presents it (like Twitter) as "2s" or "2m" or "2h" ago, or as a date.
var getTimeAgo = function(datestring) {
// Takes in any datestring that can be used with the Date() constructor:
// e.g., "10/22/15" or "Wed Nov 29 2015 13:42:33 GMT-0800 (PST)"
// and outputs a date like Twitter's datetimestamps.
var d1 = new Date();
var d2 = new Date(datestring);
var timeAgo = d1.getTime()-d2.getTime();
if ((timeAgo/1000/60/60/24) >= 1) {
// return full date: "Nov 10" if same year, or "10 Nov 2015"
var months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
@jasonalderman
jasonalderman / timecode-to-seconds.html
Last active September 26, 2017 18:53
Type a minute/second timecode (e.g., 2:47) in the top field, and get out a number of seconds (e.g., 167.0) below, and vice-versa. https://rawgit.com/jasonalderman/fe1e7b1d43442d82969f81fd2ffeff76/raw/ef635ba1dbe4362064be2c0853d79cae392c236c/timecode-to-seconds.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>timecode calculator</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
input {
font-size: 54px;

Useful Mac commands

When microphone isn't working in Chrome in Hangouts

  1. sudo killall coreaudiod
  2. Open new Chrome tab.

When you want to start a PHP Dev Server but access it from a phone or other computer

Instead of php -S localhost:8000 use php -S 0.0.0.0:8000 and you'll be able to see the server from http://<your IP address>:8000.

When you want to generate a localhost HTTPS certificate

@jasonalderman
jasonalderman / landingpage.html
Last active January 7, 2021 11:28
Simple, single-page, "coming soon" landing page template.
<!DOCTYPE html>
<html>
<head>
<!-- This is a template for a landing page!
✓ Fill in the things between the {{double braces}}, removing the {{ and }} in the process.
✓ Make a logo image for the <img> tag, and take note of its width and height.
✓ Make a sharing image for the OpenGraph/Facebook/Twitter <meta> tags (square, 1200x1200px).
✓ Tweak CSS as necessary.
✓ Rename this file to index.html and upload it and the two images to the web root directory on your server.
✓ Remove this comment when done. -->
@jasonalderman
jasonalderman / useful-git-commands.md
Created June 2, 2017 07:21
Git commands I'm learning are rather helpful.

Preview a merge without merging.

git merge --no-commit --no-ff <otherbranch>

Diff the filenames only, with status

git diff --name-status

#!/bin/sh
# Error out if anything fails.
set -e
# Make sure script is run as root.
if [ "$(id -u)" != "0" ]; then
echo "Must be run as root with sudo! Try: sudo ./install.sh"
exit 1
fi
@jasonalderman
jasonalderman / nfp
Created March 26, 2016 17:12
Nag-Free Pinterest: Quick-and-dirty bookmarklet to hide the nags and let you look at a Pinterest page while not logged in.
javascript:document.querySelector('div.Nags').remove();
@jasonalderman
jasonalderman / _chromenik
Last active February 9, 2016 10:20
Chrome extension to look up words on Wordnik.
An extension for Google Chrome that lets you look up words on Wordnik.
It's outdated—the manifest version is 1 when it should be 2—but it may work for you if you
• download the files
• go to chrome://extensions
• check "Developer Mode"
• "Load unpacked extension..."
The .zip file contains the following files:
- manifest.json
- background.html
@jasonalderman
jasonalderman / primename
Created June 20, 2015 02:39
Quick function to determine if your name adds up to a prime number.
// ****
// Because I spent all week writing javascript, then I saw this:
// https://instagram.com/p/4DJNNbR5_P/
// and needed to automate it, like so:
// > getNumber("Wolfgang Mozart")
// returns: "Your name is not a prime number: Wolfgang Mozart (178)."
// ****
var getNumber = function getNumber(nameString) {
var arr = nameString.toLowerCase().split('');
var key = " abcdefghijklmnopqrstuvwxyz".split('');