This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- details: standard fizzbuzz, n % 3 = fizz, n % 5 = buzz, n % 15 = fizzbuzz | |
-- usage: ghci> fizzbuzz [1..100] | |
checkFizzbuzz :: Int -> String | |
checkFizzbuzz n | |
| mod n 15 == 0 = "fizzbuzz" | |
| mod n 5 == 0 = "buzz" | |
| mod n 3 == 0 = "fizz" | |
| otherwise = show n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# prompt style and colors based on Steve Losh's Prose theme: | |
# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme | |
# | |
# vcs_info modifications from Bart Trojanowski's zsh prompt: | |
# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt | |
# | |
# git untracked files modification from Brian Carper: | |
# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt | |
function virtualenv_info { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MPMediaItem *item = ...; // From the Media Query | |
NSURL *url = [item valueForProperty:MPMediaItemPropertyAssetURL]; | |
AVAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil]; | |
NSError *readerError = nil; | |
AVAssetReader *assetReader = [AVAssetReader assetReaderWithAsset:asset error:&readerError]; | |
if (! assetReader) { | |
NSLog(@"reader error for URL: %@ \r\n error:%@", url, [readerError localizedDescription]); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "WebKit" | |
set aTitle to name of current tab in front window | |
set aURL to URL of current tab in front window | |
end tell | |
tell application "OmniFocus" | |
set aTask to aTitle | |
set aNote to aURL | |
tell default document to make new inbox task with properties {name:aTask, note:aNote} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "OmniFocus" | |
tell quick entry | |
open | |
make new inbox task | |
tell application "System Events" to keystroke tab | |
activate | |
end tell | |
end tell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (NSString *family in [UIFont familyNames]) { | |
NSLog(@"Family: %@", family); | |
for (NSString *font in [UIFont fontNamesForFamilyName:family]) { | |
NSLog(@" => Font: %@", font); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<root> | |
<item> | |
<name>Alt keyboard with Command_L + Command_R</name> | |
<item> | |
<name>Rebind all keys when both command keys are pressed</name> | |
<identifier vk_config="true">notsave.smp_alt_keyboard</identifier> | |
<autogen>__KeyToKey__ KeyCode::A, KeyCode::MINUS</autogen> <!-- A to [ --> | |
<autogen>__KeyToKey__ KeyCode::SEMICOLON, KeyCode::EQUAL</autogen> <!-- S to ] --> | |
<autogen>__KeyToKey__ KeyCode::S, KeyCode::MINUS, ModifierFlag::SHIFT_L</autogen> <!-- O to { --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// JNJObserver.h | |
// | |
// Created by Josh Johnson on 10/10/13. | |
// Copyright (c) 2013 jnjosh.com. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
typedef void(^JNJObserverActionHandler)(id changingObject, id oldValue, id newValue); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Usage: | |
# | |
# app_path = product_path :workspace => "MyProject.xcworkspace", | |
# :scheme => "MyProjectScheme", | |
# :configuration => "Debug", | |
# :sdk => "iphonesimulator" | |
# | |
# puts app_path //=> /Users/yourusername/Library/Developer/Xcode/DerivedData/MyProject-bltlcokzhdicjggqmcrwibpdgdcp/Build/Products/Debug-iphonesimulator/MyProject.app | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TWTHasselhoffImageProtocol.h | |
// TestURLProtocol | |
// | |
// Created by Josh Johnson on 5/9/14. | |
// Copyright (c) 2014 Two Toasters, LLC. All rights reserved. | |
// | |
@import Foundation; |