Skip to content

Instantly share code, notes, and snippets.

Avatar

Richard Saunders rdsaunders

View GitHub Profile
@rdsaunders
rdsaunders / 44x44-cursor.js
Last active Aug 27, 2020
44x44px Cursor Bookmarklet
View 44x44-cursor.js
javascript:(function(){ var style = document.createElement(%27style%27), styleContent = document.createTextNode(%27* { cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJBJREFUeNrs2dEKgDAIhWEN3/+VLYtBF12MppHwDxY0uvg4DJpORcSl0bB4uPcwq+oFHu8/956pbtJsAAYMGDBgwIABA044t3pMEgb8VU2XsWdn1o/aUUn4bchPBWNFYWvVidxbCFGmr7YULBs1YDPfsYcXEi9ryvDjAAwYMGDAgAED7nK8bHG7qNLs6nYXYAAheh5j8Qw5fwAAAABJRU5ErkJggg==) 22 22, auto !important}%27); style.appendChild(styleContent ); var caput = document.getElementsByTagName(%27head%27); caput[0].appendChild(style); })();
View Shortcut.txt
#
## Setup
GitHub token
Repo name
Path for image upload
Path for markdown upload
Choose image
@rdsaunders
rdsaunders / pocket-bookmarks-to-markdown.py
Created Oct 1, 2019
A python script to convert a CSV file of saved bookmarks via pocket/google sheets and IFTTT into markdown for jekyll.
View pocket-bookmarks-to-markdown.py
# Takes a file CSV file called "data.csv" and outputs each row as a YAML file named after first column.
# Data in the first row of the CSV is assumed to be the column heading.
# Original work borrowed from: https://github.com/hfionte/csv_to_yaml
# Import the python library for parsing CSV files.
import csv
from datetime import datetime
# Open our data file in read-mode.
csvfile = open('data.csv', 'r')
View ig-import.py
import codecs
from datetime import datetime
import json
import os
import posixpath
import re
import shutil
import sys
# This script will import your instagram photos to your static site. It should work for most, assuming you customize the POST_TEMPLATE to match what your site uses.
@rdsaunders
rdsaunders / glyphicons.ljmap
Last active Dec 9, 2015
An icon map to use with Icon Jar for the current version of the Glyphicons font (v1.8)
View glyphicons.ljmap
{
"icons":{
"e597":{
"name":"activity"
},
"e089":{
"name":"address-book"
},
"e092":{
"name":"adjust"
@rdsaunders
rdsaunders / compass-sprite-removehash.rb
Created Jan 19, 2015
Remove the random string in the sprite filename If you don’t want the random string that’s appended to the filename when a new sprite is created, here’s how to remove it. You will need to add this to config.rb inside your Compass project.
View compass-sprite-removehash.rb
# Make a copy of sprites with a name that has no uniqueness of the hash.
on_sprite_saved do |filename|
if File.exists?(filename)
FileUtils.cp filename, filename.gsub(%r{-s[a-z0-9]{10}\.png$}, '.png')
# Note: Compass outputs both with and without random hash images.
# To not keep the one with hash, add: (Thanks to RaphaelDDL for this)
FileUtils.rm_rf(filename)
end
end
@rdsaunders
rdsaunders / compass-sprite-hashtoquerystring.rb
Created Jan 19, 2015
Remove the hash string in the sprite filename and replace with a query string
View compass-sprite-hashtoquerystring.rb
# Make a copy of sprites with a name that has no uniqueness of the hash.
on_sprite_saved do |filename|
if File.exists?(filename)
FileUtils.cp filename, filename.gsub(%r{-s[a-z0-9]{10}\.png$}, '.png')
# Note: Compass outputs both with and without random hash images.
# To not keep the one with hash, add: (Thanks to RaphaelDDL for this)
FileUtils.rm_rf(filename)
end
end
View calendar-selects.html
<select name="calendar-days">
<option value="Sunday">Sunday</option>
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednesday">Wednesday</option>
<option value="Thursday">Thursday</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
</select>
View time-selects.html
<select name="time-hours">
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
View register_post_types
<?php
/* Register custom post types on the 'init' hook. */
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 0.1.0
* @access public