Skip to content

Instantly share code, notes, and snippets.

View doubleday's full-sized avatar

Daniel Doubleday doubleday

View GitHub Profile
@doubleday
doubleday / When Song Finishes, Pause.applescript
Created May 17, 2022 21:28 — forked from capnslipp/When Song Finishes, Pause.applescript
Pause Spotify after the current song finishes playing
(*
@author: Slipp Douglas Thompson
@purpose: Pauses Spotify after the current song finishes playing.
@todo: Optimize so it's more efficient.
@usage: Drop a compiled script (a .scpt file, converted with AppleScript Editor if this is a .applescript file) into ~/Library/Scripts/Applications/Spotify.
Ensure than “Show Script menu in menu bar” is enabled (which can be found in the AppleScript Editor preferences).
When playing a song in Spotify and wishing to stop the music when the track finished, choose “When Song Finishes, Pause” from the script menu, and then walk, walk away.
*)
tell application "Spotify"
log "“When Song Finishes, Pause”: player state is " & (player state)
@doubleday
doubleday / gtest_float_comparison.h
Created November 4, 2017 18:58
This is an extract if googles unit test framework to get the AlmostEquals functionaliy for floats
// Copyright 2005, Google Inc.
// All rights reserved.
//
// This is an extract if googles unit test framework to get the AlmostEquals
// functionaliy for floats
// see https://github.com/google/googletest/blob/eabd5c908d27eed925d81637c99c834489fc84b2/googletest/include/gtest/internal/gtest-internal.h
#pragma once
namespace testing {
@doubleday
doubleday / Maybes.cs
Last active October 5, 2015 14:40
Maybe types
static class Extensions
{
public static T FirstOrValue<T>(this IEnumerable<T> sequence, T value)
{
T result = value;
foreach(T item in sequence)
{
result = item;
break;
}
@doubleday
doubleday / ListPerfTest.cs
Created August 19, 2015 17:42
Quick and dirt c# list test
public static class Dev
{
public static void Null(object val)
{
if (val == null)
{
throw new InvalidOperationException();
}
}
}
@doubleday
doubleday / int_map.cpp
Created July 24, 2015 18:15
Create compile time int lookup table
template <int Val>
struct int_const : std::integral_constant<int, Val> {};
template <typename In, typename T>
struct getMappedOutput;
template <typename In, typename Left, typename Right, typename ...Tail>
struct getMappedOutput<In, std::tuple<Left, Right, Tail...>>
: getMappedOutput<In, std::tuple<Tail...>>
@doubleday
doubleday / cocos2d.iOS.csproj
Last active August 29, 2015 14:14
cocos2dnxa-projectfiles-case-fix.diff
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProjectGuid>{A83510D8-7AED-411E-9616-DCFEA180969E}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<Description>cocos2d for MonoTouch</Description>
<RootNamespace>Cocos2D</RootNamespace>
using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
namespace Scratch
{
public class Program
{
public static void Main(string[] pArgs)