Skip to content

Instantly share code, notes, and snippets.

View mimshwright's full-sized avatar

Mims H. Wright mimshwright

View GitHub Profile
@mimshwright
mimshwright / montecarlo.cpp
Created February 23, 2012 04:33
Solution to Monte Carlo problem for Coding Dojo Feb 2012 by Mims H. Wright (in C++)
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <ctime>
using namespace std;
int main()
{
int reps = 0;
cout << "Enter number of repititions then press enter." << endl;
cin >> reps;
@mimshwright
mimshwright / .profile
Created August 16, 2012 17:59
Show current git branch in your prompt
# append this to the bottom of your ~/.profile or ~/.bash_profile
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local YELLOW="\[\033[0;33m\]"
@mimshwright
mimshwright / RickrollConsole.js
Last active April 6, 2016 01:21
RickrollConsole.js
console.log("%c Never gonna give you up! ", "background-image:url(http://tinyurl.com/nggyugif);font-size:48px;font-family:zapfino;color:#FFF");
@mimshwright
mimshwright / consoleSpinner.js
Created April 10, 2014 00:06
Draw a spinner in your console.
var timer;
function showSpinner() {
var i = 0;
var css = "font-size: 32px; color: red;";
clearInterval(timer);
timer = setInterval(
function () {
console.clear();
// console.log(timer);
@mimshwright
mimshwright / showRainbow.js
Created April 10, 2014 23:23
Show an animated ripple effect in your console.
var timer;
var cycle = " ░▒▓█▓▒░";
function showRainbow() {
var offset = 0;
var css = "font-family:'Arial Black'; font-size: 32px; color: red;";
clearInterval(timer);
timer = setInterval(
function () {
console.clear();
@mimshwright
mimshwright / 00-placeholder.mustache
Last active June 2, 2017 11:55
Example of using responsive placeholder images in PatternLab
<div class="fpo placeholder {{styleModifier}}">
{{! #large }}
<img src="../../images/placeholder/{{styleModifier}}.jpg" class="large" alt="Placeholder for {{styleModifier}}, large" />
{{! / large }}
{{# medium}}
<style>
@media screen and (max-width: 960px) {
.placeholder.{{styleModifier}} img.large {
display: none;
@mimshwright
mimshwright / funcSnippet.js
Created April 14, 2015 18:25
Snippet of functional JS
// updateView()
// render all projects to projectList
projectsData
.filter(isProjectActive)
.filter(containsSearchTerm)
.sort(byDate)
.map(renderProject)
.map(appendProjectToListView);
@mimshwright
mimshwright / z-index.scss
Created October 13, 2015 12:10
Global z-indexes stored by order in a list.
// Store all the Z-Indexes that matter in your life.
// Add an id to the list. Items will be ordered based on the order in the list.
// To reorder the z-indexes, just reorder the list
// Use @include z-index(id); to set the z-index of your element.
$z-indexed-elements: (
always-on-top-of-everything-button
hamburger-nav
important-button---but-not-that-important
unnecessary-animation
ifconfig en0 | grep inet\ | grep -E '(\d{1,3}\.){3}\d{1,3}' | awk '{print $2}'
"0" : 48
"1" : 49
"2" : 50
"3" : 51
"4" : 52
"5" : 53
"6" : 54
"7" : 55
"8" : 56
"9" : 57