Skip to content

Instantly share code, notes, and snippets.

Matthew Molnar mattcodez

Block or report user

Report or block mattcodez

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gameOfLife.js
1. Any live cell with fewer than two live neighbours dies.
2. Any live cell with two or three live neighbours lives on to the next generation.
3. Any live cell with more than three live neighbours dies.
4. Any dead cell with exactly three live neighbours becomes a live cell.
const blinkerSeed = {
height: 5,
coords: [[2,1], [2,2], [2,3]]
View callWhenReadyToGo.js
// Use only vanilla JS
function callWhenReadyToGo(cb) {
var allImagesLoaded = false;
// Look at all P and SPAN for very short text that says "loading"
// we don't want long text as it might be part of a longer paragraph then
var textEls = document.querySelectorAll('SPAN, P');
var loadingEls = [];
for (var i = 0; i < textEls.lenth; i++){
View fib_iterative.js
function fib_i(num) {
console.log(`Series of ${num}`);
let num2 = 0, num1 = 1;
for (let i = 0; i < num; i++) {
const next = num2 + num1;
num2 = num1;
num1 = next;
mattcodez /
Created Sep 12, 2017
Terminal stuff
watch --color git diff --color --stat
watch git status --porcelain
mattcodez / .tmux.conf
Created Aug 29, 2017
Saving my current tmux conf
View .tmux.conf
set -g mouse on
#set-option -g mouse on
set -g status-interval 2
set -g status-right "#S #[fg=green,bg=black]#(tmux-mem-cpu-load --colors --interval 2 --powerline-right)#[default]"
set -g status-right-length 60
set -g pane-border-status top
set -g pane-border-format "#{pane_index} #{pane_current_command} #{pane_pid}"
set -g default-terminal "screen-256color"
bind-key P command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S - ; save-buffer %1 ; delete-buffer'
mattcodez / mypi.cpp
Last active Sep 11, 2017
Very simple JS pi generator
View mypi.cpp
// g++ -o mypi -std=c++14 mypi.cpp
#include <iostream>
#include <string>
#include <ctime>
#include <limits>
double myPi(long long loopCount);
typedef std::numeric_limits< double > dbl;
View pomise_lite.js
function myPromise(fn){
let done = false;
let next = [];
fn(() => {
done = true;
while (next.length > 0) next.pop()();
return {
then: fn => {
mattcodez / thinArrow.js
Last active Mar 14, 2016
Proposal for temporary scope variables
View thinArrow.js
//Proposal for temporary scope variables
let result = ? : something.crazy.long.other();
//with() - Not 'strict' compliant
with (something.crazy.long){
result = bar ? bar() : other();
//fat arrow function
mattcodez / mrdbg-es5.js
Created Feb 3, 2016
Mapreduce Debug (ES6 & ES5)
View mrdbg-es5.js
//Transpiled from Babel
"use strict";
function MRDbg() {
for (var _len = arguments.length, txt = Array(_len), _key = 0; _key < _len; _key++) {
txt[_key] = arguments[_key];
return function (prev, cur, i, arr) {
if (i === 1) {
View SomeController.js
//Use ES6 modules for your controllers in SailsJS
export default {
controllerAction1(req, res) {
controllerAction2(req, res) {
You can’t perform that action at this time.