Skip to main content

Posts

Showing posts with the label Awesome

Three ways to use user defined vscode snippets

What are code snippets? Code snippets are templates that make entering repeated code patterns, such as loops or conditional statements,  easier. Types of snippets Built-in snippets   Vscode has built-in snippets for number of languages like PHP, Javascript, Typescript etc . Snippets available on market place   There custom snippets averrable on marketplace for specific frameworks / languages and platforms as well. For example snippets for VUE, Laravel etc. User defined snippets  You can defined your own snippets, It's called user defined snippets. You can create snippets according to your need using the snippet templates.

Use google cloud log-sink to log incidents to your project management system

Small team working on multi service product, With carrying more then one responsibilities. It's a big challenge to keep everything on track. Most importantly, When it comes to incident reporting. We can not automate every thing but, at least we can automate incident reporting to our project management service eg Gitlab / GitHub / Slack. ( Slack 😅 , for small team like us slack also work like project management tool. ) Google cloud log-sink Here comes google cloud log-sink handy to you. We can direct all of your logs with severity level of Error Crtitical Alert Emergency to a logs ink which log a incident on your project & issue tracking service ( For example Gitlab ) using cloud pub/sub topics. [ You can use firebase function for such pub/sub topics ] Inclusion filter for error logs severity='(ERROR OR CRITICAL OR ALERT OR EMERGENCY)' Next time when ever error log will be generated on your cloud logs. You will get an incident created on your gitlab. So Don't wait...

Google blogger Ideas panel

Google blogger Ideas  I opened by blogger today, and..   I got this.  Google blogger Ideas  A panel suggesting a topic on which I can write my next blog. It's fetching unanswered question from web according to your previous post and topics. It was something, I was really looking for, after all it takes time to finding subject on which to write next and still being in the same niche.  Awesome feature Blogger! 

Immutable.js with firebase

To store data we can use either object or we can use array in javascript. Both have their own advantage and disadvantage. Array : Array has advantage of maintaining order, but negative side is that If you want to update any element inside array you have to find the index of the element. May be via looping through the whole array if indexes are not predictable. Object : You can store element as object property. It's like key-value pair, So If you want to update any property (element) of object, you can update it easily using key. So, It's easy to update the elements in object, but object uses hash for property, So order is not guaranteed. Immutable.js with firebase Firebase provides live updates. Suppose you are having a program where you are listening for live updates on some last x elements, while retaining others for display only, but order of display matters.  You are listening for last x elements live, So you have to update the data of those elements when you receive upd...

Ahmedabad Shopping festival

Ahmedabad Shopping festival is solution created by  Tuzzin Infotech Pvt. Ltd . I worked as part of the development team My journey started as a part-time web developer. A MySQL database, Php for backend, VueJs and jQuery frontend, scss for css and I'm done. So easy! I was never thinking about scaling, rate limiting, timeout on those days, and normal site even does not need to care about such things unless they reaches that threshold. Luckily, I got chance to work on a product which was requiring all of this. It was the first time when I got exposure to real scalable application with spike in traffic, Ahmedabad Shopping festival 2019.   Brief Intro of Ahmedabad Shopping festival  Ahmedabad Shopping festival was first digitally managed shopping festival of India hosted in Ahmedabad, Gujarat. Every customer were getting rewards and coupons for chance to win prize on making shopping during shopping hours . Technical requirements Ahmedabad Shopping festival was con...

Creating 2d games with golang and gontuz/prototype

Golang was created as server language. But with the time and curiosity of people, golang has covered GUI application and game development as well. I am sharing here one of the available golang library, on top of which you can create 2d games. Its gonutz/prototype . Sample video Gonutz/prototype is very small and easy to learn library. It's cross-platform , that means the game your are creating in one platform will be able to run on other platforms without any change in code ( in normal case ).  This package currently supports windows , mac and linux. gonutz/prototype features Support for keyboard input Support for mouse input Support for 2d drawing Support for image and sprite-sheets Support for sound  Want to learn more about this package.  Follow my youtube video playlist "2d game development in golang" Video tutorial playlist:   https://www.youtube.com/playlist?list=PLub5C2vM5SjJIF0f561mAON7nFG2nKHD9

Customize Scrollbar look

