Skip to content

Instantly share code, notes, and snippets.

View fabriciofmsilva's full-sized avatar

Fabrício Silva fabriciofmsilva

View GitHub Profile
@fabriciofmsilva
fabriciofmsilva / uuid.js
Created October 26, 2017 00:31 — forked from jcxplorer/uuid.js
UUID v4 generator in JavaScript (RFC4122 compliant)
function uuid() {
var uuid = "", i, random;
for (i = 0; i < 32; i++) {
random = Math.random() * 16 | 0;
if (i == 8 || i == 12 || i == 16 || i == 20) {
uuid += "-"
}
uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
}
@fabriciofmsilva
fabriciofmsilva / README-Template.md
Created December 26, 2017 14:16 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@fabriciofmsilva
fabriciofmsilva / JavaScript Client Detection
Created December 29, 2017 18:14
JavaScript Client Detection
/**
* JavaScript Client Detection
* (C) viazenetti GmbH (Christian Ludwig)
*/
(function (window) {
{
var unknown = '-';
// screen
var screenSize = '';
@fabriciofmsilva
fabriciofmsilva / combining-objects.js
Created January 17, 2018 11:23
Creating a new object that's a combination of others object
// Creating a new object that's a combination of
// `state` and `changes` objects.
// Old JavaScript:
var newState = {};
[state, changes].forEach(function(obj) {
for (var propName in obj) {
if (obj.hasOwnProperty(propName)) {
newState[propName] = obj[propName];
}
#!groovy
pipeline {
agent any
// environment {
// git_commit_message = ''
// git_commit_diff = ''
// git_commit_author = ''
// git_commit_author_name = ''
// git_commit_author_email = ''
@fabriciofmsilva
fabriciofmsilva / 1-git.md
Last active October 9, 2019 16:14
Git Utils

git commands

Delete local branch

$ git branch -d <branch_name>
$ git branch -D <branch_name>

Delete server branch

@fabriciofmsilva
fabriciofmsilva / git-commit-prefixes.md
Last active May 3, 2018 14:27
git-commit-prefixes
[api]: New apis / changes to apis
[test]: Update test/* files
[dist]: Changes to submodules, version bumps, updates to package.json
[minor]: Small changes
[doc]: Updates to documentation
[ux]: Updates to UX
[fix]: Bug fixes
[bin]: Update binary scripts associated with the project
[merge]: Resolved git merge from upstream or otherwise
@fabriciofmsilva
fabriciofmsilva / rest-spread-object-properties-es2018.js
Last active February 6, 2018 20:39
Rest spread in object properties in ES2018
let { a, ...b } = { a: 'JS', x: 1, y: 2 };
a; // JS
b; // { x: 1, y: 2 }
let n = { a, ...b }
n; // { a: 'JS', x: 1, y: 2 }
@fabriciofmsilva
fabriciofmsilva / chrome-console.md
Last active February 6, 2018 20:37
Chrome’s Developer Console

1. Select DOM Elements

Find one element

$('<CSS_SELECTOR>');

Find all elements

@fabriciofmsilva
fabriciofmsilva / method-chaining.md
Created February 12, 2018 14:38
Method Chaining in an API that not allows that
// conexão criada com o banco antes
const store = 'books';
object = { name: 'Cangaceiro JavaScript', isbn: 9788594188014 };

const request = connection
    .transaction([store],"readwrite")
    .objectStore(store)
    .add(object);