Posts

Docker Dev Environment with Nodemon and Mongo DB

Image
1 Install Docker  Community ediction and Composer https://blog.codeship.com/using-docker-compose-for-nodejs-development/ 2 . Sampe application resides in server folder which have the package.json file ensure package.json  has script.  "start": "nodemon -L index.js" ensure nodemon.json exhist 3. touch Dockerfile. FROM node:8.1.0-alpine RUN mkdir /server RUN npm install nodemon -g ADD ./server /server WORKDIR /server RUN npm install #ADD server/nodemon.json /server/nodemon.json EXPOSE 3000 CMD npm start 5. docker-compose build 6.touch docker-compose.yml version: '2' services:   web:     build: .     volumes:     - "./server:/server"     ports:       - "3000:3000"     links:       - mongo   mongo:     image: mongo:3.4.4     container_name: mongo     ports:       - "27017:27017" 7.docker-compse up. application runs in localhost port 3000

Firebase Promises

Image
 Firebase Nodejs requests are Asyncronus .Which means, in the follwing code block I need to check order users exhist before set user. But the user order insert fucntion written second will fire before validation finished .Developer need to careful on this when firebase adopted.     for(var user in users) {                                              f irebase.database().ref("users"); users.once("value", function(snapshot) {                                      var temp= snapshot.exists();                                                             if (temp) {                                           var temp= on_exhist_checked(snapshot);                                              }                          });                      } function on_exhist_checked(snapshot) {                             var  temp= f irebase.database(). child(snapshot.key).child('orders').set({                                   key: true                

Firebase REST API auth - access token

I have to use Firebase Database and server a REST API .I need to allow the REST API call only for authenticated users from the same freebase. According to Documentation on REST API Save data > Auth Section I able to successfully access the Database using database secret . https://firebase.google.com/docs/database/rest/save-data But I could not successfully retrieve the data using access token of authenticated user . https://<<removed-my-project-id>>.firebaseio.com/users.json?access_token=ya29.GlxuBLxJ6R2uNYJ7SXnMhe7Inqw94ShGeZ7MTBmyxYUI2cLDCXJcPAfbo1_uKLjUhfPX3uQw_ElBjIVwu73caeKJfBAh87GGRWZx2JiSwuIZybAmtVXyFyqaeYbAJQ Reffering confusing document again I pass the URL as fallows using the idtoken.(currentUser.getIdToken taken from cleint side) https:// <<my-project-id>> .firebaseio.com/users.json?auth=eyJhbGciOiJSUzI1NiIsImtpZCI6IjBkNWNlYjA1ODA2ODk3OTM3ZTAxNGFjMDNkYWZkODQyMzM4ZjBlNmQifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vZmV0Y2htZS1

Custom Email template for Laravel Password Reset

Image
Today I got new task with laravel , since I  have forget passwrod reset scenario. It works but not using the UIs of our theme.Scpecailly mail. However reset pasword section of the follwing helps me . http://miftyisbored.com/a-complete-laravel-5-3-tutorial-for-user-authentication-with-activation-email/ Mailtrap will help you. php artisan vendor:publish --tag=laravel-notifications     // email template php artisan make:notification ResetPassword.          .//edit temaplte parameters chage user class to call notification   public function sendPasswordResetNotification($token)     {         $this->notify(new ResetPassword($token));     } change ResetPassword in notification folder  eg : namespace App\Notifications; use Illuminate\Notifications\Notification; use Illuminate\Notifications\Messages\MailMessage; class PasswordResetNotification extends Notification  {     /**      * The password reset token.      *      * @var strin

Laravel Session Time Out - Trying to get property of non-object Error

Image
I have faced the follwing  error in laravel in user logged pages . Laravel Session Time Out  - Trying to get property of non-object Error The reason for error is session time out of the logged user but it not properly handled in the views . In larvel if the logged in user from auth , can be logged out using same auth middleware. Route::post('controllerName','folderName\fileName@fnNmae')- >middleware('auth'); https://stackoverflow.com/questions/34443632/make-session-expiration-redirect-back-to-login

Dynamic Responsive Pinterest Style Columns Layout with Pure CSS

Image
When Im searching for casarole  layout I found the following which is really helped me. I further improved and shared herewith. http://www.cssscript.com/dynamic-responsive-pinterest-style-columns-layout-with-pure-css/ HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jquery实现瀑布流效果</title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script src="../js/jquery.js"></script> <script src="../js/waterfalls.js"></script> </head> <body> <section id="title"> <h2>jquery瀑布流效果特效代码</h2> </section> <div id="warp"> <div class="box"> <div class="pic"> <img src="../images/img_1.jpg" /> </div> </div> <div class="box"> <div cla

jQuery Validator with Loding GIF

Image
I had to add Loding GIF   form submmit but it was not trigger at the exact event due to form validations. However as fallows it can be achieved easy .I use jQuery form validator (not HTML 5) . CSS div#spinner {     display: none;     width:160px;     height: 160px;     position: fixed;     top: 50%;     left: 50%;     background:url(../images/page-loader.gif) no-repeat center ;     text-align:center;     padding:10px;     font:normal 16px Tahoma, Geneva, sans-serif;     margin-left: -50px;     margin-top: -50px;     z-index:2;     overflow: auto; } HTML  <div id="spinner"></div> JS $(document).ready(function() {    $("form[name='registerRefer']").validate({     rules: {        name: {            required: true,        } },                                  submitHandler: function (form) {                                   $("div#spinner").fadeIn("fast");