Skip to content

Instantly share code, notes, and snippets.

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
#
# (c) Baulin Roman 2015
#
# http://stackoverflow.com/questions/1247125/how-to-get-sinatra-to-auto-reload-the-file-after-each-change
# https://github.com/rtomayko/shotgun
# sse http://www.w3schools.com/html/html5_serversentevents.asp
# sse with sinatra http://stackoverflow.com/questions/5227431/html5-server-sent-events-with-ruby-sinatra
# cool demo https://gist.github.com/rkh/1476463
#
// crash and exceptions in google analytics are stripped and all wrong
// but action and label can be delivered in full length
//
// send formatted string w/o params in action (as unique error name)
// will show up count in realtime dashboard under category err
//
// send formatted string w/ params in label (as error description)
// can be inspected and queryied in behaviour -> events -> overview -> err
//
// sample: TRACK_ERR(@"audiosession error %@", error)
- (NSString *)randomString {
NSString *alphabet = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXZY0123456789";
u_int32_t len = arc4random_uniform(20) + 5;
NSMutableString *s = [NSMutableString stringWithCapacity:len];
for (NSUInteger i = 0U; i < len; i++) {
u_int32_t r = arc4random() % [alphabet length];
unichar c = [alphabet characterAtIndex:r];
[s appendFormat:@"%C", c];
}
return s;
// related to SO question:
// http://stackoverflow.com/questions/26252432/how-do-i-set-a-auto-increment-key-in-realm/26257616#26257616
// keywords: realm auto increment id primary key autoincrement
//
// two assumptions:
// 1) time always goes forward
// 2) realm and app has shared lifetime:
// no external realms are imported, if app deleted realm is deleted
@interface TSUUID : NSObject
@property (nonatomic) double baseOffset;
class Date
def quarter
case self.month
when 1,2,3
return 1
when 4,5,6
return 2
when 7,8,9
return 3
when 10,11,12
if [ "${CONFIGURATION}" = "Ad Hoc" ] || [ "${CONFIGURATION}" = "App Store" ]; then
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}")
buildNumber=$((buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${INFOPLIST_FILE}"
./Pods/Fabric/Fabric.framework/run key key
fi
@rbaulin
rbaulin / AppDelegate.m
Last active August 29, 2015 14:20
AppDelegate without Storyboards snippet
<#ViewController#> *vc = [[<#ViewController#> alloc] init];
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:vc];
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
window.rootViewController = nc;
[window makeKeyAndVisible];
self.window = window;
@rbaulin
rbaulin / dynamic_realm.m
Last active August 29, 2015 14:21
Realm dynamic API usage example
#import <Realm.h>
// extracted from RLMRealm_Dynamic.h
@interface RLMProperty (AGDynamic)
- (instancetype)initWithName:(NSString *)name
type:(RLMPropertyType)type
objectClassName:(NSString *)objectClassName
indexed:(BOOL)indexed;
@end
var path = require('path');
var express = require('express');
var app = express();
var openConnections = [];
global.emitEvent = function () {
console.log("emit to clients " + openConnections.length);
openConnections.forEach(function(res) {
res.write('data: event' + "\n\n");