Skip to content

Instantly share code, notes, and snippets.

View AlexDenisov's full-sized avatar
🇺🇦
Talking to Machines

AlexDenisov AlexDenisov

🇺🇦
Talking to Machines
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.
@johanneswuerbach
johanneswuerbach / .travis.yml
Last active May 14, 2024 03:50
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:
@AlexDenisov
AlexDenisov / spec_arc_support.rb
Created March 27, 2013 14:51
Add compiler flags on each Spec in target
require 'xcodeproj'
project = Xcodeproj::Project.new 'SomeProject.xcodeproj'
target = project.targets.last
build_phase = target.source_build_phase
files = build_phase.files
settings = { 'COMPILER_FLAGS' => '-fno-objc-arc' }
files.each do |f|
if f.display_name =~ /Spec/
if f.settings
@AlexDenisov
AlexDenisov / ConformsTo.h
Last active December 14, 2015 11:39
Additional Cedar matchers https://github.com/pivotal/cedar
//
// ConformsTo.h
//
// Created by Alex Denisov on 01.03.13.
//
#pragma once
#import <Foundation/Foundation.h>
#import <Cedar-iOS/Cedar-iOS.h>
//
// UIDevice+DeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
#include <sys/types.h>
#include <sys/sysctl.h>
typedef enum {
@AlexDenisov
AlexDenisov / iterate_each_array.pl
Created January 23, 2013 08:44
Iterate few lists with Perl
use List::MoreUtils qw( each_array );
my @first = qw( foo bar buzz );
my @second = (1, 2, 3);
my $it = each_array( @first, @second );
while ( my ($f, $s) = $it->() ) {
print "$f = $s\n";
}
@mbostock
mbostock / .block
Last active November 7, 2023 07:54
Collapsible Tree
license: gpl-3.0
redirect: https://observablehq.com/@d3/d3-collapsible-tree
@AlexDenisov
AlexDenisov / install.md
Last active February 10, 2021 03:26
This script creates PDF from man page and opens it within Preview.app. Only Mac OS X.

pman

Generates PDF from man page and opens it within Preview.app.

Install

curl -o /usr/local/bin/pman https://gist.githubusercontent.com/AlexDenisov/4294335/raw/9fe40c81f6fc94760e81040d2636d0e703fc676f/pman.pl
chmod +x /usr/local/bin/pman

Usage

@AlexDenisov
AlexDenisov / svn_aliases.sh
Created November 6, 2012 11:54
Useful aliases for SVN
alias subadd="svn st | grep '^?' | sed 's/^? *\(.*\)/\"\1\"/g' | sed 's/@\(.*\)/@\1@/g' | xargs svn add"
alias subrm="svn st | grep '^!' | sed 's/^! *\(.*\)/\"\1\"/g' | sed 's/@\(.*\)/@\1@/g' | xargs svn rm"
alias subst='svn st'
alias subci='svn ci'
alias subup='svn up'
@bellbind
bellbind / Info.plist.json
Created July 25, 2012 08:22
[macosx][ios][objective-c]Building iOS 5.1 app with command line (completely Xcode-less programming)
{"UIDeviceFamily":[1,2]}