Skip to content

Instantly share code, notes, and snippets.

View stuyy's full-sized avatar

Anson stuyy

View GitHub Profile
import json
import discord
config_file = open('config.json')
TOKEN = json.load(config_file)['token']
client = discord.Client()
@client.event
async def on_raw_reaction_add(payload):
@stuyy
stuyy / passport.js
Created September 6, 2019 23:19 — forked from manjeshpv/passport.js
Passport.js using MySQL for Authentication with Express
// config/passport.js
// load all the things we need
var LocalStrategy = require('passport-local').Strategy;
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
@stuyy
stuyy / bot.py
Created September 2, 2019 15:13
Python Bot
import discord
import os
import mysql.connector
import json
import random
import threading
from discord.ext import commands
bucket = commands.CooldownMapping.from_cooldown(5, 2, commands.BucketType.member)
@stuyy
stuyy / nativeJavaScript.js
Created January 20, 2019 12:02 — forked from alexhawkins/nativeJavaScript.js
Implementation of Native JavaScript Methods (forEach, Map, Filter, Reduce, Every, Some)
'use strict';
/*****************NATIVE forEACH*********************/
Array.prototype.myEach = function(callback) {
for (var i = 0; i < this.length; i++)
callback(this[i], i, this);
};
//tests
<!DOCTYPE html>
<html>
<head>
<title>Task List</title>
<style>
body {
font-family: sans-serif;
}
.taskBody {
margin: 0 auto;
public class Quicksort {
private int partitionIndex;
public void quickSort(int array[], int low, int high)
{
if(low < high) // If the low index is less than the high index.
{
partitionIndex = partition(array, low, high);
@stuyy
stuyy / Person
Created November 10, 2017 04:13
A person class
public class Person {
int height;
int weight;
int age;
String name;
String favClass;
static int numOfPersons;
// Javascript Linked List
// Author: Anson Foong, 5/28/2017
function Node(data)
{
this.data = data;
this.next = null;
}
function LinkedList()
package LinkedList;
public class ListDriver {
public static void main(String[] args)
{
SinglyLinkedList list = new SinglyLinkedList();
list.addNode(50);
list.addNode(22);
list.addNode(33);
public class ApartmentComplex {
private LivingRoom apartmentLivingRoom;
private Kitchen apartmentKitchen;
private Bedroom apartmentBedroom;
private Bathroom apartmentBathroom;
public static int apartmentCount;
private final int MAX_HEIGHT = 90;