Skip to content

Instantly share code, notes, and snippets.

View ihatecsv's full-sized avatar
☢️
Totally tubular

Drake ihatecsv

☢️
Totally tubular
View GitHub Profile
@ihatecsv
ihatecsv / generateAsciiGraph.js
Created April 8, 2023 20:30
generateAsciiGraph by GPT4
// Written by GPT4
// Prompt:
// Write a JS function that returns a string of an ASCII graph for a given function string.
// The function string should be the text of an anonymous JS function that returns a single number.
// Use eval to figure out the result of the func.
function generateAsciiGraph(funcStr, width = 50, height = 10, minX = -10, maxX = 10, minY = -10, maxY = 10) {
const func = eval(funcStr);
const stepX = (maxX - minX) / width;
@ihatecsv
ihatecsv / drawASCIICircle.js
Created April 8, 2023 20:18
drawASCIICircle by GPT4
// Written by GPT4
// Prompt: Write a JS function that returns a string of an ASCII circle of a certain radius
function drawASCIICircle(radius) {
let output = "";
for (let y = -radius; y <= radius; y++) {
for (let x = -radius; x <= radius; x++) {
// Using the equation of a circle (x^2 + y^2 = r^2)
// We add 0.5 to the threshold to make the circle look smoother
@ihatecsv
ihatecsv / README.md
Last active March 1, 2023 14:14
RGB VSCode
  1. Follow the instructions to install Custom CSS and JS Loader for VSCode

  2. Make a file with the rgbcode.css content, and follow the instructions in the above link to add the file path to the settings.json. For example, mine is:

"vscode_custom_css.imports": ["file:///C:/Users/drake/Documents/rgbcode/rgbcode.css"]
@ihatecsv
ihatecsv / key-combo-detector.js
Created June 25, 2021 15:19
Key combination detector (for the Konami Code and otherwise)
/**
* Reads sequences of keypresses, then activates a function when a sequential combo has been detected.
* @author Drake Luce <me@drakeluce.com>
*/
class KeyComboDetector {
/**
* Create a key combination detector.
* @param {function} functionToCall The function that is called when the combo has been detected.
* @param {boolean} [makeListener=true] Make internal listener for keypresses instead of using the detect method.
Verifying my identity on Peepeth.com 0x526877bbff7b482b894a63e27cd7d4b76d83125b
3005
9000
9000
A000
3102
8012
3A0F
2A20
700F
F000

Keybase proof

I hereby claim:

  • I am ihatecsv on github.
  • I am drakeluce (https://keybase.io/drakeluce) on keybase.
  • I have a public key ASDiVJ4Mo1USv2BMuZ3a9EwpSLyWNNZVmwHhjR0NpYp0yQo

To claim this, I am signing this object:

@ihatecsv
ihatecsv / main.py
Created May 1, 2018 14:24
Money made today display
import os;
from datetime import datetime;
from time import mktime;
import time;
import threading;
#####################
wage = 15; # Hourly wage
startHour = 8; # Start hour (24h time)
startMinute = 30; # Start minute
@ihatecsv
ihatecsv / index.js
Created December 30, 2017 19:11
Proper way to preserve "this"?
class ExampleClass{
constructor(a){
this.a = a;
}
someMethod(){
const outerThis = this;
someOtherMethod(function(b){
outerThis.a = b;
});
}
@ihatecsv
ihatecsv / index.js
Created December 26, 2017 18:16
Best practice for JS classes?
//------------------------- Method 1
class TestClass1{
constructor(a){
this.a = a;
}
static someMethod(){
return new this(5);
}