Skip to content

Instantly share code, notes, and snippets.

@jeffmcfadden
jeffmcfadden / update_ip_addresses.rb
Created Jul 1, 2014
DNS Made Easy Dyanmic DNS Update Script
View update_ip_addresses.rb
#!/usr/bin/env ruby
require 'open-uri'
require "net/http"
require "uri"
# Change this
username = "fancypants"
# Set these up
@jeffmcfadden
jeffmcfadden / geodesic.php
Created Sep 16, 2014
Geodesic Distance in PHP
View geodesic.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 / esv_book_data.m
Last active Aug 29, 2015
ESV Data in ObjC Usable Formats
View esv_book_data.m
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",
View morse_code_dictionary.rb
MORSE_CODE_DICTIONARY = {
"a" => ".-",
"b" => "-...",
"c" => "-.-.",
"d" => "-..",
"e" => ".",
"f" => "..-.",
"g" => "--.",
"h" => "....",
"i" => "..",
View merge_asana_into_omnifocus.rb
#!/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.
View broken inheritance.js
if (typeof Object.create !== 'function') {
Object.create = function (o) {
var F = function() {};
F.prototype = o;
return new F();
};
}
var CarouselBase = function(){};
CarouselBase.prototype.cycle_interval = 15000;
@jeffmcfadden
jeffmcfadden / memcached gem fail
Created Oct 28, 2010
trying to build memcached on snow leopard
View memcached gem fail
libtool: install: /usr/bin/install -c .libs/libmemcached.lai /Users/jeffmcfadden/.rvm/gems/ruby-1.9.2-p0@rails3/gems/memcached-1.0.1/ext/lib/libmemcached.la
libtool: install: /usr/bin/install -c .libs/libmemcached.a /Users/jeffmcfadden/.rvm/gems/ruby-1.9.2-p0@rails3/gems/memcached-1.0.1/ext/lib/libmemcached.a
libtool: install: chmod 644 /Users/jeffmcfadden/.rvm/gems/ruby-1.9.2-p0@rails3/gems/memcached-1.0.1/ext/lib/libmemcached.a
libtool: install: ranlib /Users/jeffmcfadden/.rvm/gems/ruby-1.9.2-p0@rails3/gems/memcached-1.0.1/ext/lib/libmemcached.a
----------------------------------------------------------------------
Libraries have been installed in:
/Users/jeffmcfadden/.rvm/gems/ruby-1.9.2-p0@rails3/gems/memcached-1.0.1/ext/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
@jeffmcfadden
jeffmcfadden / memcached gem fail full
Created Oct 28, 2010
Full build log of attempting to build memcached gem on snow leopard
View memcached gem fail full
Building native extensions. This could take a while...
ERROR: Error installing memcached:
ERROR: Failed to build gem native extension.
/Users/jeffmcfadden/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb
Building libmemcached.
tar xzf libmemcached-0.32.tar.gz 2>&1
Patching libmemcached source.
patch -p1 -Z < libmemcached.patch
patching file libmemcached-0.32/libmemcached/memcached_response.c
View Peter.rb
class Peter
def isTired?
hadClassToday? && Time.now.hour > 22
end
def hadClassToday?
true unless ( Time.now.wday == 0 || Time.now.wday == 6 )
end
def status
@jeffmcfadden
jeffmcfadden / Jaconda2.js
Created Jan 28, 2011
Jaconda UserScript v2
View Jaconda2.js
// ==UserScript==
// @name growl-notifications
// @namespace http://fluidapp.com
// @description What does this do?
// @include *
// @author Someone
// ==/UserScript==
//Jquery:
/*!