Skip to content

Instantly share code, notes, and snippets.

View miklb's full-sized avatar
🎣
Gone Fishing

Michael Bishop miklb

🎣
Gone Fishing
View GitHub Profile
@miklb
miklb / py_forecast.py
Last active June 14, 2016 19:54
Pythonista script to grab your current location, then retrieve current weather via forecast.io
# -*- coding:utf-8 -*
import location
import re
import sys
import json
import urllib
import webbrowser
from os import environ
from sys import exit, argv
@miklb
miklb / habarihighlight.plugin.php
Last active August 29, 2015 13:55
previous attempt at inserting the script tag
<?php
class HabariHighlight extends Plugin {
public function action_template_header ()
{
Stack::add('template_stylesheet','http://yandex.st/highlightjs/8.0/styles/default.min.css','highlight');
Stack::add('template_header_javascript','http://yandex.st/highlightjs/8.0/highlight.min.js','highlightjs');
}
public function theme_header( $theme )
@miklb
miklb / titlecase.py
Last active August 29, 2015 14:00
Python Port by Stuart Colville of Gruber's Perl Title Case Script
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
titlecase.py v0.2
Original Perl version by: John Gruber http://daringfireball.net/ 10 May 2008
Python version by Stuart Colville https://muffinresearch.co.uk/titlecasepy-titlecase-in-python/
License: http://www.opensource.org/licenses/mit-license.php
"""
@miklb
miklb / gist:8536fdb43ed8564689cb
Last active December 1, 2016 04:50
bookmarklet to hide "IFTTT" from a page. (specifically pinboard). Completely cribbed from this [Stack Overflow](https://gist.github.com/miklb/8536fdb43ed8564689cb/edit) solution.
javascript:function htmlreplace(a,b,element){if(!element)element=document.body;var nodes=element.childNodes;for(var n=0;n<nodes.length;n++){if(nodes[n].nodeType==Node.TEXT_NODE){nodes[n].textContent=nodes[n].textContent.replace(new RegExp(a,'gi'),b);}else{htmlreplace(a,b,nodes[n]);}}}htmlreplace('IFTTT','');
@miklb
miklb / moonphase.py
Created July 1, 2015 07:12
Calculate Lunar Phase
#!/usr/bin/env python
"""
moonphase.py - Calculate Lunar Phase
Author: Sean B. Palmer, inamidst.com
Cf. http://en.wikipedia.org/wiki/Lunar_phase#Lunar_phase_calculation
"""
import math, decimal, datetime
dec = decimal.Decimal
@miklb
miklb / custom.css
Last active August 29, 2015 14:24
Using background image so can export from Marked app to PDF
@media print {
body.custom {
background-color: #fff;
background-image: url('http:/miklb.com/grid_paper_blue_lines.gif');
-webkit-font-smoothing:antialiased;
font:normal .8764em/1.5em Arial,Verdana,sans-serif;
margin:100px;
}
@miklb
miklb / jekyl_frontmatter_textexpander.js
Last active October 20, 2021 12:41
A TextExpander snippet for Jekyll Front Matter. Enter a title, outputs front matter including a slug for the permalink.
var title = '%filltext:name=Title%';
slug = title.replace(/[^\w\s]/gi, '');
var newslug = title.split(" ").join("-");
var dt = new Date();
TextExpander.appendOutput("---\n");
TextExpander.appendOutput("layout: post \n");
TextExpander.appendOutput("title: " + '"' +title + '"'+ "\n");
TextExpander.appendOutput("tags: \n");
function chapel_project_metaboxes(array $meta_boxes)
{
// underscore hides meta box from custom field list
$prefix = '_chapel_';
$meta_boxes ['project_metabox'] = array(
'id' => 'project_metabox',
'title' => __('Project Overview', 'cmb2'),
'object_types' => array( 'project'),
@miklb
miklb / client.php
Created April 6, 2016 17:14
CPT forms front-end w/CMB2
<?php
add_action( 'init', 'chapel_client_init' );
/**
* Create Client Custom Post Type
*
*/
function chapel_client_init() {

Keybase proof

I hereby claim:

  • I am miklb on github.
  • I am miklb (https://keybase.io/miklb) on keybase.
  • I have a public key ASCIPpnA3ebZHf7nef4SLLuHXijPbzCz84WRbkvllMWiFAo

To claim this, I am signing this object: