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
module.exports = function (app) { | |
return async (req, res, next) => { | |
const { | |
files | |
} = req; | |
const fileRes = []; | |
const seq = app.get('sequelizeClient'); | |
const { media } = seq.models; | |
for (const file of files) { |
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
// eslint-disable-next-line no-unused-vars | |
module.exports = function(options = {}) { | |
// Return the actual hook. | |
return async context => { | |
// relationRecords are array of data | |
// e.g: Array<Comments> || Array<Likes> which sequelize will not handle in a patch request | |
const { id, data: { relationRecords } } = context; | |
const service1 = context.app.service('relation1Service'); | |
await removeOldData(service1, +id); | |
await addNewData(service1, +id, relationRecords); |
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
import { Injectable } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
import { isNull } from 'util'; | |
interface QueryParams { | |
[key: string]: string | number; | |
} | |
export interface Post { |
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 mysql = require('mysql'); | |
const MySQLEvents = require('@rodrigogs/mysql-events'); | |
const ora = require('ora'); // cool spinner | |
const spinner = ora({ | |
text: '🛸 Waiting for database events... 🛸', | |
color: 'blue', | |
spinner: 'dots2' | |
}); | |
const program = async () => { |
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 getById = (id) => { | |
console.log('get') | |
return document.getElementById(id) | |
} | |
// IIFE | |
setInterval( | |
(() => { | |
const h1 = getById('display-number') | |
const { floor, random } = Math | |
return () => { |
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 { series, parallel, src, dest } = require('gulp') | |
const { sync } = require('glob') | |
const sass = require('gulp-sass') | |
const { join } = require('path') | |
const cleanCSS = require('gulp-clean-css') | |
const babel = require('gulp-babel') | |
const uglify = require('gulp-uglify') | |
sass.compiler = require('node-sass') | |
const path = join(__dirname, 'src') |
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
from functools import reduce | |
def func01(name): return f'{name}-func01' | |
def func02(name): return f'{name}-func02' | |
def func03(name): return f'{name}-func03' | |
def func04(name): return f'{name}-func04' | |
def func05(name): return f'{name}-func05' | |
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 func01 = (name) => `${name}-func01` | |
const func02 = (name) => `${name}-func02` | |
const func03 = (name) => `${name}-func03` | |
const func04 = (name) => `${name}-func04` | |
const func05 = (name) => `${name}-func05` | |
const result = func01(func02(func03(func04(func05('rowadz'))))) | |
console.log(result) |
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
import { | |
createSlice, | |
createEntityAdapter, | |
createAsyncThunk, | |
} from '@reduxjs/toolkit' | |
export const fetchData = createAsyncThunk( | |
'users/fetchData', | |
async (_, { dispatch }) => { | |
const data = await fetch('http://localhost:3001/users').then((res) => |
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
import React, { useState } from 'react' | |
import ReactDOM from 'react-dom' | |
import { Button } from 'rsuite' | |
import 'rsuite/dist/styles/rsuite-dark.css' | |
import { generate } from 'shortid' | |
import User from './User' | |
import Viewer from './Viewer' | |
const App = () => { | |
const [users, setUsers] = useState([ |