Skip to content

Instantly share code, notes, and snippets.

View nikolaykasyanov's full-sized avatar

Nikolay Kasyanov nikolaykasyanov

  • Careem
  • Berlin, Germany
View GitHub Profile
@nikolaykasyanov
nikolaykasyanov / update-all-profiles.sh
Last active August 29, 2015 13:56
Script for updating Apple provisioning profiles. Can be used on CI servers like Jenkins.
#!/bin/sh
function fetchProvisioningProfiles()
{
ios profiles:download:all --type development
DEVELOPMENT_RESULT=$?
if [ "$DEVELOPMENT_RESULT" -ne "0" ]; then
return 1
fi
find . -name '*.p12' -depth 1 -type f | sed 's/^\.\/\(.\)/\1/' | xargs -I '{}' openssl pkcs12 -passin 'pass:' -in '{}' -out '{}'.pem -nodes
@nikolaykasyanov
nikolaykasyanov / RAC-generator.m
Last active August 29, 2015 13:57
Poor man's generator using ReactiveCocoa 3.0
static RACSignal *BodyImageURLs(NSString *postBody)
{
NSRange (^lastRangeFromMatch)(NSTextCheckingResult *) = ^(NSTextCheckingResult *match) {
if (match == nil) {
return NSMakeRange(NSNotFound, 0);
}
else {
return [match rangeAtIndex:match.numberOfRanges - 1];
}
};
@nikolaykasyanov
nikolaykasyanov / ReactiveCocoa.podspec
Last active August 29, 2015 14:01
podspec for ReactiveCocoa 3.0
Pod::Spec.new do |s|
s.name = "ReactiveCocoa"
s.version = "3.0-dev"
s.summary = "A framework for composing and transforming streams of values."
s.homepage = "https://github.com/blog/1107-reactivecocoa-is-now-open-source"
s.author = { "Josh Abernathy" => "josh@github.com" }
s.source = { :git => "https://github.com/ReactiveCocoa/ReactiveCocoa.git", :commit => "7fe93c972aed2dc1f1c9ac1b75cd955d1773fd35" }
s.license = 'MIT'
s.description = "ReactiveCocoa (RAC) is an Objective-C framework inspired by Functional Reactive Programming. It provides APIs for composing and transforming streams of values."
@nikolaykasyanov
nikolaykasyanov / RAC.swift
Last active August 29, 2015 14:02
Proof-of-concept typesafe RAC wrapper
protocol ISubscriber {
typealias Element
func disposable() -> RACCompoundDisposable
func sendNext(e: Element)
func sendError(e: NSError)
func sendCompleted()
}
@nikolaykasyanov
nikolaykasyanov / loadland.cpp
Created September 16, 2011 08:23
current VHGT parsing
esm.getHNExact(&rawHeights, sizeof(VHGT), "VHGT");
float base = rawHeights.heightOffset;
int currentHeightIndex = 0;
for (int y = 0; y < LAND_SIZE; y++)
{
uint8_t delta = rawHeights.heightData[currentHeightIndex];
currentHeightIndex++;
base += delta;
landData->heights[y * LAND_SIZE] = base * HEIGHT_SCALE;
/*******************************************************************************
* Copyright (c) 2006, 2009 The Pampered Chef, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* The Pampered Chef, Inc. - initial API and implementation
* Tom Schindl - cell editing
@nikolaykasyanov
nikolaykasyanov / LoadCollada.java
Created March 16, 2012 13:11
Collada loading with Ardor3d
public static Node loadColladaModel(final String modelFileStr) throws Exception {
final int a = modelFileStr.lastIndexOf("/");
String modelDirStr = modelFileStr.substring(0, a);
final String modelNameStr = modelFileStr.substring(modelFileStr.lastIndexOf("/") + 1);
final File modelDir = new File(modelDirStr);
modelDirStr = modelDir.getAbsolutePath();
final ColladaImporter importer = new ColladaImporter();
@nikolaykasyanov
nikolaykasyanov / assignment1.scala
Created March 17, 2012 15:42
Algo class assignment 1
val numbers = io.Source.fromFile("IntegerArray.txt").getLines.map({v => v.toInt}).toArray
def analyze(a : Array[Int]) : Tuple2[Long, Array[Int]] = a.size match {
case 1 => (0, a.clone)
case 2 => if (a(0) > a(1)) (1, a.reverse) else (0, a)
case _ => {
val l = a.size / 2
val (lcount, larr) = analyze(a.slice(0, l).toArray)
val (rcount, rarr) = analyze(a.slice(l, a.size).toArray)
@nikolaykasyanov
nikolaykasyanov / Eclipse for OS X.xml
Created May 13, 2012 17:19
Eclipse-like keymap for Idea on OS X
<?xml version="1.0" encoding="UTF-8"?>
<keymap version="1" name="Eclipse for OS X" parent="Eclipse">
<action id="$Copy">
<keyboard-shortcut first-keystroke="meta C" />
</action>
<action id="$Cut">
<keyboard-shortcut first-keystroke="meta X" />
</action>
<action id="$Paste">
<keyboard-shortcut first-keystroke="meta V" />