Skip to content

Instantly share code, notes, and snippets.

View hectorddmx's full-sized avatar

Hector De Diego hectorddmx

View GitHub Profile
@hectorddmx
hectorddmx / Elixir Email Validation
Last active March 8, 2018 07:14 — forked from mgamini/Elixir Email Validation
Elixir Email Validation
defmodule EmailValidator do
# ensure that the email looks valid
def validate_email(email) when is_binary(email) do
case Regex.run(~r/^[A-Za-z0-9._%+-+']+@[A-Za-z0-9.-]+\.[A-Za-z]+$/, email) do
nil ->
{:error, "Invalid email"}
[email] ->
try do
Regex.run(~r/(\w+)@([\w.]+)/, email) |> validate_email
@hectorddmx
hectorddmx / run phoenix on amazon linux.sh
Last active March 9, 2018 05:43 — forked from eikes/run phoenix on amazon linux.sh
run phoenix on amazon linux
export LANG="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
cd /
# app deps
yum install git -y
# erlang deps
@hectorddmx
hectorddmx / install_pyenv.sh
Created April 8, 2018 23:43 — forked from ysaotome/install_pyenv.sh
pyenv install for CentOS 6.5 x86_64
#!/bin/zsh
# pyenv install for CentOS 6.5 x86_64
yum install -y gcc gcc-c++ make git patch openssl-devel zlib-devel readline-devel sqlite-devel bzip2-devel
git clone git://github.com/yyuu/pyenv.git ~/.pyenv
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
@hectorddmx
hectorddmx / Fonts.swift
Created April 23, 2018 04:58 — 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()
}
}
@hectorddmx
hectorddmx / UIColorExtension.md
Created May 7, 2018 01:55 — forked from bhrott/UIColorExtension.md
Swift 3: Hex UIColor

Extension:

import Foundation
import UIKit

extension UIColor {
    convenience init(hexString: String) {
        let hex = hexString.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
        var int = UInt32()
 Scanner(string: hex).scanHexInt32(&int)
@hectorddmx
hectorddmx / xcode-increment-build.sh
Created June 8, 2018 20:15
Auto increment build, version and save to Info.plist branch and commit, tested for xcode 9.4
echo "Setting build and version numbers..."
versionNumber=`date +%Y%m.%d`; echo "New versionNumber ${versionNumber}"
buildNumber=`date +%H%M%S`; echo "New buildNumber ${buildNumber}"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $versionNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
echo "Setting branch name..."
function parse_git_dirty() {
git diff --quiet --ignore-submodules HEAD 2>/dev/null; [ $? -eq 1 ] && echo "*"
}
@hectorddmx
hectorddmx / ignore_warnings.rb
Created June 10, 2018 06:07
Ignore framework warnings
post_install do |installer|
ignored_targets = ["autocontratacion-gonet", "Pods-autocontratacion-gonet_Example", "Pods-autocontratacion-gonet_Tests"]
puts "\nSetting up targets."
installer.pods_project.targets.each do |target|
unless ignored_targets.include?(target.name)
puts "Disabling warnings for target #{target}"
target.build_configurations.each do |config|
config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'] = "YES"
end
else
@hectorddmx
hectorddmx / find_named_colors_storyboard_regex.js
Created June 10, 2018 06:39
Regex to find named colors from a list
name="(ActivityIndicator|BlackTextFieldText|Blue|BlueLineSeparate|BlueLinkColor|BluePercentage|BlueProgress|BlueQuestion|BlueThankYouText|BrownCircleLineChart|BrownFillColorLineChart|BrownPieChart|DarkGrayCatalog|GrayButton|GrayLineSeparate|GrayPieChart|GrayPlaceHolder|GraySelectedRaw|GrayTextFieldLine|GrayTextFieldTitle|GreenPieChart|GreenValuesLineChart|Orange)"
@hectorddmx
hectorddmx / textField.regex
Created July 26, 2018 20:01
Regex to find UITextFieldDelegates
(UITextFieldDelegate)+\s*\n?\{
@hectorddmx
hectorddmx / README.md
Last active September 14, 2018 19:23 — forked from guilhermearaujo/README.md
OCLint integration with Xcode

OCLint (0.13) integration with Xcode

1. Integration

  • Add a new Target of kind Aggregate, name it OCLint
  • Under Builde Phases, add a new Run Script Phase
  • Paste the script

2. Usage

  • Select target OCLint
  • Build the target (press ⌘+B)