Skip to content

Instantly share code, notes, and snippets.

View antranapp's full-sized avatar

An Tran antranapp

View GitHub Profile

Making behat use phantomjs for the tests

If you want to run it on phantomjs (a headless browser) you can add this profile to your behat.yml and you need phantomjs >= 1.8.0

phantomjs:
    extensions:
        Behat\MinkExtension\Extension:
            base_url: http://dev.local
            goutte: ~
            selenium2:
 wd_host: "http://localhost:8643/wd/hub" 
<!doctype html>
<html>
<head>
<title>
</title>
<script src="http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js">
</script>
</head>
var shake = (function () {
var shake = {},
watchId = null,
options = { frequency: 300 },
previousAcceleration = { x: null, y: null, z: null },
shakeCallBack = null;
// Start watching the accelerometer for a shake gesture
shake.startWatch = function (onShake) {
shakeCallBack = onShake;
var shake = (function () {
var shake = {},
watchId = null,
options = { frequency: 300 },
previousAcceleration = { x: null, y: null, z: null },
shakeCallBack = null;
// Start watching the accelerometer for a shake gesture
shake.startWatch = function (onShake) {
shakeCallBack = onShake;
@antranapp
antranapp / gist:7263973
Created November 1, 2013 11:08
Tear down script for appium, phpunit integration to wait for the last session to be destroyed before starting a new one
public function tearDown() {
$count = 0;
$sessionId = $this->getSessionId();
while ($sessionId !== FALSE && $count < 5) {
printf("\n".$count." - ".$sessionId."\n");
parent::tearDown();
sleep(2);
$sessionId = $this->getSessionId();
$count++;
}
@antranapp
antranapp / icons
Last active August 29, 2015 14:18 — forked from brutella/icons
#! /bin/sh
function print_example() {
echo "Example"
echo " icons ios ~/AppIcon.png ~/Icons/"
}
function print_usage() {
echo "Usage"
echo " icons <ios|watch|all> in-file.png (out-dir)"
@antranapp
antranapp / gist:6b6676c246a95ddba915
Last active August 29, 2015 14:20
[iOS] [Swift] Get AppDelegate
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
@antranapp
antranapp / gist:439a0333730c08dffee8
Last active August 29, 2015 14:20
[iOS] Get current root view controller from appDelegate
if let currentViewController = self.window?.rootViewController {
// do something here
}
@antranapp
antranapp / gist:cbb6a97ced6b7f487ccf
Last active March 31, 2020 11:02
[iOS] Send notification from appdelegate to view controller
// App Delegate
NSNotificationCenter.defaultCenter().postNotificationName("EventNotification", object: nil, userInfo: ["data": "dummy"])
// View Controller
NSNotificationCenter.defaultCenter().addObserver(self, selector: "handleEventNotification", name: "EventNotification", object: nil)
@antranapp
antranapp / gist:79cd13c2991b8a4d8d9e
Created May 1, 2015 14:36
[iOS] Make status bar in iOS white
// set UIViewControllerBasedStatusBarAppearance to NO in the Info.plist
UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent