Skip to content

Instantly share code, notes, and snippets.

Avatar
📚
Being Geek!

Shekhar Prasad Rajak Shekharrajak

📚
Being Geek!
View GitHub Profile
View 1SheeldVoiceTwitFacePoster
//Not all this code is my code. This code is part of 1Sheeld.com code. It is part of their simple example-Voice Recognizer
/* if you post to much to facebook ant twitter in a short amout of time you wil not be able to post anything for a while*/
/*Keep by 140 characters when using Twitter otherwize it will not tweet*/
/* Include 1Sheeld library. */
#include <OneSheeld.h>
/* Voice commands set by the user. */
//Voice commands the 1sheeld is going to react to -- Set by the user--
const char tweetCommand[] = "tweet"; //Change the word in the brackets to your preffered word
const char facebookpostCommand[] = "post on facebook"; //DO NOT USE CAPITALS
@Shekharrajak
Shekharrajak / login.ejs
Last active Aug 29, 2015
For the tutorial on medium.com : passportJS auth
View login.ejs
<div class = "col-md-6" style="left:20%;margin-top:10%">
<form action="/login" method="POST" class="form-signin">
<br>
<br><br>
<h3> Login here </h3>
<input type="text" class="form-control" placeholder="Email address" name="email"><br>
<input type="password" class="form-control" placeholder="Password" name="password"><br>
<input type="submit" class="btn btn-default center-block col-xs-12" value="Login"><br>
<p style="text-align:center;margin-top:30px;">Don't have an account? <a href="/signup">Sign Up</a></p>
@Shekharrajak
Shekharrajak / signup.ejs
Created Jul 16, 2015
For the tutorial on medium.com : passportJS auth
View signup.ejs
<div class = "col-md-6" style="left:20%;margin-top:10%">
<form action="/signup" method="POST" class="form-signin">
<h3>Create a new account..</h3>
<input type="text" class="form-control" placeholder="Email address" name="email"><br>
<input type="password" class="form-control" placeholder="Password" name="paassword"><br>
<input type="submit" class="btn btn-success center-block col-xs-12" value="Sign Up"><br>
<p style="text-align:center;margin-top:30px;">Already have an account? <a href="/login">Sign in</a></p>
<input type="hidden" value="<%= _csrf %>" name="_csrf">
@Shekharrajak
Shekharrajak / passport.js
Created Jul 16, 2015
For the tutorial on medium.com : passportJS auth
View passport.js
var passport = require('passport'),
LocalStrategy = require('passport-local').Strategy,
bcrypt = require('bcrypt');
passport.serializeUser(function(user, done) {
done(null, user.id);
});
passport.deserializeUser(function(id, done) {
User.findOne({ id: id } , function (err, user) {
@Shekharrajak
Shekharrajak / AuthController.js
Created Jul 16, 2015
For the tutorial on medium.com : passportJS auth
View AuthController.js
/**
* AuthController
*
* @description :: Server-side logic for managing auths
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
*/
var passport = require('passport');
module.exports = {
@Shekharrajak
Shekharrajak / User.js
Created Jul 16, 2015
For the tutorial on medium.com : passportJS auth
View User.js
/**
* User.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/#!documentation/models
*/
var bcrypt = require('bcrypt');
module.exports = {
@Shekharrajak
Shekharrajak / isAuthenticated.js
Created Jul 16, 2015
For the tutorial on medium.com : passportJS auth
View isAuthenticated.js
module.exports = function(req, res, next) {
if (req.isAuthenticated()) {
return next();
}
else{
return res.redirect('/login');
}
};
@Shekharrajak
Shekharrajak / routes.js
Created Jul 16, 2015
For the tutorial on medium.com : passportJS auth
View routes.js
module.exports.routes = {
/***************************************************************************
* *
* Make the view located at `views/homepage.ejs` (or `views/homepage.jade`, *
* etc. depending on your default view engine) your home page. *
* *
* (Alternatively, remove this and add an `index.html` file in your *
* `assets` directory) *
@Shekharrajak
Shekharrajak / layout.ejs
Created Jul 16, 2015
For the tutorial on medium.com : passportJS auth
View layout.ejs
<!DOCTYPE html>
<html lang="en" ng-app>
<head>
<title>PassportJS Auth</title>
<!-- Viewport mobile tag for sensible mobile support -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!-- Created by shekhar Prasad Rajak follow me on github for more awesome repo : www.github.com/shekharrajak -->
<!--STYLES-->
<link rel="stylesheet" href="/styles/animate.css">