Skip to content

Instantly share code, notes, and snippets.

View sorrycc's full-sized avatar
🌻
Working on UmiJS

chencheng (云谦) sorrycc

🌻
Working on UmiJS
View GitHub Profile
initHotProduct:function() {
$("div.J_Product").each(function() {
var el = this;
var swipe = Swipe(el, {
auto: 30000,
callback: function(pos) {
bullets.removeClass("on");
bullets[pos].className = "on";
}
});
@sorrycc
sorrycc / template.html
Last active August 29, 2015 13:58
anima widget basic template.
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>test delegate</title>
</head>
<body>
<script src="https://a.alipayobjects.com/seajs/seajs/2.2.0/sea.js"></script>
/**
* 检测客户端系统中,是否安装了某种字体
*
* 在IE中,通过<object classid>的方式,提取系统中的字体库进行判断
* 非IE中,通过字体宽度与默认字体进行比较
*
* @example
qext.FontDetect.detect(['微软雅黑','Microsoft Yahei'],function(isExist){
//获得html节点
var htmlElm = qing.dom.query('html')[0];
/**
* Require the module at `name`.
*
* @param {String} name
* @return {Object} exports
* @api public
*/
function require(name) {
var module = require.modules[name];
@sorrycc
sorrycc / index.js
Created May 23, 2014 11:05
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var moment = require("moment")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
@sorrycc
sorrycc / after.js
Created July 25, 2014 08:21
spm-build diff
define("acharts/1.0.0/index-debug", [], function(require, exports, module) {
var acharts = require("acharts/1.0.0/src/chart-debug");
acharts.Util = require("acharts/1.0.0/src/util-debug");
acharts.Canvas = require("acharts/1.0.0/src/canvas-debug");
window.Chart = acharts;
module.exports = acharts;
});
@sorrycc
sorrycc / config.js
Created October 30, 2014 10:02
spm build script
var join = require('path').join;
var DEFAULT_CONFIG = {
// spm 源
"registry": "http://private-spm-url",
// Rename files
// 详见:https://github.com/jeremyruppel/pathmap
"pathmap": null,
@sorrycc
sorrycc / check_local_pkg.js
Created December 30, 2014 09:16
Compare sync pkg's md5.
require('shelljs/global');
var crypto = require('crypto');
var stat = require('fs').statSync;
var join = require('path').join;
var dirname = require('path').dirname;
var readFile = require('fs').readFileSync;
var dir = join(__dirname, '../spmjs.io/data/repository');
cd(dir);
# the path where screenshots to save
SS_PATH="/tmp"
# if you want to save them to your desktop, SS_PATH should be "/Users/YOURNAME/Desktop"
# a variable of unix timestamp for screenshot file name
NOW=$(date +%s)
# execute screen capture command, screenshot$NOW.png is the name of file
screencapture -i -r $SS_PATH/screenshot$NOW@2X.png
@sorrycc
sorrycc / CSS Overflow Test Script
Created February 27, 2011 08:10
CSS Overflow Test Script
/**
* CSS Overflow Test Script
* @author sorrycc@gmail.com, @chenchengpro
* @doc http://www.chencheng.org/
*/
(function() {
// Text