Skip to content

Instantly share code, notes, and snippets.

View mimshwright's full-sized avatar

Mims H. Wright mimshwright

View GitHub Profile

FizzBuzz Analysis

Here's the challenge. It's a classic since it's easy but not that obvious. I'll accept any code that I can run that satisfies the requirement but bonus points for elegance and economy. Please record the time it takes you to finish and any other notes you'd like to include.

“Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".”

The expected output

  • 1
  • 2
"0" : 48
"1" : 49
"2" : 50
"3" : 51
"4" : 52
"5" : 53
"6" : 54
"7" : 55
"8" : 56
"9" : 57
ifconfig en0 | grep inet\ | grep -E '(\d{1,3}\.){3}\d{1,3}' | awk '{print $2}'
@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
@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 / 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 / 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 / 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 / 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 / .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\]"