Skip to content

Instantly share code, notes, and snippets.

View ikovalisko's full-sized avatar

Ivan Kovalisko ikovalisko

  • Innocode
  • Lviv, Ukraine
View GitHub Profile
@jacobator
jacobator / Power outage 2.1.scriptable
Created June 11, 2024 10:08
Power outage for scriptable Lviv
{
"always_run_in_app" : false,
"icon" : {
"color" : "deep-blue",
"glyph" : "lightbulb"
},
"name" : "Power outage 2.1",
"script" : "\/\/ colors\nconst DEFAULT_TEXT_COLOR = Color.dynamic(Color.black(), Color.white());\nconst SECONDARY_TEXT_COLOR = new Color('#bababa');\nconst OUTAGE_COLOR = Color.red();\nconst NO_OUTAGE_COLOR = Color.green();\nconst MAYBE_OUTAGE_COLOR = Color.orange();\nconst WIDGET_COLOR = Color.dynamic(Color.white(), new Color('#1c1c1e'));\n\n\/\/ text\nconst DEFAULT_FONT = Font.mediumSystemFont(14);\nconst LARGE_FONT = Font.lightSystemFont(37);\nconst SECONDARY_FONT = Font.boldSystemFont(14);\nconst OUTAGE_MESSAGE = 'Outage';\nconst NO_OUTAGE_MESSAGE = 'Okay';\nconst MAYBE_OUTAGE_MESSAGE = 'Maybe';\n\n\/\/ other\nconst OUTAGE_CODE = '-';\nconst NO_OUTAGE_CODE = '+';\nconst MAYBE_OUTAGE_CODE = '0';\nconst SEEDS = new Map([\n [\n '1.1',\n '0-++++0-++++-0++++-0++++++++-0++++-0++-0++++-0++0-++++0-++++++++0-++++0-++0-++++0-++',\n ],\n [\n '1.2',\n '-0++++-0++++0-+
@natecook1000
natecook1000 / NSTimer+Closure.swift
Last active October 30, 2025 15:51
Scheduled NSTimer with a Swift closure
extension NSTimer {
/**
Creates and schedules a one-time `NSTimer` instance.
- Parameters:
- delay: The delay before execution.
- handler: A closure to execute after `delay`.
- Returns: The newly-created `NSTimer` instance.
*/
@dotfold
dotfold / RACReplay
Created August 7, 2014 11:46
RAC - replay and multicast resources
Best design pattern for starting only one async operation and share signal result
https://github.com/ReactiveCocoa/ReactiveCocoa/issues/828
http://stackoverflow.com/questions/14066651/how-to-using-reactivecocoa-to-transparently-authenticate-before-making-api-calls/14072445#14072445
http://stackoverflow.com/questions/15075075/when-to-use-racreplaysubject-vs-racmulticastconnection
http://spin.atomicobject.com/2014/06/29/replay-replaylast-replaylazily/
@staltz
staltz / introrx.md
Last active May 7, 2026 01:31
The introduction to Reactive Programming you've been missing
/**
Provides the ability to verify key paths at compile time.
If "keyPath" does not exist, a compile-time error will be generated.
Example:
// Verifies "isFinished" exists on "operation".
NSString *key = SQKeyPath(operation, isFinished);
// Verifies "isFinished" exists on self.
@aprato
aprato / AMPNavigationBar.m
Last active July 13, 2018 00:23
Darker iOS7 translucent UINavigationBar
// .h
@interface AMPNavigationBar : UINavigationBar
@property (nonatomic, assign) CGFloat extraColorLayerOpacity UI_APPEARANCE_SELECTOR;
@end
// .m
@steipete
steipete / UIKitLegacyDetector.m
Last active May 21, 2025 10:07
A simple way to detect at runtime if we're running in UIKit legacy mode or the new "flat" variant. Written for our PDF iOS SDK (http://pspdfkit.com), where the precompiled binary needs to detect at runtime in what variant it's running. Want more stuff like that? Follow me on Twitter: http://twitter.com/steipete
// Taken from http://PSPDFKit.com. This snippet is under public domain.
#define UIKitVersionNumber_iOS_7_0 0xB57
BOOL PSPDFIsUIKitFlatMode(void) {
static BOOL isUIKitFlatMode = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// We get the modern UIKit if system is running >= iOS 7 and we were linked with >= SDK 7.
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) {
isUIKitFlatMode = (NSVersionOfLinkTimeLibrary("UIKit") >> 16) >= UIKitVersionNumber_iOS_7_0;
}
@codebutler
codebutler / crashlytics_orgs.rb
Last active April 10, 2022 07:32
Crashlytics requires an IDE to "onboard" an Android app for no good reason. This prevents you from setting up a new app using a command line build tools such as Maven, Gradle or unsupported IDEs such as Android Studio. Turns out all you really need is your org's api key, which you can get using this script. Then just add this to your AndroidMani…
require 'httparty'
require 'json'
class Crashlytics
include HTTParty
base_uri 'https://api.crashlytics.com/api/v2'
def session(email, password)
self.class.post('/session.json',
body: {email: email, password:password}.to_json,
@kastiglione
kastiglione / gcd_map.mm
Last active January 6, 2017 20:52
Concurrent map benchmark
#import <Foundation/Foundation.h>
#import <libkern/OSAtomic.h>
@interface NSArray (ConcurrentMap)
- (NSArray*)semaphore_map:(id (^)(id))block;
- (NSArray*)serial_map:(id (^)(id))block;
- (NSArray*)spinlock_map:(id (^)(id))block;
@end
@implementation NSArray (ConcurrentMap)
@johanneswuerbach
johanneswuerbach / .travis.yml
Last active September 22, 2025 03:17
Deploy an iOS app to testflight using Travis CI
---
language: objective-c
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
env:
global: