Skip to content

Instantly share code, notes, and snippets.

Avatar

Alejandro Ramirez janodev

View GitHub Profile
@janodev
janodev / project.yml
Created May 16, 2021
Xcodegen project
View project.yml
name: myproject
options:
bundleIdPrefix: com.myproject
usesTabs: false
indentWidth: 4
tabWidth: 4
createIntermediateGroups: true
deploymentTarget:
iOS: "14.5"
@janodev
janodev / Optional+Extension.swift
Created Feb 18, 2017
Chainable closures for optional types.
View Optional+Extension.swift
import Foundation
extension Optional
{
@discardableResult
func ifSome(_ handler: (Wrapped) -> Void) -> Optional {
switch self {
case .some(let wrapped): handler(wrapped); return self
case .none: return self
}
View SomeView.swift
import UIKit
final class SomeView: LayoutView
{
let view1 = UIView()
let view2 = UIView()
let view3 = UIView()
override func layout() {
super.layout()
@janodev
janodev / Makefile
Last active Aug 5, 2020
Securing Apache with client certificate authorisation
View Makefile
.DEFAULT_GOAL := hello
CA = ca
CA_NAME = Janodev CA
SERVER = jano
SERVER_DOMAIN = jano.dev
CLIENT = client
CLIENT_NAME = Janodev Notes User
SERVER_CONF = server.conf
CLIENT_CONF = client.conf
View ioslocaleidentifiers.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@janodev
janodev / Person.m
Created May 16, 2017
Right and wrong ways to call a block property
View Person.m
#import <Foundation/Foundation.h>
#undef X
typedef void (^salute_t)();
@interface Person : NSObject
@property (nonatomic,copy) NSString *name;
@property (nonatomic,copy) salute_t salute;
View patternMatching.swift
// BASIC SWITCH
enum Media { case Book }
extension Media : CustomStringConvertible
{
var description: String {
switch self {
case .Book: return "bible"
}
View AppDelegate.swift
import UIKit
import PluggableApplicationDelegate
@UIApplicationMain
class AppDelegate: PluggableApplicationDelegate
{
override var services: [ApplicationService] {
return [
LoggerApplicationService()
]
@janodev
janodev / AutoLayout.swift
Created Apr 30, 2019
Buttons with equal width using Visual Format Language
View AutoLayout.swift
import UIKit
public extension UIView {
var autoLayout: AutoLayout {
return AutoLayout(self)
}
}
@janodev
janodev / gist:5341598
Created Apr 8, 2013
Text to speech on iOS with private framework.
View gist:5341598
// Not App Store safe. Only available in real devices.
#define RTLD_LAZY 0x1
#define RTLD_NOW 0x2
#define RTLD_LOCAL 0x4
#define RTLD_GLOBAL 0x8
NSObject *voiceSynthesizer;
void *voiceServices;