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 / 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
#include "cocotouch.h"
#include <Adafruit_NeoPixel.h>
#include <avr/power.h>
#define PIN 8
#define NUMPIXELS 60
char index;
uint8_t idx;
#include "cocotouch.h"
#include <Adafruit_NeoPixel.h>
#include <avr/power.h>
#define PIN 5
#define NUMPIXELS 60
CocoTouch touch;
uint8_t touchstates[12];
@winsonwq
winsonwq / ListStore.js
Last active October 13, 2017 13:36 — forked from morlay/ListStore.js
import { createStore } from 'reflux'
// if you don't mind
import { pipe, of } from 'ramda'
import GalleryActions from '../actions/GalleryActions'
export default createStore({
init(){
this.galleryMap = {}
@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 / parking-lot.js
Last active May 4, 2016 15:28
Parking Lot with inheritance
// Step 1
function Car () {}
function Ticket () {}
function ParkingLot(capacity) {
this.capacity = capacity;
this.cars = [];
}
@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 / 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'
},