Skip to content

Instantly share code, notes, and snippets.

View peerax's full-sized avatar

peerathai puapan peerax

View GitHub Profile
@peerax
peerax / animation.m
Created January 30, 2015 09:57
ios custom transition
- (void)perform {
UIViewController *sourceViewController = self.sourceViewController;
UIViewController *destinationViewController = self.destinationViewController;
// Add the destination view as a subview, temporarily
[sourceViewController.view addSubview:destinationViewController.view];
// Transformation start scale
destinationViewController.view.transform = CGAffineTransformMakeScale(0.05, 0.05);
@peerax
peerax / HTTPpost.java
Created January 30, 2015 06:55
Android Request HTTP class
import android.os.Handler;
import android.os.Message;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
@peerax
peerax / add
Created January 26, 2015 08:54
Add UIBarbutton
UIBarButtonItem *btn =[[UIBarButtonItem alloc] initWithTitle:@"Check out" style:UIBarButtonItemStyleBordered target:self action:@selector(Checkout)];
self.navigationItem.rightBarButtonItem = btn;
@peerax
peerax / APNSTest.rb
Last active August 29, 2015 14:13 — forked from vzqwer/APNSTest.rb
# Install APNS gem:
# sudo gem install APNS
require 'APNS'
# gateway.sandbox.push.apple.com is default
# APNS.host = 'gateway.push.apple.com' # Production
APNS.host = 'gateway.sandbox.push.apple.com' # Development
# this is also the default. Shouldn't ever have to set this, but just in case Apple goes crazy, you can.
APNS.port = 2195
//
// AppDelegate.swift
// pushtest
//
// Created by sawapi on 2014/06/08.
// Copyright (c) 2014年 sawapi. All rights reserved.
//
// iOS8用
import UIKit
@peerax
peerax / ios sqlite
Created December 15, 2014 15:33
SQlite ios Set get version
PRAGMA user_version;//Get
PRAGMA user_version = 2; //Set
@peerax
peerax / gist:b2d191f1be5e20fd875a
Created September 9, 2014 15:21
arduino gsm gprs code
http://stackoverflow.com/questions/8500698/use-arduino-gsm-gprs-shield-to-send-data-to-my-web-service
//Register Notification ในviewDidLoad
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(ชื่อฟังค์ชั่น) name:@"ชื่อโนติ" object:nil];
//Call Notification main thread
[[NSNotificationCenter defaultCenter]postNotificationName:@"ชื่อโนติ" object:self];
@peerax
peerax / NSUrlSession POST
Created August 28, 2014 09:03
NSUrlsession use POST
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
NSMutableURLRequest *request = [NSMutableURLRequest
requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@:%@/getAllUser",[GlobalVar serverIp],[GlobalVar serverPort]]]];
NSDictionary *requestData = [[NSDictionary alloc] initWithObjectsAndKeys:
[defu objectForKey:@"ComId"], @"id",
nil];
NSError *error;
NSData *postData = [NSJSONSerialization dataWithJSONObject:requestData options:0 error:&error];
@peerax
peerax / my.cnf
Created August 28, 2014 03:30
mySQL config file for ram 8GB
# my.cnf for TAKIS Server
# BEGIN CONFIG INFO
# DESCR: 8 GB RAM, InnoDB only, ACID, few connections, heavy queries
# TYPE: SYSTEM
# END CONFIG INFO
[client]
port = 7000
socket = /var/lib/mysql/mysql.sock