Skip to content

Instantly share code, notes, and snippets.

View kukat's full-sized avatar

Cheng Yao kukat

View GitHub Profile
@kukat
kukat / loadjQuery.js
Created March 24, 2012 19:02
Javascript: Load jQuery
load = function() {
load.getScript("http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js");
load.tryReady(0); //用来等待jQuery类库加载
}
//以下代码用来动态加载任何js代码
load.getScript = function(filename) {
var script = document.createElement('script')
script.setAttribute("type","text/javascript")
script.setAttribute("src", filename)
@kukat
kukat / TigerAirwaysPlus.js
Created March 27, 2012 18:47
Load more: TigerAirwaysPlus.js
var loadMoreLink;
var loadingImg;
load = function() {
load.getScript("http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js");
load.tryReady(0); //用来等待jQuery类库加载
}
//以下代码用来动态加载任何js代码
load.getScript = function(filename) {
@kukat
kukat / AirAsiaPlus.js
Last active July 14, 2018 14:50
Load more: AirAsiaPlus.js
var loadMoreLink;
var loadingImg;
load = function() {
load.getScript("https://code.jquery.com/jquery-1.12.4.min.js");
load.tryReady(0); //用来等待jQuery类库加载
}
//以下代码用来动态加载任何js代码
load.getScript = function(filename) {
@kukat
kukat / ExampleClass.m
Created March 31, 2012 07:12 — forked from lukeredpath/ExampleClass.m
Macro for creating your "shared instance" using GCD
@implementation MySharedThing
+ (id)sharedInstance
{
DEFINE_SHARED_INSTANCE_USING_BLOCK(^{
return [[self alloc] init];
});
}
@end
@kukat
kukat / JetStarSearch.js
Created April 13, 2012 16:37
Load more: JetStarSearch.js
var loadMoreLink;
var loadingImg;
load = function() {
load.getScript("http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js");
load.tryReady(0); //用来等待jQuery类库加载
}
//以下代码用来动态加载任何js代码
load.getScript = function(filename) {
@kukat
kukat / zoomToFitMapAnnotations.m
Created April 26, 2012 11:08
UIMapView Zoom to fit annotations
-(void)zoomToFitMapAnnotations:(MKMapView*)mapView
{
if([mapView.annotations count] == 0)
return;
CLLocationCoordinate2D topLeftCoord;
topLeftCoord.latitude = -90;
topLeftCoord.longitude = 180;
CLLocationCoordinate2D bottomRightCoord;
@kukat
kukat / login_hsgj168.py
Created July 5, 2012 14:50
simulate login hsgj168
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib2
import urllib
from urllib2 import *
import re
import sys
ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz'
@kukat
kukat / Podfile.rb
Created August 1, 2012 07:10
Podfile with custom pod
platform :ios
pod 'AFNetworking', '~> 1.0RC1'
#pod 'SDURLCache', '~> 1.2'
pod do |s|
s.name = 'SDURLCache'
s.version = '1.2a'
s.platform = :ios
s.summary = 'URLCache subclass with on-disk cache support on iPhone/iPad.'
s.homepage = 'https://github.com/rs/SDURLCache'
@kukat
kukat / dismisskeyboard.m
Created August 27, 2012 16:07
tap anywhere to dismiss keyboard
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(keyboardWillShow:) name:
UIKeyboardWillShowNotification object:nil];
[nc addObserver:self selector:@selector(keyboardWillHide:) name:
UIKeyboardWillHideNotification object:nil];
tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(didTapAnywhere:)];
@kukat
kukat / xunlei-kankan.js
Created January 7, 2013 15:39
xunlei-kankan.js
if(window.location&&window.location.href){
if(window.location.href.split("/")[2].search('kankan.com')>0){
document.domain="kankan.com";
}else{
document.domain="xunlei.com";
}
}
var G_DAPCTRL = null;