This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* multi offline task add for pan.baidu.com | |
* 执行代码前必须 点一下 **离线下载** 按钮 | |
**/ | |
(function () { | |
var R = require('function-widget-1:offlineDownload/util/newOfflineDialog.js'); | |
var r = R.obtain(); | |
var timer = 600; | |
var add = function (url) { | |
r.setVisible(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* base | |
*/ | |
/** | |
* @vendor http://learnboost.github.io/stylus/docs/interpolation.html | |
*/ | |
vendor(prop, args) | |
-webkit-{prop} args | |
-moz-{prop} args | |
{prop} args |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://james.padolsey.com/javascript/parsing-urls-with-the-dom/ | |
// This function creates a new anchor element and uses location | |
// properties (inherent) to get the desired URL data. Some String | |
// operations are used (to normalize results across browsers). | |
function parseURL(url) { | |
var a = document.createElement('a'); | |
a.href = url; | |
return { | |
source: url, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- encoding: utf-8 -*- | |
import os | |
import hashlib | |
import logging | |
_hashes = {} | |
def get_absolute_path(root, path): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#setting | |
# Enable full keyboard access for all controls | |
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 | |
# Disable menu bar transparency | |
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false | |
# Allow quitting Finder via ⌘ + Q; doing so will also hide desktop icons | |
defaults write com.apple.finder QuitMenuItem -bool true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://github.com/jeromegn/Backbone.localStorage/blob/master/backbone.localStorage.js#L27 | |
// Generate four random hex digits. | |
function S4() { | |
return (((1+Math.random())*0x10000)|0).toString(16).substring(1); | |
}; | |
// Generate a pseudo-GUID by concatenating random hexadecimal. | |
function guid() { | |
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta charset='utf-8'> | |
<title> requestAnimationFrame </title> | |
<style type="text/css"> | |
.mover { | |
position: absolute; | |
height: 100px; | |
width: 100px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://github.com/gabrielecirulli/2048/blob/master/js/animframe_polyfill.js | |
(function () { | |
var lastTime = 0; | |
var vendors = ['webkit', 'moz']; | |
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { | |
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; | |
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || | |
window[vendors[x] + 'CancelRequestAnimationFrame']; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var quickSort = function(arr){ | |
if ( arr.length <= 1 ) { | |
return arr; | |
} | |
var sampleIndex = Math.floor(arr.length/2), | |
sample = arr.splice(sampleIndex, 1)[0], | |
left = [], | |
right = []; | |
for (var i = 0; i < arr.length ; i++){ | |
if ( arr[i] < sample ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* http://blog.teamtreehouse.com/box-sizing-secret-simple-css-layouts#comment-50223 | |
*/ | |
html { | |
box-sizing: border-box; | |
} | |
*, *:before, *:after { | |
box-sizing: inherit; | |
} |
NewerOlder