Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Coding

Jorge del Casar jorgecasar

👨‍💻
Coding
View GitHub Profile
@jorgecasar
jorgecasar / push-manifest-to-firebase.js
Last active Nov 13, 2018
Include Server Push headers in firebase.json from push-manifest.json generated by Polymer Build
View push-manifest-to-firebase.js
#!/usr/bin/env node
const fs = require("fs");
const path = require("path");
const util = require('util');
const readFile = util.promisify(fs.readFile);
const writeFile = util.promisify(fs.writeFile);
function throwError(err) {
throw err;
@jorgecasar
jorgecasar / localStorageFallback.js
Created Aug 26, 2014
It's an Angular Factory with $fakeStorage fallback. LocalStorage is not working in Safari, then we create a session storage in a local variable. Take care about the data you save on it, remember that it's a local variable.
View localStorageFallback.js
angular.module('myApp.factories', [])
.factory('$fakeStorage', [
function(){
function FakeStorage() {};
FakeStorage.prototype.setItem = function (key, value) {
this[key] = value;
};
FakeStorage.prototype.getItem = function (key) {
return typeof this[key] == 'undefined' ? null : this[key];
}