Skip to content

Instantly share code, notes, and snippets.

View rpappalax's full-sized avatar

Richard Pappalardo rpappalax

View GitHub Profile
@rpappalax
rpappalax / length2.c
Created January 1, 2014 08:34
Determine the length of a message. Uses well-known idiom for determining end of line. source: http://knking.com/books/c2/programs/length2.c
// Determine the length of a message
#include <stdio.h>
int main(void)
{
int len = 0;
printf("Enter a message: ");
while (getchar() != '\n')
#!/usr/bin/env python
## merge.py -- Merge two sorted lists -*- Python -*-
## Time-stamp: "2009-01-21 14:02:57 ghoseb"
l1 = [1, 3, 4, 7]
l2 = [0, 2, 5, 6, 8, 9]
def merge_sorted_lists(l1, l2):
"""Merge sort two sorted lists
#!/bin/bash
if [ "$1" == "" ]; then
echo 'Pulls and pushes pref.js to your phone.'
echo 'Usage: ./modPref.sh [pull|push|catfxa|rmfxa]'
exit
fi
echo "Plug in your device"
adb wait-for-device
echo "Found device"
PROFILE=$(adb shell echo -n "/data/b2g/mozilla/*.default")
{ "acknowledged_risks" : true,
"skip_warning" : true,
"wifi": { "ssid": "Mozilla Guest" }
}
#!/usr/bin/env python
from marionette import Marionette
from gaiatest.apps.browser.app import Browser
# remember to 'adb forward tcp:2828 tcp:2828'
m = Marionette('localhost', 2828)
m.start_session()
browser = Browser(m)
browser.launch()
from marionette import Marionette
from gaiatest.apps.browser.app import Browser
m = Marionette('localhost', 2828)
m.start_session()
browser = Browser(m)
browser.launch()
browser.go_to_url('http://native.123done.org\n')
browser.switch_to_content()
#wait
btn = m.find_element('css selector', 'img[src*="persona-login"]')
from gaiatest import GaiaTestCase
import time
class TestIdentitySmoke(GaiaTestCase):
APP_NAME = 'UI tests'
_bid_tests_locator = ('link text', 'navigator.mozId tests')
_bid_iframe_locator = ('css selector', 'iframe[src*="identity"]')
def setUp(self):
gaiatest --testvars=/Users/Edwin/home.json --address=localhost:2828 test_persona_cookie.py
@rpappalax
rpappalax / marionette_js_switchToApp.js
Last active August 29, 2015 13:58
Marionette JS: switchToApp
/*
* Go to Email App from Calendar App
* http://evanxd.github.io/write-tests-with-marionette/#18
*/
// Go to Calendar App.
client.apps.launch(CALENDAR_APP_URL);
client.apps.switchToApp(CALENDAR_APP_URL);
// Go to System App.
client.switchToFrame();
@rpappalax
rpappalax / fxa_prefs.js
Created April 11, 2014 03:56
FxA prefs file
// FxA-related prefs from sam
user_pref("dom.identity.enabled", true);
user_pref("toolkit.identity.debug", true);
user_pref("dom.inter-app-communication-api.enabled", true);
user_pref("dom.identity.syntheticEventsOk", true);
// fxa is now preffed off by default
user_pref("identity.fxaccounts.ui.enabled", true);
// enable debugging of certified/system apps