Skip to content

Instantly share code, notes, and snippets.

@fhefh2015
fhefh2015 / new_gist_file.html
Created May 11, 2016 02:47
css3方法:未知高度宽度居中
<style>
.tips_layer_wrap {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .7);
z-index: 10000;
}
- (NSArray *)datas {
if (_datas == nil) {
NSMutableArray *temp = [NSMutableArray array];
NSString *path = [[NSBundle mainBundle] pathForResource:@"apps.plist" ofType:nil];
NSArray *arr = [NSArray arrayWithContentsOfFile:path];
for (NSDictionary *dict in arr) {
CellData *data = [CellData dataWithDict:dict];
[temp addObject:data];
}
@fhefh2015
fhefh2015 / new_gist_file_0.js
Last active May 17, 2016 06:11
jquery 为动态添加的元素绑定事件
$('someUlSelector').delegate('someLiSelector', 'click', function() {
//codes...
//$(this) for the current jquery instance of the element
});
@fhefh2015
fhefh2015 / new_gist_file
Last active May 17, 2016 06:12
多图下载
//
// TableViewController.m
// 多图下载
//
#import "TableViewController.h"
#import "KMCGeigerCounter.h"
#import "CellData.h"
@interface TableViewController ()
@fhefh2015
fhefh2015 / new_gist_file.js
Last active May 17, 2016 06:13
预加载js
//预加载 jQuery版本
!(function() {
var preloader = function(opts) {
var _this = this;
_this.files = opts.files;
_this.current = 0;
_this.progress = opts.progress;
_this.complete = opts.complete;
_this.container = document.createElement("div");
_this.container.style.cssText = "position:absolute;left:-1000px;top:0;width:1px;height:1px;overflow:hidden";
@fhefh2015
fhefh2015 / new_gist_file
Created May 20, 2016 03:36
NSURLSession下载
//1.创建url
NSString *urlStr=@"https://github.com/cnbin/insertDemo/archive/master.zip";
urlStr =[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url=[NSURL URLWithString:urlStr];
//2.创建请求
NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:url];
//3.创建会话(这里使用了一个全局会话)并且启动任务
NSURLSession *session=[NSURLSession sharedSession];
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>居中分页DIV CSS DIVCSS5在线案例演示</title>
<style>
a {
text-decoration: none
}
@fhefh2015
fhefh2015 / new_gist_file.lp
Created May 23, 2016 03:04
CABasicAnimation动画
- (void)animationBaseTest {
CABasicAnimation *baseAnimate = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
baseAnimate.toValue = @(0);
baseAnimate.duration = 0.8;
baseAnimate.repeatCount = MAXFLOAT;
baseAnimate.autoreverses = YES;
[self.heart.layer addAnimation:baseAnimate forKey:@"scaleAnimate"];
@fhefh2015
fhefh2015 / new_gist_file
Created May 24, 2016 03:09
CAAnimateGroup组合动画
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
CABasicAnimation *baseAnimate1 = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
baseAnimate1.toValue = @(0.1);
baseAnimate1.duration = 0.5;
CABasicAnimation *baseAnimate2 = [CABasicAnimation animationWithKeyPath:@"position"];
baseAnimate2.toValue = [NSValue valueWithCGPoint:CGPointMake(0, 0)];
baseAnimate2.duration = 0.5;
@fhefh2015
fhefh2015 / new_gist_file
Created August 1, 2016 14:57
正确的绘制Grid线条 1px细线
//
// SvGridView.h
// SvSinglePixel
//
// Created by xiaoyong.cxy on 6/23/15.
// Copyright (c) 2015 smileEvday. All rights reserved.
//
#import <UIKit/UIKit.h>