Skip to content

Instantly share code, notes, and snippets.

View dekaikiwi's full-sized avatar

Jono Glassey dekaikiwi

View GitHub Profile
@dekaikiwi
dekaikiwi / .vimrc
Created May 20, 2019 14:14
My Vim Configuration File
" Maintainer: Jono Glassey <[email protected]>
" Last change: 2019 April 26
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
" Vundle Setup (2019-04-26)
@dekaikiwi
dekaikiwi / avl_insertion.java
Created February 11, 2019 15:42
AVL Tree Insertion Example
package jono.structures;
import java.lang.Math;
import jono.structures.Node;
import java.util.stream.Stream;
class AvlNode extends Node {
int balance = 0;
int height = 0;
@dekaikiwi
dekaikiwi / QuickSorter.java
Created January 12, 2019 08:27
Implementation of QuickSort in Java.
package jono.sorting;
import java.util.Arrays;
import java.util.stream.Stream;
public class QuickSorter {
public static void main(String[] args) {
QuickSorter sorter = new QuickSorter();
@dekaikiwi
dekaikiwi / MergeSorter.java
Last active January 12, 2019 07:33
Merge Sort implementation in Java
package jono.sorting;
import java.util.Arrays;
import java.util.stream.Stream;
public class MergeSorter {
public static void main(String[] args) {
MergeSorter sorter = new MergeSorter();
int[] array = Stream.of(args[0].split(",")).mapToInt(Integer::parseInt).toArray();
@dekaikiwi
dekaikiwi / Bst.java
Created January 4, 2019 10:08
Implementation of a Binary Search Tree in Java
package jono.structures;
import java.util.stream.Stream;
import jono.structures.Node;
public class Bst {
public static void main(String args[]) {
Node root = null;
int[] numbers = Stream.of(args[0].split(",")).mapToInt(Integer::parseInt).toArray();
@dekaikiwi
dekaikiwi / bubble_sort.rb
Created December 16, 2018 15:52
Quick attempt at Bubble Sort implementation in Ruby (needs to be improved)
def bubble_sort(arr, swap_count = 0)
time_start = Time.now
total_swap_count = 0
swap_count = nil
while swap_count.nil? || swap_count > 0
swap_count = 0
arr.each_with_index do |i, index|
pos = index
@dekaikiwi
dekaikiwi / gist:5eb9003d5ec40257cfdcbd12810b1dc5
Created July 5, 2018 06:57
For when you forget to run RAILS_ENV=test bundle exec rspec
# https://stackoverflow.com/questions/28639439/rails-repeated-activerecordrecordnotunique-when-creating-objects-with-postgre?rq=1
ActiveRecord::Base.descendants.each do |model|
unless model.attribute_names.include?('id')
Rails.logger.debug "Not resetting #{model}, which lacks an ID column"
next
end
begin
max_id = model.maximum(:id).to_i + 1
result = ActiveRecord::Base.connection.execute(
@dekaikiwi
dekaikiwi / keybase.md
Created March 9, 2018 02:03
keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object: