Skip to content

Instantly share code, notes, and snippets.

View fortunee's full-sized avatar
🎯
Focusing

Fortune Ekeruo fortunee

🎯
Focusing
View GitHub Profile
@fortunee
fortunee / .gitignore
Created May 29, 2017 18:53
Prevent Git from pushing our .env file and the node_modules directory
node_modules/
.env
@fortunee
fortunee / getTweet.js
Last active May 30, 2017 08:16
Import the required libraries
// We import our installed libraries from line 1 to 3
const Tweet = require('twitter');
const dotenv = require('dotenv').config(); // Call the config function of dotenv
const readline = require('readline');
// We create a readline interface for reading and writing user's input:
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
@fortunee
fortunee / getTweets.js
Last active May 30, 2017 08:23
Getting user's tweets
// We import our installed libraries from line 1 to 3
const Tweet = require('twitter');
const dotenv = require('dotenv').config(); // Call the config function of dotenv
const readline = require('readline');
/**
* We create a new instance of Tweet which we required
* above passing in our secret information as an object
* and using process.env to fetch the actual value from
* where it was set in our environment variable (.env file)
@fortunee
fortunee / getTweets.js
Last active May 30, 2017 08:27
Setup Twitter Configuration and API Keys
// We import our installed libraries from line 1 to 3
const Tweet = require('twitter');
const dotenv = require('dotenv').config(); // Call the config function of dotenv
const readline = require('readline');
/**
* We create a new instance of Tweet which we required
* above passing in our secret information as an object
* and using process.env to fetch the actual value from
* where it was set in our environment variable (.env file)
@fortunee
fortunee / postTweet.js
Last active May 30, 2017 08:28
Posting tweets
// We import our installed libraries from line 1 to 3
const Tweet = require('twitter');
const dotenv = require('dotenv').config(); // Call the config function of dotenv
const readline = require('readline');
/**
* We create a new instance of Tweet which we required
* above passing in our secret information as an object
* and using process.env to fetch the actual value from
* where it was set in our environment variable (.env file)
@fortunee
fortunee / .env
Last active July 27, 2017 19:57
Keys Generate for us by Twitter
CONSUMER_KEY=REPLACE_WITH_YOURS
CONSUMER_SECRET=REPLACE_WITH_YOURS
ACCESS_TOKEN_KEY=REPLACE_WITH_YOURS
ACCESS_TOKEN_SECRET=REPLACE_WITH_YOURS
@fortunee
fortunee / function.hoisting.js
Created November 7, 2017 23:39
Function Hoisting
console.log(func1);
console.log(func2);
let func1 = function() {
// do something
}
function func2() {
// do another thing
}
@fortunee
fortunee / block.statement.js
Last active November 10, 2017 11:09
Block statement
for(var i = 1; i <= 5; i++) {
console.log('Number: ' + i);
}
// Variable i is accessible here
console.log(i) // -> 6 - which is the last value of i incremented by 1
/**
* However, using the ES6 let or const keyword to declare the variable
* makes it behave like a scope as it's only accessible within the for
@fortunee
fortunee / global.scope.js
Last active November 13, 2017 21:26
Global Scope
var name = 'Fortune';
var age = 22;
function func() {
// Both name and age can be accessed here
console.log(`The name is ${name}, and I'm ${age} years old`);
}
func() // 'The name is Fortune, and I'm 22 years old'
@fortunee
fortunee / variable.hoisting.js
Last active November 13, 2017 21:51
Hoisting
console.log(age); // -> undefined
var age = 22;
console.log(age); // -> 22
console.log(location); // throws -> Uncaught ReferenceError: location is not defined
location = 'Lagos, Nigeria';