Skip to content

Instantly share code, notes, and snippets.

View jollychang's full-sized avatar
🎼
Focusing

William Zhang jollychang

🎼
Focusing
View GitHub Profile
:⌉
=⌉
¦-) as opposed to |
⍥ om nom nom
@evilchili
evilchili / git-hook-functions.sh
Created October 4, 2011 20:17
function library for git hooks & a post-receive hook for automatic branch building
#!/bin/bash
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ -z "$GIT_DIR" ]; then
echo >&2 "fatal: hooks/functions: GIT_DIR not set"
exit 1
fi
read oldrev newrev refname
@davehunt
davehunt / README.md
Created December 1, 2011 13:27
pytest issue 93 example test case

install required python modules

sudo pip install pytest pytest-xdist selenium

download selenium server

curl http://selenium.googlecode.com/files/selenium-server-standalone-2.14.0.jar -o selenium-server-standalone-2.14.0.jar
# 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
@stackedsax
stackedsax / registerAndroid.sh
Created May 3, 2012 01:55
poor man's flynnid.py for registering android emulators in bash
#!/bin/bash
HUB_HOST="hostname"
HUB_PORT="4444"
LOCAL_IP="ip"
SOCAT_PORT="8081"
JSON="{'configuration': {'registerCycle': 5000, 'hub': 'http://<HUB_HOST>:<HUB_PORT>/grid/register', 'host': '<LOCAL_IP>', 'proxy': 'org.openqa.grid.selenium.proxy.DefaultRemoteProxy', 'maxSession': 1, 'port': <SOCAT_PORT>, 'hubPort': <HUB_PORT>, 'hubHost': '<HUB_HOST>', 'url': 'http://<LOCAL_IP>:<SOCAT_PORT>', 'remoteHost': 'http://<LOCAL_IP>:<SOCAT_PORT>', 'register': true, 'role': 'node'}, 'class': 'org.openqa.grid.common.RegistrationRequest', 'capabilities': [{'seleniumProtocol': 'WebDriver', 'platform': 'ANDROID', 'browserName': 'android', 'version': null, 'maxInstances': 1}]}"
JSON=${JSON//<HUB_HOST>/$HUB_HOST}
JSON=${JSON//<HUB_PORT>/$HUB_PORT}
@mockee
mockee / check_ctrip_price.js
Created May 5, 2012 15:18
Check the price of Ctrip tourism product
var http = require('http'),
jsdom = require('jsdom'),
nodemailer = require('nodemailer');
smtpTransport = nodemailer.createTransport('SMTP', {
service: 'Gmail',
auth: {
user: 'username@gmail.com',
pass: 'password'
}
@jam1401
jam1401 / EspressoXMLInstrumentationTestRunner.java
Created December 31, 2013 21:17
If you are using the new Espresso testing framework on Android with CI then you need a way to generate the test results in an XML format. The existing GoogleInstrumentationTestRunner does not support this. This Gist provides an example TestRunner that provides the test output in XML
package com.google.android.apps.common.testing.testrunner;
import android.app.Instrumentation;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.test.AndroidTestRunner;
import android.test.InstrumentationTestRunner;
import android.test.TestSuiteProvider;
import android.util.Log;
@jonathanpenn
jonathanpenn / unix_instruments.sh
Last active January 26, 2016 19:09
Make Instruments play nice with unix by returning > 0 status code if build fails
#!/usr/bin/env bash
#
# Copyright (c) 2013 Jonathan Penn (http://cocoamanifest.net)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@languitar
languitar / violations_trigger.groovy
Created August 26, 2013 07:59
A trigger script for the jenkins (hudson) email_ext plugin which informs users in case their commits introduce new violations or warnings. In contrast to the limit options of various other plugins for code analysis reporting this does not fail the build.A simple but insecure way to share this script between different jobs is to execute the follo…
import jenkins.model.Jenkins
build = Jenkins.instance.items[0].builds[0]
println build
println("Available actions on the build: " + build.actions)
def analysisCoreActions = []
// All static analysis actions based on static analysis core can be handled uniformly
analysisCoreActions.addAll(build.actions.findAll{it.class.name =~ "hudson.plugins.checkstyle.CheckStyle.*ResultAction"})
@linjunpop
linjunpop / README.md
Created October 29, 2012 06:34
Git basic

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