Skip to content

Instantly share code, notes, and snippets.

View jollychang's full-sized avatar
🎼
Focusing

William Zhang jollychang

🎼
Focusing
View GitHub Profile
# This script adds a "Webclip" shortcut to your homescreen.
# The shortcut can be used to open a web page in full-screen mode,
# or to launch a custom URL (e.g. a third-party app).
# You'll be asked for a title, a URL, and an icon (from your camera roll)
import plistlib
import BaseHTTPServer
import webbrowser
import uuid
from io import BytesIO
# 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"

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

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key
{
"capabilities":
[
{
"browserName": "android",
"platform": "ANDROID",
"seleniumProtocol": "WebDriver",
"maxInstances": 1,
"port": 8080
}
@jollychang
jollychang / registerAndroid.sh
Last active December 15, 2015 03:29 — forked from stackedsax/registerAndroid.sh
register Android/iphone driver to selenium grid2
#!/bin/bash
HUB_HOST="localhost"
HUB_PORT="4444"
LOCAL_IP="ip"
SOCAT_PORT="8001"
PLATFORM='ANDROID'
BROWSERNAME='android'
MAXINSTANCES=1
# To install the Python client library:
# pip install -U selenium
# Import the Selenium 2 namespace (aka "webdriver")
from selenium import webdriver
# iPhone
driver = webdriver.Remote(browser_name="iphone", command_executor='http://172.24.101.36:3001/hub')
# Android
# SUMMARY
# This gist shows a performance test between a few different variations of Selenium,
# running against Rsel's unit-test sinatra site (https://github.com/a-e/rsel)
# It repeats these steps 20 times:
#
# - Click "About this site" link
# - Go back to the homepage
# - Click "Form test" link
@jollychang
jollychang / rach3.py
Created June 12, 2012 05:07 — forked from illicitonion/rach3.py
Rachmaninov's Third Piano Concerto, Played by Selenium
from selenium import webdriver
from time import sleep
d = webdriver.Chrome()
d.get('http://mrcoles.com/piano/')
sleep(2)
d.execute_script('document.querySelector(\'.keys\').style.width=\'791px\' ; var es = document.querySelectorAll(\'.black\') ; for (var e = 0 ; e < es.length ; ++e) { es[e].style.width = \'1px\'; }')
keymap = {'a': [-3, 9], 'a#': [-2, 10], 'bb': [-2, 10], 'b': [-1, 11], 'c': [-12, 0, 12], 'c#': [-11, 1], 'd': [-10, 2], 'd#': [-9, 3], 'eb': [-9, 3], 'e': [-8, 4], 'f': [-7, 5], 'f#': [-6, 6], 'g': [-5, 7], 'g#': [-4, 8]}
def key(letter, pos):