This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//With locationbar.visible check if not in a webview (like an open web app) | |
if (locationbar.visible) { | |
//mozApps used for the open web app and with the user agent check if have MObile (used in Firefox OS) | |
if (navigator.userAgent.indexOf('Firefox') > -1 && navigator.userAgent.indexOf("Mobile") > -1) { | |
//Check Firefox OS | |
} else if (navigator.userAgent.indexOf('Firefox') > -1 && navigator.userAgent.indexOf("Android") > -1) { | |
//Check Firefox for Android | |
} else if (navigator.userAgent.indexOf("Firefox") > -1) { | |
//Check Firefox Desktop | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getVersion() { | |
if (navigator.userAgent.match(/(mobile|tablet)/i)) { | |
var ffVersionArray = (navigator.userAgent.match(/Firefox\/([\d]+\.[\w]?\.?[\w]+)/)); | |
if (ffVersionArray.length === 2) { | |
//Check with the gecko version the Firefox OS version | |
//Table https://developer.mozilla.org/en-US/docs/Gecko_user_agent_string_reference | |
var hashVersion = { | |
'18.0': '1.0.1', | |
'18.1': '1.1', | |
'26.0': '1.2', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Based on http://jsfiddle.net/i_like_robots/W2DA8/ | |
(function(name, context, definition) { | |
if (typeof define === 'function' && define.amd) { | |
define(definition); | |
} | |
else if (typeof module !== 'undefined' && module.exports) { | |
module.exports = definition(); | |
} | |
else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
It demonstrates how you can create your own API when using REST style | |
calls through the browser with CORS enabled. | |
Possible commands created in this shetch: | |
* "/arduino/digital/13" -> digitalRead(13) | |
* "/arduino/digital/13/1" -> digitalWrite(13, HIGH) | |
* "/arduino/analog/2/123" -> analogWrite(2, 123) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Download from https://bugzilla.mozilla.org/show_bug.cgi?id=926940 the development build with the WebSerial API | |
Screenshot: https://plus.google.com/u/0/+DanieleScasciafratteMte90Net/posts/EED6sbEt2zv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Dashboard Widget Activity Custom Post Type | |
Plugin URI: | |
Description: | |
Author: Daniele Mte90 Scasciafratte | |
Version: 1.0.0 | |
Author URI: http://mte90.net | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function table_from_array( $cols, $tableclass = 'info' ) { | |
$content = "<table class=\"" . $tableclass . "\">\n"; | |
$i = 1; | |
foreach ( $cols as $key => $value ) { | |
if ( !empty( $value ) ) { | |
$i++; | |
if ( $i % 2 === 0 ) { | |
$content .= "<tr>"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Error For WP backend | |
Plugin URI: https://github.com/Mte90/ | |
Description: Wrap the PHP errors in the WP admin backend with the native notice | |
Author: Mte90 | |
Version: 1.0.0 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function sortArrayByArray( $array, $orderArray ) { | |
$order = array(); | |
foreach ( array_keys( $array ) as $index ) { | |
foreach ( array_keys( $orderArray ) as $key ) { | |
$order[ $index ][ $key ] = $array[ $index ][ $key ]; | |
} | |
} | |
return $order; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Better errors | |
* Description: Better errors in log | |
* Author: Daniele Scasciafratte | |
* Version: 1.0 | |
* Author URI: http://codeat.co | |
*/ | |
function handleError($code, $description, $file = null, $line = null, $context = null) { |
OlderNewer