Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rvanzon's full-sized avatar

Richard van Zon rvanzon

View GitHub Profile
@rvanzon
rvanzon / f7hotreload.js
Last active March 22, 2019 10:19
Framework 7 backdrop remover and reopener when used with hot reload (HRM)
export default function ($f7, reopenPopup = true) {
if (module.hot) {
module.hot.addStatusHandler(status => {
if (status === 'idle') {
const activePopup = document.querySelector('.modal-in')
// next tick
setTimeout(() => {
// remove all popup backdrops if all popups are closed
if (!document.querySelectorAll('.modal-in').length) {
@rvanzon
rvanzon / README.md
Last active December 2, 2018 13:52
Ubuntu 18.x - server basic install

Install a basic Ubuntu server

Version 0.1

It does:

  • Changes the port of the SSH server.
  • Adds an admin user.
  • Adds the user to SUDO-ers and disables the need of a password.
  • Adds that SSH-port to UFW and enables it.
@rvanzon
rvanzon / readme.md
Last active November 8, 2017 21:08
Using Framework7-Vue from GitHub (instead of NPM)
  1. create a directory to place the framework.
  2. clone the repository git clone https://github.com/nolimits4web/Framework7-Vue
  3. cd Framework7-Vue
  4. npm install
  5. npm run dist
  6. go to your project and remove the Framework7-Vue: npm remove Framework7-Vue
  7. link the new package you just build: npm link <path to Framework7-Vue>

That's it!

@rvanzon
rvanzon / nuxt.config.js
Last active September 1, 2022 13:25
A way to use vue-chartjs as a plugin of Nuxt.js
// just an example. A cleaner way is to wrap the showLine-stuff in a dedicated component
<template>
<div>
<my-line v-if="showLine" :data="lineData" :options="options">
</div>
</template>
<script>
export default {
data () {
@rvanzon
rvanzon / 0_reuse_code.js
Created May 2, 2017 07:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rvanzon
rvanzon / readme.md
Last active September 9, 2021 17:22
Nuxt.js: reduce the number of chunks

To reduce the number of chunks of your project build with Nuxt.js add the next lines:

  if (!this.dev) {
    config.plugins.push(new webpack.optimize.LimitChunkCountPlugin({
      maxChunks: 3        
    }))
  }

right under extend (config, ctx) { of nuxt.config.js. Then build your project with npm run build. Et voilà, No more than 3 chunks :-)

@rvanzon
rvanzon / http.js
Created April 11, 2016 15:48
Sails - add a static client (/public)
/**
* HTTP Server Settings
* (sails.config.http)
*
* Configuration for the underlying HTTP server in Sails.
* Only applies to HTTP requests (not WebSockets)
*
* For more information on configuration, check out:
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.http.html
*/
@rvanzon
rvanzon / autoreload.js
Created April 11, 2016 14:17
Sails - autoreload.js
// config/autoreload.js
module.exports.autoreload = {
active: true,
usePolling: false,
dirs: [
"api/models",
"api/controllers",
"api/services",
"config/locales"
],
@rvanzon
rvanzon / compileAssets.js
Last active April 11, 2016 14:37
Sails - add Stylus-support
// tasks/register/compileAssets.js
module.exports = function (grunt) {
grunt.registerTask('compileAssets', [
'clean:dev',
'jst:dev',
'less:dev',
'copy:dev',
'coffee:dev',
'stylus:dev'
]);
@rvanzon
rvanzon / bootstrap.js
Last active June 26, 2018 20:08
ES6 setup for MelonJS (using Webpack)
import game from './game';
import PlayerEntity from './entities/player';
import PlayScreen from './screens/play';
import TitleScreen from './screens/title';
class Bootstrap {
constructor() {
// Initialize the video.