Skip to content

Instantly share code, notes, and snippets.

@ChazAttack73
ChazAttack73 / Ruh-Roh.md
Created December 4, 2015 19:18 — forked from jaywon/Ruh-Roh.md
Email Hell

###Email Hell

We just found out that there is a bug in production that our e-mail function was iterating errantly and sending duplicate e-mails to many users. We need to fix this quickly but we don't want to send out a mass apology letter to all of our users.

Our sysadmin gave us the SMTP logs and we need to process the logs and identify which users received multiple e-mails so that we can directly send them a follow up e-mail explaining the situation and offer super cool swag to keep them on as customers.

Also, the boss wants this done ASAP, we don't have time to do this manually...HAAALLLLPPP!

###The Fix

@ChazAttack73
ChazAttack73 / gist:8ce66bde85e214d010a0
Created December 5, 2015 20:58 — forked from jaywon/gist:c76abc57dc33e1679c02
Circular String Brain Bender

###Good Morning Agents

Your challenge this morning is to create a function that implements an algorithm using the concepts we've covered this week.

###Challenge

  1. Write an algorithm that takes in 2 strings as parameters (source, find).
  2. Your function should return true if the string passed in as the find parameter is found in the source parameter if source were circular in nature. Meaning there is no end to the source string.
  3. Important: A match would be true if the word to find is partially at the end of the word and at the beginning in sequence.

Ex.

@ChazAttack73
ChazAttack73 / stack-challenge.md
Created December 9, 2015 19:07 — forked from jaywon/stack-challenge.md
Use a Linked List to simulate a stack trace

###Console History Sim Stack Trace Challenge

Using a linked list, we are going to demonstrate a use case for a linked list and simulate a stack like you see in a stack trace (similar to what you see in your console when an error occurs), that replays the history of what we typed.

  1. Add a text box to an HTML page and add 2 buttons, save and dump.
  2. Every time the user clicks the first button to save, we are going to save the text input to our linked list as the most recent node or head.
  3. Whenever someone clicks the dump button we are going to dump out all of the input they've typed in to that point from most recent to oldest. This should be written as HTML to the page.
@ChazAttack73
ChazAttack73 / js-constructors.js
Created December 11, 2015 00:24 — forked from JoeKarlsson/js-constructors.js
invoke function from js-constructors.js
/**
* @method invoke
*
* Allows the spellcaster to cast spells.
* The first parameter should either be a `Spell` or `DamageSpell`.
* If it is a `DamageSpell`, the second parameter should be a `Spellcaster`.
* The function should return `false` if the above conditions are not satisfied.
*
* You should use `instanceof` to check for these conditions.
*
@ChazAttack73
ChazAttack73 / add-upstream.md
Created December 12, 2015 00:05 — forked from sgnl/add-upstream.md
So you've forked a Repository and you want updates...

#tl;dr

setting up a branch to track a repo

pre: assuming you have forked a repo and cloned your fork to your computer

  1. git remote add [maintainer's name] [paste URL here]
  2. git fetch --all
  3. git branch --track [maintainer's name]_[branch] [remote name from step 1]/[branch you want to track] At this point you may watch to checkout to your newly create branch and issue a git pull command.
@ChazAttack73
ChazAttack73 / bowlingScoreCalculator.md
Created December 15, 2015 19:07 — forked from sgnl/bowlingScoreCalculator.md
Bowling Score Calculator

Bowling Score Calculator

Your task is to write a function for calculating the score of a 10 pin bowling game. The input for the function is a list of pins knocked down per roll for one player. Output is the player's total score.

General rules

Rules of bowling in a nutshell:

A game consists of 10 frames. In each frame the player rolls 1 or 2 balls, except for the 10th frame, where the player rolls 2 or 3 balls. The total score is the sum of your scores for the 10 frames

  • If you knock down fewer than 10 pins with 2 balls, your frame score is the number of pins knocked down
@ChazAttack73
ChazAttack73 / README.md
Created December 15, 2015 19:07 — forked from jaywon/README.md
Analytics Tracking

###Business Objective Good morning team! We just got a request from the new CMG(Chief Marketing Groovru) that he wants to start A/B testing every element across the entire site for user interaction. We are going to need you to create a script that can be included in an HTML page that tracks every click on a page and reports what element was clicked so that we know at a micro level how users are interacting with our new optimized, user-friendly, uber-engagement platform.

###Your Task Mock up a simple HTML page with a bunch of different elements on the page and create a script that tracks every single element clicked and the number of times it was clicked. We will worry about saving this to our analytics database later, we just need a way to prove that it works.

Thaaannnks :D

Pig Latin Translator

A new alien species has moved to earth and they only speak pig-latin! The president has called you and says that they need your help!

Your mission is to create a module that is capable of taking an english sentence and translating it into pig latin. We must also be able to understand what our new alien friends are saying, so the module needs to be able to convert pig-latin back to english.

TL;DR: Create a module that translates a string into Pig Latin, and is capable of translating Pig Latin back into in the native language.

##How Pig Latin Works Basically, the Pig Latin system used here works as follows:

$git init
$npm init --yes
$npm install -g mocha (only need to do once)
$mkdir test
$touch test/pig_latin.spec.js //mocha looks for a test folder with a file that has the extension spec
//in your pig_latin.spec.js file insert the following
var chai = require('chai');
var expect = chai.expect;
chai.should();
var pigLatin = require('./../index.js');
@ChazAttack73
ChazAttack73 / gulp-scss-livereload.md
Created December 20, 2015 00:20 — forked from sgnl/gulp-scss-livereload.md
Gulp + SCSS + LiveReload - Updated 12/18/2015

Gulp + SCSS + LiveReload

This Gist outlines the gulp workflow that will:

  1. watch for any scss changes, then compiles scss source into css
  2. watch for any changes in the public directory, and trigger live-reload
  3. serve static content in public/

This Gist also assumes you already know how to install npm modules, gitignore, create directories and create files via the command line.