Skip to content

Instantly share code, notes, and snippets.

View sendoa's full-sized avatar

Sendoa Portuondo sendoa

View GitHub Profile
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
# Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions
# Usage: sudo ./xcode_ramdisk.sh start
USERNAME=$(logname)
TMP_DIR="/private/tmp"
RUN_DIR="/var/run"
SYS_CACHES_DIR="/Library/Caches"
@sendoa
sendoa / xcode-git-config.sh
Created February 12, 2014 16:15
Setup initial Git setup for Xcode projects
#!/bin/sh
curl -s https://gist.github.com/sendoa/8952600/raw/bc1854640d8653d125239d112ad64537a82dd0a7/.gitignore > .gitignore
curl -s https://gist.github.com/sendoa/8957654/raw/1bc1f29b9a5e87e5ab8ee8cd7b3e8ae86d126b83/.gitattributes > .gitattributes
@sendoa
sendoa / gist:19c4453ee76c37527771
Created May 8, 2014 14:36 — forked from odrobnik/gist:2106f26379fd609d4ed3
Hide status bar & navigation bar together
- (IBAction)handleTap:(id)sender
{
BOOL isHiding = !_statusBarHidden;
_statusBarHidden = isHiding;
[UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:0 options:0
animations:^{
[self setNeedsStatusBarAppearanceUpdate];
}
completion:NULL];
#import <Foundation/Foundation.h>
// typedef
typedef NSString*(^ConvertBlock)(NSString *text);
@interface Thing : NSObject
@property (nonatomic, strong) void (^coolPropertyBlock)(NSString *text); // Property
// method param
- (void)doSomething:(void(^)(NSString *text))block with:(NSString *)person;
//
// BinaryDataScanner.m
//
// Copyright 2009 Dave Peck <davepeck [at] davepeck [dot] org>. All rights reserved.
// http://davepeck.org/
//
// This class makes it quite a bit easier to read sequential binary files in Objective-C.
//
// This code is released under the BSD license. If you use it in your product, please
// let me know and, if possible, please put me in your credits.
@sendoa
sendoa / ios7statusbar.md
Last active August 29, 2015 14:25 — forked from hujunfeng/ios7statusbar.md
About iOS 7 Status Bar Style

UIStatusBarStyle in iOS 7

  • The status bar in iOS 7 is transparent, the view behind it shows through.

  • The style of the status bar refers to the appearances of its content. In iOS 7, the status bar content is either dark (UIStatusBarStyleDefault) or light (UIStatusBarStyleLightContent). Both UIStatusBarStyleBlackTranslucent and UIStatusBarStyleBlackOpaque are deprecated in iOS 7.0. Use UIStatusBarStyleLightContent instead.

How to change UIStatusBarStyle

  • If below the status bar is a navigation bar, the status bar style will be adjusted to match the navigation bar style (UINavigationBar.barStyle):
@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>
@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 / 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: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);