Skip to content

Instantly share code, notes, and snippets.

@m1k3yfoo
m1k3yfoo / 0_reuse_code.js
Created November 23, 2015 20:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
import java.util.*;
/**
* Created by Amaterasu on 7/9/17.
*/
public class RoutePlanner
{
private static int[][] graph;
private static boolean[] visited;
private static int[] dist;
@m1k3yfoo
m1k3yfoo / jsArrayMethods.js
Last active March 22, 2022 14:59
[JavaScript Array Methods: sort, map, reduce, some, every] Map calls the callback function 1 time for each element in the array. #JavaScript
const inventors = [
{ first: 'Albert', last: 'Einstein', year: 1879, passed: 1955 },
{ first: 'Isaac', last: 'Newton', year: 1643, passed: 1727 },
{ first: 'Galileo', last: 'Galilei', year: 1564, passed: 1642 },
{ first: 'Marie', last: 'Curie', year: 1867, passed: 1934 },
{ first: 'Johannes', last: 'Kepler', year: 1571, passed: 1630 },
{ first: 'Nicolaus', last: 'Copernicus', year: 1473, passed: 1543 },
{ first: 'Max', last: 'Planck', year: 1858, passed: 1947 },
{ first: 'Katherine', last: 'Blodgett', year: 1898, passed: 1979 },
{ first: 'Ada', last: 'Lovelace', year: 1815, passed: 1852 },
@m1k3yfoo
m1k3yfoo / cssClock.html
Created December 29, 2017 18:42
[CSS Clock] A clock animated by CSS transforms #CSS #JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JS + CSS Clock</title>
</head>
<body>
<div class="clock">
@m1k3yfoo
m1k3yfoo / css-variables.html
Created December 29, 2017 18:46
[CSS Variables] #JavaScript, #CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Scoped CSS Variables and JS</title>
</head>
<body>
<h2>Update CSS Variables with <span class='hl'>JS</span></h2>
<div class="controls">
@m1k3yfoo
m1k3yfoo / flex-panels.html
Created December 29, 2017 20:30
[Flex Panels Image Gallery] #CSS, #JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Flex Panels 💪</title>
<link href='https://fonts.googleapis.com/css?family=Amatic+SC' rel='stylesheet' type='text/css'>
</head>
<body>
<style>
html {
@m1k3yfoo
m1k3yfoo / hold-shift.html
Created December 30, 2017 19:37
[Hold Shift to Check Multiple Checkboxes] #JavaScript, #CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hold Shift to Check Multiple Checkboxes</title>
</head>
<body>
<style>
html {
@m1k3yfoo
m1k3yfoo / konami-cheat-code.html
Created December 30, 2017 21:39
[Konami Cheat Code Sequence] #CSS, #JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Key Detection</title>
<script type="text/javascript" src="http://www.cornify.com/js/cornify.js"></script>
</head>
<body>
<script>
const typed = [];
@m1k3yfoo
m1k3yfoo / BooleanTable.java
Created January 15, 2018 19:40
[Boolean Table] Generates all possible combinations of true/false for a boolean table #Java, #COMP671
public class BooleanTable
{
public static void main( String[] args ) {
final int n = 3;
final int col = (int) Math.pow( 2, n );
ArrayList<char[]> charMatrix = new ArrayList<>();
char[][] transposedMatrix = new char[n][col];
ArrayList<char[]> charArr;
@m1k3yfoo
m1k3yfoo / stack.py
Created March 26, 2018 20:11
[Python Stack]
# Using lists as stacks
stack = [3, 4, 5]
stack.append(6) ## Same as push
stack.pop()
## Custom implementation of stack using LinkedList (See LinkedList)
class Element(object):
def __init__(self, value):
self.value = value
self.next = None