Skip to content

Instantly share code, notes, and snippets.

View dawncold's full-sized avatar
🎯
Focusing

Zhen Tian dawncold

🎯
Focusing
View GitHub Profile
@dawncold
dawncold / index.html
Created November 30, 2015 10:29
React todo mvc
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Hello React!</title>
<style>
li.todo-item.completed span {
text-decoration: line-through;
}
</style>
@dawncold
dawncold / hideRows.vba
Created November 13, 2016 10:42
hide some rows in excel
Sub LoopThroughSheets()
Dim ws As Worksheet
Dim endDate As Date
endDate = DateValue("2016/10/09")
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "汇总" Then
For Each rw In ws.Rows
If rw.Cells(1).Value = "" Then
Exit For
@dawncold
dawncold / webpack.config.js
Last active January 12, 2017 15:38
my webpack config
const path = require('path');
const webpack = require('webpack');
const pkg = require('./package.json');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const InlineManifestWebpackPlugin = require('inline-manifest-webpack-plugin');
const APP_SRC_PATH = path.resolve(__dirname, 'mobile/frontend');
const APP_DIST_PATH = path.resolve(__dirname, 'static/mobile/dist');
const STATIC_PATH = path.resolve(__dirname, 'static');
const jsTemplate = path.resolve(APP_SRC_PATH, 'frontend-js.ejs');
const cssTemplate = path.resolve(APP_SRC_PATH, 'frontend-css.ejs');
import { Index } from './Index';
import { BaseLayout } from './BaseLayout';
<Route path="/" component={BaseLayout} hideHeader="false" hideFooter="false">
<IndexRoute component={Index}/>
</Route>
<Route path="/" getComponent={() => System.import('./BaseLayout').then(c => c.BaseLayout)} hideHeader="false" hideFooter="false">
<IndexRoute getComponent={() => System.import('./Index').then(c => c.Index)}/>
</Route>
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: (module, count) => {
var userRequest = module.userRequest;
if (typeof userRequest !== 'string') {
return false;
}
return userRequest.indexOf('node_modules') >= 0;
function Foo() {
getName = function () { alert (1); };
return this;
}
Foo.getName = function () { alert (2);};
Foo.prototype.getName = function () { alert (3);};
var getName = function () { alert (4);};
function getName() { alert (5);}
//请写出以下输出结果:
@dawncold
dawncold / remove_orphan_tasks.py
Created September 7, 2017 05:50
tasktiger remove orphan tasks
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, division
import sys
from redis import Redis
def check():
r = Redis()
task_keys = set()
for key in r.scan_iter(match='t:task:*'):

Keybase proof

I hereby claim:

  • I am dawncold on github.
  • I am dawncold (https://keybase.io/dawncold) on keybase.
  • I have a public key whose fingerprint is 260E 9341 3205 CA34 573E 0670 74B6 B0F5 536B B58C

To claim this, I am signing this object:

@dawncold
dawncold / pms.sh
Last active January 10, 2022 23:15
Plex media server script for FreeBSD
#! /bin/sh
. /etc/rc.subr
name=plexmediaserver
rcvar=plexmediaserver_enable
load_rc_config $name
: ${plexmediaserver_enable:=NO}
command=/usr/sbin/daemon