I hereby claim:
- I am leandrodelimac on github.
- I am leandrodelimac (https://keybase.io/leandrodelimac) on keybase.
- I have a public key ASDLQC_VNwlvdwlL4NKU6ZBS8iGxo3axWl-HNRk-gFa63Qo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
function randomDate(start, end) { | |
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime())); | |
} | |
console.log(randomDate(new Date(2012, 0, 1), new Date())); |
export const sortList = ( list, field_default, field = field_default, order = 'a_z' ) => { | |
list.sort(comparator(field, order)); | |
}; | |
const comparator = (field, order) => { | |
return (a, b) => { | |
const comparation_table = { | |
a_z: a[field] == b[field] ? 0 : a[field] < b[field] ? -1 : 1, | |
z_a: a[field] == b[field] ? 0 : a[field] > b[field] ? -1 : 1, | |
}; |
/* | |
* Returns a "state" reactive object, that contains the following properties | |
* result: Result from promise if there's any | |
* error: Error from promise if there's any | |
* isLoading: Boolean that signals if our promise is Loading or not | |
* retry_attempts: Tracks how many retries we already did | |
* | |
* And the following method | |
* retry: Will automatically retry our promise and reasign all values | |
*/ |
import snackBarComponent from '@/components/global/snackBar'; | |
const snackBarPlugin = { | |
install: (Vue, options = {}) => { | |
let isHolderCreated = false; | |
const idName = 'snackbar', | |
ToastConstructor = Vue.extend(snackBarComponent); | |
const createHolder = () => { | |
let holder = document.createElement('div') |
<script> | |
import Driver from 'driver.js'; | |
import 'driver.js/dist/driver.min.css'; | |
import { steps } from './steps'; | |
export default { | |
computed: { | |
driver() { | |
return new Driver({ |
interface Observer { | |
update: () => void; | |
} | |
interface Subject { | |
subscribe: (observer: Observer) => void, | |
unsubscribe: (observer: Observer) => void, | |
notify: () => void, | |
} |
// Constructors | |
// Be careful when using | |
// Constructor pattern | |
function C() { | |
this.instanceMember = 'Whoops!!' | |
} | |
const c = C() // Forgot 'new' |
// Comportamental - Como os objetos dependentes se mantem atualizados | |
interface Observer { | |
update: () => void | |
} | |
interface Subject { | |
attach: (observer: Observer) => void, | |
detach: (observer: Observer) => void, | |
notify: () => void, |
{ | |
"presets": [ | |
"@babel/preset-env" | |
], | |
"plugins": [ | |
[ | |
"@babel/plugin-proposal-decorators", | |
{ | |
"legacy": true | |
} |