Skip to content

Instantly share code, notes, and snippets.

@dylan-k
dylan-k / calculate-margins.js
Last active October 9, 2018 13:36
Margin Calculator
// MARGIN CALCULATOR
// source: https://goo.gl/D3k5Fz
/* here's some javascript, courtesy John Smith, to calculate the margins */
var width = 5.5;
var height = 8.5;
// and here are all the paper sizes you could ever need
// as inputs to the script above to calculate the margins:
@dylan-k
dylan-k / poem.md
Last active March 19, 2024 15:30
Example of a poem in markdown with YAML frontmatter
title author
Huntress
H. D.

Come, blunt your spear with us,
our pace is hot
and our bare heels
in the heel-prints—
we stand tense—do you see—

@dylan-k
dylan-k / firstLast.sql
Created April 9, 2018 22:25 — forked from mrclay/firstLast.sql
MySQL: Extract last and first name(s) from a full "name" field (for Elgg)
SELECT
-- Assumed to be trimmed
name
-- Does name contain multiple words?
,(LOCATE(' ', name) = 0) AS hasMultipleWords
-- Returns the end of the string back until reaches a space.
-- E.g. "John Doe" => "Doe"
-- E.g. "Francis Scott Key" => "Key"
@dylan-k
dylan-k / dev_setup.ps1
Created August 9, 2017 19:37 — forked from thitemple/dev_setup.ps1
A PowerShell script for installing a dev machine using Chocolatey.
function Add-Path() {
[Cmdletbinding()]
param([parameter(Mandatory=$True,ValueFromPipeline=$True,Position=0)][String[]]$AddedFolder)
# Get the current search path from the environment keys in the registry.
$OldPath=(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path
# See if a new folder has been supplied.
if (!$AddedFolder) {
Return 'No Folder Supplied. $ENV:PATH Unchanged'
}
# See if the new folder exists on the file system.
@dylan-k
dylan-k / Importing posts from Wordpress into Jekyll.rb
Created November 17, 2016 19:44 — forked from vitobotta/Importing posts from Wordpress into Jekyll.rb
The script I used to import posts from my Wordpress blog into a new Jekyll one.
%w(rubygems sequel fileutils yaml active_support/inflector).each{|g| require g}
require File.join(File.dirname(__FILE__), "downmark_it")
module WordPress
def self.import(database, user, password, table_prefix = "wp", host = 'localhost')
db = Sequel.mysql(database, :user => user, :password => password, :host => host, :encoding => 'utf8')
%w(_posts _drafts images/posts/featured).each{|folder| FileUtils.mkdir_p folder}
@dylan-k
dylan-k / crawler.sh
Last active October 13, 2017 19:00 — forked from nerdpanda/crawler.sh
wget crawler
#!/bin/bash
#
# Crawls a domain
# Retreives all visible URLs and their page titles
# Saves to CSV
# $1 = URL
# $2 = csv filename
#
# USAGE:
# save this script as, say, crawler.sh”.
@dylan-k
dylan-k / note.sublime-snippet
Created March 31, 2016 17:54
snippet for sublime text note-taking
<snippet>
<content><![CDATA[
---
title: ${1:title}
date:
tags: ${2:#@work}
---
]]></content>
<tabTrigger>note</tabTrigger>
<description>Create a simple YAML header</description>
@dylan-k
dylan-k / sublime-keys.json
Created March 30, 2016 14:45
sublime key bindings
[
{ "keys": ["super+shift+u"], "command": "sftp_upload_file" },
{ "keys": ["super+alt+t"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["super+t"], "command": "insert_snippet", "args": { "name": "Packages/XML/long-tag.sublime-snippet" } }
]
@dylan-k
dylan-k / roots-plugins.md
Created May 12, 2015 14:30
Recommended WordPress Plugins from the makers of Roots and Sage Wordpress Themes
Plugin Name Plugin Description
Gravity Forms With Gravity Forms you can build complex, interactive contact forms in minutes.
WPML WPML makes it easy to build multilingual sites and run them. Roots already includes translations for:
English, Spanish, French, Italian, Dutch, Brazilian Portuguese, Macedonian, Finnish, Danish, and Turkish.
WordPress SEO Yoast's all in one SEO solution: titles, meta descriptions, XML sitemaps, breadcrumbs & more.
WP Super Cache WP Super Cache is a static caching plugin that generates HTML files.
W3 Total Cache Improve site performance and user experience via caching.
Analytics 360 Pull Google Analytics and M
@dylan-k
dylan-k / install-sage.sh
Last active August 29, 2015 14:19
steps i took to install and use the Sage theme for Wordpress
# grab a copy of Sage from github
$ git clone --depth=50 --branch=master git://github.com/roots/sage.git roots/sage
# move into the directory where Sage was installed
$ cd roots/sage
$ npm install -g bower gulp jscs # Sage tests include the install for jscs this way. docs don't mention it.
# now check to ensure that you have the requirements installed, with prerequisite versions
# optional: $ composer --version
$ php -v && node -v && gulp -v && bower -v
# you should have:
# PHP >= 5.4.x (test uses 5.6.5)