Skip to content

Instantly share code, notes, and snippets.

@HaiderMalik12
HaiderMalik12 / authorApi.js
Created June 22, 2016 01:08 — forked from coryhouse/authorApi.js
Mock Author API for "Building Applications with React and Flux" on Pluralsight
"use strict";
//This file is mocking a web API by hitting hard coded data.
var authors = require('./authorData').authors;
var _ = require('lodash');
//This would be performed on the server in a real app. Just stubbing in.
var _generateId = function(author) {
return author.firstName.toLowerCase() + '-' + author.lastName.toLowerCase();
};
@HaiderMalik12
HaiderMalik12 / Galaxy Of Tutorial Torrents
Created November 25, 2016 16:19 — forked from iHassan/Galaxy Of Tutorial Torrents
Ultimate Galaxy Of Tutorial Torrents
=============================
**http://kickass.to/infiniteskills-learning-jquery-mobile-working-files-t7967156.html
**http://kickass.to/lynda-bootstrap-3-advanced-web-development-2013-eng-t8167587.html
**http://kickass.to/lynda-css-advanced-typographic-techniques-t7928210.html
**http://kickass.to/lynda-html5-projects-interactive-charts-2013-eng-t8167670.html
**http://kickass.to/vtc-html5-css3-responsive-web-design-course-t7922533.html
*http://kickass.to/10gen-m101js-mongodb-for-node-js-developers-2013-eng-t8165205.html
*http://kickass.to/cbt-nuggets-amazon-web-services-aws-foundations-t7839734.html
@HaiderMalik12
HaiderMalik12 / AWS_S3_File_Upload.js
Created April 24, 2017 13:37 — forked from homam/AWS_S3_File_Upload.js
How to upload files to AWS S3 with NodeJS SDK
var AWS = require('aws-sdk'),
fs = require('fs');
// For dev purposes only
AWS.config.update({ accessKeyId: '...', secretAccessKey: '...' });
// Read in the file, convert it to base64, store to S3
fs.readFile('del.txt', function (err, data) {
if (err) { throw err; }
const promiseChaining = (req, res, next) => {
let rsp = {};
const company = new Company({
name: 'FullStackhour'
});
company.save()
.then(savedCompany => {
rsp.company = savedCompany;
const job = new Job({
title: 'Node.js Developer',
function loopDemo(req, res, next) {
let users = [1, 2, 3, 4, 5, 6];
let results = [];
async.each(users, (userId, cb) => {
RestClientService.get(`http://jsonplaceholder.typicode.com/users/${userId}/posts`, (posts, response) => {
if (response.statusCode !== 200) {
return cb('Unable to fetch the posts');
//import the hapi package
const hapi = require(‘hapi’);
//create new server
const server = new hapi.Server();
//connect the server to localhost and port should be 3000
server.connection({
host: ‘localhost’,
port: ‘3000’
npm init
npm install — save hapi
node server.js
const hapi = require(‘hapi’);
const server = new hapi.Server();
server.connection({
host: ‘127.0 .0 .1’,
port: ‘3000’
});
server.route({