This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const worker = require('./worker') | |
const data = { | |
// ... | |
} | |
worker.enqueue('send-reports', data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const worker = require('./worker') | |
async function main() { | |
let count = 0 | |
const interval = setInterval(() => { | |
worker.enqueue('jobExample', { | |
message: `Hello from worker ${++count}!` | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shuffleArray(array) { | |
let currentIndex = array.length | |
let temporaryValue, randomIndex | |
while (currentIndex !== 0) { | |
randomIndex = Math.floor(Math.random() * currentIndex) | |
currentIndex-- | |
temporaryValue = array[currentIndex] | |
array[currentIndex] = array[randomIndex] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function findDocumentIndex({ _id, collection, conditions, sort }) => { | |
const data = await db.collection(collection).aggregate([{ | |
$match: conditions | |
}, { | |
$sort: sort | |
}, { | |
$group: { | |
_id: null, | |
positions: { | |
$push: "$_id" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { parse } = require('rss-to-json') | |
async function fetchPosts() { | |
const rss = await parse('http://rss.uol.com.br/feed/economia.xml') | |
return rss.items | |
} | |
fetchPosts() | |
.then(posts => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Support; | |
use Illuminate\Contracts\Bus\Dispatcher; | |
use Illuminate\Support\Facades\Redis; | |
class DelayedJob | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Validator { | |
constructor(data, rules) { | |
this.data = data | |
this.rules = rules | |
this.errors = {} | |
} | |
get validations() { | |
return { | |
required(field) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { setContext } from 'svelte'; | |
export let multiple = false | |
export let header = true | |
const items = new Set() | |
setContext('accordion', { | |
getMultiple: () => multiple, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="accordion-group"> | |
<slot /> | |
</div> | |
</template> | |
<script> | |
export default { | |
name: 'AccordionGroup', | |
props: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<style> | |
* { | |
margin: 0; | |
padding: 0; |
NewerOlder