Skip to content

Instantly share code, notes, and snippets.

@alexparker
alexparker / current-media-queries.scss
Created November 4, 2012 03:55
SASS Proposition for extending media queries via output buffer style functions
/*
I understand this is how it currently works.
Also there is a little "convenience" way to do it with some control structures and passing an argument to the mixin,
but the resulting code is still the same.
*/
@mixin handhelds() {
@media only screen and (max-width: 479px) { @content; }
}
@Wilto
Wilto / blockquote.md
Created December 20, 2012 15:35
Of Blockquotes and Outlines
@bencrowder
bencrowder / splitimage.sh
Last active January 27, 2019 18:28
Shell script to split two-spread image into two different images. Uses ImageMagick.
#!/bin/sh
# Split two-spread image into two different images (leaving some overlap for safety)
# Usage: splitimage filename.jpg
# ----------------------------------------------------------------------------------
convert $1 -crop 56x100%+0+0 +repage output/`basename $1 .jpg`a.jpg
convert $1 -flop -crop 60x100%+0+0 -flop +repage output/`basename $1 .jpg`b.jpg
@bencrowder
bencrowder / gc_references.py
Last active December 29, 2023 19:48
Small Python script to scrape LDS General Conference transcripts and output HTML page listing scripture references. Example: http://bencrowder.net/files/gc-references/2013-04
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import codecs
import requests
import bs4
# Change these
year = 2013
@mindbat
mindbat / rename_gutenberg.sh
Created July 28, 2013 18:43
Bash script to rename project gutenberg ebooks to their document titles.
#!/bin/bash
# Bash script to pull document titles from
# Project Gutenberg ebooks.
# Invoke using command like:
# find ./ -type f -name "*.txt" | xargs -n 1 ./process.sh ~/Documents/
# pull the first line of the file
FIRST_LINE=`head -n 1 $2`
@zholmquist
zholmquist / Hazel + Evernote Logging
Last active May 19, 2017 00:39
Hazel Embedded AppleScript that logs filename to Evernote. I use this in a script that cleans up my Desktop and Downloads and files everything away.
tell application "Evernote"
tell application "Finder" to set file_name to (name of theFile)
set time_string to do shell script "date '+%H:%M:%S'"
set date_string to do shell script "date '+%Y-%m-%d'"
set message to "<p><b>" & time_string & "</b> | Moved <em>" & file_name & "</em></p>"
set matches to find notes date_string & " notebook:Log"
if (count of matches) is 1 then
set the_note to item 1 of matches
@thomd
thomd / semantic-layout.html
Last active November 11, 2024 20:30
Standard HTML5 Semantic Layout
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Title</title>
<link href="stylesheets/main.css" rel="stylesheet" />
</head>
<body>
<header>
<hgroup>
@mildred
mildred / download.sh
Created October 20, 2014 10:03
Download from archive.org Wayback Machine
#!/bin/bash
url=http://redefininggod.com
webarchive=https://web.archive.org
wget="wget -e robots=off -nv"
tab="$(printf '\t')"
additional_url=url.list
# Construct listing.txt from url.list
# The list of archived pages, including some wildcard url
@caseywatts
caseywatts / bookmarkleting.md
Last active May 3, 2025 14:47
Making Bookmarklets

This is one chapter of my "Chrome Extension Workshops" tutorial, see the rest here: https://gist.github.com/caseywatts/8eec8ff974dee9f3b247

Unrelated update: my book is out! Debugging Your Brain is an applied psychology / self-help book

Making Bookmarklets

I'm feeling very clever. I've got this sweet line of javascript that replaces "cloud" with "butt". My mom would LOVE this, but she doesn't computer very well. I'm afraid to show her the Developer Console and have her type/paste this in. But she IS pretty good at bookmarks, she knows just how to click those!

A bookmark normally takes you to a new web page. A bookmarklet is a bookmark that runs javascript on the current page instead of taking you to a new page. To declare that it is a bookmarklet, the "location" it points to starts with javascript:.

@adaptivegarage
adaptivegarage / theme-detect.css
Last active December 1, 2024 00:39
Pure CSS ePub theme detection (White / Sepia / Night) in iBooks (Mac OS and iOS included)
/*
Pure CSS ePub theme detection (White / Sepia / Night) in iBooks (Mac OS and iOS included)
Version 1.1
Note that iBooks actually uses internal JavaScript to set the "__ibooks_internal_theme" attribute on :root (html) element
every time the theme is changed, but this happens independently of whether your epub html markup is scripted or not.
Discovered and tested in iBooks on Mac, iPhone and iPad by
https://twitter.com/adaptivegarage
*/