# This example does an AJAX lookup and is in CoffeeScript
$('.typeahead').typeahead(
# source can be a function
source: (typeahead, query) ->
# this function receives the typeahead object and the query string
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
$(document).ready(function() { | |
// Support for AJAX loaded modal window. | |
// Focuses on first input textbox after it loads the window. | |
$('[data-toggle="modal"]').click(function(e) { | |
e.preventDefault(); | |
var url = $(this).attr('href'); | |
if (url.indexOf('#') == 0) { | |
$(url).modal('open'); | |
} else { |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
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
# -*- coding: utf-8 -*- | |
import httplib2 | |
import pprint | |
from apiclient.discovery import build | |
from apiclient.http import MediaFileUpload | |
from oauth2client.client import SignedJwtAssertionCredentials | |
# Email of the Service Account. | |
SERVICE_ACCOUNT_EMAIL = '@developer.gserviceaccount.com' |
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
<?php | |
//判断美国那个时间段是否为夏令时 | |
function is_dst($timestamp) | |
{ | |
$timezone = date('e'); //获取当前使用的时区 | |
date_default_timezone_set('US/Pacific-New'); //强制设置时区 | |
$dst = date('I',$timestamp); //判断是否夏令时 | |
date_default_timezone_set($timezone); //还原时区 | |
return $dst; //返回结果 | |
} |
- LuCI官网: http://luci.subsignal.org/trac
- openwrt-luci技术文档: http://wiki.openwrt.org/doc/techref/luci
- luci翻译项目: http://i18n.luci.subsignal.org/pootle/
- LuCI源码中, po文件是用来翻译程序源代码里的字符串的, 即由上面翻译项目支持, po文件都是由一对对的msgid和msgstr组成的. msgid就是原文. msgstr就是译文. 基于Po翻译文件, 最终生成的LMO文件是一种有效的二进制字符串包格式. 用官方话说,
The abbreviation "LMO" stands for "Lua Machine Objects" in the style of the GNU gettext *.mo format
. 参考链接: http://luci.subsignal.org/trac/wiki/Documentation/LMO; 所以, Luci程序通过读取.lmo文件使自身的界面转换成用户使用的语言, 如简体中文(zh), 关于修改界面程序后如何重新编译po文件的链接, 参考http://luci.subsignal.org/trac/wiki/Documentation/i18n.
上一篇总结了uhttpd的工作方式, openwrt中利用他作为web服务器, 实现客户端web页面配置功能. 对于request处理方式, 采用的是cgi, 而所使用的cgi程序就是luci, 工作框架如下图所示:
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
async def main(): | |
coroutine1 = do_some_work(1) | |
coroutine2 = do_some_work(2) | |
coroutine3 = do_some_work(4) | |
tasks = [ | |
asyncio.ensure_future(coroutine1), | |
asyncio.ensure_future(coroutine2), | |
asyncio.ensure_future(coroutine3) | |
] |
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
{ | |
"xiaohongshu.com": "小红书", | |
"vip.com": "唯品会", | |
"douguo.com": "豆果美食", | |
"youshu.cc": "有书", | |
"missfresh.cn": "每日优鲜", | |
"qnr.io": "去哪儿", | |
"kaola.com": "网易考拉", | |
"waimai.meituan.com": "美团外卖", | |
"qcs.meituan.com": "美团打车", |
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
(function () { | |
// IndexedDB | |
var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.OIndexedDB || window.msIndexedDB, | |
IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.OIDBTransaction || window.msIDBTransaction, | |
dbVersion = 2.0; | |
// Create/open database | |
var request = indexedDB.open("soundScapeFiles", dbVersion), | |
db, | |
createObjectStore = function (dataBase) { |