Skip to content

Instantly share code, notes, and snippets.

View aschuch's full-sized avatar
🦩
👨🏻‍💻

Alexander Schuch aschuch

🦩
👨🏻‍💻
View GitHub Profile
@key = OpenSSL::PKey::RSA.new 2048
# Generate CSR
csr = OpenSSL::X509::Request.new
csr.version = 0
csr.subject = OpenSSL::X509::Name.new([
['CN', "PEM", OpenSSL::ASN1::UTF8STRING]
])
csr.public_key = @key.public_key
csr.sign @key, OpenSSL::Digest::SHA1.new
@aschuch
aschuch / Foo.swift
Last active August 29, 2015 14:03
Swift compiler segfault
import UIKit
class Foo<T: NSCoding>: NSObject, NSCoding {
let value: T
init(value: T) {
self.value = value
super.init()
}
@aschuch
aschuch / Blocks.m
Last active December 22, 2015 12:59 — forked from twobitlabs/gist:4226365
Blocks cheat sheet
/**
* Blocks cheat sheet
*/
///////////////////////////////////
#pragma mark - block typedef
///////////////////////////////////
typedef void(^Block)();
typedef void(^ConditionalBlock)(BOOL);
typedef NSString*(^BlockThatReturnsString)();
@aschuch
aschuch / Macros.h
Created August 18, 2013 16:13
Collection of helpful Objective-C macros.
/**
Determine System Version
Usage: if (SYSTEM_VERSION_LESS_THAN(@"4.0")) { ... }
*/
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
@aschuch
aschuch / index.html
Created March 28, 2013 16:34
CSS3 pulsing dots, http://jsfiddle.net/24GXr/ and with fade in and fade out http://jsfiddle.net/qnN6B/
<div class="pulse green"></div>
<div class="pulse yellow"></div>
<div class="pulse red"></div>
@aschuch
aschuch / analytics.jade
Last active March 1, 2019 10:14
Google Analytics Jade
script(type='text/javascript')
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-Y']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
@aschuch
aschuch / AppDelegate.m
Created November 9, 2012 07:50
Flurry iOS integration with Backtrace Error Handler
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Flurry
#ifndef DEBUG
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
[FlurryAnalytics logAllPageViews:navigationController];
[FlurryAnalytics startSession:kFlurryKey];
#endif
}