Skip to content

Instantly share code, notes, and snippets.

View hunk's full-sized avatar
🤑
working

Edgar G @hunk hunk

🤑
working
View GitHub Profile
@hunk
hunk / test.m
Created February 17, 2016 01:24
// Debug log \o/
HKNormal(@"normal log without color, but whit the format of HK");
HKVerbose(@"normal log with Verbose in gray");
HKDebug(@"this line is with a debug word in %@",@"blue");
HKInfo(@"a info log");
HKWarning(@"oh, no, oh no, this is not happening");
HKError(@"aahhhhh, help!!!!!!");
HKAlt(@"alternative color");
HKOpt(@"optional color");
<?php
query_posts( array(
'post_type' => array( 'post', 'postType1', 'postType2', 'other_post_type' ),
'showposts' => 5 )
);
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<p><?php the_title(); ?></p>
// https://github.com/hunk/Kit-iOS/tree/master/rotation
//para iniciar la animación
// el primer parametro es el tiempo en segundos de cada ciclo (vuelta completa)
// el segundo parametro es la dirección de la rotación
[my_button spinInfinityButtonWithTime:2 direction:-1];
[my_image spinInfinityImageWithTime:5 direction:1];
@hunk
hunk / gist:2764992
Created May 21, 2012 22:05
JavaScript for detecting iOS devices
var deviceAgent = navigator.userAgent.toLowerCase();
var iOS = deviceAgent.match(/(iphone|ipod|ipad)/);
if (iOS) {
// iOS
} else {
// not iOS
}
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
int numFrase = arc4random() % 3;
NSString *html = [NSString stringWithFormat:@"<html><body style=\"background-color: transparent;\" ><img src='%d.gif'></body></html>",numFrase];
if (cual == 2) {
[homero loadHTMLString:html baseURL:baseURL];
//remove the ugly shadow of uiwebview
for(UIView *wview in [[[myCustomWebView subviews] objectAtIndex:0] subviews]) {
if([wview isKindOfClass:[UIImageView class]]) {
wview.hidden = YES;
}
}
//
// ViewController.m
// sale
//
// Created by Edgar Garcia on 2/21/12.
// Copyright (c) 2012 E. All rights reserved.
//
#import "ViewController.h"
@hunk
hunk / gist:1637220
Created January 19, 2012 02:17
custom buttons NavigationBar
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"Root view";
UIButton *backImage = [UIButton buttonWithType:UIButtonTypeCustom];
backImage.frame = CGRectMake(0, 0, 24, 24);
backImage.backgroundColor = [UIColor clearColor];
[backImage setBackgroundImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
[backImage addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchDown];
@hunk
hunk / gist:1637194
Created January 19, 2012 02:14
background NavigationBar
UIImage *gradientImage44 = [[UIImage imageNamed:@"nav44"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
UIImage *gradientImage32 = [[UIImage imageNamed:@"nav32"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UINavigationBar appearance] setBackgroundImage:gradientImage44
forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setBackgroundImage:gradientImage32
forBarMetrics:UIBarMetricsLandscapePhone];
[my_image spinImageWithTime:2 direction:1];
[my_button spinButtonWithTime:4 direction:-1];