Skip to content

Instantly share code, notes, and snippets.

import sys
from enum import *
import cozmo
from cozmo.util import degrees
from Triggers import *
# Log Error
def error(message):
print("*********************ERROR:", message)
@mokagio
mokagio / update_xcode_plugins.sh
Last active May 17, 2019 08:54
Script updating all plugins to be compatible with the latest Xcode and Xcode-beta
#!/bin/bash
#
# Updates all plug-ins to be compatible with the latest Xcode and Xcode-beta
#
plugins_location="~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins"
# Get Xcode's version
current_xcode_version="$(defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID)"
@djvaldez
djvaldez / ViewController.swift
Created October 25, 2015 17:01
Simple x-pay-token implementation in swift
//
// ViewController.swift
// hackathon
//
// Created by David Valdez on 10/25/15.
// Copyright © 2015 Blah. All rights reserved.
//
import UIKit
@natecook1000
natecook1000 / operatorCharacters.swift
Last active September 2, 2024 22:07
Allowed characters for Swift operators
import Foundation
extension UnicodeScalar : ForwardIndexType {
public func successor() -> UnicodeScalar {
return UnicodeScalar(value + 1)
}
}
var operatorHeads: [UnicodeScalar] = Array("=-+!*%<>&|^~?".unicodeScalars)
operatorHeads += Array("\u{00A1}" ... "\u{00A7}")
@sketchytech
sketchytech / circlefifths.swift
Last active September 5, 2017 15:35
Circle of Fifths in Swift: Notes for Key
import Foundation
// randomly thinking about how you might use circle of fifths to return notes in any given musical Key
enum KeySignature:String {
case A, B, C, CSharp = "C♯",D, E, F, G, AFlat = "A♭", BFlat = "B♭", CFlat = "C♭", DFlat = "D♭", EFlat = "E♭", GFlat = "G♭"
case Am, Bm, Cm, Dm, Em, Fm, Gm, FSharpm = "F♯m", CSharpm = "C♯m", GSharpm = "G♯m", EFlatm = "E♭m", BFlatm = "B♭m", AFlatm = "A♭m", ASharpm = "A♯m"
func major() -> KeySignature {
switch self {
case .Am:
return KeySignature.C
@aembleton
aembleton / docx2md.md
Last active May 17, 2023 07:04 — forked from vdavez/docx2md.md
Convert a Word Document into MD

Converting a Word Document to Markdown in One Move

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

Installing Pandoc

On a mac you can use homebrew by running the command brew install pandoc.

The Solution

@LearnCocos2D
LearnCocos2D / gist:4acd1eb6733192aab180
Last active May 31, 2017 17:55
GKMinmaxStrategist stub classes implementing the GKGameModel* protocols for Swift 2.0
/*
Swift classes implementing the GKMinmaxStrategizer protocols, without any logic.
You can use these as a template, copy & paste them into your project and start working. ;)
This gist is provided by http://tilemapkit.com and released into public domain.
Here's my tutorial about GKMinmaxStrategist: http://tilemapkit.com/2015/07/gkminmaxstrategist-build-tictactoe-ai/
*/
class TheGameModel: NSObject, NSCopying, GKGameModel {
@loganwright
loganwright / Picker.swift
Created June 2, 2015 02:54
Swift Generic UIPickerView
class PickerSource : NSObject, UIPickerViewDelegate, UIPickerViewDataSource {
var data: [[String]] = []
var selectionUpdated: ((component: Int, row: Int) -> Void)?
// MARK: UIPickerViewDataSource
func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int {
return data.count
}
@airspeedswift
airspeedswift / CSV.swift
Created May 11, 2015 16:19
CSV-parsing code in Swift
// after http://www.cocoawithlove.com/2009/11/writing-parser-using-nsscanner-csv.html
import Foundation
extension NSScanner {
func scanUpToCharactersFromSet(set: NSCharacterSet) -> String? {
var str: NSString?
return self.scanUpToCharactersFromSet(set, intoString: &str)
? str as? String
: nil
@ericallam
ericallam / RotateKeynoteDocumentDroplet
Created July 31, 2014 11:12
Rotate Keynote Document for use as an app Prototype
// Open Script Editor and Export this as an Application
//
// Then drop a keynote file on it in the Finder and it will properly resize
// and rotate everything so the Keynote file becomes usable as a prototype
// in the iPhone keynote app
// rotateDocument exported function
//
// Accepts a Keynote document and will rotate
// all the slides and elements in the slide 90 degrees