Skip to content

Instantly share code, notes, and snippets.

View hunk's full-sized avatar
🤑
working

Edgar G @hunk hunk

🤑
working
View GitHub Profile
//
// 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];
@hunk
hunk / duplicate.php
Created August 28, 2011 18:32
this script delete rows duplicate in postmeta for the meta_key _mf_write_panel_id
<?php
## script delete rows postmeta
## version: 0.1
## author: Edgar G (hunk) ing.edgar@gmail.com
## this script delete rows duplicate in postmeta for the meta_key _mf_write_panel_id
## magicfields.org hunk.com.mx
include('wp-config.php');
include('wp-load.php');
<?php
function get_group($name_group,$post_id=NULL,$add_params = NULL){
global $wpdb, $post, $FIELD_TYPES;
if(!$post_id){ $post_id = $post->ID; }
$cache_name = $post_id.'/_groups-'. sanitize_title_with_dashes( $name_group ).'.txt';
if( !$data_groups = unserialize( MF_get_cached_data( $cache_name, FALSE ) ) ) {
$sql = "SELECT pm.field_name, cf.type, pm_wp.meta_value, pm.order_id, pm.field_count, cf.id, fp.properties
- (void)viewDidLoad{
[super viewDidLoad];
if ([MFMailComposeViewController canSendMail]) {
myButton.enabled = YES;
}
}
- (IBAction)buttonPressed{
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
mailController.mailComposeDelegate = self;
// MailTestViewController.h
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
@interface MailTestViewController : UIViewController <MFMailComposeViewControllerDelegate>{
IBOutlet UIButton *myButton;
}
- (IBAction)buttonPressed;
;;bindings
(global-set-key (kbd "<f1>") 'start-kbd-macro)
(global-set-key (kbd "<f2>") 'nxhtml-mumamo-mode)
(global-set-key (kbd "<f3>") 'php-mode)
(global-set-key (kbd "<f4>") 'indent-region)
(global-set-key (kbd "<f5>") 'enlarge-window)
(global-set-key (kbd "<f6>") 'shrink-window)
(global-set-key (kbd "<f7>") 'enlarge-window-horizontally)
(global-set-key (kbd "<f8>") 'shrink-window-horizontally)
(global-set-key (kbd "<f9>") 'comment-region)
<?php
function FilterPostsPagesListJoin($join){
global $wpdb;
if (isset($_GET['filter-posts'])) {
$join = " JOIN $wpdb->postmeta ON wp_postmeta.post_id = wp_posts.ID ";
}
return $join;
}
?>