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 / Cakefile
Created December 11, 2012 09:53
Cakefile
{exec} = require 'child_process'
run = (command, callback) ->
exec command, (err, stdout, stderr) ->
console.warn stderr if stderr
callback?() unless err
build = (callback) ->
run 'coffee -co lib src', callback
@winsonwq
winsonwq / array_callback.rb
Created May 27, 2013 03:08
add hook when array size changed
a = []
class << a
Array.instance_methods(false).each do |meth|
old = instance_method(meth)
define_method(meth) do |*args, &block|
old_size = size
old.bind(self).call(*args, &block)
size_changed(size) if old_size != size
end if meth != :size
@winsonwq
winsonwq / aami.config.js
Last active December 21, 2015 02:59
Viff config file for AAMI prodtest & prod
'use strict'
module.exports = {
seleniumHost: 'http://localhost:4444/wd/hub',
browsers: ['firefox'],
envHosts: {
prodtest: 'http://prodtest.aami.com.au',
prod: 'http://www.aami.com.au'
},
paths: [
@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: [
@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 / 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 / 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 / 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": "[email protected]",
"url": "http://ishouldbeageek.me"
},
@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 / jenkins
Created December 2, 2013 03:29
jenkins
#!/bin/bash
# /etc/init.d/jenkins
# debian-compatible jenkins startup script.
# Amelia A Lewis <[email protected]>
#
### BEGIN INIT INFO
# Provides: jenkins
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5