Skip to content

Instantly share code, notes, and snippets.

View insidegui's full-sized avatar

Guilherme Rambo insidegui

View GitHub Profile
@insidegui
insidegui / Card type
Created January 11, 2017 20:34 — forked from igorcferreira/CardType.swift
Basic implementation to apply different regexes over a card number String and find the card type
import UIKit
//: Basic implementation to apply different regexes over a card number String and find the card type
enum CardType:String, CustomStringConvertible {
case invalid = "Not valid"
case visa = "^4[0-9]{6,}$"
case mastercard = "^5[0-9]{6,}$"
case amex = "^3[47][0-9]{13}$"
case diners = "^3(?:0[0-5]|[68][0-9])[0-9]{11}$"
@insidegui
insidegui / mergegenstrings.py
Created October 4, 2016 23:14 — forked from yoichitgy/mergegenstrings.py
A script to generate .strings file for .swift, .m, .storyboard and .xib files by genstrings and ibtool commands, and merge them with existing translations.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Localize.py - Incremental localization on XCode projects
# João Moreno 2009
# http://joaomoreno.com/
# Modified by Steve Streeting 2010 http://www.stevestreeting.com
# Changes
# - Use .strings files encoded as UTF-8