Skip to content

Instantly share code, notes, and snippets.

View cristoferdomingues's full-sized avatar

Cristofer Domingues cristoferdomingues

  • Florianópolis, Brazil
View GitHub Profile
@cristoferdomingues
cristoferdomingues / objectSpreed.js
Created March 5, 2018 13:45
Object spreed merged Example
getDadosDefaultApr (nmInterface, { ...extraParams }) {
this._vm.$info('getDadosDefaultApr -- http request', { params: { method: 'executar', interface: this.nmInterface, ...extraParams }})
return this.HTTP.get('defaultAprFW.rest', { params: { method: 'executar', interface: this.nmInterface, ...extraParams }})
}
@cristoferdomingues
cristoferdomingues / App.vue
Last active April 24, 2018 20:18 — forked from lmiller1990/App.vue
Vuex pattern to handle ajax
<template>
<div id="app">
<p>
Pending: {{ $store.state.getInfoPending }}
</p>
<p>
{{ $store.state.getInfoData }}
</p>
</div>
</template>
@cristoferdomingues
cristoferdomingues / cpf_cnpj_validator
Created March 16, 2018 20:17 — forked from igorcosta/cpf_cnpj_validator
Regex para validar CPF e CNPJ
Para CPF
/^\d{3}\.\d{3}\.\d{3}\-\d{2}$/
Para CNPJ
/^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/
Para ambos ao mesmo tempo
@cristoferdomingues
cristoferdomingues / ChildComponent.vue
Created March 27, 2018 20:14 — forked from sproogen/ChildComponent.vue
Vee Validate - Child Component Example
<template>
<div>
<input v-validate data-rules="required" :class="{'has-error': errors.has("textInput")}" id="textInput" name="textInput" type="text">
<span class="error" v-show="errors.has("textInput")">{{ errors.first("textInput") }}</span>
</div>
</template>
<script>
import { find, propEq } from 'ramda'
import bus from './bus'
@cristoferdomingues
cristoferdomingues / fb-fan-export.js
Created May 4, 2018 11:24 — forked from adamloving/fb-fan-export.js
Export Facebook Page Fans
/*
For more detailed instructions on how to use this script, sign up with your email here:
http://adamloving.com/internet-programming/how-toexport-facebook-page-fans
DISCLOSURE: This javascript runs in your browser pretending to be you
looking through your page fans. Facebook should have no problem with this,
but who knows if they will think it is strange to see you looking through
all your fans so quickly (the script waits 3s before requesting each page).
I've had no problem running this so far for 1000s of page fans, but I
@cristoferdomingues
cristoferdomingues / DataTable.ts
Created June 27, 2018 02:07 — forked from cschmidli/DataTable.ts
Semantic UI Data Table Component
import * as React from 'react';
import * as hash from 'object-hash';
import {
TableProps,
Table,
TableBody,
TableCell,
TableFooter,
TableHeaderCell,
@cristoferdomingues
cristoferdomingues / ObjectToArray
Created July 10, 2018 14:32
Function which creates an Array from an Object
const arrayToObject = (obj) => Array.from(Object.keys(obj), k => obj[k]);
@cristoferdomingues
cristoferdomingues / exemple.vue
Created September 13, 2018 20:49
vue computed setter e getter
<template>
<v-date-picker v-model="formattedDate">
</template>
<script>
export default {
data: function () {
return { date: '2018-MAY-09T12:00:00' }
},
computed: {
formattedDate: {
@cristoferdomingues
cristoferdomingues / attributesByString.js
Created November 19, 2018 16:20
Get atributes from object by string
Object.byString = function(o, s) {
s = s.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
s = s.replace(/^\./, ''); // strip a leading dot
var a = s.split('.');
for (var i = 0, n = a.length; i < n; ++i) {
var k = a[i];
if (k in o) {
o = o[k];
} else {
return;
@cristoferdomingues
cristoferdomingues / multiFilter.js
Created December 3, 2018 21:21 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple criteria.
/**
* Filters an array of objects with multiple criteria.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria as the property names
* @return {Array}
*/
function multiFilter(array, filters) {
const filterKeys = Object.keys(filters);
// filters all elements passing the criteria