Skip to content

Instantly share code, notes, and snippets.

View sendoa's full-sized avatar

Sendoa Portuondo sendoa

View GitHub Profile
@sendoa
sendoa / proyecto.pch
Created November 20, 2012 10:05
Alternatives to NSLog
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...)
#endif
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#ifdef DEBUG
# define ULog(fmt, ...) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s\n [Line %d] ", __PRETTY_FUNCTION__, __LINE__] message:[NSString stringWithFormat:fmt, ##__VA_ARGS__] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; }
#else
# define ULog(...)
@sendoa
sendoa / gist:3033254
Created July 2, 2012 13:30
Método adicional para jQuery Validator de comprobación de hora (hh:mm)
// Hay que añadirlo a additional-methods.js
jQuery.validator.addMethod("horahhmm", function(value, element) {
var res = false;
// Formato hh:mm
res = this.optional(element) || /^\d{2}[:]\d{2}$/.test(value);
var hora = value.split(':');
var hh = parseInt(hora[0],10);
var mm = parseInt(hora[1],10);
@sendoa
sendoa / gist:2896994
Created June 8, 2012 17:21
Recibir un mail cada vez que Google visita la web
<?php
if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Googlebot' ) !== false ) {
mail('tu_direccion@correo.com','Aviso: Googlebot ha visitado tu web','El Googlebot ha visitado tu página: http://tu_dominio.com'. $_SERVER['REQUEST_URI']);
}
?>
@sendoa
sendoa / gist:2887604
Created June 7, 2012 09:02
Evitar que la pantalla se bloquee (iOS)
// Disable the idle timer
[[UIApplication sharedApplication] setIdleTimerDisabled: YES];
// Or for those who prefer dot syntax:
[UIApplication sharedApplication].idleTimerDisabled = YES;
@sendoa
sendoa / UIImageViewRounded.h
Created June 1, 2012 08:35
Categoría para UIImageView con bordes redondeados
//
// UIImageRounded.h
// BDD Restaurantes
//
// Created by Sendoa Portuondo on 03/10/11.
// Copyright 2011 Qbikode Solutions, S.L. All rights reserved.
//
#import <UIKit/UIKit.h>