Skip to content

Instantly share code, notes, and snippets.

View JoMangee's full-sized avatar

Jo JoMangee

View GitHub Profile
@NNTin
NNTin / savePastDiscordChat.py
Created November 28, 2016 07:37
goes through a text channel's chat log and writes it to a file
import discord
import asyncio
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
@briancavalier
briancavalier / messy-async-with-callbacks.js
Created February 10, 2012 16:51
Messy async handling of error conditions
function thisMightFail(callback, errback) {
xhrGet('/result', callback, errback);
}
function recoverFromFailure(callback, errback) {
recoverAsync(
function(result) {
if(callback) {
try {
@briancavalier
briancavalier / try-catch.js
Created February 10, 2012 16:48
try/catch example
function thisMightFail() {
//...
if(badThingsHappened) {
throw new Error(...);
}
return theGoodResult;
}
function recoverFromFailure(e) {