Skip to content

Instantly share code, notes, and snippets.

View jherran's full-sized avatar

Jose Herran jherran

  • Madrid, Spain
  • 04:13 (UTC +02:00)
View GitHub Profile
@jherran
jherran / LegalInfoValidation.swift
Created June 10, 2019 11:33 — forked from gservera/LegalInfoValidation.swift
Validar DNI español o calcular su letra en Swift 2.0
import Foundation
/**
Valida el número y la(s) letra(s) de un cualquier documento nacional de identidad
español (NIF o NIE) utilizando una implementación del algoritmo oficial.
- parameter nationalID: El DNI que se validará. No distingue mayúsculas y minúsculas.
- returns: `true` si el DNI proporcionado es válido o `false` si no lo es.
*/
func validateSpanishNationalIdentifier(nationalID: String) -> Bool {
guard nationalID.characters.count == 9 else {
@jherran
jherran / gist:d45792c55b66293c45b5
Last active August 4, 2023 23:48
Download and label all WWDC 2015 videos
#!/usr/local/bin/bash
curl -s https://developer.apple.com/videos/wwdc/2015/ -o source.html
grep "?id=" source.html | grep -v "video center" | sed -E 's/(.*)(\?id=[0-9]+).*/\2/g' | sort | uniq > video_links.txt
rm source.html
cat video_links.txt | while read line
do
url="https://developer.apple.com/videos/wwdc/2015/$line"
curl -s $url -o video.html
title=$(grep "<h3>" video.html | sed -E 's/<h3>|<\/h3>//g' | sed -e 's/^[ \t]*//')
@jherran
jherran / GitHookPostCheckoutPodInstallForTowerApp
Created February 27, 2015 22:27
Git Hook post-checkout for running pod install after git checkout
#!/bin/bash
if [ -f Podfile ] && command -v pod install >/dev/null
then
OUT=$(unset GIT_DIR; exec pod install)
if echo "$OUT" | grep -q "Integrating client project"
then
echo "$OUT"
true
else
echo "$OUT" >&2
@jherran
jherran / GitHookPostCheckoutPodInstall
Last active August 29, 2015 14:16
Git Hook post-checkout for running pod install after git checkout
#!/bin/bash
if [ -f Podfile ] && command -v pod install >/dev/null
then
(unset GIT_DIR; exec pod install)
true
fi
//
// CustomDynamicAlertView.h
// Week3_inclass
//
// Created by Victor Baro on 18/02/2015.
// Copyright (c) 2015 Produkt. All rights reserved.
//
#import <UIKit/UIKit.h>