Skip to content

Instantly share code, notes, and snippets.

View duggiemitchell's full-sized avatar
🏠
Working from home

Erica Edge duggiemitchell

🏠
Working from home
View GitHub Profile
@duggiemitchell
duggiemitchell / README.md
Created November 9, 2015 20:18 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@duggiemitchell
duggiemitchell / freecodecamp-bonfire-mutations.js
Last active January 5, 2016 18:43
Traversing Array to strings using indexOf()
// Bonfire: Mutations
// Author: @duggiemitchell
// Challenge: http://www.freecodecamp.com/challenges/bonfire-mutations
// Learn to Code at Free Code Camp (www.freecodecamp.com)
//Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.
function mutation(arr) {
var strOne = arr[0].toLowerCase();
var strTwo = arr[1].toLowerCase().split("");
// Bonfire: Falsy Bouncer
// Author: @duggiemitchell
// Challenge: http://www.freecodecamp.com/challenges/bonfire-falsy-bouncer
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function bouncer(arr) {
var falsyArr = [];
var trueArr = arr.filter(Boolean);
return (trueArr);
// Bonfire: Seek and Destroy
// Author: @duggiemitchell
// Challenge: http://www.freecodecamp.com/challenges/bonfire-seek-and-destroy
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function destroyer(arr) {
var argCombo = arr.slice.call(arguments);
console.log(argCombo.splice(0,1));
// Bonfire: Where do I belong
// Author: @duggiemitchell
// Challenge: http://www.freecodecamp.com/challenges/bonfire-where-do-i-belong
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function where(arr, num) {
arr.push(num);
arr.sort();
@duggiemitchell
duggiemitchell / config.json
Created December 11, 2015 16:45 — forked from anonymous/config.json
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
@duggiemitchell
duggiemitchell / quoteme.readME.md
Last active December 24, 2015 16:49
Random Quote Generator using jQuery Event Handlers

Random Quote Generator

First create arrays as global variables. I was informed global variables should be avoided for they can cause problems, especially in a project with concurrency. But seeing this project is fairly simple, we can make this exception. We'd obviously like to have more quotes to choose from, but if you want to see the project in action check it out on my portfolio.

var happyQuotes = ["I am a happyQuote!","I too am a happyQuote!;]; var lostQuotes = [" I am lost!"," I too am lost!";`"]; var scaredQuote = ["I am sooo scared!" , "I second that... being scared!"]; var sadQuote = [```"Fear is the mind killer.","...doesn't stop my fear"];

getRandomNumberNumber accepting min and max as arguments function getRandomNumber(min, max){

@duggiemitchell
duggiemitchell / bonfire-Diff-Two-Arrays.js
Last active January 3, 2016 00:21
Compare Differences in Arrays using filter & indexOf - Javascript
At our meetup today, @kileyDowling pair programmed with me and it was... different. But I heard having someone peek over your shoulder whilst solving an algorithm is both helpful and a real world example of coding in the wild. The particular challenge of the day was to create function comparing two arrays with different values, and returning a new array containing unique values.
My working solution was close, but not quite returning the right answer. Here is the function:
function diff (arr1, arr2) {
var newArr = [];
return newArr;
}
The solution I created before meeting today used the filter() funtion and indexOf() methods and while on some level filtering the function, the results were not quite what I was hoping for:
@duggiemitchell
duggiemitchell / Where-art-thou.js
Last active January 13, 2016 21:35
Where Art Thou
Create a function that takes in two arguments and iterates through an array of objects (first argument) and returns an array of objects that have matching properties and values pairs of the second argument. The property and value of the source object must be present in the collection variable in order to be included in the returned array.
Given these variables:
var collection = [ { first: "Romeo", last: "Montague" },
{ first: "Mercutio", last: null },
{ first: "Tybalt", last: "Capulet" } ];
var source = [{last: "Capulet"}];

Back at Death Valley, scientists could see that the Sheep Situation would quickly get out of control. They have decided that, for any month the population climbs above 10000, half of the sheep will be sent away to other regions.

Inside our for loop, insert an if statement that:

Removes half of the sheep population if the number of sheep rises above 10000. Prints the number of sheep being removed to the console in the following format: Removing <number> sheep from the population.

var numSheep = 4;
var monthsToPrint = 12;