Skip to content

Instantly share code, notes, and snippets.

View krzysztofzablocki's full-sized avatar

Krzysztof Zabłocki krzysztofzablocki

View GitHub Profile
@JaviSoto
JaviSoto / gist:5906004
Last active June 27, 2023 10:25
Mark designated initializer at compile time
#define MSDesignatedInitializer(__SEL__) __attribute__((unavailable("Invoke the designated initializer `" # __SEL__ "` instead.")))
// Sample usage:
- (instancetype)initWithObject:(id)object;
- (instancetype)init MSDesignatedInitializer(initWithObject:); // <- This even gets auto-complete.
// Now calling init on this class would throw a warning.
@hoshi-takanori
hoshi-takanori / Makefile
Last active October 3, 2019 18:17
Testing Objective-C class by XCTest with plain old Makefile in command line.
CLASS_NAME = MyObject
OBJS = main.o $(CLASS_NAME).o $(CLASS_NAME)Tests.o
PROGRAM = a.out
CFLAGS = -Wall -F$(FWPATH)
LIBS = -F$(FWPATH) -framework XCTest -framework Foundation
FWPATH = /Applications/Xcode.app/Contents/Developer/Library/Frameworks
XCTEST = /Applications/Xcode.app/Contents/Developer/usr/bin/xctest
@lawrencelomax
lawrencelomax / rac_testing.md
Created April 30, 2014 15:38
RAC Testing abortive blogpost

layout: post title: "ReactiveCocoa Unit Testing Tips" date: 2013-09-22 20:45 comments: true categories:

  • Testing
  • iOS
  • Patterns
  • Xcode
#!/bin/bash
############################################################################
# Automated WWDC 2014 videos downloader script
# Cristian Grau @SaroFR
# Based on Krzysztof Zablocki's (@merowing_) Download HD WWDC 2014 command
############################################################################
function download {
curl --silent --remote-name $1
@cabeca
cabeca / simulator_populator
Created September 23, 2014 21:30
This script removes and recreates all simulators in Xcode 6.
#!/usr/bin/env ruby
device_types_output = `xcrun simctl list devicetypes`
device_types = device_types_output.scan /(.*) \((.*)\)/
runtimes_output = `xcrun simctl list runtimes`
runtimes = runtimes_output.scan /(.*) \(.*\) \((com.apple[^)]+)\)$/
devices_output = `xcrun simctl list devices`
devices = devices_output.scan /\s\s\s\s(.*) \(([^)]+)\) (.*)/
@dulacp
dulacp / Overlay_iOS_app_version_on_icon_README.md
Last active November 19, 2017 11:18
Overlay the iOS application version on top of the icon

Usage

Requirements

Install the two dependencies, ImageMagick and Ghostscript.

$ brew install imagemagick
$ brew install ghostscript
@anvaka
anvaka / top-github.md
Last active February 3, 2021 19:58
Top GitHub users by total number of stars

I was playing with GitHub Archive recently. Out of curiosity I ran this query:

SELECT COUNT(repository_owner) as totalStars, repository_owner
FROM [githubarchive:github.timeline] 
WHERE type = 'WatchEvent'
GROUP BY repository_owner
ORDER BY totalStars DESC
LIMIT 1000
@berikv
berikv / ExponentialMovingAverage.swift
Last active December 30, 2022 18:25
Exponential Moving Average
func exponentialMovingAverage(currentAverage: Double, newValue: Double, smoothing: Double) -> Double {
return smoothing * newValue + (1 - smoothing) * currentAverage
}
// Usage:
// var a = 3
// a = exponentialMovingAverage(a, 8, 0.5)
// Swift 2
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 6, 2024 07:22
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@cabeca
cabeca / simulator_populator_xcode7
Last active April 16, 2020 09:18
This script removes and recreates all simulators in Xcode 7.
#!/usr/bin/env ruby
require 'JSON'
device_types = JSON.parse `xcrun simctl list -j devicetypes`
runtimes = JSON.parse `xcrun simctl list -j runtimes`
devices = JSON.parse `xcrun simctl list -j devices`
devices['devices'].each do |runtime, runtime_devices|
runtime_devices.each do |device|