Skip to content

Instantly share code, notes, and snippets.

View jollychang's full-sized avatar
🎼
Focusing

William Zhang jollychang

🎼
Focusing
View GitHub Profile
@jollychang
jollychang / uiautomation_login.js
Created February 13, 2014 09:22
uiautomation login demo
var target = UIATarget.localTarget();
var app = target.frontMostApp();
var appWindow = app.mainWindow();
var user = 'youruser';
var password = 'yourpass'
appWindow.logElementTree();
UIALogger.logMessage(appWindow.textFields());
appWindow.textFields()[0].setValue(user);
appWindow.secureTextFields()[0].setValue(password);
var loginButton = appWindow.buttons()[0];
@jollychang
jollychang / Mobile JSON Wire Protocol Specification
Created May 21, 2014 05:58
Mobile JSON Wire Protocol Specification
Mobile JSON Wire Protocol Specification
=======================================
### *DRAFT*
Introduction
------------
This specification is designed to extend the [JSON Wire
Protocol](https://code.google.com/p/selenium/wiki/JsonWireProtocol) (JSONWP),
a W3C working draft for web browser automation. The JSONWP has been greatly
@jollychang
jollychang / clean_all_external_drive.command
Created May 25, 2014 15:27
clean all external drive for osx-ntfs bug
list=`diskutil list | grep Windows | awk '{print $3}'`
for l in $list;
do sh ./clean_hd.sh $l;
done
import jenkinsapi
from jenkinsapi.jenkins import Jenkins
jk = Jenkins('http://qa-dev.intra.douban.com:9999/')
job = jk.get_job('test_peters_master')
lb = job.get_last_build()
url = lb.python_api_url(lb.baseurl)
data = lb.get_data(url)
print data['culprits'], data['builtOn']
@jollychang
jollychang / toggleRelatedBox.js
Created May 27, 2014 08:34
hide and display block
toggleRelatedBox = function() {
if (!this._toggleLock) {
this._toggleLock = true;
$('div.related div.content').slideToggle(300, function() {
list-resources._toggleLock = false;
});
}
#!/usr/bin/env python
''' Apple AppStore reviews scrapper
version 2011-04-12
Tomek "Grych" Gryszkiewicz, grych@tg.pl
http://www.tg.pl
based on "Scraping AppStore Reviews" blog by Erica Sadun
- http://blogs.oreilly.com/iphone/2008/08/scraping-appstore-reviews.html
AppStore codes are based on "appstore_reviews" by Jeremy Wohl
- https://github.com/jeremywohl/iphone-scripts/blob/master/appstore_reviews
@jollychang
jollychang / parallel_grid.sh
Created July 2, 2014 06:49
robotframework + selenium grid parallel(http://www.gnu.org/software/parallel/) run and generate report
rm -rf static/webtest_report/*
find . -iname "test*.txt" | sed -e "s/_code//g" | xargs grep -l " core" | parallel --tty -j15 pybot -v GRAB_SERVER_ERROR:no -v SHIRE_PATH:`pwd` -v GRAB_SERVER_ERROR:NO -v remote:yes -v DEFAULT_INIT_TIMEOUT:60 -v AJAX_TIMEOUT:15 -v NOT_INIT:yes -v DEFAULT_TIMEOUT:60 `python ./shireconfig.py --webtest` -i core --timestampoutputs --outputdir static/webtest_report/{} {} \; {0..255}\>/dev/null
cd static/webtest_report
xml_list=`find . -iname '*.xml'`
rebot --name Webtest --output ./output.xml $xml_list
find . -iname '*.png*' -exec cp {} ./ \;

Git basic

Commit

Pricinple

  • One commit one small feature or bug fix
  • Include unit test in one commit
  • Exclude non-associated files
  • Don't commit un-finished or wrong code
@jollychang
jollychang / lme_mo.py
Created August 6, 2014 08:31
check MOLYBDENUM price
import requests
url = 'http://www.quandl.com/api/v1/datasets/OFDP/MOLYBDENUM_56'
r = requests.get(url)
data = r.json().get('data')
print data
if data[0][-1] > data[1][-1]:
print 'price is rise'
# encoding: UTF-8
namespace :simulator do
desc "Call 'Reset Content and Settings' in iOS Simulator menu"
task :reset do
%x{
osascript <<-END
tell application "iPhone Simulator" to activate
tell application "System Events"
tell process "iPhone Simulator"