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 / .gitignore
Created September 20, 2016 16:07 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@duggiemitchell
duggiemitchell / git-feature-workflow.md
Created August 23, 2016 18:58 — forked from blackfalcon/git-feature-workflow.md
Git basics - a general workflow

There are many Git workflows out there, I heavily suggest also reading the atlassian.com [Git Workflow][article] article as there is more detail then presented here.

The two prevailing workflows are [Gitflow][gitflow] and [feature branches][feature]. IMHO, being more of a subscriber to continuous integration, I feel that the feature branch workflow is better suited.

When using Bash in the command line, it leaves a bit to be desired when it comes to awareness of state. I would suggest following these instructions on [setting up GIT Bash autocompletion][git-auto].

Basic branching

When working with a centralized workflow the concepts are simple, master represented the official history and is always deployable. With each now scope of work, aka feature, the developer is to create a new branch. For clarity, make sure to use descriptive names like transaction-fail-message or github-oauth for your branches.

@duggiemitchell
duggiemitchell / how-to-ajax.js
Created February 16, 2016 05:56
Use Ajax to create interactive user experiences!
//Simple AJAX call using `$.get` shorthand method instead of `$.ajax`
$(document).ready(function() {
$('#tour').on('click', 'button', function() {
$.get('/photos.html',function(response) {
$('.photos').html(response).fadeIn();
});
});
});
// data option of ajax function
@duggiemitchell
duggiemitchell / es2015.md
Last active February 1, 2016 19:00
ES2016 Reference Sheet &Translations

Declarations

Using let Defines new variables scoped to the nearest block in which it has been declared, without affecting like-named variables outside of the block scope. Variables using let are not hoisted to the top They cannot be redeclared

//before:
var foo = 'bar';
//ES2015
let foo = 'bar';
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@duggiemitchell
duggiemitchell / lighthouse.js
Last active January 27, 2016 19:44
Object Creation & Manipulation - JS Roadtrip Part 4.2 - 4.9
//The ranger-devs want to upgrade Lighthouse Rock with new super-blinding light bulbs and remove the old existing bulbs. The new superBlinders array and lighthouseRock object are provided. Each index of the superBlinders array contains a bulb name and its wattage within a sub-array.
/*
Completely remove the existing bulbs property from the lighthouseRock object.
Add a weaponBulbs property to lighthouseRock and assign the superBlinders array as a value.
Log the name value of the bulb with the highest wattage to the console. Use the correct index from the weaponBulbs property of the lighthouseRock object to access the correct name value. */
var superBlinders = [
["Firelight", 4000],
["Solar Death Ray", 6000],
["Supernova", 12000]
];
@duggiemitchell
duggiemitchell / ObjectOcean.md
Last active January 27, 2016 14:59
What is Hard-Coding?

One thing I love about Codeschool is, the instructors place an emphasis on steering from hard coding in functions; a term I had not heard prior. So instead of using the real value when defining variables and/or functions, we use variables as a placeholder that we can reference later within the program. For an example, say we ar building a simple program calculating the area of a circle for a given radius. If we are hardcoding the program our function would look something like this:

 function areaOfCircle(radius) {
  return 2 * 3.14 * radius;
}
calculateCircumference(1); //returns 6.28

The formula to find the area of a circle is A = πr2. In the above function, the value 3.14 is hardcoded into our program when instead we could have used PI (since PI is not exactly 3.14, it is 3.14159 to be precise). Luckily, in Javascript there is such a property that represents the ratio of a circle's circumference: Math.PI ( Math.PI ≈ 3.14159 ). Imagine, if you will, that this value is used throughout our c

@duggiemitchell
duggiemitchell / Closures.js
Last active January 20, 2016 15:07
Using a Closure II - CodeSchool JS Roadtrip Part 3
/*The Cove’s Dev Girls just got reports of icebergs in the area!
Build a warning message by passing a "iceberg" obstacle as an argument into the warningMaker function.
Store the results in a new variable called icebergAlert.
Call the icebergAlert function to view the warning message.*/
function warningMaker(obstacle) {
return function() {
alert("Beware! There have been " + obstacle + " sightings in the Cove today!");
};
@duggiemitchell
duggiemitchell / MappingArrays.js
Created January 19, 2016 00:03
Using Map With Arrays II
The passengers have arrived at Maple Mountain! Take the modifiedNames array that you produced in the last challenge, and map a new anonymous function on it.
The function should alert the following message to the screen for each passenger in turn:
var modifiedNames = [ "Thomas Meeks",
"Gregg Pollack",
"Christine Wong",
"Dan McGaw" ];
modifiedNames.map(function(modifiedNames) {
alert("Yo, " +modifiedNames+ "!");
@duggiemitchell
duggiemitchell / DNAPairs.js
Last active January 18, 2016 18:27
DNA Pairing
function pair(str) {
// Return each strand as an array of two elements, the original and the pair.
var paired = [];
// Function to check with strand to pair.
var search = function(char) {
switch (char) {
case 'A':
paired.push(['A', 'T']);
break;