Skip to content

Instantly share code, notes, and snippets.

View Antoinebr's full-sized avatar
:octocat:
🔥

Antoinebr

:octocat:
🔥
View GitHub Profile
@Antoinebr
Antoinebr / os.md
Created August 8, 2018 10:32
OneSIgnal custom UI

One Signal

Create a custom subscription button

function subscribe() {
  OneSignal.push(["registerForPushNotifications"]);
function onPageRequest(req, res) {
res.writeHead(200, {
'Content-Type': 'application/json',
"Access-Control-Allow-Origin": "*"
});
res.end(JSON.stringify(
{
@Antoinebr
Antoinebr / node-jwt.md
Last active October 26, 2018 21:26
node-jwt.js
@Antoinebr
Antoinebr / pwa-defering-prompt.js
Created June 25, 2018 19:10
pwa-defering-prompt.js
/*
| --------------------------------------------------------------------------
| Defering prompt
| --------------------------------------------------------------------------
*/
let deferredPrompt;
window.addEventListener('beforeinstallprompt', event =>{
/*
| --------------------------------------------------------------------------
| Prerender the checkout page from the cart
| --------------------------------------------------------------------------
|
+*/
add_action( 'wp_head', function(){
global $woocommerce;
caches.open('my-pwa-demo')
var CACHE_NAME = "my-pwa-demo";
var CACHED_URLS = [
'/',
"index.html",
"app.js",
"app.css"
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 );
<?php
/*
| --------------------------------------------------------------------------
| DEFER on scripts
| function to add async and defer attributes
| --------------------------------------------------------------------------
*/
function defer_js_async($tag){
@Antoinebr
Antoinebr / moisture-sensor-espruino.js
Created April 16, 2018 22:45
Espruino moisture sensor
const wifi = require("Wifi");
const http = require("http");
wifi.setHostname("antoine-espruino-plant");
wifi.connect("SSID", {password:"Csdsddd**%%dddd"}, function(err){
@Antoinebr
Antoinebr / advanced-offline.md
Last active January 7, 2020 19:58
pwa-event-paris

Install workbox

npm install workbox-cli.

List your assets that will only change at build time