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 / rv.js
Created December 2, 2017 23:54
Randomness visualizer
var dim = 256;
var offset = 5;
var randomSources = [
{
rBool: function(){
return Math.random() >= 0.5;
//return 1;
}
},
@ihatecsv
ihatecsv / highlight.js
Created December 16, 2017 18:59
Highlight selected text matches on page (jQuery)
//Note:
//Requires jQuery! Also, you need to define a CSS class for .highlight
//Something like: .highlight{background-color: #ff96da;}
function getSelectionText() { //Thanks https://stackoverflow.com/a/5379408
var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != "Control") {
text = document.selection.createRange().text;
@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);
}
@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 / 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

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:

3005
9000
9000
A000
3102
8012
3A0F
2A20
700F
F000
Verifying my identity on Peepeth.com 0x526877bbff7b482b894a63e27cd7d4b76d83125b
@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 <[email protected]>
*/
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.
@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"]