Skip to content

Instantly share code, notes, and snippets.

@liunian
liunian / gist:4116655
Created November 20, 2012 07:57
chrome scrollbar style
/* from http://www.alloyteam.com/wp-content/themes/alloyteam/style.css */
::-webkit-scrollbar-track-piece {
background-color:#f5f5f5;
border-left:1px solid #d2d2d2;
}
::-webkit-scrollbar {
width:13px;
height:13px;
}
::-webkit-scrollbar-thumb {
@liunian
liunian / gist:1885866
Created February 22, 2012 16:24
expand t.co to realLink in twitter page when click
$('#stream-items-id').delegate('.js-tweet-text a[data-expanded-url]', 'click', function(e){
this.href = $(this).attr('data-expanded-url');
});
@jonathantneal
jonathantneal / detect-autofill.js
Created September 11, 2018 14:56
Detect autofill in Chrome, Edge, Firefox, and Safari
export default scope => {
// match the filter on autofilled elements in Firefox
const mozFilterMatch = /^grayscale\(.+\) brightness\((1)?.*\) contrast\(.+\) invert\(.+\) sepia\(.+\) saturate\(.+\)$/
scope.addEventListener('animationstart', onAnimationStart)
scope.addEventListener('input', onInput)
scope.addEventListener('transitionstart', onTransitionStart)
function onAnimationStart(event) {
// detect autofills in Chrome and Safari by:
@liunian
liunian / gist:1875119
Created February 21, 2012 08:25
use curl to get headers if get_headers is unable to use
<?php
/**
* Script to check link validity
*
* @author Satya Prakash
*
*/
$links = array();
$links[] = 'http://www.satya-weblog.com/2007/04/dynamically-populate-select-list-by.html';
@liunian
liunian / gist:5676234
Created May 30, 2013 07:24
jquery 和 underscore 式的构造器,有无 new 都会进行创建,传入已创建的对象会直接返回
var _ = function(obj) {
if (obj instanceof _) return obj;
if (!(this instanceof _)) return new _(obj);
this._wrapped = obj;
};
@liunian
liunian / gist:5926438
Last active April 26, 2024 03:32
javascript sort
/*
list: the array
fn: sort fn
start: the start index of the sorted range, included
end: the end index of the sorted range, excluded
means range: [start, end)
modify the array itself and return nothing
*/
/*
* 频率控制 返回函数连续调用时,fn 执行频率限定为每多少时间执行一次
* @param fn {function} 需要调用的函数
* @param delay {number} 延迟时间,单位毫秒
* @param immediate {bool} 给 immediate参数传递false 绑定的函数先执行,而不是delay后后执行。
* @return {function} 实际调用函数
*/
var throttle = function (fn,delay, immediate, debounce) {
var curr = +new Date(),//当前时间
last_call = 0,
@liunian
liunian / gist:7133112
Created October 24, 2013 08:08
A to Z in 10x10
/*
10 x 10
A-Z ( 65 -> 90)
output something like this
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* J I * * * * * * *
### BY: MUNFAQQIHA ####################################################################################################################################
######################### A BASH SHELL SCRIPT FOR LINUX AND WINDOWS TO AUTOMATICALLY NON-STOP UPLOAD FILES TO WWW.TERABOX.COM #########################
#######################################################################################################################################################
### ----------------------------------------------------------------------------------------------------------------------------------------------- ###
### | sample of successful upload: on linux: https://s.id/teraupnix || on windows: https://s.id/teraupwin | ###
### ----------------------------------------------------------------------------------------------------------------------------------------------- ###
### it is possible to upload multiple different types of files recursively, except 0-byte file size, in a folder
var supports = (function() {
var div = document.createElement('div'),
vendors = 'Khtml Ms O Moz Webkit'.split(' '),
len = vendors.length;
return function(prop) {
if ( prop in div.style ) return true;
prop = prop.replace(/^[a-z]/, function(val) {
return val.toUpperCase();