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 download = require('image-downloader') | |
const puppeteer = require('puppeteer') | |
const $ = require('cheerio'); | |
const saveImage = (urlVar, callback) => { | |
puppeteer | |
.launch() | |
.then(function(browser) { | |
return browser.newPage(); | |
}) |
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
var fs = require('fs'); | |
var spawn = require('child_process').spawn; | |
var wstream = fs.createWriteStream('dumpfilename.sql'); //Name of SQL dump file | |
var mysqldump = spawn('mysqldump', [ | |
'-u', | |
'DB_USER', | |
'-p DB_PASSWORD', | |
'DB_NAME' | |
]); |
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
var axios = require('axios'); | |
var qs = require('qs'); | |
exports.getAccessToken = (code) => { | |
var data = qs.stringify({ | |
'client_id': '', | |
'client_secret': '', | |
'grant_type': 'authorization_code', | |
'code': code, | |
'redirect_uri': '', |
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 axios = require("axios"); | |
exports.handler = async event => { | |
try { | |
let username = "" // Your Github Username | |
let repos = await axios({ | |
method: "GET", | |
url: `https://api.github.com/users/${username}/repos` | |
}).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
const { mongo } = require("./mongo"); | |
const db = mongo.db; | |
// collection - The name of the collection to perform operation on | |
// body - req.body or an object with data to insert/update in a table | |
// query - Filter to find document in the table i.e { username: "DMDBOI" } | |
const database = { | |
create: async function (collection, body) { | |
let document = await db |
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
//If you're reading this, say hi on Twitter @dmdboi | |
async function getData(url) { | |
// Default options are marked with * | |
const response = await fetch(url, { | |
method: "GET", // *GET, POST, PUT, DELETE, etc. | |
mode: "cors", // no-cors, *cors, same-origin | |
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached | |
headers: { | |
"Content-Type": "application/json" | |
}, |
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 axios = require("axios") | |
//An array of Discord Embeds. | |
let embeds = [ | |
{ | |
title: "Discord Webhook Example", | |
color: 5174599, | |
footer: { | |
text: `📅 ${date}`, | |
}, |
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 axios = require('axios') | |
const fs = require('fs'); | |
const start = async (number) => { | |
for (let num = 0; num < 10; num++) { | |
let posts = [] | |
for (let index = 0; index < number; index++) { | |
let comic = (num * number) + index + 1 | |
console.log(comic) |
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
// This script reads all pages in a Notion DB and saves them as Markdown files ready for Nuxt/Content. | |
// You will need a Notion Integration key to make the Client() work and the ID of the database yo want to save. | |
// Run this from the root dir of your Nuxt project. | |
const fs = require('fs-extra'); | |
const { Client } = require("@notionhq/client"); | |
const { NotionToMarkdown } = require("notion-to-md"); | |
const notionAuth = "" |
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 type { HttpContextContract } from "@ioc:Adonis/Core/HttpContext"; | |
import { default as Log } from "@ioc:Adonis/Core/Logger"; | |
export default class Logger { | |
public async handle(ctx: HttpContextContract, next: () => Promise<void>) { | |
Log.info(`[ ${ctx.request.method()} ] ${ctx.request.url()}`); | |
await next(); | |
} | |
} |
OlderNewer