Skip to content

Instantly share code, notes, and snippets.

View amandeepmittal's full-sized avatar

Aman Mittal amandeepmittal

View GitHub Profile
// FAVORITE BOT====================
// find a random tweet and 'favorite' it
var favoriteTweet = function(){
var params = {
q: '#nodejs, #Nodejs', // REQUIRED
result_type: 'recent',
lang: 'en'
}
// for more parametes, see: https://dev.twitter.com/rest/reference
// RETWEET BOT ==========================
// find latest tweet according the query 'q' in params
var retweet = function() {
var params = {
q: '#nodejs, #Nodejs', // REQUIRED
result_type: 'recent',
lang: 'en'
}
// for more parametes, see: https://dev.twitter.com/rest/reference/get/search/tweets
// Use Streams API for interacting with a USER ==========
// set up a user stream
var stream = Twitter.stream('user');
// FOLLOW-Reply BOT ===========================
// when someone follows
stream.on('follow', followed);

NODEJS Overview

What is Nodejs?

  • Platform built on Chrome's JavaScript runtime, for building fast, scalable network applications
  • Nodejs uses event driven, non-blocking I/O

NOTE

@amandeepmittal
amandeepmittal / user.js
Created March 31, 2017 16:16
faker gist user.js
const faker = require('faker')
const User = {
name: faker.name.findName(),
email: faker.internet.email(),
website: faker.internet.url(),
address: faker.address.streetAddress() + faker.address.city() + faker.address.country(),
bio: faker.lorem.sentences(),
image: faker.image.avatar()
}

#Ionic Publish Android App

This is the process to publish an ionic android app.

  1. Make sure you set/increment the version number in config.xml ie 0.0.3.

  2. Make sure the android platform has been added

@amandeepmittal
amandeepmittal / error-handler.js
Created April 22, 2017 12:50
Express Handlers
/// error handlers
// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function(err, req, res, next) {
res.send('error', {
message: err.message,
error: err
});
}); }
@amandeepmittal
amandeepmittal / .eslintrc.json
Last active December 23, 2017 17:23
eslint RN config
{
"extends": "airbnb",
"parser": "babel-eslint",
"env": {
"node": true,
"browser": true,
"es6": true
},
"plugins": ["react"],
"rules": {
@amandeepmittal
amandeepmittal / redux-rn.shell
Created December 23, 2017 17:22
Redux in RN
npm i --save redux react-redux redux-thunk redux-promise && npm i --save-dev remote-redux-devtools remotedev-rn-debugger remote-redux-devtools redux-logger
@amandeepmittal
amandeepmittal / top-npm.md
Created March 17, 2017 15:55
Top Npm Commands
  • npm init: displays a simple wizard to help you create and describe your new project;
  • npm install module_name: install a module;
  • fnpm install -g module_name: install a global module;
  • npm install module_name --save: install a module and add it into the package.json file, inside dependencies;
  • npm install module_name --save-dev: install a module and add it into the package.json file, inside devDependencies;
  • npm list: lists all the modules installed on the project;
  • npm list -g: lists all the global modules installed on the OS;
  • npm remove module_name: uninstall a module from the project;
  • npm remove -g module_name: uninstall a global module;
  • npm remove module_name --save: uninstall a module from the project and also remove it from the attribute dependencies;