TL; DR:
I’ve released a PHP library for Adding watermark on image or PDF with PHP last year. As of today, it has 43 stars and 15 forks and 16 issues (10 of which are closed).
Continue reading →TL; DR:
I’ve released a PHP library for Adding watermark on image or PDF with PHP last year. As of today, it has 43 stars and 15 forks and 16 issues (10 of which are closed).
Continue reading →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
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 →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.
Before diving into commands, let’s go through a list of highlights of this tool.
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.
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
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)
Here is it – live demo.
Thanks to Codepen, JSON Blob and Twitter Bootstrap for making demonstration so easy!
It’s a simple bash script that checks system readiness for launching an application. It checks –
Here is a sample output –
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 🙂
In 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.
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 →