Skip to content

Instantly share code, notes, and snippets.

@leahpjoyce
leahpjoyce / gist:d0f7659d78994ff832feb6096810a91b
Created August 11, 2018 21:47 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
function make(adjective) {
return new Function('noun', "return noun[0].toUpperCase() + noun.slice(1) + ' is " + adjective + "!'");
}
var isFun = make('fun');
isFun('biking'); //"Biking is fun!"
@leahpjoyce
leahpjoyce / Object.keys() and Object.values()
Created July 24, 2018 23:51
Extracting Properties and Values
const dictionary = {
car: 'automobile',
apple: 'healthy snack',
cat: 'cute furry animal',
dog: 'best friend'
};
Object.keys(dictionary); // [car, apple, 'cat', 'dog']
Object.values(dictionary); // ['automobile', 'healthy snack', 'cute furry animal', 'best friend']
@leahpjoyce
leahpjoyce / Passing Arguments into Methods
Created July 24, 2018 23:21
Invoking Objects Methods
const developer = {
name: 'Andrew',
sayHello: function () {
console.log('Hi there!');
},
favoriteLanguage: function (language) {
console.log(`My favorite programming language is ${language}`);
}
};
@leahpjoyce
leahpjoyce / Calling Methods
Created July 24, 2018 23:15
Invoking Objects Methods
const developer = {
name: 'Andrew',
sayHello: function () {
console.log('Hi there!');
}
};
developer.sayHello();
// 'Hi there!'
developer['sayHello']();
const parrot = {
group: 'bird',
feathers: true,
chirp: function () {
console.log('Chirp chirp!');
}
};
const pigeon = {
group: 'bird',
const iceCreamOriginal = {
Andrew: 3,
Richard: 15
};
const iceCreamCopy = iceCreamOriginal;
iceCreamCopy.Richard;
// 15
@leahpjoyce
leahpjoyce / Passing an Object
Created July 24, 2018 23:02
Object into a function
let originalObject = {
favoriteColor: 'red'
};
function setToBlue(object) {
object.favoriteColor = 'blue';
}
setToBlue(originalObject);
@leahpjoyce
leahpjoyce / Install Gulp.txt
Created July 22, 2018 06:29 — forked from objarni/Install Gulp.txt
Installing gulp in Windows
1. Install nodejs. https://nodejs.org/en/
2. Check npm (node package manager) is installed via command prompt:
$ npm
3. Install gulp:
$ npm install gulp --global
4. In relevant project folder, create 'gulpfile.js':
@leahpjoyce
leahpjoyce / README-Template.md
Created May 20, 2018 21:26 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites