Skip to content

Instantly share code, notes, and snippets.

View nahidacm's full-sized avatar

Mahmudur Rahman nahidacm

  • Dhaka, Bangladesh
View GitHub Profile
@nahidacm
nahidacm / magnto2-nginx-fix.conf
Last active May 27, 2018 23:29
Magento2 out of the box nginx config file has got some issues. This file has got the fixes. with comment text #The setup fix
## Example configuration:
# upstream fastcgi_backend {
# # use tcp connection
# # server 127.0.0.1:9000;
# # or socket
# server unix:/var/run/php5-fpm.sock;
# server unix:/var/run/php/php7.0-fpm.sock;
# }
# server {
# listen 80;
@nahidacm
nahidacm / turn-any-form-into-ajax.html
Created December 11, 2016 03:27
Just make some some changes on your form, mostly adding some classes. your form will be a ajax form.
<script>
$(function () {
initAjaxFormPosts();
});
function initAjaxFormPosts() {
if ($("form .form-actions.ajax-form").length > 0) {
$("form .form-actions.ajax-form").each(function () {
var $form = $(this).closest("form");
$form.find(".form-actions.ajax-form .btn.submit").bind('click', function () {
##################################################################################################
############################### Virtualhost named: softanis-pm.com ###############################
##################################################################################################
server {
listen 80;
listen [::]:80;
root /var/www/softanis-pm.com/html;
# Add index.php to the list if you are using PHP
@nahidacm
nahidacm / email-test.php
Created October 30, 2014 03:27
PHP Email Testing Script
<?php
if(isset($_POST['submit'])){
$to = $_POST['email_to']; // this is your Email address
$from = $_POST['email_from']; // this is the sender's Email address
$name = $_POST['name'];
$subject = "Form submission";
$subject2 = "Copy of your form submission";
$message = $name . " " . " wrote the following:" . "\n\n" . $_POST['message'];
$message2 = "Here is a copy of your message " . $name . "\n\n" . $_POST['message'];
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
<?php
//Table names and table prefixes
$tableName = Mage::getSingleton('core/resource')
getTableName('catalog_product_entity');
// if prefix was 'mage_' then the below statement
// would print out mage_catalog_product_entity
echo $tableName;
//Accessing the database connection resource
<?php
$img_location = Mage::getBaseDir('media'). '/igallery'.$file_path;
$imageResized = Mage::getBaseDir('media'). '/igallery/resized'.$file_path;
$image= new Varien_Image($img_location);
$image->resize(80, 80);
$image->save($imageResized);
echo '<img src="'.Mage::getBaseUrl('media'). 'igallery'.$value['file'].'" />';
@nahidacm
nahidacm / awesome-php.md
Last active December 11, 2015 12:58 — forked from ziadoz/awesome-php.md

Awesome PHP Libraries

A list of amazingly awesome PHP libraries that you should consider using (and some other shiny extras).

We can't make this file beautiful and searchable because it's too large.
"zip","city","state","latitude","longitude","timezone","dst"
"00210","Portsmouth","NH","43.005895","-71.013202","-5","1"
"00211","Portsmouth","NH","43.005895","-71.013202","-5","1"
"00212","Portsmouth","NH","43.005895","-71.013202","-5","1"
"00213","Portsmouth","NH","43.005895","-71.013202","-5","1"
"00214","Portsmouth","NH","43.005895","-71.013202","-5","1"
"00215","Portsmouth","NH","43.005895","-71.013202","-5","1"
"00501","Holtsville","NY","40.922326","-72.637078","-5","1"
"00544","Holtsville","NY","40.922326","-72.637078","-5","1"
"00601","Adjuntas","PR","18.180103","-66.74947","-4","0"
@nahidacm
nahidacm / CitiesArray.php
Created November 13, 2012 04:31 — forked from jonathonbyrdziak/CitiesArray.php
Cities Array :: An array of USA cities, as of April 2010
array(
'ALABAMA'=>
array('ABBEVILLE','ADAMSVILLE','ADDISON','AKRON','ALABASTER','ALBERTVILLE','ALEXANDER CITY','ALEXANDRIA','ALICEVILLE','ALLGOOD','ALTOONA','ANDALUSIA','ANDERSON','ANNISTON','ARAB','ARDMORE','ARGO','ARITON','ARLEY','ASHFORD','ASHLAND','ASHVILLE','ATHENS','ATMORE','ATTALLA','AUBURN','AUTAUGAVILLE','AVON','BABBIE','BAILEYTON','BANKS','BAY MINETTE','BAYOU LA BATRE','BEAR CREEK','BEATRICE','BEAVERTON','BELK','BENTON','BERRY','BESSEMER','BILLINGSLEY','BIRMINGHAM','BLACK','BLOUNTSVILLE','BLUE MOUNTAIN','BLUE RIDGE','BLUE SPRINGS','BOAZ','BOLIGEE','BON AIR','BRANCHVILLE','BRANTLEY','BRENT','BREWTON','BRIDGEPORT','BRIGHTON','BRILLIANT','BROOKSIDE','BROOKWOOD','BRUNDIDGE','BUTLER','BYNUM','CAHABA HEIGHTS','CALERA','CAMDEN','CAMP HILL','CARBON HILL','CARDIFF','CAROLINA','CARROLLTON','CASTLEBERRY','CEDAR BLUFF','CENTER POINT','CENTRE','CENTREVILLE','CHALKVILLE','CHATOM','CHELSEA','CHEROKEE','CHICKASAW','CHILDERSBURG','CITRONELLE','CLANTON','CLAY','CLAYHATCHEE','CLAYTON','CLEVELAND','CLIO','COALING',