Skip to content

Instantly share code, notes, and snippets.

@fhefh2015
fhefh2015 / gist:b6e55f338032fc9266dc
Last active March 8, 2016 08:19 — forked from libo1106/gist:9777985
flex未知高度垂直居中写法
<!DOCTYPE html>
<html lang="zh-CN" class="fullscreen">
<head>
<title>flex未知高度垂直居中写法</title>
<style>
html,
body {
width: 100%;
@fhefh2015
fhefh2015 / gist:43564a47e84b7d44d36f
Last active March 8, 2016 09:14 — forked from tomohisa/gist:2897676
iOS 子控制器
// add child view
UIViewController* controller = [self.storyboard instantiateViewControllerWithIdentifier:@"test"];
[self addChildViewController:controller];
controller.view.frame = CGRectMake(0, 44, 320, 320);
[self.view addSubview:controller.view];
[controller didMoveToParentViewController:self];
// remove child view
UIViewController *vc = [self.childViewControllers lastObject];
[vc.view removeFromSuperview];
@fhefh2015
fhefh2015 / prober.php
Created March 8, 2016 09:20 — forked from shenyubao/prober.php
常用PHP探针
<?php
error_reporting(0); //抑制所有错误信息
@header("content-Type: text/html; charset=utf-8"); //语言强制
ob_start();
$title = "Yahei-PHP Prober";
$version = "v0.3.5"; //版本号
define('HTTP_HOST', preg_replace('~^www\.~i', '', $_SERVER['HTTP_HOST']));
@fhefh2015
fhefh2015 / gist:aa582d97fe0bc7550e3c
Last active March 17, 2016 01:29 — forked from ethanbing/gist:10970615
iOS 常用数学函数
1、 三角函数 
  double sin (double);正弦 
  double cos (double);余弦 
  double tan (double);正切 
  2 、反三角函数 
  double asin (double); 结果介于[-PI/2, PI/2] 
  double acos (double); 结果介于[0, PI] 
  double atan (double); 反正切(主值), 结果介于[-PI/2, PI/2] 
  double atan2 (double, double); 反正切(整圆值), 结果介于[-PI, PI] 
  3 、双曲三角函数 
@fhefh2015
fhefh2015 / Quartz2D.md
Created March 17, 2016 10:18 — forked from ldong/Quartz2D.md
Quartz 2D

Quartz 2D Notes

  CGContextRef context = ();
    //设置起始点
    CGContextMoveToPoint (context, 160, 100);
    CGContextAddLineToPoint (context, 100, 180);
    CGContextAddLineToPoint (context, 160, 180);
    // 设置边界
    [[UIColor blackColor] setStroke];
@fhefh2015
fhefh2015 / UITableView+reloadDataAnimated.m
Created August 6, 2016 10:48 — forked from tony0x59/UITableView+reloadDataAnimated.m
tableview重载数据时的淡入淡出动画过渡效果
#import "UITableView+reloadDataAnimated.h"
@implementation UITableView (reloadDataAnimated)
- (void)reloadDataWithAnimated:(BOOL)animated
{
[self reloadData];
if (animated) {
CATransition *animation = [CATransition animation];
version=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $PRODUCT_SETTINGS_PATH`
version=`expr $version + 1`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $version" $PRODUCT_SETTINGS_PATH
#/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $version" $PRODUCT_SETTINGS_PATH 这行代码会让version也自增,一般不需要
@fhefh2015
fhefh2015 / TaskQe.js
Created September 19, 2016 09:41 — forked from thewei/TaskQe.js
Javascript实现异步任务队列类
/*
@Author:thewei
@website:http://www.99is.com
@title: 异步事件任务队列类
*/
(function(){
TaskQe = function(){
this._arrayFn = []; //事件集合
@fhefh2015
fhefh2015 / jsonp-usage.js
Created September 26, 2016 06:00 — forked from erjjones/jsonp-usage.js
JSONP function - Easily fetch remote JSONP files
// Example usage: Fetch it's own code from GitHub
JSONP( 'https://api.github.com/users/erjjones?callback=?', function( response ) {
var data = response.data;
console.log(data.followers);
});
import urllib.request
import asyncio
import json
r = urllib.request.urlopen('https://raw.githubusercontent.com/spacelan/wechat-emoticon/master/emoticons.json').read().decode('utf8')
json_obj = json.loads(r)
@asyncio.coroutine
def download(todo):
urllib.request.urlretrieve(todo.get('url'), todo.get('md5') + '.gif')