Skip to content

Instantly share code, notes, and snippets.

View alexito4's full-sized avatar

Alejandro Martínez alexito4

View GitHub Profile
@alexito4
alexito4 / gist:3582382
Created September 1, 2012 18:22
AFNetworking - UIImageView+AFNetworking - New method setImageURL + blocks
/*
If you want to use blocks the only method that works is:
setImageWithURLRequest:placeholderImage:success:failure:
But you don't want to use URLRequest!
*/
// .h
- (void)setImageWithURL:(NSURL *)url
placeholderImage:(UIImage *)placeholderImage
@alexito4
alexito4 / monitordb.sh
Created September 4, 2012 08:10
Easy acces to Android emulator database
#!/bin/sh
while :
do
./querydb.sh
sleep 2
done
@alexito4
alexito4 / UIViewController+ModalCheck.h
Created October 11, 2012 21:04
Checking whether ViewController is presented as Modal
// UIViewController+ModalCheck.h
//
// Created by Felipe Sabino on 06/14/11
#import <UIKit/UIKit.h>
@interface UIViewController (ModalCheck)
-(BOOL)isPresentedAsModal;
@alexito4
alexito4 / gist:4249907
Created December 10, 2012 10:46
Responsive youtube, videos...
embed, iframe, object { max-width: 100%; }
@alexito4
alexito4 / example_call.txt
Created April 29, 2013 16:03
Minecraft & MultiMC. List all the mods in a MultiMC instance.
ruby mods.rb /Applications/Minecraft/MultiMC.app/Contents/Resources/instances/CustomDirewolf20/ > mods.txt
@alexito4
alexito4 / Android Pull Database
Last active December 19, 2015 08:49
Shell script for pulling the database from an android device.
#!/bin/sh
# Params
while echo $1 | grep ^- > /dev/null; do
eval $( echo $1 | sed 's/-//g' | tr -d '\012')=$2
shift
shift
done
adbdefault="/Applications/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb"
@alexito4
alexito4 / gist:5950169
Created July 8, 2013 16:09
Basic REST API with NodeJS and Express
var express = require('express');
var app = express();
app.use(express.bodyParser());
var users = [
{
"id": 0,
"isActive": false,
"balance": "$1,274.00",
@alexito4
alexito4 / enums.playground
Last active August 12, 2019 06:32
Swift enums and UISegmentedControl
import UIKit
enum Size: Int, CustomStringConvertible {
case S = 0
case M
case L
case XL
static func allValues() -> [String] {
#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;
@alexito4
alexito4 / playground
Created August 26, 2014 18:55
Swift extensions and inheritance
import UIKit
protocol Thing {
func name() -> String
}
protocol God {
func talk() -> String
}