function subscribe() {
OneSignal.push(["registerForPushNotifications"]);
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 onPageRequest(req, res) { | |
res.writeHead(200, { | |
'Content-Type': 'application/json', | |
"Access-Control-Allow-Origin": "*" | |
}); | |
res.end(JSON.stringify( | |
{ |
Demo available : https://confused-stitch.glitch.me/
POST https://confused-stitch.glitch.me/api/login
POST (protected ) https://confused-stitch.glitch.me/api/ ( with correct headers )
var request = require("request");
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
/* | |
| -------------------------------------------------------------------------- | |
| Defering prompt | |
| -------------------------------------------------------------------------- | |
*/ | |
let deferredPrompt; | |
window.addEventListener('beforeinstallprompt', event =>{ |
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
/* | |
| -------------------------------------------------------------------------- | |
| Prerender the checkout page from the cart | |
| -------------------------------------------------------------------------- | |
| | |
+*/ | |
add_action( 'wp_head', function(){ | |
global $woocommerce; |
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
caches.open('my-pwa-demo') | |
var CACHE_NAME = "my-pwa-demo"; | |
var CACHED_URLS = [ | |
'/', | |
"index.html", | |
"app.js", | |
"app.css" |
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
const glob = require("glob") | |
const util = require('util'); | |
const exec = util.promisify(require('child_process').exec); | |
// Updte with your image path | |
const yourImagesPath = "/home/mobileui/app/wp-content/uploads/2018/01/*.jpg"; | |
glob(yourImagesPath, {}, function (er, files) { | |
if( er ) throw new Error( er ); |
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 | |
/* | |
| -------------------------------------------------------------------------- | |
| DEFER on scripts | |
| function to add async and defer attributes | |
| -------------------------------------------------------------------------- | |
*/ | |
function defer_js_async($tag){ |
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
const wifi = require("Wifi"); | |
const http = require("http"); | |
wifi.setHostname("antoine-espruino-plant"); | |
wifi.connect("SSID", {password:"Csdsddd**%%dddd"}, function(err){ |