A free, hosted, advanced wiki – Dropbox Paper

Around a year ago, while starting a new project, I was asking a friend and colleague for a suggestion between Docuwiki and Confluence to use as team wiki. He suggested trying Dropbox Paper instead. I’ve tried, and the result was amazing!

Since then, using it as the team wiki for several projects happily. In this post, I’ll share some of the points which convinced me to use Dropbox Paper as a wiki (or alternative of wiki) for a team.

Why Dropbox Paper?

Take 3 minutes to go through the following points and screenshots. Hopefully, you’ll find Dropbox Paper a good fit for many of your situations where you’ll use a wiki.

Continue reading →

Merge Images and PDFs into PDF

When working with PDF documents or scanned images, it’s a pretty common task to merge them to PDF. We have been doing these things using imagemagick and ghostscript for years. But we had to compromise with a few serious drawbacks of that process including converting PDF pages into image snapshot and increasing file size. So, eventually, I have written merge2pdf a tiny cli tool for this job (and a few extra).

This post is to show some example usages (commands) of this tool for different scenarios.

Highlights

Before diving into commands, let’s go through a list of highlights of this tool.

  • Lossless quality by default. Option to adjust JPEG quality
  • Can be merged all pages or only specific pages of PDF
  • Supports a wide range of image formats
  • Options to adjust size, margin, and scaling of images
  • Supports directory as input (merges all Images/PDFs of a directory)
  • Free and open source
  • Very simple and easy to use

Continue reading →

Backup your database periodically to free cloud storage

Database Backup Mega.nz

You want to keep a periodical, automatic backup of your database. And, for safety, you are thinking to keep these backups to a (preferably free) cloud storage. Then this post is for you ?.

It can be done in thousands of ways. But, I am trying to show you an easy, almost effortless process. Just bear with me for 10 mins and you’ll see it’s happening.

Let’s start.

Continue reading →

Adding watermark on image or PDF with PHP

Watermarking with PHP is not a complex thing. Google will list hundreds of solutions using GD or ImageMagick. But the complexity starts when I need custom positioning, rotation, repetition etc. Though all those things are just a matter of tweaking some options in ImageMagick or GD, discovering them every time is a pain. So I just encapsulated all those tweakings in a PHP library.

Check it – ajaxray/php-watermark

Continue reading →

Dependent / Cascading Select List with jQuery Select2

Select2 is one of the most popular select list plugin for jQuery. It has beautiful features and powerful customization options.

One missing feature of Select2 is built-in support for making select boxes cascading/dependent. In simple words, loading/refreshing options of a select2 list box using ajax based on selection of another select2 list box. So, I’ve written a reusable class for this purpose.

Get it here – Select2 Cascade (for v4.x)

Looking for a demo?

Here is it – live demo.

Thanks to Codepen, JSON Blob and Twitter Bootstrap for making demonstration so easy!

Continue reading →

Convert Excel TSV to CSV in vim

After Copy-Paste some data from MS Excel spreadsheet, it appeared to be half thousand TSV (Tab Separated Values) lines in vim. Then it took around 20 seconds to convert it to CSV! So, how did I do it so quickly?

Okay, it was just two simple replace command using vim regexp –

:%s/\t\(.*,[^\t]*\)\t/\t"\1"\t/g 
:%s/\t/,/g

The first line is adding quotes around column values which have comma in it. And the next one is to replace tabs with comma. Done!

Hope this tip will save someone’s time someday 🙂

Store data to Google Sheets using PHP

Google SheetsIn some cases, when you need to dump some data to somewhere easily accessible, pushing to Google Sheets can be a good option. You can store data to Google Spreadsheet from cron jobs, background workers or even simple form submission. For example, in my case, I am logging some information from mailgun hooks.

While I were doing that, it seems like this easy task took more time then expected only because of lack of documentation. So, trying to write down an easy to follow tutorial that can make you set and pushing data to goggle Spreadsheet within 20 minutes.

Continue reading →

Multiple sites with Apache Server on different ports or domains

Apache Server multiple site on ports

Sometimes people become amazed with an awesome feature of his new shiny tool, and never discover that it was already there for years in his old boring tool. A good example of this phenomenon is – I see people choosing nginx for it’s ability of listening to multiple ports and domains.

Definitely there are solid reasons and cases for choosing nginx. But, I’ll say, this one alone is not a good reason for switching to nginx if you’re already running on and confident with Apache Server. Because, you can serve multiple apps/sites on different ports or domains using Apache too.

Let’s see some quick example of how Apache can do it. I’ll here just list a few example of Apache VirtualHost configs for various cases with a single server.
Continue reading →

Track or count online users in Firebase webapp

It’s a pretty common need to track online users of an web application. Sometimes for counting total online users, sometimes by isolated space, e.g., by chatroom or shared list. So, instead of doing similar things every time, I’ve written a javascript module to use in Firebase web applications – Gathering.js.

In this post, I’ll show how it can be used for various type of tracking needs with small code snippets.

BTW, if you are thinking what Firebase is, it’s a Google acquired app development platform for mobile and web. For web application, it’s providing ready made infrastructure with super fast realtime database, flexible Authentication, cross platform Cloud Messaging, static hosting, CDN… (almost) everything you need to develop an app (or a feature) quickly with robustness. You should give it a try.

Continue reading →