Skip to content

Instantly share code, notes, and snippets.

View ldandersen's full-sized avatar

Buzz Andersen ldandersen

View GitHub Profile
CABasicAnimation *positionAnimation = [CABasicAnimation animationWithKeyPath:@"position.x"];
positionAnimation.toValue = [NSNumber numberWithFloat: self.backgroundImageView.layer.position.x - 50.0];
CABasicAnimation *widthAnimation = [CABasicAnimation animationWithKeyPath:@"bounds.size.width"];
widthAnimation.toValue = [NSNumber numberWithFloat: self.backgroundImageView.bounds.size.width + 50.0];
CAAnimationGroup *resizeAnimationGroup = [CAAnimationGroup animation];
resizeAnimationGroup.duration = 0.5;
resizeAnimationGroup.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
resizeAnimationGroup.animations = [NSArray arrayWithObjects:positionAnimation, widthAnimation, nil];
@ldandersen
ldandersen / great-circle-cocoa.m
Created September 6, 2011 22:40
Great circle distance in Cocoa
static NSInteger STEarthRadiusKilometers = 6371;
- (NSNumber *)distanceFromLatitude:(NSDecimalNumber *)inLatitude longitude:(NSDecimalNumber *)inLongitude;
{
CLLocationDegrees inLatitudeDegrees = [inLatitude doubleValue];
CLLocationDegrees latitudeDegrees = [self.latitude doubleValue];
CLLocationDegrees inLongitudeDegrees = [inLongitude doubleValue];
CLLocationDegrees longitudeDegrees = [self.longitude doubleValue];
double distance = acos(sin(inLatitudeDegrees) * sin(latitudeDegrees) + cos(inLatitudeDegrees) * cos(latitudeDegrees) * cos(longitudeDegrees - inLongitudeDegrees)) * STEarthRadiusKilometers;
@ldandersen
ldandersen / trump-audit.markdown
Last active January 24, 2017 21:19
How to support Elizabeth Warren's Trump audit

If you want to support Senator Warren's request to audit President Trump's finances for conflicts of interest, the woman who answered the phone at the Comptroller General of the Government Accountability Office said the most effective way to be sure my support counted was to email two administrators, Katherine Siggerud and Timothy Minnelli.

Their email addresses are:

siggerudk@gao.gov

minellit@gao.gov

There is a third email address through which they're tracking people who are urging support for the audit: congrel@gao.gov

@ldandersen
ldandersen / kiosk.rb
Last active January 10, 2019 22:52
Kiosk Backend Code for Stripe Card Present Source Conversion
require 'sinatra'
require 'stripe'
require "net/http"
require "uri"
require 'json'
Stripe.api_key = "sk_test_jHt1s7iazJkYNA8o9GbHZ9e2"
set :bind, '0.0.0.0'