Skip to content

Instantly share code, notes, and snippets.

View xadim's full-sized avatar
💭
Code Enthusiast

Hadim J. xadim

💭
Code Enthusiast
View GitHub Profile
/**
*
* @param str
* @returns
*/
function reversePolish(str) {
str = str.split(" "), result = [];
if (str === "" || str === null) return;
let haystack = str.map((i) => {
@xadim
xadim / AWS apache SolR issue with Drupal Connection: Your site was unable to contact the Apache Solr server.
Created January 25, 2018 16:19
Setup Connection between A Drupal website and SolR Server on AWS: Your site was unable to contact the Apache Solr server.
After installing SolR, you need to add your collection in solr by running : sudo su - solr -c "/opt/solr/bin/solr create -c mysolrcollection -n data_driven_schema_configs"
Your Solr collection link should look like:
-> http://your_domain_or_ip:8983/solr/mysolrcollection
Your SolR AWS Security Group should allow ip from your Drupal domain, then try to reconnect Drupal and SolR.
Cheers!!!
@xadim
xadim / Unhasher.js
Created April 8, 2016 04:12
Full functions Hashing and Unhashing in Javascript...
//Write JavaScript code to find a ten letter string of characters that contains only letters
//I've been tested with this and here is the solution for those it may interest
/*
Here is the given pseudo code that I changed to retrieve my company's name
It's in 10 words.
I call it a Hasher
*/
function hasher(hashedValue)
@xadim
xadim / Date interval into Human Readable Time
Created April 2, 2015 21:54
Simple snippet PHP function that turns Date interval into Human Readable Time
/**
* Format an interval to show all existing components. Human Readable Time
* If the interval doesn't have a time component (years, months, etc)
* That component won't be displayed.
*
* @param DateInterval $interval The interval
*
* @return string Formatted interval string.
*/
function format_interval(DateInterval $interval) {