Skip to content

Instantly share code, notes, and snippets.

View WesJD's full-sized avatar

Wesley Smith WesJD

View GitHub Profile
@WesJD
WesJD / InstanceHolder.java
Created August 13, 2016 23:41
Literally holds instances of a type
public class InstanceHolder<T> {
private final List<T> instances = new ArrayList<>();
public void add(T instance) {
instances.add(instance);
}
public T get(Class<? extends T> clazz) {
return instances.stream().filter(instance -> instance.getClass().equals(clazz)).findFirst().orElse(null);
@WesJD
WesJD / questioner.rs
Last active August 21, 2016 22:13
Simple questioner written in Rust (first little project)
use std::io;
struct Question {
ask: String,
answers: Vec<String>,
}
impl Question {
fn new(ask: String, answers: Vec<String>) -> Question {
Question {
@WesJD
WesJD / mac-modmap.txt
Created October 1, 2016 00:10
Basically get mac keybinds on linux
clear control
clear mod1
clear mod4
keycode 64 = Control_L NoSymbol Control_L
keycode 133 = Alt_L NoSymbol Alt_L
keycode 37 = Super_L NoSymbol Super_L
keycode 108 = Control_L NoSymbol Control_L
keycode 134 = Alt_L NoSymbol Alt_L
@WesJD
WesJD / FileManager.java
Last active December 17, 2016 13:19
Easily manage configuration files
public class FileManager {
private final JavaPlugin plugin;
private final List<ManagedFile> managedFiles = new ArrayList<>();
public FileManager(JavaPlugin plugin) {
this.plugin = plugin;
plugin.getDataFolder().mkdirs();
}

Keybase proof

I hereby claim:

  • I am WesJD on github.
  • I am wesjd (https://keybase.io/wesjd) on keybase.
  • I have a public key whose fingerprint is 5DF0 E345 74BD D70A 03B7 1C4E 45CB 4DED 972A F8C4

To claim this, I am signing this object:

import javax.swing.JOptionPane;
public class CarRental {
private CarRental() {
final String make = JOptionPane.showInputDialog("What is the car make?");
final String model = JOptionPane.showInputDialog("What is the car model?");
final String licensePlate = JOptionPane.showInputDialog("What is the license plate value?");
final int digits = Integer.parseInt(licensePlate.substring(4));
@WesJD
WesJD / RockPaperScissors.scala
Created December 30, 2016 05:19
Rock Paper Scissors in Scala (a little intro project)
package net.wesjd.rockpaperscissors
import java.util.concurrent.ThreadLocalRandom
import scala.collection.JavaConverters
import scala.io.StdIn._
import scala.reflect.ClassTag
class RockPaperScissors {
@WesJD
WesJD / instructions.md
Last active March 14, 2017 23:44 — forked from exception/instructions.md
Ubuntu screnshoting for Pxl.lt

Instructions

After creating the screenshot.sh file you shoud:

  • Assign a Key to the screenshot.sh file
MariaDB [(none)]> use michelle;
MariaDB [michelle]> create table items (type VARCHAR(75) NOT NULL, broken BOOL NOT NULL, used BOOL NOT NULL DEFAULT TRUE, got_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, last_used TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP);Query OK, 0 rows affected (0.01 sec)
MariaDB [michelle]> DESCRIBE items;
+-----------+-------------+------+-----+-------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+-------------------+-------+
| type | varchar(75) | NO | | NULL | |
| broken | tinyint(1) | NO | | NULL | |
| used | tinyint(1) | NO | | 1 | |
@WesJD
WesJD / mapsections.md
Created February 5, 2019 21:49
super craft brothers map sections

scb maps

  • DragonsDescent
  • ClockWork
  • LostTemple
  • NightDragon
  • CandyLand
  • Icefall
  • CherryGrove
  • TreeHouse