Skip to content

Instantly share code, notes, and snippets.

@yijian166
yijian166 / Enhance.js
Created March 12, 2016 00:41 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@yijian166
yijian166 / rules.conf
Created October 26, 2015 13:53 — forked from janlay/README.md
Yet another config for Surge.app (build 245+)
# This config file was created for myself (@janlay). You may want to add or remove some rules to make efficient use of the Internet.
# This file depends on the main.conf which defines your own proxy.
# Your main.conf will look like this:
# ---- START ----
# #!PROXY-OVERRIDE:rules.conf
# [Proxy]
# Proxy = https,server.address,port,username,password
# ---- END ----
#
@yijian166
yijian166 / surge.conf
Created October 8, 2015 09:11 — forked from soffchen/surge.conf
surge.conf
[General]
loglevel = notify
all-tcp-mode = false
[Proxy]
Proxy = custom
[Rule]
// iOS Maps
DOMAIN-SUFFIX,ls.apple.com,DIRECT
@yijian166
yijian166 / detector
Created July 2, 2015 06:31
浏览器检测
//https://github.com/hotoo/detector/blob/master/detector.js
var detector = {};
var NA_VERSION = "-1";
var win = this;
var external;
var re_msie = /\b(?:msie |ie |trident\/[0-9].*rv[ :])([0-9.]+)/;
var re_blackberry_10 = /\bbb10\b.+?\bversion\/([\d.]+)/;
var re_blackberry_6_7 = /\bblackberry\b.+\bversion\/([\d.]+)/;
var re_blackberry_4_5 = /\bblackberry\d+\/([\d.]+)/;
@yijian166
yijian166 / app.js
Last active August 29, 2015 14:06 — forked from jgoux/app.js
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers'])
.run(function(DB) {
DB.init();
});
@yijian166
yijian166 / gist:319a5ff5387091875bad
Last active August 29, 2015 14:01
清除浮动——bootstrap
.clearfix {
*zoom: 1;
&:before,
&:after {
display: table;
content: "";
}
&:after {
clear: both;
}
(function(){
/**
 * 功能:图片惰性加载。在需要图片惰性加载的页面底部载入。再将图片加上class=“lazy”。并将图片的真实地址放置在图片的自定义属性dataimg中。
 * @author haunghm
 * @version 1.0.0
 * @dependencies jquery 或者 zepto
 */
var lazyLoad = {
 
init: function() {
@yijian166
yijian166 / gist:934ce36673921d8af8e2
Created May 21, 2014 03:44
js 判断对象相同
//1) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
var isSame = Object.is(value1, value2);
//2) Fast and limited.
//The ORDER of the properties IS IMPORTANT
JSON.stringify(obj1) === JSON.stringify(obj2) ;
//3) Slow and more generic.
function deepCompare () {
* {
-webkit-user-select:none; /* Prevent copy paste for all elements except text fields */
-webkit-tap-highlight-color:rgba(0, 0, 0, 0); /* set highlight color for user interaction */
-moz-tap-highlight-color:rgba(0, 0, 0, 0); /* set highlight color for user interaction */
-ms-touch-action:none;
-moz-user-select:-moz-none;
-webkit-touch-callout: none; /* prevent the popup menu on any links*/
margin:0;
padding:0;
-webkit-box-sizing:border-box;
@yijian166
yijian166 / Universal Internet Explorer 6 CSS.css
Created April 17, 2014 04:37
Universal Internet Explorer 6 CSS
/* --------------------------------------------------------------
Universal Internet Explorer 6 stylesheet:
http://stuffandnonsense.co.uk/blog/about/universal_internet_explorer_6_css/
Author: Andy Clarke
Web site: http://stuffandnonsense.co.uk
Web site: http://forabeautifulweb.com
Web site: http://transcending.com
Web site: http://hardboiledwebdesign.com
Twitter: http://twitter.com/malarkey