Skip to content

Instantly share code, notes, and snippets.

View privatenumber's full-sized avatar

Hiroki Osame privatenumber

View GitHub Profile
@privatenumber
privatenumber / requirejs.reload.js
Created July 7, 2016 06:11
Require.js "Watch" Implementation
var reload = (function () {
'use strict';
var cache = {};
var refresh = {};
var execCb = window.requirejs.s.contexts._.execCb;
window.requirejs.s.contexts._.execCb = function (name, callback) {
(function BFS(obj, lookingFor, maxFinds = 100, maxDuration = 3) {
console.log('Traversing', obj, 'to find', lookingFor);
let findCount = 0;
let timedOut = false;
let queue = [[obj, '']];
setTimeout(() => (timedOut = true), maxDuration * 1000);
@privatenumber
privatenumber / Navigation.md
Last active May 19, 2017 22:06
Navigation TAD

Navigation

<template>
	<o-navigation :links="links">

		<template slot="links" props="link">
			<nuxt-link :to="link.href">{{link.text}}</nuxt-link>
		</template>
@privatenumber
privatenumber / VueLifecycleTap.js
Created January 18, 2019 16:13
Vue lifecycle tap
window.VueLifecycleTap = ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeDestroy', 'destroyed'].reduce((agg, curr) => {
agg[curr] = function() {
console.log(`uid: ${this._uid} -`, curr);
};
return agg;
}, {});
@privatenumber
privatenumber / planets.json
Last active February 1, 2019 22:51
Planets Data for Orbit Demo
[
{
"planet": "Mercury",
"moons": 0,
"diameter": 4879,
"distanceFromSun": 57.9,
"icon": "https://img.icons8.com/color/48/000000/mercury-planet.png"
},
{
"planet": "Venus",
{
"version": "v3.28.0", // Latest release
"assets": [
{ "version": "v3.28.0" },
{ "version": "v3.27.7" },
{ "version": "v3.26.0" },
...
{ "version": "v2.13.1" },
{ "version": "v2.13.0" },
...
say "hellod";
say "bye bye3"
@privatenumber
privatenumber / video-toolkit.js
Last active April 22, 2020 20:39
video-toolkit.js
alert(2);
@privatenumber
privatenumber / increaseConsoleGroupIndent.js
Created April 24, 2020 04:52
Increase console.group indentation
const kGroupIndent = Object.getOwnPropertySymbols(console).find(s => s.description === 'kGroupIndent');
function increaseConsoleGroupIndent(increaseIndentBy = ' ') {
const { group, groupEnd } = console;
console.group = function () {
group.apply(this, arguments);
this[kGroupIndent] += increaseIndentBy;
};
console.groupEnd = function () {
groupEnd.apply(this, arguments);
console.log(window.helloworld);
window.helloworld = (window.helloworld || 0) + 1;