Skip to content

Instantly share code, notes, and snippets.

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
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;
@dstaley
dstaley / PREVIEW.md
Last active August 29, 2015 14:25
Slack desktop theme based on Atom's default theme

Preview of the Atom for Slack theme

(function() {
var out = {};
var n;
var walk = document.createTreeWalker(
document,
NodeFilter.SHOW_COMMENT,
{ acceptNode: function(n) { return n.nodeValue.substring(1, 7) === './src/'; } },
false
);
while ((n = walk.nextNode()) !== null) {
@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
@dstaley
dstaley / SassMeister-input.scss
Created October 27, 2015 15:49
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}