Skip to content

Instantly share code, notes, and snippets.

View dylan-k's full-sized avatar

Dylan Kinnett dylan-k

View GitHub Profile
@dylan-k
dylan-k / repo-migrate.txt
Last active April 23, 2021 18:41
Move a Repo from Bitbucket to Github
# Create a new empty repository in GitHub (without readme or licesne. empty!)
# then copy down your bitbucket repo. --mirror helps you get everything.
git clone --mirror https://bitbucket.org/exampleuser/repository-to-mirror.git
cd repository-to-mirror/
# update the URL used as the remote
git remote set-url origin git@github.com:User/UserRepo.git
<?php
function my_find_expired_events( $ids ) {
$args = array(
'post_type' => 'tribe_events',
'nopaging' => true,
'fields' => 'ids',
'meta_query' => array(
array(
@dylan-k
dylan-k / .htaccess
Created March 20, 2019 19:57 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@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>