This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const NSString *_GOOGLE_URI = @"http://translate.google.com/m/translate?hl=en&sl=auto&tl=en&ie=UTF-8&prev=_m&q="; | |
-(void) openWebViewForGGranslate : (UIWebView*) webView translate: (NSString *) targetString | |
{ | |
// clean up new line at end of string | |
targetString = [targetString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; | |
// escape URL encode | |
targetString = [targetString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
// optional cache | |
// AFNetwork | |
NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil]; | |
[NSURLCache setSharedURLCache:URLCache]; | |
[[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES]; | |
*/ | |
const NSString *_WORD_NET_URI = @"http://th.asianwordnet.org/services/dictionary/json/th2en/"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define UIColorFromRGBA(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF000000) >> 24))/255.0 green:((float)((rgbValue & 0xFF0000) >> 16))/255.0 blue:((float)((rgbValue & 0xFF00) >> 8 ))/255.0 alpha:((float)((rgbValue & 0xFF))/255.0)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// refer to : http://tyleregeto.com/article/drawing-ios-uiviews-to-as3-bitmapdata-via-air | |
Drawing iOS UIViews to AS3 bitmapData via Adobe AIR native extensions | |
2011.12.13 | |
A major draw back to displaying native iOS UIView objects on top of your Adobe AIR applications is that they... well... are on top. Here is a quick code snippet for rendering native iOS view objects to ActionScript bitmapData objects via the recently released native extensions support. This allows you to add them to the display list (at the loss of all their native functionality). With native extensions we can update the bitmapData directly in memory which results in very fast updates. The possibilities are endless. | |
FREObject drawToBitmap(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) { | |
// grab the AS3 bitmapData object for writing to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import com.freshplanet.ane.AirAlert.AirAlert; | |
import flash.display.Sprite; | |
import flash.events.Event; | |
import flash.system.MessageChannel; | |
import flash.system.Worker; | |
import flash.system.WorkerDomain; | |
import flash.utils.setInterval; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation UIImage (Dwellable) | |
- (UIImage *)crop:(CGRect)rect | |
{ | |
return [self copyFromRect:rect toSize:rect.size]; | |
} | |
- (UIImage *)copyToSize:(CGSize)dstSize | |
{ | |
return [self copyFromRect:CGRectMake(0, 0, self.size.width, self.size.height) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_.mixin({templateFromUrl: function (url, data, settings) { | |
var templateHtml = ""; | |
this.cache = this.cache || {}; | |
if (this.cache[url]) { | |
templateHtml = this.cache[url]; | |
} else { | |
$.ajax({ | |
url: url, | |
method: "GET", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://bruce-lab.blogspot.com/2014/08/using-crossbridgeflascc-for-code.html | |
// https://forums.adobe.com/message/5121420 | |
// http://hecool108.blogspot.com/2013/08/hide-your-key-with-alchemyflascccrossbr.html | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include "AS3/AS3.h" | |
void gk() __attribute__((used, | |
annotate("as3sig:public function ec(keystr:String):String"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Post to page by admin | |
--- | |
* user get access_token with manage_pages from app | |
https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&display=touch&response_type=token&scope=manage_pages&redirect_uri=YOUR_REDIRECT_URI | |
* user get access_token from page id | |
https://graph.facebook.com/YOUR_PAGE_ID?fields=access_token&access_token=YOUR_ACCESS_TOKEN | |
* get log live access_token (2 months) | |
https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=fb_exchange_token&fb_exchange_token=YOUR_ACCESS_TOKEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// DBKUIColor.swift | |
// DBKUIColor | |
// | |
// Created by Todsaporn Banjerdkit (katopz) on 12/19/14. | |
// Copyright (c) 2014 Debokeh. All rights reserved. | |
// | |
// Credit : http://stackoverflow.com/questions/24263007/how-to-use-hex-colour-values-in-swift-ios/24263296#24263296 | |
import UIKit |