Skip to content

Instantly share code, notes, and snippets.

@oncomouse
oncomouse / gist:6238377
Created August 15, 2013 05:00
Portion of a Middleman config.rb file relevant to getting middleman-blog working.
set :markdown_engine, :kramdown
set :markdown, :fenced_code_blocks => true,
:autolink => true,
:smartypants => true,
:footnotes => true,
:superscript => true
helpers do
def javascript_path(file_path)
asset_path(:js, file_path)
@oncomouse
oncomouse / pandoc.rb
Last active August 29, 2015 14:10
Ruby script to process LaTeX files for conversion to .docx using Pandoc as a transport.
# Usage:
# => ruby pandoc.rb -i <file_name>(.tex) (options for pandoc)
# => minimum options for pandoc: --bibliography=<bibliography_file.bib> --csl=<mla or chicago>.csl
# Installed by running 'gem install bibtex' (may need to append sudo)
require 'bibtex'
default_bibliography = "./transhumanism.bib" # change this to whatever
if ARGV.find_index("-i")
@oncomouse
oncomouse / points.csv
Created June 2, 2015 22:32
Using Mechanize to Populate Neatline w/ Geocoded Information
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 7 columns, instead of 4 in line 8.
location,date,type,point,lat,lon,voyage
"12 Fulton St, New York, NY",10/19/1843,Port of Embarkation,POINT(-8238040.262471187 4969156.247075499),40.7065671,-74.0035748,0
"Merseyside L3 4BB, Liverpool, UK",11/1/1843,Port of Disembarkation,POINT(-333333.99225396814 7057466.066808143),53.400715,-2.9943902,0
"Bristol Harbour, Bristol, England",4/8/1838,Shipyard Location,POINT(-290859.72885313287 6701227.851099645),51.44969200000001,-2.6128374,0
"Merseyside L3 4BB, Liverpool, UK",1/4/1845,Port of Embarkation,POINT(-333333.99225396814 7057466.066808143),53.400715,-2.9943902,1
"Boston, MA",1/24/1845,Port of Disembarkation,POINT(-7910238.3479711665 5215071.602551562),42.3600825,-71.0588801,1
"Bay of Quick, Greenock, Scotland",1/4/1845,Shipyard Location,POINT(-531214.7175602124 7549756.132135566),55.95647599999999,-4.771983,1
"12 Fulton St, New York, NY",6/27/1855,Port of Embarkation,POINT(-8238040.262471187 4969156.247075499),40.7065671,-74.0035748,2
"Merseyside L3 4BB, Liverpool, UK",7/10/1855,Port of Disembarkation,
@oncomouse
oncomouse / fix.rb
Created April 30, 2017 14:56
Script to fix permissions issues caused by a student IT worker running `chmod -R 755` in my OSX home directory
require 'shellwords'
# Dir.glob was acting weird w/ spaces in file names, so just used find:
IO.popen("find Old\\ Home/apilsch/ -type f") do |fp|
while not (output = fp.gets).nil?
# Full file path:
file = "/Users/apilsch/Desktop/#{output.strip}"
# Location of original file on disk:
disk_file = file.sub("Desktop/Old\ Home/apilsch/", "")
next if not File.exist? disk_file
@oncomouse
oncomouse / index.html
Last active January 17, 2021 17:42
Simple Tracery Demo Template
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<title>
Page Title
</title>
@oncomouse
oncomouse / readme.md
Created January 20, 2018 16:42
Amodern Code Figures
function sayHello(name) {    
     return ‘Hello there,  + name;
}
function sayHello(name) {
    name = name || ‘default person’;
 return ‘Hello there,  + name;
cask_args appdir: '/Applications'
tap "heroku/brew"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"
tap "homebrew/cask-fonts"
# Shell stuff
brew "fish"
cask_args appdir: '/Applications'
tap "heroku/brew"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"
tap "homebrew/cask-fonts"
# Shell stuff
brew "fish"
@oncomouse
oncomouse / StyledTransition.js
Last active April 15, 2021 05:24
Using CSSTransitionGroup with Emotion.js
import React from 'react';
import styled from '@emotion/styled';
import { css } from '@emotion/core';
import { CSSTransition } from 'react-transition-group';
const has = (key, obj) => Object.prototype.hasOwnProperty.call(obj, key);
const keyframes = [
'appear',
'enter',
@oncomouse
oncomouse / App.js
Created June 4, 2019 23:45
DHSI 2019 - Day 2 Working Code
import React, { useState } from 'react';
import Headline from './components/Headline';
import NameForm from './components/NameForm';
import Names from './components/Names';
const App = () => {
const [names, setNames] = useState([])
return (
<div>