Skip to content

Instantly share code, notes, and snippets.

View purdrew's full-sized avatar

Drew Walters purdrew

View GitHub Profile
Description Function (Bytes) Class (Bytes) Difference (Bytes)
Stateless 96 276 180
State 224 483 259
Render Optimized 297 542 245
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>
<body>
<script src="bundle.js"></script>
</body>
</html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Test Bug</title>
</head>
<body>
<script src="bundle.js"></script>
</body>
</html>
@purdrew
purdrew / helloCordova.html
Created May 29, 2012 19:05
Hello World Cordova
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" id="viewport" content="width=device-width,height=device-height,initial-scale=1.0,user-scalable=no">
<script type="text/javascript" src="cordova-1.8.0.js"></script>
<script type="text/javascript">
function deviceInfo() {
console.log('Cordova initialized');
document.getElementById('hello.cordova').innerHTML = 'Hello world from Cordova ' + device.cordova;
#!/bin/sh
COD_FILE='Z:\\Work\\Eclipse\\WSPhoneGap\\sample\\build\\StandardInstall\\CordovaSample.cod.pending'
SIMULATORS="/cygdrive/c/BBWW/simpack"
SIMVER='7.0.0.318'
SIMPATH="$SIMULATORS/$SIMVER"
$SIMPATH/fledgecontroller.exe "/execute=LoadCod($COD_FILE)"
$SIMPATH/fledgecontroller.exe '/execute=LoadCod("updates.force")'
@purdrew
purdrew / cordova_proxy.js
Created February 23, 2012 14:28
Cordova proxy definitions. Used when implementation is defined in JS as opposed to native.
proxies: {
Contacts: {
actions: {
search: {
path: 'cordova/proxies/blackberry/contact_search'
},
save: {
path: 'cordova/proxies/blackberry/contact_save'
}
}
@purdrew
purdrew / network.html
Created January 11, 2012 15:16
Simple example showing how to use network API
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" id="viewport" content="width=device-width,height=device-height,initial-scale=1.0,user-scalable=no">
<script src="json2.js" type="text/javascript"></script>
<script src="phonegap.js" type="text/javascript"></script>
<script type="text/javascript">
// invoked when device is ready
@purdrew
purdrew / file_cr_rm.html
Created January 10, 2012 20:15
Example of using the File API to create/remove a file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" id="viewport" content="width=device-width,height=device-height,initial-scale=1.0,user-scalable=no">
<script src="json2.js" type="text/javascript"></script>
<script src="phonegap.js" type="text/javascript"></script>
<script type="text/javascript">
// invoked when device is ready
@purdrew
purdrew / bb_camera_permrequest.java
Created December 15, 2011 15:58
Request PERMISSION_INPUT_SIMULATION
private void checkPermissions() {
// Capture the current state of permissions and check against the requirements.
ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
ApplicationPermissions original = apm.getApplicationPermissions();
if (original.getPermission(ApplicationPermissions.PERMISSION_INPUT_SIMULATION) ==
ApplicationPermissions.VALUE_DENY) {
apm.addReasonProvider(ApplicationDescriptor.currentApplicationDescriptor(), new ReasonProvider() {
public String getMessage(int i) {
String msg = "I need the permissions in order to work properly.";