Skip to content

Instantly share code, notes, and snippets.

import Ember from 'ember';
import { computed } from '@ember/object';
export default Ember.Component.extend({
ts: computed(function () {
return performance.now()
})
});

Keybase proof

I hereby claim:

  • I am inkless on github.
  • I am inkless (https://keybase.io/inkless) on keybase.
  • I have a public key ASDdw7aYnMqFMH2RIpxuQzrpvu-KuU3KscnwlrCSF_-xnAo

To claim this, I am signing this object:

Tile Engine

Old Engine

1. Create page

When creating a page, server side will generate a new config for this page. Some data will be read from database too. This includes:

@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')
/**
* An example to try to call API multiple times
*/
'use strict';
const maxTryTimes = 3;
const tryTimeInterval = 500;
/**
* try multiple times to access server API

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"/>
@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];
@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 / 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 / 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;
}