Skip to content

Instantly share code, notes, and snippets.

View the-vampiire's full-sized avatar
💭
ive lost a shade of color in my life. rest in peace.

the-vampiire

💭
ive lost a shade of color in my life. rest in peace.
View GitHub Profile
@the-vampiire
the-vampiire / index.html
Created April 25, 2017 15:48
Project Section
<div id="Projects" style="visibility: hidden"></div>
<!-- Projects SECTION -->
<div class="container-fluid rounded" style="background-color:#FF6600;">
<!-- HEADER -->
<div class="jumbotron" style="background-color: black; margin-top:50px">
<h1 class="text-center" style="color: #FF6600; font-family: 'Cinzel Decorative', cursive; margin-top: -30px ">
<hr> Projects <hr>
@the-vampiire
the-vampiire / The_Aptly_Named_I_Dont_Know_How_This_Works.js
Created April 27, 2017 03:39
How in god's name does this work?
// How in gods name did this work? I don't understand what I even did. It started off making sense and 25 console logs and muckeries later
// it has come to this. Literally wtf.
function sumPrimes(num){
var i = 2, nums = [], primes = [];
while(i <= num){
nums.push(i);
i++;
@the-vampiire
the-vampiire / LCM.js
Last active April 28, 2017 03:07
Lowest Common Multiple
function smallestCommons(arr) {
// sort to ensure smallest to largest
function sorting_hat(a,b){
return a-b;
}
arr.sort(sorting_hat);
// set lower and upper bounds for range
@the-vampiire
the-vampiire / Janky_Bullshit.js
Created May 1, 2017 19:29
fucking bullshit solution
var arr1 = [
[21, "Bowling Ball"],
[2, "Dirty Sock"],
[1, "Hair Pin"],
[5, "Microphone"]
];
var arr2 = [
[2, "Hair Pin"],
[3, "Half-Eaten Apple"],
@the-vampiire
the-vampiire / Inventory_Update
Created May 1, 2017 23:00
Inventory Update Advanced Algorithm
// I am a fucking savage.
function updateInventory(arr1, arr2){
var merged = arr1.concat(arr2);
var JSON_merged = {};
// utilizes fact that objects can not have repeating properties with the same name
// to filter out duplicates
// will retain the last seen duplicate element during loop
@the-vampiire
the-vampiire / Phone_Number_Test_Cases
Created May 4, 2017 00:36
By the Power of RegEx...
var map = {
"should return true." : '\n',
"should return false." : '\n',
"should return a boolean." : '\n',
"should return false" : '\n',
"should return true" : '\n',
"telephoneCheck(" : '',
'")' : '"',
'.' : '',
/**
* Created by Vampiire on 5/12/17.
*/
// jQuery shortcuts
var i = 0, rand = 0, square = $('.square'), reset = $('#reset');
// squares
var center = $('#square_5');
/**
* Created by Vampiire on 5/12/17.
Completely refactored thanks to Dan for his advice in teaching me how to use Jasmine for unit tests.
Was able to build a much more efficient and elegant board state checker by starting with simple cases and building up.
unit tests can be found here: http://jsfiddle.net/he6L475b/1/
*/
// jQuery shortcuts
@the-vampiire
the-vampiire / tictactoe.js
Created May 12, 2017 23:21
tictactoe V2 now checks for tie game
/**
* Created by Vampiire on 5/12/17.
*/
// jQuery shortcuts
var square = $('.square'), reset = $('#reset'), modal = $('.modal'), winnerOutput = $('#winnerOutput');
// global variables
var userSelect, compSelect, row, column, board = [ ['1','2','3'], ['4','5','6'], ['7','8','9'] ], timeout, winner, boardCount = 0;
@the-vampiire
the-vampiire / tictactoe.js
Last active May 13, 2017 06:28
Fangs and Stakes Submitted Code
/**
* Created by Vampiire on 5/11/17.
*/
// jQuery shortcuts
var square = $('.square'), center = $('#square_5'), modal = $('.modal'), winnerOutput = $('#winnerOutput');
// global variables
var userSelect, compSelect, row, column, board = [ ['1','2','3'], ['4','5','6'], ['7','8','9'] ],