This file contains 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
;; a simple .emacs.d/init.el to set up | |
;; inferior lisp mode for Clojure with lein | |
;; this also add Marmalade as a package repository to obtain clojure-mode and paredit | |
(setq inferior-lisp-program "lein repl") | |
;; On OSX set the command key to be the meta key | |
(setq ns-command-modifier 'meta) | |
(require 'package) |
This file contains 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
;;; Markdown | |
(defun turn-on-outline-minor-mode () | |
(outline-minor-mode 1)) | |
(when (require 'markdown-mode nil 'noerror) | |
(setq auto-mode-alist | |
(cons '("\\.md" . markdown-mode) auto-mode-alist)) | |
(setq auto-mode-alist | |
(cons '("\\.markdown" . markdown-mode) auto-mode-alist)) | |
(setq markdown-command "/usr/local/bin/Markdown.pl") |
This file contains 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
$(document).ready(function () { | |
var tabOpts = { | |
activate: handleTabSelect, | |
// fx has been deprecated | |
show: { | |
height: 'toggle', | |
opacity: 'toggle' | |
} | |
}; |
This file contains 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
var store:EKEventStore = EKEventStore() | |
store.requestAccessToEntityType(EKEntityTypeEvent, | |
completion:{(granted:Bool, error:NSError?) -> Void in | |
if let e = error { | |
println("Error \(e.localizedDescription)") | |
} | |
if granted { |
This file contains 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
self.geocoder.geocodeAddressString("Haddonfield, NJ", | |
completionHandler: {(placemarks, error:NSError!) in | |
if error? { | |
println("Error \(error!.localizedDescription)") | |
if error!.code == 8 { | |
println("not found") | |
} | |
return | |
} |
This file contains 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
func playSoundWithAVAudioPlayer() { | |
var alertSound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("alert", ofType: "mp3")) | |
var error:NSError? | |
if !AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, error: &error) { | |
if let err = error { | |
println("could not set session category: \(err.localizedDescription)") | |
} | |
} |
This file contains 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
/// soundbanks are either dls or sf2. see http://www.sf2midi.com/ | |
var soundbank:NSURL! | |
var mp:AVMIDIPlayer! | |
func playMIDIFile() { | |
// Load a SoundFont or DLS file. | |
self.soundbank = NSBundle.mainBundle().URLForResource("GeneralUser GS MuseScore v1.442", withExtension: "sf2") | |
// a standard MIDI file. |
This file contains 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
class Sound : NSObject { | |
/// The player. | |
var avPlayer:AVAudioPlayer! | |
/** | |
Uses AvAudioPlayer to play a sound file. | |
The player instance needs to be an instance variable. Otherwise it will disappear before playing. | |
*/ | |
func readFileIntoAVPlayer() { |
This file contains 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
func setSessionPlayer() { | |
let session:AVAudioSession = AVAudioSession.sharedInstance() | |
var error: NSError? | |
if !session.setCategory(AVAudioSessionCategoryPlayback, error:&error) { | |
println("could not set session category") | |
if let e = error { | |
println(e.localizedDescription) | |
} | |
} | |
if !session.setActive(true, error: &error) { |
This file contains 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
class MIDISampler : NSObject { | |
var engine:AVAudioEngine! | |
var playerNode:AVAudioPlayerNode! | |
var mixer:AVAudioMixerNode! | |
var sampler:AVAudioUnitSampler! | |
/// soundbanks are either dls or sf2. see http://www.sf2midi.com/ | |
var soundbank:NSURL! | |
let melodicBank:UInt8 = UInt8(kAUSampler_DefaultMelodicBankMSB) | |
/// general midi number for marimba | |
let gmMarimba:UInt8 = 12 |
OlderNewer