TLDR: Use for...of
instead of forEach()
in asynchronous code.
For legacy browsers, use for...i
or [].reduce()
To execute the promises in parallel, use Promise.all([].map(...))
--- | |
// NoJS Astro + TailwindCSS Gallery with Lightbox Zoom | |
// Usage: | |
// <Gallery | |
// gallery="Cute Kittens" | |
// dir="cute-kittens" | |
// alt="Pictures of cute kittens" | |
// /> | |
import fs from "node:fs"; |
import bs4 as bs | |
import urllib.request | |
import re | |
import nltk | |
#Install beautifulsoup | |
#Article this is from: | |
#https://stackabuse.com/text-summarization-with-nltk-in-python/ | |
#NLTK help: | |
#https://stackoverflow.com/questions/4867197/failed-loading-english-pickle-with-nltk-data-load |
import React, { Component } from 'react'; | |
import '../plugins/jscolor/jscolor'; | |
/** | |
* JsColor | |
*/ | |
class JsColor extends Component { | |
/** | |
* JsColor Constructor | |
* @param {*} props |
#!/usr/bin/env python | |
''' | |
Send an multipart email with HTML and plain text alternatives. The message | |
should be constructed as a plain-text file of the following format: | |
From: Your Name <your@email.com> | |
To: Recipient One <recipient@to.com> | |
Subject: Your subject line | |
--- |
First, learn JSON. It's not programming language, not even close. Just follow syntax rules and you will be fine.
Find the Discord channel in which you would like to send commits and other updates
In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe!
UIFont.familyNames.forEach({ familyName in | |
let fontNames = UIFont.fontNames(forFamilyName: familyName) | |
print(familyName, fontNames) | |
}) |
import UIKit | |
protocol CommandExecuting { | |
func run(commandName: String, arguments: [String]) throws -> String | |
} | |
enum BashError: Error { | |
case commandNotFound(name: String) | |
} |
import Foundation | |
extension SequenceType { | |
@warn_unused_result | |
func any(@noescape predicate: (Self.Generator.Element) throws -> Bool) rethrows -> Bool { | |
for element in self { | |
let result = try predicate(element) | |
if result { | |
return true | |
} |