Skip to content

Instantly share code, notes, and snippets.

View hanguokai's full-sized avatar

Jackie(Guokai) Han hanguokai

View GitHub Profile
@hanguokai
hanguokai / detect
Last active August 29, 2015 14:06
Detect browser devtools console, and give a text when first open it. 用于在浏览器 console 上给开发者显示信息。
// 方法一:最简单的方法是直接在页面末尾加上这句话。
// 请替换具体文字内容。还可以为文字添加样式。
console && console.log("%cWelcome to here!\n", "font-size:1.5em;color:#4558c9;");
// 方法二:在打开 DevTools 时才提示,将下面代码添加到页面末尾。
(function(){
try{
function detect(){
if ((window.outerHeight - window.innerHeight) > 100 || (window.outerWidth - window.innerWidth) > 100){
// replace your text
@hanguokai
hanguokai / designer.html
Last active August 29, 2015 14:06
designer
<link rel="import" href="../topeka-elements/theme.html">
<link rel="import" href="../topeka-elements/topeka-resources.html">
<link rel="import" href="../topeka-elements/topeka-app.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@hanguokai
hanguokai / designer.html
Last active August 29, 2015 14:06
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@hanguokai
hanguokai / designer.html
Last active August 29, 2015 14:06
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element" attributes="owner">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@hanguokai
hanguokai / countUniqueRows.js
Last active December 20, 2015 15:19
统计 Google doc 电子表格的有效行数,一般用于报名表(表单回复)的人数统计,可以方便地知道当前的报名人数,并且以 email 作为唯一标示过滤重复的行。行数统计不包括电子表格中的第一行,因为第一行一般是标题而不是数据。
// email 所在的列,从0开始算。email 作为唯一标示,用于去重。
var emailColumn = 1;
// 电子表格的 doc key
key = "0AhIp-TG_44qxdHFnTDFUeDNOUEp2LVVpbmVMa25QQVE";
/**
* 统计报名人数,根据 email 唯一标示去除重复的报名。
*/
function countUniqueRows() {
@hanguokai
hanguokai / notify.js
Created April 28, 2013 10:29
本代码为 Google Apps Script 。 用于读取 Google Drive 中的报名表(电子表格),去除重复数据,并根据姓名和 Email 地址发送通知邮件。
//已发送邮件的标记内容
var EMAIL_SENT = "EMAIL_SENT";
//记录已发送记录的列,一般为原有数据的后面一列,从0开始
var EMAIL_SENT_COLUMN = 9;
// 发送的邮件主题
var SUBJECT = "北京GDG之编程语言沙龙参会确认函";
// email 所在的列,从0开始算