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
uri = URI.parse("http://bar.com")
request = Net::HTTP::Post.new(uri)
request.set_form_data(
"source" => "http://example.com",
"target" => "http://foo.com",
)
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
Installing colorator 1.1.0
Using ffi 1.9.14
Using forwardable-extended 2.6.0
Using sass 3.4.22
Using rb-fsevent 0.9.7
Using kramdown 1.11.1
Using liquid 3.0.6
Using mercenary 0.3.6
Using rouge 1.11.1
Using safe_yaml 1.0.4

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:

@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() {
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 / 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");
@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 / 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 / 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 / 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
"""