Skip to content

Instantly share code, notes, and snippets.

@phenomen
phenomen / Gallery.astro
Created January 26, 2023 18:29
NoJS Astro + TailwindCSS Gallery with Lightbox Zoom
@TutorialDoctor
TutorialDoctor / summarizer.py
Created January 1, 2020 19:04
Summarize web pages given a URL
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
@niveshsaharan
niveshsaharan / JsColor.js
Last active March 13, 2022 04:01
React.js Component for jscolor.com
import React, { Component } from 'react';
import '../plugins/jscolor/jscolor';
/**
* JsColor
*/
class JsColor extends Component {
/**
* JsColor Constructor
* @param {*} props
@rtulke
rtulke / markdown-to-email
Created June 12, 2018 16:32 — forked from cleverdevil/markdown-to-email
markdown-to-email A simple script to send beautifully formatted emails that you write in Markdown. The email will have an HTML payload and a plain-text alternative, so you'll make everyone happy, including yourself.
#!/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
---
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active July 22, 2024 09:05
Do not use forEach with async-await

Do not use forEach with async-await

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(...))

The problem

@Birdie0
Birdie0 / ifttt-webhooks-extended-guide.md
Last active July 26, 2024 09:49
How to use Discord Webhooks

⚠️ This gist is no longer updated! For maintained, improved and even more extended guide click here.


How to use Discord Webhook

It's a JSON

First, learn JSON. It's not programming language, not even close. Just follow syntax rules and you will be fine.

@jagrosh
jagrosh / Github Webhook Tutorial.md
Last active July 23, 2024 22:30
Simple Github -> Discord webhook

Step 1 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send commits and other updates

  2. 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! WebhookDiscord

Step 2 - Set up the webhook on Github

  1. Navigate to your repository on Github, and open the Settings Settings
@khanlou
khanlou / Fonts.swift
Created October 6, 2016 21:10
Print all fonts in Swift 3
UIFont.familyNames.forEach({ familyName in
let fontNames = UIFont.fontNames(forFamilyName: familyName)
print(familyName, fontNames)
})
@andreacipriani
andreacipriani / Bash.swift
Last active February 15, 2024 12:50
Execute shell/bash commands from Swift
import UIKit
protocol CommandExecuting {
func run(commandName: String, arguments: [String]) throws -> String
}
enum BashError: Error {
case commandNotFound(name: String)
}
@khanlou
khanlou / Swift2.swift
Last active November 4, 2019 23:14
`any`, `all`, `none`, `first`, and `count` on SequenceType in Swift
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
}