Skip to content

Instantly share code, notes, and snippets.

View vinicius73's full-sized avatar
🤓
"Those who cannot acknowledge themselves, will eventually fail."

Vinicius Reis vinicius73

🤓
"Those who cannot acknowledge themselves, will eventually fail."
View GitHub Profile
@vinicius73
vinicius73 / index.js
Last active September 21, 2018 22:23
$nextTickInSequence
import $nextTickInSequence from './next-tick-in-sequence'
export const install = Vue => {
Object.defineProperty(Vue.prototype, `$nextTickInSequence`, {
get: () => $nextTickInSequence
})
}
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];
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`,
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 21:20
Node + PostgreSQL
FROM node:8.9-alpine
RUN npm install --global yarn && \
yarn global add pm2 && \
yarn
const { curry } = require('ramda')
const { readdirSync, readFileSync } = require('fs')
const path = require('path')
const isGraphQLFile = fileName => fileName.endsWith('.graphql')
const readFile = curry((dirname, fileName) => readFileSync(path.join(dirname, fileName), 'utf8'))
/**
* @method loadGraphQLFiles
* @param {String} dirname
---
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
network_mode: host
environment:
ZOOKEEPER_CLIENT_PORT: 32181
ZOOKEEPER_TICK_TIME: 2000
extra_hosts:
@vinicius73
vinicius73 / Makefile
Created March 18, 2018 00:18
GoLang Makefile project
GOBIN=$(shell pwd)/bin
PROD_VERSION=$(shell cat ./VERSION)
BUILD_DIR=$(shell pwd)
SRC_DIR=$(BUILD_DIR)/src
GONAME=$(shell basename "$(PWD)")
BINFILE=${GOBIN}/${GONAME}
GOFILES=.
PID=/tmp/go-$(GONAME).pid
GOARCH = amd64
@vinicius73
vinicius73 / docker-compose.yml
Created March 18, 2018 00:11
Kafika Docker Compose
---
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
network_mode: host
environment:
ZOOKEEPER_CLIENT_PORT: 32181
ZOOKEEPER_TICK_TIME: 2000
extra_hosts:
@vinicius73
vinicius73 / Makefile
Created March 14, 2018 14:28
npm release makefile
LIB = $(SRC:src/%.js=lib/%.js)
build: $(LIB)
define release
VERSION=`node -pe "require('./package.json').version"` && \
NEXT_VERSION=`node -pe "require('semver').inc(\"$$VERSION\", '$(1)')"` && \
node -e "\
var j = require('./package.json');\
j.version = \"$$NEXT_VERSION\";\