Skip to content

Instantly share code, notes, and snippets.

View mhamzas's full-sized avatar

M Hamza Siddiqui mhamzas

View GitHub Profile
@mhamzas
mhamzas / phpfunction_helper.php
Created March 31, 2016 17:28
Useful PHP functions.
<?php
////////////////////////////////////////////////////////////////////////////////////////////////////
// Function: array_to_json //
////////////////////////////////////////////////////////////////////////////////////////////////////
function array_to_json( $array )
{
if( !is_array( $array ) )
{
return false;
@mhamzas
mhamzas / remove-words.php
Created September 29, 2016 14:31 — forked from keithmorris/remove-words.php
PHP remove common words from a string
<?php
function removeCommonWords($input){
// EEEEEEK Stop words
$commonWords = array('a','able','about','above','abroad','according','accordingly','across','actually','adj','after','afterwards','again','against','ago','ahead','ain\'t','all','allow','allows','almost','alone','along','alongside','already','also','although','always','am','amid','amidst','among','amongst','an','and','another','any','anybody','anyhow','anyone','anything','anyway','anyways','anywhere','apart','appear','appreciate','appropriate','are','aren\'t','around','as','a\'s','aside','ask','asking','associated','at','available','away','awfully','b','back','backward','backwards','be','became','because','become','becomes','becoming','been','before','beforehand','begin','behind','being','believe','below','beside','besides','best','better','between','beyond','both','brief','but','by','c','came','can','cannot','cant','can\'t','caption','cause','causes','certain','certainly','changes','clearly','c\'mon','co','co.','com','come','comes','concerni
@mhamzas
mhamzas / HostNameRouter.php
Last active July 25, 2017 11:06 — forked from chill117/HostNameRouter.php
Manage multiple hostnames (domains, sub-domains) within a single instance of CodeIgniter.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
Manage multiple hostnames (domains, sub-domains) within a single instance of CodeIgniter.
Example:
If you had the following domain/sub-domain style for your site:
your-domain.com
@mhamzas
mhamzas / solrMysqlSetup.md
Created October 31, 2017 13:15 — forked from rnjailamba/solrMysqlSetup.md
Solr + Mysql + Data Import Handler + Delta Import Handler [ Version 5.5.0 of solr ]
@mhamzas
mhamzas / 00. tutorial.md
Created October 31, 2017 13:48 — forked from maxivak/00. tutorial.md
Importing/Indexing database (MySQL or SQL Server) in Solr using Data Import Handler
@mhamzas
mhamzas / AutocompleteController.cls
Created December 28, 2017 07:36 — forked from peterknolle/AutocompleteController.cls
Lightning Autocomplete Component
public class AutocompleteController {
@AuraEnabled
public static List<sObject> getSuggestions(String sObjectType, String term, String fieldsToGet, Integer limitSize) {
// could add in logic to remove possible duplicate fields
String fields = fieldsToGet.length() > 0 ? ',' + fieldsToGet : '';
String soql =
' SELECT Name, Id ' + String.escapeSingleQuotes(fields) +
' FROM ' + String.escapeSingleQuotes(sObjectType) +
' WHERE Name Like \'' + String.escapeSingleQuotes(term) + '%\'' +
@mhamzas
mhamzas / apkdl.sh
Created January 31, 2018 14:21 — forked from arulrajnet/apkdl.sh
Script to download apk file from Google Play a.k.a Android Market.
#!/bin/bash
#
# Script to download apk file from Google Play a.k.a Android Market.
# Accepts package name or Google Play URL as input.
# Files are download from apk-dl.com
# author : Arul (@arulrajnet)
#
APK_DL_URL="http://apk-dl.com/store/apps/details?id=%s"
PACKAGE_NAME=""
@mhamzas
mhamzas / media-query.css
Created February 26, 2018 06:25 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@mhamzas
mhamzas / SFDCRandomClass.cls
Created March 29, 2018 06:59
Salesforce - Randomize Generic Class
public class Randomizer {
//returns a random Integer
public static Integer getRandomNumber(Integer size){
Double d = math.random() * size;
return d.intValue();
}
//returns either true or false randomly
public static Boolean getRandomBoolean(){
@mhamzas
mhamzas / custom-loki.sh
Created April 11, 2018 08:09 — forked from evertontrindade/custom-loki.sh
Things to do after install Elementary OS Loki (0.4)
# First you update your system
sudo apt-get update && sudo apt-get dist-upgrade
# Clean-up System
sudo apt-get purge epiphany-browser epiphany-browser-data #browser
sudo apt-get purge midori-granite #browser
sudo apt-get purge noise
sudo apt-get purge scratch-text-editor #text-editor
sudo apt-get purge modemmanager
sudo apt-get purge geary #email