Skip to content

Instantly share code, notes, and snippets.

@dstaley
dstaley / README.md
Created December 10, 2012 19:50
Save Money with IronWorker and Dwolla

Save Money with IronWorker and Dwolla

This is a simple script that asks you for a savings goal and a deadline. It then calculates how much money you need to save per day to reach your goal, and then schedules withdrawals from one of your Dwolla funding sources. It aims to be a "set and forget" way to save money.

Requirements

The script requires that you have Ruby and the following gems installed:

  • iron_worker_ng
  • typhoeus
  • chronic
  • json

Given the following JSON responses:

GET /things

{
    "things": [
        {
            "name": "spoon"
        },
 {
func partition<C: Comparable>(v: C[], left: Int, right: Int) -> Int {
var i = left
for j in (left + 1)..(right + 1) {
if v[j] < v[left] {
i++
(v[i], v[j]) = (v[j], v[i])
}
}
(v[i], v[left]) = (v[left], v[i])
return i
@dstaley
dstaley / fizzbuzz.swift
Last active February 5, 2019 21:19
FizzBuzz in Swift using pattern matching
func fizzbuzz(i: Int) -> String {
let result = (i % 3, i % 5)
switch result {
case (0, _):
return "Fizz"
case (_, 0):
return "Buzz"
case (0, 0):
return "FizzBuzz"
default:
func jortSort<T:Comparable>(inout array: [T]) -> Bool {
// sort the array
let originalArray = array
array.sort({$0 < $1})
// compare to see if it was originally sorted
for var i = 0; i < originalArray.count; ++i {
if originalArray[i] != array[i] { return false }
}
/Users/dstaley/Downloads/Winners of MiCredits Mi 4.zip:$pkzip$1*1*2*0*5c*58*2e6a7cd6*0*36*8*5c*2e6a*e21dd3255fcc6919f64ddadc95ac710d065b7fb96d0e97937a1f253bf92d73fe7a4aa92db7fca1f600c4a8b4e8f3331b0847f2d2f0b73d5665496b68747f4e394c7b7829b81832839cef7da084e564815672a3de59b4b8576d25dc87*$/pkzip$
export default {
name: 'geolocation-service',
initialize: function(container, app) {
app.inject('route', 'geolocationService', 'service:geolocation');
app.inject('controller', 'geolocationService', 'service:geolocation');
}
};
@dstaley
dstaley / designer.html
Last active August 29, 2015 14:06
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="dfp-ad-unit" attributes="network-id width height ad-unit">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
body {
background-color: #CE3426;
color: white;