Skip to content

Instantly share code, notes, and snippets.

View FullZero5's full-sized avatar
🏠
Working from home

@FullZero FullZero5

🏠
Working from home
View GitHub Profile
@ireade
ireade / sw.js
Last active October 7, 2023 20:56
Handle broken images with the service worker
self.addEventListener('install', (e) => {
e.waitUntil(
caches.open("precache").then((cache) => cache.add("/broken.png"))
);
});
function isImage(fetchRequest) {
return fetchRequest.method === "GET" && fetchRequest.destination === "image";
}
@rayfranco
rayfranco / README.md
Last active June 1, 2021 07:49
Inline SVG with Nuxt

Inline SVG with Nuxt

I was looking for a SSR and scoped styles ready solution to implement inline SVG with Nuxt

You need svg-inline-loader and xmldom to be installed.

@Tuarisa
Tuarisa / nuxt-axios-cache.js
Last active October 3, 2021 21:28
Nuxt axios cache plugin
import hash from 'object-hash'
import sizeof from 'object-sizeof'
import lruCache from 'lru-cache'
const cacheEnabled = true
const cacheMaxAge = 30 * 60 * 1000
const cacheMaxSize = 128 * 1000 * 1000
const getCacheKey = obj => hash(obj)
@benmccallum
benmccallum / _Instructions.md
Last active July 25, 2021 03:35
nuxtjs, bootstrap-vue with custom bootstrap build

Important! This guide is out of date (circa 2017) and should no longer be used. For the latest advice, please refer to the BootstrapVue docs and their Nuxt.js module. https://bootstrap-vue.org/docs#nuxt-js

General setup:

  1. Install bootstrap as a dev dependency, and its dependencies (node-sass and sass-loader) npm install --save-dev bootstrap@4.0.0-beta.2 node-sass sass-loader
@daliborgogic
daliborgogic / ga.js
Last active June 25, 2019 17:40
Google Analytics for Nuxt.js 678bytes
export default ({ app }) => {
if (process.env.NODE_ENV !== 'production') return
const KEY = 'ga:user'
const UID = (localStorage[KEY] = localStorage[KEY] || Math.random() + '.' + Math.random())
function encode(obj) {
let k
let str = 'https://www.google-analytics.com/collect?v=1'
for (k in obj) {
// store/index.js
const createStore = () => {
return new Vuex.Store({
state: {
counter: 0,
repos: []
},
actions: {
LOAD_REPOS: function({ commit }) {
axios.get('url').then((res) => {
@artemsky
artemsky / upgrade.sh
Last active November 6, 2020 16:48
PHP 7.2 Cloud9
sudo apt-get install python-software-properties -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -y
sudo apt-get install php7.2 php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml
sudo apt-get install libapache2-mod-php7.2 -y
sudo a2dismod php5
sudo a2enmod php7.2
sudo service apache2 restart
@jmdobry
jmdobry / app.js
Last active May 16, 2018 18:16
js-data + js-data-firebase + js-data-localstorage
var fb = new DSFirebaseAdapter({
basePath: 'https://my-app.firebase.io'
});
var ls = new DSLocalStorageAdapter();
var store = new JSData.DS({
// try firebase first, otherwise try offline data
fallbackAdapters: ['fb', 'ls'],
// After creating an item, sync it to localStorage
@erickoledadevrel
erickoledadevrel / SendDocument.js
Last active November 30, 2022 12:57
Send a Google Doc in an email using Apps Script
/**
* Sends an email using the contents of a Google Document as the body.
*/
function sendDocument(documentId, recipient, subject) {
var html = convertToHtml(documentId);
html = inlineCss(html);
GmailApp.sendEmail(recipient, subject, null, {
htmlBody: html
});
}