Skip to content

Instantly share code, notes, and snippets.

View leohxj's full-sized avatar
💯
Focusing

Leo Hui leohxj

💯
Focusing
View GitHub Profile
@leohxj
leohxj / highlight.css
Created June 17, 2014 03:31
解决ios, android下点击元素背景阴影问题
-webkit-tap-highlight-color:rgba(255,255,255,0)
@leohxj
leohxj / callout.css
Created July 24, 2014 03:54
禁止长按链接与图片弹出菜单
a, img {
-webkit-touch-callout: none; /* 禁止长按链接与图片弹出菜单 */
}
html, body {
-webkit-user-select: none; /* 禁止选中文本(如无文本选中需求,此为必选项) */
user-select: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
@leohxj
leohxj / OS.gitignore
Created October 29, 2014 05:38
OS generated files
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
@leohxj
leohxj / prevent-img-drag.css
Created November 3, 2014 08:27
阻止图片拖拽
img {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}
@leohxj
leohxj / minimal-ui.html
Last active August 29, 2015 14:13
iOS 7.1的Safari为meta标签新增minimal-ui属性,在网页加载时隐藏地址栏与导航栏,http://www.36kr.com/p/210516.html
<meta name="viewport" content="minimal-ui">
<!--
Just say goodbye to minimal-ui (for now)
http://stackoverflow.com/questions/24889100/ios-8-removed-minimal-ui-viewport-property-are-there-other-soft-fullscreen
-->
@leohxj
leohxj / common-regexp.js
Created April 15, 2015 09:17
JavaScript常用正则表达式
/<%([^%>]+)?%>/g; // 匹配<%,%>之间内容
@leohxj
leohxj / extend.js
Last active August 29, 2015 14:19
Helper function for extending objects
/**
* Check if object is part of the DOM
* @constructor
* @param {Object} obj element to check
*/
function isDOMElement(obj) {
return obj && typeof window !== 'undefined' && (obj === window || obj.nodeType);
}
/**
@leohxj
leohxj / uc_control.js
Last active August 29, 2015 14:24
UC浏览器关闭默认手势和长按弹出菜单
// UC-U3内核JavaScript专用API
// (经测试,官方文档给出的API很多也不能使用,下面只列出测试能用的)
// 1. 关闭默认手势
// 用法:
navigator.control.gesture(false);
// 推荐写法:
try {
navigator.control.gesture(false);
} catch (e) {
}
@leohxj
leohxj / FibonacciSequenceSum.java
Created December 24, 2012 07:15
数列求和
/**
* 求FebonacciSequence数列
*/
import java.util.Scanner;
public class FibonacciSequenceSum {
public static void main(String[] args) {
long sum;
while (true) {
@leohxj
leohxj / isArray.js
Created August 2, 2013 03:36
JS判断变量是否是数组
isArray = ('isArray' in Array) ? Array.isArray : function(value) {
return Object.prototype.toString.call(value) === '[object Array]';
}