You can customize the look of scrollbar using CSS. Here is a snippet of sample custom scrollbar UI, ( I have introduced  : hover   because I want to show scrollbar on an element only when user hover on that element ) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 *: :-webkit-scrollbar { width : 5px ; display : none ; background-color : #666666 ; } * :hover : :-webkit-scrollbar { width : 5px ; display : block ; background-color : #666666 ; } *: :-webkit-scrollbar-track { background : #ddd ; } *: :-webkit-scrollbar-thumb { background : #666 ; border - radius : 20px ; }

Cursor based navigation for datatable

I was working on a module where data was comming from datastore and paginated using cursor. If you are not familier with datastore, then you can refer to this link . In case of datastore we just have cursor to get next set of data. Though there is offset availabe in datastore its costly. So to be cost effective we have only option available is cursor. Datastore decodes cursor and in response returns data associated with that cursor. Now, If you are using bootstrap data-table you might find it cofusing that how to pass the cursor to your queryparameter. Even I still don't get answer of how I can change data-queryparamter dynamically to update cursor on the url. But instead I got another simple solution. HTML Snippet <table id= "table" data-toggle= "table" > <thead> <tr> // your data table fields </tr> </thead> <tbody></tbody> </table> <nav aria-label= "Page ...

partial search with firestore

You can provide partial search [ type ahead facility ] with firestore. It's not that much streight forward and also not feasible in case of large amount of data that has to support the partial search. Here is just a sample of how you provide partial search with firestore. Logic behind the search is a custom kind of indexing that enables partial search for us. You need to create a collection of documents called indexes which contains indexes generated for the fields you want to search over. First reqirement is to create every possible partial search strings. Below function returns array of the possible indexes generate after chopping out input string character by character. /* storing searchabel fields */ function _chopped_object(iString) { var searchables = {} for (i = 0; i < iString.length; i++) { var string_part = iString.substr(0, iString.length - i) searchables[string_part] = true } return searchables } Output of _chopped_o...

Upload Files to Firebase Storage with dropzone.js

Almost every file uploader I found on web are expecting url to where we want to upload file. If you are using firebase storage then you will find this awkward as you don't have any rest url where you have to upload file .  Instead, file upload handled by firestore library firebase-storage. After certain effort I found a way to use dropzone.js with firebase storage. Here is some snippet of code which you may find useful, If you are in the same situation as I am. This both function are in same file Dropzone configuration.. ( in index.js ) var myDropzone = new Dropzone( "form#dropzone" , { // Make the whole body a dropzone url : '/' , addRemoveLinks : true , method : 'put' , chunking : true , forceChunking : true , autoQueue : false , autoProcessQueue : false }); myDropzone.autoDiscover = false ; myDrop...

mailgun forward incoming mail

Mailgun is email service provider. For detail infomration about mailgun you can visit its site mailgun.com . Untill my last project( blogger-editor.xyz ) i was just using mailgun sending mails. There was no need to receive emails on that domain. But in blogger-editor.xyz , I need to have a domain based email address on which i should send and receive email. Its quite straight forward setup to receive email through mailgun. Just you have to do these two things : Make sure your mx record points to mailgun. [ It should be ticked verfied on mailgun dns verification ] Setup route on mailgun MX Record setup with Domain Registrar In domain verification and Dns section of mailgun you will find that you have to setup two mx record with your domain service provider. mxb.mailgun.org ( priority 10 ) mxb.mailgun.org ( priority 10 ) During creation of mx record you will be asked for host. Host value for your record is the @ if you are using root domain with mailgun , and it w...

Sciter : GUI Application with Golang using HTML/CSS

GUI library for golang sciter This is the words from Sciter's Web site, Sciter brings a stack of web technologies to desktop UI development. Web designers and developers can reuse their experience and expertise in creating modern looking desktop applications. Various GUI frameworks offer different UI declaration and styling languages, such as QML and  XAML (Microsoft WPF) . On the contrary, Sciter allows using time proven, robust, and flexible HTML and CSS for GUI definition and GPU accelerated rendering.   Before using sciter I already tried other alternatives but none of them was satisfactory as an example first i tried andlabs / ui  library   i already have written a post on it. You can read it on post gui programming with golang .  But this library is still under construction and has no support for production apps. Secondly, I go for electron but the problem was my simple calc like the app was of size 150mb....

multithreaded copier in golang example

multithreaded copier in golang example Here I am sharing snippet for  the multithreaded copier in the golang example.  What it does is Read the source file meta ( specifically size ) Divides the file size into 8 equal groups Generates goroutines for each group  for copying The code is so self-explanatory. Still, if you find any problem to understand leave a comment  👇. 😀

Setup development environment for Hyperledger composer on windows

There is no direct best ( or at least I don’t know ) way to create a good development environment for the hyper ledger composer on windows. I have installed hyper ledger on windows and it’s also not working satisfactorily. I want to develop in windows while want to run it smoothly like in Ubuntu. So the way I found is virtual box and ssh. Vagrant is kind of the thing that gives this readymade. But .box file we need to download is very slow in speed [ 150 kbps] and for me, it was disconnecting continuously. So I left the vagrant and find another way to get the facility provided by the vagrant. I am going to show the way I created my development environment. You Need  Virtual Box ISO of ubuntu server 16.04 LTS OR Ubuntu Virtual Box  Machine That's it. If you have this two things you are ready to go. Prepare Ubuntu Server Virtual Box Machine Either install ubuntu 16.04 on the virtual box or import the ub...