Skip to content

Instantly share code, notes, and snippets.

View winsonwq's full-sized avatar
🎯
Focusing

Wang Qiu winsonwq

🎯
Focusing
  • 可好玩乐
  • Chengdu China
View GitHub Profile
@winsonwq
winsonwq / members.json
Created March 13, 2014 04:32
members
{
"name": "Drupal",
"members": [
{
"name": "Wang Qiu",
"role": "Team Lead",
"motto": "",
"avatar": "https://2.gravatar.com/avatar/7ed23c4532204410539c551c405ce213?d=https%3A%2F%2Fidenticons.github.com%2Fe66953f95ec27b59aab57b32b630cfda.png&r=x&s=460"
}
/*, others */
@winsonwq
winsonwq / minico.js
Created March 3, 2014 06:15
mini_co implementation
function asyncRandom() {
return function (fn) {
setTimeout(function () {
fn(Math.random());
}, 10);
};
}
function *gen1() {
var a = yield asyncRandom();
@winsonwq
winsonwq / time-ago-filter.php
Created January 17, 2014 01:56
"time ago" function
<?php
function ago($time)
{
$periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
$lengths = array("60","60","24","7","4.35","12","10");
$now = time();
$difference = $now - $time;
$tense = "ago";
@winsonwq
winsonwq / jenkins
Created December 2, 2013 03:29
jenkins
#!/bin/bash
# /etc/init.d/jenkins
# debian-compatible jenkins startup script.
# Amelia A Lewis <alewis@ibco.com>
#
### BEGIN INIT INFO
# Provides: jenkins
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
@winsonwq
winsonwq / selenium-server.sh
Last active October 12, 2020 20:15
selenium webdriver as background
#!/bin/bash
# Start the service selenium-server
start() {
echo "Starting selenium-server server."
export DISPLAY=:0
java -jar /Users/tw/Projects/test/selenium-server-standalone-2.35.0.jar -role hub &>/dev/null &
PID=$!
### Create the lock file ###
echo $PID > /var/run/selenium-server.pid
@winsonwq
winsonwq / package.json
Created October 15, 2013 00:57
package.json for mocha & node in grunt
{
"name": "webdriver-helper",
"description": "JavaScript WebDriver Helper",
"version": "0.1.0",
"homepage": "https://github.com/tw/js-webdriver-helper",
"author": {
"name": "Wang Qiu",
"email": "winsonwq@gmail.com",
"url": "http://ishouldbeageek.me"
},
@winsonwq
winsonwq / Gruntfile.js
Created October 15, 2013 00:56
template with mocha & node in grunt
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
mochacli: {
options: {
reporter: 'spec'
},
@winsonwq
winsonwq / Rate.cs
Last active December 24, 2015 11:08
class Rate : IRate {
public Rate(CustomerType, weekdays, weekdayPrice, weekendPrice) {
// .....
}
public double calculte (Days days...) {
double totalPrice = 0;
for(var day in days) {
if day is weekdays {
@winsonwq
winsonwq / counter.js
Last active September 7, 2016 17:28
闭包练习三
// function counter(initValue, seed) {}
// testcase
var incrementByOneFromOne = counter(1, 1);
incrementByOneFromOne.should.include.keys('value');
incrementByOneFromOne.should.include.keys('increment');
incrementByOneFromOne.should.include.keys('decrement');
// testcase
var incrementByOneFromOne = counter(1, 1);
@winsonwq
winsonwq / sunbk.config.js
Created August 15, 2013 09:07
viff test for sunbk
'use strict'
module.exports = {
seleniumHost: 'http://localhost:4444/wd/hub',
browsers: ['firefox'/*, 'chrome', 'safari', 'opera'*/],
envHosts: {
prodtest: 'http://prodtest.suncorpbank.com.au',
prod: 'http://suncorpbank.com.au'
},
paths: [