Skip to content

Instantly share code, notes, and snippets.

View jeffmcfadden's full-sized avatar

Jeff McFadden jeffmcfadden

View GitHub Profile
@jeffmcfadden
jeffmcfadden / dr_nine_slice.rb
Last active December 30, 2023 20:11
Dragon Ruby Nine Slice Function
# License: MIT
#
# Slice a sprite into 9 pieces, and render them to the output area, scaled to fit.
#
# @note Slice coordinates are from the TOP LEFT of the sprite. Output coordinates are from the normal Bottom Left.
#
# @param args [Hash] The args hash
# @param path [String] The path to the sprite
# @param x1 [Integer] The X coordinate of the first vertical slice
# @param x2 [Integer] The X coordinate of the second vertical slice
require 'watir'
browser = Watir::Browser.new
while true do
begin
browser.goto "http://www.radiotimes.com/news/2017-07-21/radio-times-radio-and-podcast-champion-round-4-5"
sleep 1
puts "Clicking Brady Haran"
browser.radio(name: "PDI_answer9793268", value: "44802685" ).set

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

---
layout: default
---
<div class="photo-post">
<div class="photo-post-photo">
<a href="{% asset_path "photos/{{page.photo_lg}}" %}"><img class="img" src="{% asset_path "photos/{{page.photo_sm}}" %}" /></a>
</div>
<div class="photo-post-caption">
<p class="desc">{{page.exif_desc}}</p>
#!/usr/bin/env ruby
require 'optparse'
require 'yaml'
require 'time'
require 'date'
PHOTOS_DIR = "/Users/yourname/yoursite/_assets/images/photos"
POSTS_DIR = "/Users/yourname/yoursite/_posts"
#!/usr/bin/env ruby -E utf-8
# merge_asana_into_omnifocus.rb
# Hilton Lipschitz
# http://www.hiltmon.com
# Use and modify freely, attribution appreciated
# Script to import Asana projects and their tasks into
# OmniFocus and keep them up to date from Asana.
MORSE_CODE_DICTIONARY = {
"a" => ".-",
"b" => "-...",
"c" => "-.-.",
"d" => "-..",
"e" => ".",
"f" => "..-.",
"g" => "--.",
"h" => "....",
"i" => "..",
@jeffmcfadden
jeffmcfadden / esv_book_data.m
Last active August 29, 2015 14:06
ESV Data in ObjC Usable Formats
NSArray *books_and_chapters = @{@"Genesis" : @"50",
@"Exodus" : @"40",
@"Leviticus" : @"27",
@"Numbers" : @"36",
@"Deuteronomy" : @"34",
@"Joshua" : @"24",
@"Judges" : @"21",
@"Ruth" : @"4",
@"1 Samuel" : @"31",
@"2 Samuel" : @"24",
@jeffmcfadden
jeffmcfadden / geodesic.php
Created September 16, 2014 22:37
Geodesic Distance in PHP
function HowFar( $p1, $p2 ){
// WGS-84 Ellipsoid
$a = 6378137;
$b = 6356752.3142;
$f = 1/289.257223563;
$L = $p2->GetLong() - $p1->GetLong();
$U1 = atan( ( 1 - $f ) * tan( $p1->GetLat() ) );
$U2 = atan( ( 1 - $f ) * tan( $p2->GetLat() ) );
@jeffmcfadden
jeffmcfadden / IPCameraView.swift
Created July 2, 2014 22:48
A UIView Subclass For Displaying An IPCamera Stream (MJPEG)
class IPCameraView: UIView, NSURLSessionDataDelegate {
var imageView:UIImageView
var url: NSURL
var endMarkerData: NSData
var receivedData: NSMutableData
var dataTask: NSURLSessionDataTask
init(frame: CGRect) {