Skip to content

Instantly share code, notes, and snippets.

@inkless
inkless / compress.php
Last active December 10, 2015 20:48
Another Gist test.
<?php
define('WE_VERSION', '1.0.0');
$conf = array(
'common',
'component',
'business',
'page',
);
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,maximum-scale=1.0,minimum-scale=1.0">
<script src="http://we.sdoprofile.com/common/js/release/loader.min.js"></script>
<script type="text/javascript">
var prizeInfoUrl = "xxxx";
var drawUrl = 'xxx';
</script>

移动端规范初步草案

多平台解决方案

纯移动端

对于已经存在桌面Web版,难以重构或者非常复杂的网站,我们考虑采用纯移动端的设计开发,尽量走轻量级路线。类似于本次 http://m.sdo.com 的页面开发需求。

全站响应式

对于新建站点,并且站点内容并不非常复杂,同时有移动端需求的网站,我们考虑采用全站响应式设计开发。

设计规范

分辨率

@inkless
inkless / resizeimage.php
Last active December 15, 2015 06:49
使用方法: 将该文件存放在任何php环境。运行方法两种: 1. 命令行模式 php resizeimage.php {path} 2. 浏览器模式 localhost/resizeimage.php?path=. 注意路径最好使用相对路径
<?php
$dir = '';
if (isset($argv[1])) $dir = $argv[1];
if ($_REQUEST['path']) $dir = $_REQUEST['path'];
if (!$dir) {
echo "Path not specified! Please use `localhost/resizeimage.php?path=.` or `php resizeimage.php {path}`\n";exit;
}
@inkless
inkless / build.js
Last active December 15, 2015 12:39
Grunt related files
// Build msdo.js to the dist directory. Embed date@version.
grunt.registerMultiTask(
"build",
"Concatenate source and build msdo.js to the dist directory. Embed date@version.",
function() {
// Concat specified files.
var compiled = "",
name = this.data.dest,
src = this.data.src,
@inkless
inkless / blogs_and_nlp__summarize.py
Created April 24, 2013 01:27
对文章进行自动摘要(Automatic summarization)的算法实现(python)
# -*- coding: utf-8 -*-
import sys
import json
import nltk
import numpy
N = 100 # Number of words to consider
CLUSTER_THRESHOLD = 5 # Distance between words to consider
TOP_SENTENCES = 5 # Number of sentences to return for a "top n" summary
@inkless
inkless / crawl_website.php
Created June 9, 2013 09:44
抓取静态网站的全部静态资源和内容
<?php
ini_set('display_errors', 'On');
$theme_id = $_SERVER['HTTP_HOST'] ? $_REQUEST['theme_id'] : $argv[1];
if (!$theme_id) die("No Theme ID specified!");
$target_url = $_SERVER['HTTP_HOST'] ? $_REQUEST['target'] : $argv[2];
$target_url = $target_url ?: "http://wbpreview.com/previews/";
$index_page = $_SERVER['HTTP_HOST'] ? $_REQUEST['index_page'] : $argv[3];

Email Structure Documentation

layout

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width"/>
/**
* An example to try to call API multiple times
*/
'use strict';
const maxTryTimes = 3;
const tryTimeInterval = 500;
/**
* try multiple times to access server API
@inkless
inkless / unregister.js
Created July 19, 2016 20:26
Override previous directives or filters in angular
/**
* unregister
*
* unregister old directives or filters
*
* @param {Object.<{name: string, type: string}>[]} declares
* @param string module
* @returns {undefined}
* @example
* {name: 'foo', type: 'directive')