Skip to content

Instantly share code, notes, and snippets.

🤓
"Those who cannot acknowledge themselves, will eventually fail."

Vinicius Reis vinicius73

🤓
"Those who cannot acknowledge themselves, will eventually fail."
Block or report user

Report or block vinicius73

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vinicius73
vinicius73 / Dockerfile
Last active Aug 15, 2019
Node project with PM2 and Docker
View Dockerfile
FROM node:10.15-alpine as base
RUN apk --no-cache --virtual build-dependencies add \
python \
make \
g++ \
&& rm -f /var/cache/apk/* \
&& npm config set unsafe-perm true \
&& npm install --quiet node-gyp -g --cache /tmp/empty-cache
@vinicius73
vinicius73 / main.js
Created Feb 19, 2019
Vuex Route Guard DEMO
View main.js
import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import plugins from './plugins';
plugins({
router, store, Vue,
});
View senadores-a-favor-aumento-stf.md
View state-to-url-index.js
import { isEmpty } from 'lodash'
import { makeWatch, makeCallback, parseDump } from './utils'
const extractDump = context => {
const dump = context.$route.query.dump
return dump
? parseDump(dump)
: {}
}
View on-idle-helpers.js
import { PromisePipeFactory } from './p-pipe'
import { isFunction, isArray } from 'lodash'
const w = window
/**
* @type Function
* @param {Function}
* @returns {void}
*/
const subscribe = (() => {
@vinicius73
vinicius73 / index.js
Last active Sep 21, 2018
$nextTickInSequence
View index.js
import $nextTickInSequence from './next-tick-in-sequence'
export const install = Vue => {
Object.defineProperty(Vue.prototype, `$nextTickInSequence`, {
get: () => $nextTickInSequence
})
}
View notificationclick.js
self.addEventListener('notificationclick', function(e) {
// Android doesn't automatically close notifications on click
e.notification.close();
// Focus tab if open
e.waitUntil(clients.matchAll({
type: 'window'
}).then(function(clientList) {
for (var i = 0; i < clientList.length; ++i) {
var client = clientList[i];
View component-debug-mixin.js
function formatTime (timeInMs) {
let date = new Date(timeInMs)
// ${date.getDate()}/${date.getMonth()}/${date.getFullYear()}
return `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}.${date.getMilliseconds()}`
}
function log (type, ...args) {
if (this.$options.debug) {
console[type](`%c[${this.$_id}]${formatTime(Date.now())}>> `,
`background:${type === 'log' ? '#384A5E' : type === 'warn' ? '#F1BF39' : '#FF5370'}; padding: 3px; border-radius: 3px; color: #fff`,
View log-pretty-version.js
const appName = 'App Web'
const companyName = 'D6'
const version = '1.0.0'
const hasSw = (navigator.serviceWorker && navigator.serviceWorker.controller)
const mode = (window.matchMedia('(display-mode: standalone)').matches)
? 'standalone'
: 'web'
const sw = hasSw
? 'sw-on'
@vinicius73
vinicius73 / Dockerfile
Last active May 11, 2018
Node + PostgreSQL
View Dockerfile
FROM node:8.9-alpine
RUN npm install --global yarn && \
yarn global add pm2 && \
yarn
You can’t perform that action at this time.