Posts

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");                            

Laravel using Cookies to Save URL Question Mark Parameter

Image
In Laravel most of the time cookies are set by the response .Further most of the posts does not directly tell how to retire URL Get  parameters. Eg: https://www.blogger.com/? blogID=1441573773987640178 To retrieve the value we can take the value in routes >>web.php Route::get('/', function(){      $term = Input::get(' blogID ');       if(isset($term)){         Cookie::queue(Cookie::make(' blogID ',$term, 60*24*365));       }     return view('home'); }); In here cookies are save using (Cookie::make) . In the next response the cookie value get saved in client browser.               e.g.  $cookie = Cookie :: make ( $name , $value , 60 ); http://laravel-recipes.com/recipes/48/creating-a-new-cookie To retrieve the Cookies value is simple       $request->cookie(' blogID ');