Posts
async and await on array reduce function
Array reduce is a very useful function to reduce the array into a single value, without async await syntax or Promise.resolve() wrappers it won't wait for asynchronous requests so hereRead More →
How to return the value of a function as an object property es6
You can always use Object.defineProperty() to define your object with getters and setters, but this is a hacky but a correct and easy way to do the similar things, unlike Object.Read More →
How to remove duplicates from an array
There are a number of ways to remove duplicates from an array, most of them require you to iterate through all elements once or twice.Read More →
How to select an option by its option text using jQuery
Okay so here is a select list below and you need to choose an option by text so you can mark it as selected or trigger a change etc.Read More →
How to merge two arrays Javascript, ES6 array spread etc
Learn how to merge two arrays in many different ways. Most of the following work on plain JS or using ES6.Read More →
Gulp Error - watch task has to be a function
Gulp is my favorite task manager.Read More →
How to migrate existing Drupal 8 site into a Composer managed structure?
If you set up your site using a downloadable tarball or zip file your composer.json file isn't structured to do Drupal core updates so you need to convert it to a composer manager structure, how do you do it is very simple.Read More →
React Native - JSON value null of type NSNull cannot be converted to NSString
I recently came across this weird errors and tried to figure out why it is happening, the project used GraphQL on Appolo Client over Hapi server.Read More →
How to use async await on map function
The built-in map function in JS does not provide async await.Read More →
In Javascript how to make the first letter of a string uppercase / capitalize
Capitalize string.Read More →
How to convert a string to sentence case
This is a small script to make your string Sentence Case this also can easily be modified to use string to convert to CamelCase.Read More →
Failed prop type - checker is not a function
Failed prop type - checker is not a functionRead More →
Recursively remove empty elements from an associative array in PHP
While there are other built-in functions to remove empty array values like array_filter with callback etc for associative arrays it is important to have similar methods when dealing with a large number of data sets.Read More →
When use StackNavigator how do we change title text dynamically
StackNavigator is the key navigator available for React Native and changing the title dynamically isn't a difficult thing but it is required all the time especially when you use to display one screen for multiple types of listsRead More →
Five Start Widget Formatter for List Integer Field for Drupal 8 using CSS only
First, create the field formatter for list integer field type. Add this file in your custom module.Read More →
How to upload a file in Drupal 8 using FAPI
This is a simple code snippet to show you how to upload a file and save it into the database without much effort.Read More →
Useful Regular Expressions (regex)
Utility RegExRead More →
Programmatically delete nodes in Drupal 8
First load the storage handler using the entity type manager object in Drupal 8 and then we need to load the full node before we delete it.Read More →
How to add Views templates into a module instead of a theme
You can use the hook_views_api to tell where is your template files are.Read More →
Drupal 8 Twig template override Views field template
The most common naming convention for the views field override is as follow.Read More →
How to modify an existing views join using hook_views_query_alter
This will let you alter the query before you execute the query so you have a chance to request a different set of data than originally configured within the views.Read More →
Add class to body based on path alias in Drupal 8
We can simply implement template_preprocess_html in the theme to make this happen.Read More →
Deploying Laravel App to Heroku
The steps are very simple and Laravel works out of the box to support on Heroku. One major important thing is Laravel will not work without the APP_KEY variables so make sure you create that variable via the UI from your App settings or use the command as described.Read More →
Preprocess blocks using hook_preprocess_block
Preprocess is a very common function in Drupal to alter the content and other properties like Lable of a block. The Drupal.org URL itself also provides a glimpse of what it looks like to preprocess.Read More →
How do you check if a field is empty in Drupal 8
This is easy with Drupal 8. We can use built in isEmpty method for this so following is an example of the usage.Read More →
How to load the instance of referenced entity from the field in Drupal 8
Loading the entity or entities from a field is a very useful method in numerous ways. So here are the possible ways to get access to it so you can load it up and access it's properties.Read More →
How To Easily Remove Docker Images, Containers, and Volumes -Shell Commands
Docker utility commands.Read More →
How to programmatically generate Migration entities and config entities
In a recent event I had a requirement to dynamically create Migrations within the entity_update hook.Read More →
Paragraphs - How to create a Paragraph view with node id as an argument (Contextual Filters)
Paragraphs in Drupal 8 is very popular among the content editors and site builders since it's easy of use and flexibility.Read More →
How to asynchronously load views blocks or views attachments in Drupal 8
The lazy load or asynchronously load is a nice way to avoid too much pressure on the server or avoid being cashed by the reverse proxy or something else.Read More →
How to export MySQL tables in to separate files and import back in to a single database
We can use the MySQLDump (mysqldump) command to export tables in to separate files as follow.Read More →
How to install Nginx, PHP MySQL on FreeBSD 11 (FEMP stack) including Composer and Drush for Drupal 8
I'm going to share bunch of commands here I recently tried on a FreeBSD 11 environment.Read More →
Adding a new menu item to admin/config page of Drupal 8
This is fairly straight forward and there is no any special thing to do compared to traditional menu items. So here is how you do it.Read More →
How to set a placeholder text for the proximity search field
In Drupal 7 there are 3 popular ways to create proximity search for your content or entity.Read More →
Merging two Git repositories preserving existing Git history
First Git clone your current Git repository.Read More →
Using constant values in Drupal 8 Migrations
Using constant values is very common in migrations, it can be useful for adding content type machine name, concatenate values or any other default values. Sounds easy.Read More →
How to change the Web Property ID of Google Analytics per hostname / domain / language in Drupal 8
This can be done for almost anything not just for Google Analytics, so what we are going to do here is override exportable configs in settings.php so we can add conditional logics to it.Read More →
How to programmatically update a field's value in Drupal 8
Following are the code snipped to update field values programmatically. Number of different ways are discussed and feel free to comment if anything is missing.Read More →
Drupal Content Translation or Entity Translation and SEO - What you should know
For content translations, the rule of thumb is that focus on SEO of English version then get a good translator to research keywords and translate the content to the target language and work with them to optimize it again in the target language.Read More →
How to use Drupal 8 as a backend for React.js (Drupal 8, ES2015 (w/ Babel) and React.js)
Webform 8.x-5.x is a completely new code base, that takes a different, but familiar approach to solving the challenges of building rich, flexible, and maintainable client facing forms for a Drupal website.Read More →
Steps to clear out or reset the history of a git repository
Resetting and clear out a repository will completely erase your code and all repository history. If you need this data, make a backup now before proceeding.Read More →
Migrate Drupal Webform 6 or 7 in to Webforms in Drupal 8
Webform 8.x-5.x is a completely new code base, that takes a different, but familiar approach to solving the challenges of building rich, flexible, and maintainable client facing forms for a Drupal website.Read More →
How to alter configuration entity data in Drupal 8 or add additional data in to the configuration entities
Here I'm going to detail a little bit about altering configuration entities, the config entities is a great addition in D8 and does a tons of helpful stuff for developers and site builders.Read More →
Need to be able to manually sort attributes by row weight of the product variation with Commerce Fancy Attributes
The solution I'm going to show here is a simple custom code to solve that issue.Read More →
Migrate Ubercart Recurring data to the Commerce Recurring framework along with the Authorize.NET card on file data
I've worked with Commerce Migrate Ubercart module many times and provided number of patches to make it a great and stable module.Read More →
Creating file of 1MB, 2MB or {N}MB using shell command
Is it really possible to create a large file using shell?. I had the same question in my head and while looking at some of the shell commands man pages I figured that yes we can..Read More →
Migrate Magento Stores into Drupal Commerce
Commerce Migrate and the Migrate suite that can migrate Magento stores from either the existing Drupal database or an external database on the same machine.Read More →
How to use gzip or gunzip with mysqldump mysql to import export
The syntax is fairly easy and it is a common practice to use gzip specially when you transfer your backup files over two or more different servers so here is the syntax.Read More →
Changing chmod for files but not directories
For security reasons the files inside a web server should be 644 or lower, 644 is good because otherwise Web Server it self cannot read the file.Read More →
Rewrite local image path to remote path
When a client already have a Website and they needed to do some improvements to the existing site, it is important to get the same copy (as close as possible) from their production and set it up local.Read More →
MySQL - How to do find and replace and remove duplicate entries
Sometimes these small utility codes are really important when you stuck with a large amount of data.Read More →
Downloading an Entire Web Site with wget or HTTrack
If you ever need to download an entire Web site, perhaps for off-line viewing, wget can do the job—for example.Read More →
Views exposed filters weight has no effect? here is how to fix it.
I hope you have a basic understanding of how Views works and what is the form_alter etc.Read More →
BelleCamera the Image Magnifier
Most of the shared hosting providers will only allow very low level of PHP memory for the command line.Read More →
How to increase php memory limit for drush in a shared host
Most of the shared hosting providers will only allow very low level of PHP memory for the command line.Read More →
Change the Timezone List on Drupal
Recently I did some work related to change the user timezone listing on user registration and edit forms of Drupal.Read More →
How to get user location data without using HTML5 or Google maps
I recently worked on a project that required to detect the user country and redirect to the proper website based on that, I'm on Drupal and i know there are contrib modules out there to do that..Read More →
How to ssh to a server using another server?
I've been doing a lot of server side stuff lately and I'm loving working on the shell and learning a lot of new shell commands too.Read More →
Multiple Checkboxes or Radio button descriptions
If you are using the Drupal Form API you might know how to add a description.Read More →
Fix - Adium Facebook Authorization keeps repeating
Recently I changed my FB password for security reasons and this error keep bugging me on Adium, for some reason Adium couldn't authenticate.Read More →
Jenkins template for continuous integration for Drupal Multi Site
We've been working on implementing continuous integration for our projects to improve code quality.Read More →
Remove HTTPAuth Authentication
I think you came to this post sine you or someone already had installed httpauth on your websites/server.Read More →
How to Use Google AdSense or DFP on a Responsive Website
Responsive web sites are kind of a hot topic these days, every one needs a responsive web site. Most of the today website when the revamp or rebuild they think about making them responsive too.Read More →
Parallax scrolling with jQuery
When I first heard about Parallax, I was like what the hack is that?. Then I started googling about what is Parallax effect (I knew it was a JS thing). Okay, Wikipedia came up first.Read More →
Wondering what is the X-Drupal-Cache is?
Hope your familiar with Drupal Drupal is a popular content management system.Read More →
Quick and Dirty Facebook JS oAuth example
This is a really simple FB oAuth code that I used in a project I recently worked. This does a really simple job but this will might help someone to start something big..Read More →
SCP with Tar compression
Do you have couple of Giga, Tera byes of data to transfer between servers?. Did you have to move your files in to a new server.Read More →
How to refresh the file index with a new .gitignore
Git is the one of powerful tools that I'm using on my day to day activities, but sometimes it's better to share some of my experiences with it.Read More →
Compress files that are recently added
I recently had a 3-4TB data transfer for a client who are a publishing company in NY.Read More →
Forgot Jenkins password or changed security
Did you changed security on and now you cannot login? Don't worry we've got you covered.Read More →
How to increase your /tmp partition size
The /tmp directory is just a directory. Most people who install Ubuntu do so by setting up one big partition, so /tmp doesn't really have a fixed size limit, aside from the size of the main Ubuntu installation.Read More →
How to flush or clear your varnish cache
What is Varnish? Don't think you hit this link accidently but here is some introduction for the newbies..Read More →
Drupal Batch API
Batch API! What it does? It creates and processes batch operations :).Read More →
Field collections CRUD(Create/Update/Delete) operations programmatically
With the entity system in Drupal 7 the fields has a real big value and what about a field which has number of fields tha we can manage inside it.Read More →
Custom Field Handlers for Views 3
Here are the basic steps to create custom field handler for views 3.Read More →
Video module now compatible with WYSIWYG
Today I released new beta version of the video module, we have fixed lot of core issues on the video module, wiped out unwanted code, formatted code to match coding standards and lot moreRead More →
Video module 7.x-2.x, what you should know?
This major version completely redesign the video module and its core.Read More →
Video module 7.x-2.x, configure Zencoder
Today I released the Drupal video module 7.x-2.x first stable release..Read More →
Magic with HTML5 <video> tag controls
I got a chance to play with HTML5 video tag recently using some JS hacks, so had a lot of fun with that (Sometimes clients are requesting me to do this kind of work for their site, Thanks Jeff)Read More →
How to Redirect a Web Page in 12 ways
301 redirect is the most efficient and Search Engine Friendly method for webpage redirection.Read More →
hook_query_alter (Altering Queries in D7)
In a query object u may use Tag and Metadata but neither tagging nor meta data do anything on their own..Read More →
Programmatically creating video fields
Creating video fields are useful when you have videos in your hand and need to import to Drupal using Drush or running a script.Read More →
Missing label on CCK single on/off checkbox
Its not an issue on Drupal, its the way we create the field. For single on/off checkboxes, drupal will use the on label specified in the allowed values field.Read More →
How to theme a Drupal form using tpl.php file
You may already know that tpl.php files are the template controls wich can only affect the output of the contents.Read More →
A PHP script for dealing with DoS attacks
This script is to let you deal with DoS attack.Read More →
How to get *node* visits in access log
If you do not already enable the Statistics module enable the statistics and in admin>reports enable accesslog.Read More →
How to group by in Views 2
This hook is called right before the execute process. The query is now fully built, but it has not yet been run through db_rewrite_sql..Read More →
First impression with views 2 hooks, its amazing
Recently I could work with great two hooks in views2.Read More →
Avoid SQL injection in Drupal
Drupal depends on a database to function correctly. Inside Drupal, a lightweight database abstraction layer exists between your code and the database.Read More →
How to label checkboxes properly
Lets learn how to label checkboxes.Read More →
How to create handy URL for Drupal videos
This piece of code snipped is to provide bunch of info to create video node url's like you-tube videos.Read More →
W3C unveiled today the HTML5 logo
W3C unveiled today an HTML5 logo, a striking visual identity for the open web platform.Read More →
Merge two PHP stdClass() Objects
Merge two PHP stdClass() Objects.Read More →
Performance check for PHP Vs JSP
Summary of PHP VS JSP performance tests.Read More →
🍪 This site does not track you.