Skip to content

Instantly share code, notes, and snippets.

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

Wilson junior wjuniorw

🏠
Working from home
View GitHub Profile
@wjuniorw
wjuniorw / cpf_validator_fp.js
Created November 20, 2024 23:36
validate CPF with functional programing paradigm in javascript
const clearCPF = cpf => cpf.replace(/\D/g, '')
const validLength = cpf => cpf.length === 11
const redundant = cpf => cpf.split('').every(x => x === cpf[0])
const restOrZero = amount => (amount === 10 || amount === 11) ? 0 : amount
const calculateDigits = cpf => {
const numsStr = cpf.split('')
const arrNums = Array.from(numsStr, n => +n)
const nineDigits = arrNums.slice(0,9)
const tenDigits = arrNums.slice(0,10)
@philipecampos
philipecampos / relogio-ubuntu.md
Created June 10, 2021 10:45
Como exibir dia da semana no relógio do ubuntu
  1. Instale o seguinte pacote
sudo apt-get install dconf-editor
  1. Inicie o programa "super" + dconf-editor

  2. Pesquise por weekday

@wjuniorw
wjuniorw / a_good_git_flow.md
Last active March 8, 2021 01:11
a good git flow implementation

A good git flow implementations:

  • Three principal branches : main,dev,qa

  • these three are locked to push

flows:

  • feature, improvement or fix:

    • checkout and pull on main branch

      • git checkout main

  • git pull origin main

@andrebrait
andrebrait / keychron_linux.md
Last active February 13, 2026 10:19
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

@simenbrekken
simenbrekken / schema.js
Created December 21, 2016 14:06
Firebase backed GraphQL schema
import firebase from 'firebase'
import { filter, map } from 'lodash'
import { makeExecutableSchema } from 'graphql-tools'
firebase.initializeApp({
databaseURL: 'https://grafire-b1b6e.firebaseio.com',
})
const mapSnapshotToEntity = snapshot => ({ id: snapshot.key, ...snapshot.val() })
const mapSnapshotToEntities = snapshot => map(snapshot.val(), (value, id) => ({ id, ...value }))
@suissa
suissa / routes-api.js
Created June 3, 2015 22:45
Meu arquivo que gera rotas automaticamente para o Express a partir de um JSON
var express = require('express')
, router = express.Router()
, Controller = require('./../controller')
;
var cbCreate = function(req, res) {
Controller.create(req, res);
}
, cbRetrieve = function(req, res) {
Controller.retrieve(req, res);