Skip to content

Instantly share code, notes, and snippets.

@waynelkh
waynelkh / datamapper_lang.php
Last active August 29, 2015 14:07
Codeigniter Datamapper zh_tw language, language/datamapper_lang.php
<?php
$lang['alpha_dash_dot'] = '%s 只能填寫英文字母、數字、底線(_)、破折號(-)或句號(.)。';
$lang['alpha_slash_dot'] = '%s 只能填寫英文字母、數字、底線(_)、斜線(/)或句號(.)。';
$lang['min_date'] = '%s 必須晚於 %s。';
$lang['max_date'] = '%s 必須早於 %s。';
$lang['min_size'] = '%s 必須大於 %s。';
$lang['max_size'] = '%s 必需小於 %s。';
$lang['transaction'] = '%s 交易失敗 %s。';
$lang['unique'] = '%s 您所提供的已經存在。';
# Setting the prefix from `C-b` to `C-a`.
# By remapping the `CapsLock` key to `Ctrl`,
# you can make triggering commands more comfottable!
set -g prefix C-a
# Free the original `Ctrl-b` prefix keybinding.
unbind C-b
# Ensure that we can send `Ctrl-a` to other apps.
bind C-a send-prefix
@waynelkh
waynelkh / httpd-vhosts.conf
Last active August 29, 2015 14:13
/etc/apache2/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents/
</VirtualHost>
<VirtualHost *:80>
ServerName waynelkh.com
ServerAlias www.waynelkh.com
DocumentRoot /Users/waynelkh/Sites/
ErrorLog "/private/var/log/apache2.waynelkh.error.log"

Javascript 的测试, 不管在用 jasmine 还是 mocha, 都是很头疼的事情. 但是自从有了 jest, 一口气写7个测试, 腰也不疼了, 头也不疼了.

只需要 3 个理由

在说用 jest 测为什么好之前,我们先来看我们要测的一个例子.

@waynelkh
waynelkh / designer.html
Last active August 29, 2015 14:13
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<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-menu/core-submenu.html">
<link rel="import" href="../paper-calculator/paper-calculator.html">
<link rel="import" href="../paper-toast/paper-toast.html">
@waynelkh
waynelkh / App.jsx
Last active August 29, 2015 14:13
React Warning: This JSX uses a plain function. Only React components are valid in React's JSX transform
var React = require('react');
var Yo = require('./Yo.jsx');
var App = React.createClass({
render: function(){
return (
<div>Hello wrold
<Yo />
</div>);
}
@waynelkh
waynelkh / InputBox-test.js
Created January 17, 2015 22:10
react jest in inputbox
jest.dontMock('../InputBox.js');
var React = require('react/addons');
var TestUtils = React.addons.TestUtils;
var InputBox = require('../InputBox.js');
describe('InputBox', function () {
it('type will change the value and state', function () {
var inputBox = TestUtils.renderIntoDocument(<InputBox />);
# Hexo Configuration
## Docs: http://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/
# Site
title: Infinity Road
subtitle: Be a better Programmer
description: Note something I had done
author: Wayne Lee
language: zh-TW
@waynelkh
waynelkh / compo
Last active August 29, 2015 14:22
react webpack babel es6 alt
var Path = require("path");
var webpack = require('webpack');
// 如果有傳入 -d 代表 dev 模式,反之如果有 -p 代表 production
// 此參數是給 $ webpack 用的,與 webpack-dev-server 無關
/*var isDev = process.argv.indexOf('-d') > -1;
// 特例,如果是執行 $ webpack-dev-server 要強迫進入 isDev 模式,才能啟動 HMR
isDev = process.env.DEV || isDev;
@waynelkh
waynelkh / redux-react.js
Last active August 29, 2015 14:27
react with redux
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
else if(typeof define === 'function' && define.amd)
define(["react"], factory);
else if(typeof exports === 'object')
exports["Redux"] = factory(require("react"));
else
root["Redux"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_23__) {