Skip to content

Instantly share code, notes, and snippets.

@import Foundation;
@interface KKWatchAppNotificationCenter : NSObject
+ (instancetype)sharedCenter;
- (void)postNotification:(NSString *)key;
- (void)addTarget:(id)target selector:(SEL)selector name:(NSString *)notification;
- (void)removeObserver:(NSObject *)observer;
@end
@bradtheappguy
bradtheappguy / create_ota_manifest.sh
Created April 4, 2015 07:50
Create an iOS Plist file using plistbuddy (OSX)
#!/bin/bash
#Creates an iOS OTA (Over the Air) Minifest File
URL="https://sywl.theappguy.guru/relayrunner/0.2.6/RunnerApp_0.2.6ent.ipa"
BUNDLE_ID="com.example.yourbundleid"
BUNDLE_VERSION="0.0.1"
TITLE="Your App Name"
FILE="yourmanifestfile.plist"
@tehnoir
tehnoir / getudid.sh
Last active September 24, 2018 19:41
getudid
#!/bin/bash
function getUDID {
udid=($(system_profiler SPUSBDataType | grep -A 11 -w "iPad\|iPhone\|iPod\|AppleTV" | grep "Serial Number" | awk '{ print $3 }'))
if [ -z $udid ]; then
echo "No device detected. Please ensure an iOS device is plugged in."
exit 1
else
for id in "${udid[@]}"; do
if [ ${#id} -eq 24 ]; then
@daddykotex
daddykotex / DummyAndroidTextUtilsMockTest.java
Last active April 20, 2017 10:51
Mock Android TextUtils static method
import android.text.TextUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@PomepuyN
PomepuyN / SettingsAdapter.java
Last active June 5, 2018 09:02
Functional example of WearableListView
public class SettingsAdapter extends WearableListView.Adapter {
private final Context context;
private final List<SettingsItems> items;
public SettingsAdapter(Context context, List<SettingsItems> items) {
this.context = context;
this.items = items;
}
private void exportDB() {
String SAMPLE_DB_NAME = "your database name";
File sd = Environment.getExternalStorageDirectory();
File data = Environment.getDataDirectory();
FileChannel source = null;
FileChannel destination = null;
String currentDBPath = "/data/" + "your package name"
+ "/databases/" + SAMPLE_DB_NAME;
--==============================
-- Send Keynote Text to Desktop Markdown File
-- Writted By: Richard Dooling https://github.com/RichardDooling/
-- Based on
-- Send Keynote Presenter Notes to Evernote
-- Version 1.0.1
-- Written By: Ben Waldie <ben@automatedworkflows.com>
-- http://www.automatedworkflows.com
-- Version 1.0.0 - Initial release
@Aracem
Aracem / ParallaxPageTransformer.java
Last active March 8, 2023 17:28
Parallax transformer for ViewPagers that let you set different parallax effects for each view in your Fragments.
package com.aracem.utils.animations.pagetransformation;
import org.jetbrains.annotations.NotNull;
import android.support.v4.view.ViewPager;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
@jedi4ever
jedi4ever / upload-to-appstore.sh
Created August 18, 2014 12:13
Command upload App/Ipa to the iTunes Connect App Store
#!/bin/bash
set -ex
# This scripts allows you to upload a binary to the iTunes Connect Store and do it for a specific app_id
# Because when you have multiple apps in status for download, xcodebuild upload will complain that multiple apps are in wait status
# Requires application loader to be installed
# See https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html
# Itunes Connect username & password
USER=bla
@rectalogic
rectalogic / KeyValueObserver.swift
Last active January 19, 2018 10:25
Key Value Observing (KVO) in Swift using closures
import Foundation
typealias KVObserver = (source: NSObject, keyPath: String, change: [NSObject : AnyObject]) -> Void
class KVOContext {
private let source: NSObject
private let keyPath: String
private let observer: KVObserver
func __conversion() -> UnsafeMutablePointer<KVOContext> {