Skip to content

Instantly share code, notes, and snippets.

@tonycn
tonycn / html_extract_note
Last active August 29, 2015 14:03
extract text,image,video from html
PART I tags to remove
<script ></script>
<script />
<link >
<style></style>
<style />
PART II tags to extract
########## text ###############
1. text without tag
@tonycn
tonycn / web_dev_tools:
Created June 6, 2014 16:00
Wed Dev Tools
- Javascript:
Photo Scroller: http://www.jssor.com/
- CSS
http://www.css3maker.com/
http://cssanimate.com/
@tonycn
tonycn / iOS_keyboard_notification.m
Created May 25, 2014 04:22
iOS keyboard frame changing notifications
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardFrameWillChange:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardFrameWillChange:)
name:UIKeyboardWillChangeFrameNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
@tonycn
tonycn / iOS_glass_blur_effct.txt
Last active August 29, 2015 14:01
iOS glass blur effect
View Layout
* Layer 1: Underlying view which will be taken snapshot
* Layer 2: FXBlurView and a mask view
* Layer 3: Content view
Example:
+ view (Root View Controller)
- FXBlurView (glass effect view)
- mask view (translucent view : usally black with alpha)
- content view
@tonycn
tonycn / gist:f877044ebdf80599cb26
Last active December 18, 2015 07:16
iOS SSID
NSString *currentSSID = @"";
CFArrayRef myArray = CNCopySupportedInterfaces();
if (myArray != nil){
NSDictionary* myDict = (__bridge NSDictionary *) CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
if (myDict!=nil){
currentSSID=[myDict valueForKey:@"SSID"];
} else {
currentSSID=@"<<NONE>>";
}
} else {
@tonycn
tonycn / get_started_iOS
Last active August 29, 2015 13:59
For iOS beginers:
For iOS beginers:
* Objective C
* iOS Framework : UIKit, CoreGraphic ...
* apple sample code
Resources:
* http://objc.io
* Apple WWDC videos
@tonycn
tonycn / jsonmodel_generator
Created April 12, 2014 06:48
sublime plugin to generate ObjC property code
# -*- coding: utf-8 -*-
import sublime, sublime_plugin
import json
class JsonpropCommand(sublime_plugin.TextCommand):
"""
Test 1:
{"a" : "abc", "b" : 1}
Test 2:
@tonycn
tonycn / TopBarViewController
Created January 7, 2014 10:09
Customise top bar with base controller
@interface TopBarViewController ()
@property (nonatomic, strong) UIView *statusbarBgView;
@end
@implementation TopBarViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
@tonycn
tonycn / OSStatus.m
Last active December 28, 2015 21:39 — forked from zoul/OSStatus.m
#import <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
NSString *NSStringFromOSStatus(OSStatus errCode)
{
if (errCode == noErr)
return @"noErr";
char message[5] = {0};
*(UInt32*) message = CFSwapInt32HostToBig(errCode);
return [NSString stringWithCString:message encoding:NSASCIIStringEncoding];
@tonycn
tonycn / gist:7478979
Created November 15, 2013 04:16
unix commands
1) nc & curl to view http request
$ nc -l localhost 8000 &
$ curl --proxy localhost:8000 --silent --max-time 1 http://baidu.com