Skip to content

Instantly share code, notes, and snippets.

@mxpr
mxpr / dashing-requests.py
Created December 15, 2013 17:22
Example of how to send data to dashing from python
# http://stackoverflow.com/questions/20211990/sending-data-curl-json-in-python
import requests #pip install requests
import simplejson as json #pip install simplejson
url = "http://<ip-address>:3030"
widget = "welcome"
data = { "auth_token": "YOUR_AUTH_TOKEN", "text": "Python Greetings!!" }
fullUrl = "%s/widgets/%s" % (url, widget)
@mxpr
mxpr / 1-watchkit-update-plists.py
Last active January 14, 2016 23:42
watchkit command line builds
import plistlib
# Read Plists
myAppInfoPlist = plistlib.readPlist(“MyApp/Info.plist”)
watchKitExtensionInfoPlist = plistlib.readPlist(“WatchKitExtension/Info.plist”)
watchKitAppInfoPlist = plistlib.readPlist(“WatchKitApp/Info.plist”)
# Update Watch Kit Extension Plist
watchKitExtensionInfoPlist[“NSExtension”][“NSExtensionAttributes”][“WKAppBundleIdentifier”] = watchKitAppInfoPlist[“CFBundleIdentifier”]
watchKitExtensionInfoPlist[“CFBundleVersion”] = myAppInfoPlist[“CFBundleVersion”]
@mxpr
mxpr / 1-uitableview-simple-changes.swift
Last active August 29, 2015 14:19
UITableView Move + Update
func animateChanges()
{
tableView.moveRowAtIndexPath(NSIndexPath(forRow: 2, inSection: 0), toIndexPath: NSIndexPath(forRow: 0, inSection: 0))
tableView.reloadRowsAtIndexPaths([NSIndexPath(forRow: 0, inSection: 0)], withRowAnimation: .Automatic)
}
import Foundation
import UIKit
class ItemSizeCollectionViewcontroller : UICollectionViewController
{
// MARK: Outlets
@IBOutlet weak var flowLayout: UICollectionViewFlowLayout!
// MARK: Properties
@mxpr
mxpr / 0.1-export-plist.sh
Last active November 25, 2022 04:15
Export Options Plist flag in xcodebuild
# Switch xcrun to leverage Xcode 7
# Note: This won't be needed once Xcode 7 is released
# and becomes the primary Xcode in use.
export DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer/
# Export Archive
xcrun xcodebuild -exportArchive -exportOptionsPlist exportPlist.plist -archivePath /path/to/app.xcarchive -exportPath /path/to/app.ipa
@mxpr
mxpr / 0.1-kvs-protocol.swift
Last active August 29, 2015 14:26
KeyedCallbacks
protocol KeyValueStore
{
func valueForKey(key: String) -> String
func setValue(value: String, forKey key: String)
func removeValueForKey(key: String)
}