Skip to content

Instantly share code, notes, and snippets.

View giolvani's full-sized avatar

Giolvani de Matos giolvani

  • Foz do Iguacu - PR
View GitHub Profile
@giolvani
giolvani / .env.sample
Last active September 2, 2023 19:34
Manual update from github (a dummy alternative to the github actions)
APPLICATION_URL=http://localhost
@giolvani
giolvani / getter.js
Created February 22, 2019 13:17
Vuex getter with parameter
getters: {
foo(state) {
return (bar) => {
return bar;
}
}
}
export default {
name: 'MyComponent',
@giolvani
giolvani / orderby.js
Last active January 17, 2019 19:34
Array helpers
// order by asc
itens.sort((a, b) => a.property - b.property);
// order by desc
itens.sort((a, b) => b.property - a.property);
@giolvani
giolvani / escape.js
Last active January 17, 2019 19:31
string helpers
const escape = input => input.replace(/[-[\]{}()*+!<=:?.\/\\^$|#\s,]/g, '\\$&');
// how to use
escape('.');
@giolvani
giolvani / numberSeparators.js
Created January 16, 2019 16:44
Get number separator by locale
function getNumberSeparators (locale) {
// defaults
var res = { "decimal": ".", "thousand": "" };
// convert a number formatted according to locale
var str = parseFloat(1234.56).toLocaleString(locale);
// if the resulting number does not contain previous number
// (i.e. in some Arabic formats), return defaults
if (!str.match("1"))
@giolvani
giolvani / encrypt.js
Created January 12, 2019 22:43
Caesar Cipher
function encrypt(input){
var alphabet = "abcdefghijklmnopqrstuvwxyz";
var fullAlphabet = alphabet + alphabet + alphabet;
var offset = 3;
offset = (offset % alphabet.length);
var result = '';
for(i=0; i < input.length; i++){
var letter = input[i];
var upper = (letter == letter.toUpperCase());

Keybase proof

I hereby claim:

  • I am giolvani on github.
  • I am giolvani (https://keybase.io/giolvani) on keybase.
  • I have a public key ASBCofCOoiBgza8Zr40qTeHSfL86vtRy_wYfvDNzm1nhVgo

To claim this, I am signing this object:

@giolvani
giolvani / component.js
Created September 26, 2018 19:27
using webcomponents
/*
import { LitElement, html } from 'https://unpkg.com/@polymer/lit-element/lit-element.js?module';
export default class ActionGroup extends LitElement {
static get properties() {
return {
}
}
@giolvani
giolvani / deploy.sh
Last active July 27, 2016 17:27
Script to update libs and pull code from git
#!/bin/bash
echo -e "\e[1;32mInit ssh agent\e[0m"
eval $(ssh-agent -s)
ssh-add ~/.ssh/rsa
echo -e "\e[1;32mGit pull\e[0m"
git pull
echo -e "\e[1;32mNpm update\e[0m"
npm update --production