Skip to content

Instantly share code, notes, and snippets.

View Albinzr's full-sized avatar
⛩️
Focusing

Albin Albinzr

⛩️
Focusing
View GitHub Profile
@Albinzr
Albinzr / RBResizer.swift
Created December 22, 2016 07:07 — forked from HamptonMakes/RBResizer.swift
Swift Image Resizer
//
// RBResizer.swift
// Locker
//
// Created by Hampton Catlin on 6/20/14.
// Copyright (c) 2014 rarebit. All rights reserved.
//
import UIKit
struct Regex {
let pattern: String
let options: NSRegularExpressionOptions
private var matcher: NSRegularExpression {
return try! NSRegularExpression(pattern: pattern, options: options)
}
init(pattern: String, options: NSRegularExpressionOptions! = nil)
{
@Albinzr
Albinzr / Fonts.swift
Created February 12, 2017 12:22 — forked from feighter09/Fonts.swift
Set global font for iOS app in one place
// MARK: - Swizzling
extension UIFont {
class var defaultFontFamily: String { return "Georgia" }
override public class func initialize()
{
if self == UIFont.self {
swizzleSystemFont()
}
}
@Albinzr
Albinzr / validation.js
Created February 12, 2017 12:28 — forked from pavsidhu/validation.js
Validate.js constraints
export const validation = {
email: {
presence: {
message: '^Please enter an email address'
},
format: {
pattern: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
message: '^Please enter a valid email address'
}
},
@Albinzr
Albinzr / map-filter-reduce.playground
Created February 12, 2017 12:35 — forked from AccordionGuy/map-filter-reduce.playground
Map, filter, and reduce in Swift, explained with emoji
// Map
func cook(_ item: String) -> String {
let cookupTable = [
"🐮": "🍔", // Cow face -> burger
"🐄": "🍔", // Cow -> burger
"🐂": "🍖", // Ox -> meat on bone
"🐷": "🍖", // Pig face -> meat on bone
"🐽": "🍖", // Pig nose -> meat on bone
"🐖": "🍖", // Pig -> meat on bone
@Albinzr
Albinzr / index.ios.js
Created November 7, 2017 18:58 — forked from Jpoliachik/index.ios.js
ReactNative LayoutAnimation Example
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';
@Albinzr
Albinzr / universal-framework.sh
Created April 6, 2018 15:56 — forked from atsepkov/universal-framework.sh
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures). This version works with Cocoapods, merging simulator and device architectures for intermediate libraries as well. To use this script, go to Product > Scheme > Edit S…
exec > /tmp/${PROJECT_NAME}_archive.log 2>&1
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
if [ "true" == ${ALREADYINVOKED:-false} ]
then
echo "RECURSION: Detected, stopping"
else
export ALREADYINVOKED="true"
@Albinzr
Albinzr / universal-framework.sh
Created April 6, 2018 15:56 — forked from atsepkov/universal-framework.sh
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures). This version works with Cocoapods, merging simulator and device architectures for intermediate libraries as well. To use this script, go to Product > Scheme > Edit S…
exec > /tmp/${PROJECT_NAME}_archive.log 2>&1
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
if [ "true" == ${ALREADYINVOKED:-false} ]
then
echo "RECURSION: Detected, stopping"
else
export ALREADYINVOKED="true"
@Albinzr
Albinzr / libz.sh
Created April 6, 2018 16:01 — forked from dulacp/libz.sh
Download & Compile Libz (zlib) for iOS (all architectures)
# Builds a ZLib framework for the iPhone and the iPhone Simulator.
# Creates a set of universal libraries that can be used on an iPhone and in the
# iPhone simulator. Then creates a pseudo-framework to make using libz in Xcode
# less painful.
#
# To configure the script, define:
# IPHONE_SDKVERSION: iPhone SDK version (e.g. 8.1)
#
# Then go get the source tar.bz of the libz you want to build, shove it in the
# same directory as this script, and run "./libz.sh". Grab a cuppa. And voila.
<style>
.iframe-container {
background: #ccc;
position: relative;
height: 0;
padding-bottom: 75%; /* 4/3 on mobile, padding = 3/4 */
}
.iframe-container iframe {
position: absolute;
top: 0;