Skip to content

Instantly share code, notes, and snippets.

@Alexander-Pop
Alexander-Pop / Install Composer to use MAMP's PHP.md
Created July 25, 2023 13:33 — forked from kkirsche/Install Composer to use MAMP's PHP.md
How to install Composer globally using MAMP's PHP

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.bash_profile

This will open nano with the contents, at the top in a blank line add the following line:

@Alexander-Pop
Alexander-Pop / magento-2-dump-and-die-like-laravel.php
Last active July 20, 2023 14:04
Magento 2 debugging method to mimic Laravel dd()
<?php
public function d($arg)
{
if (is_object($arg)) {
echo PHP_EOL . 'CLASS: ' . get_class($arg) . PHP_EOL;
//DB
if ($arg instanceof \Magento\Framework\DB\Select) {
var_dump($arg->__toString());
}
@Alexander-Pop
Alexander-Pop / get-specific-days-of-the-week.php
Created December 23, 2020 14:26
PHP - get all Mondays of a Month #php #date
<?php
function getMondays($y, $m)
{
return new DatePeriod(
new DateTime("first monday of $y-$m"),
DateInterval::createFromDateString('next monday'),
new DateTime("last day of $y-$m")
);
}
@Alexander-Pop
Alexander-Pop / jquery-enable-disable-button.html
Created December 3, 2019 15:43
[jQuery enable/disable button] How to disabled submit button after clicked #form #jq #jquery #js
<!DOCTYPE html>
<html>
<head>
<title>jQuery enable/disable button</title>
<script type='text/javascript' src='http://code.jquery.com/jquery.min.js'></script>
<script type='text/javascript'>
$(function () {
$('#searchInput').keyup(function () {
if ($(this).val() == '') {
//Check to see if there is any text entered
@Alexander-Pop
Alexander-Pop / modal-video.html
Last active December 23, 2022 22:02
[Modal Video] Modal Video #modal #video
<div class="wrapper">
<a class="modal-open" href="#play-video" data-youtube-id="ze_ie8Ctp60">Play Video</a>
</div>
<div class="modal">
<div class="background"></div>
<div class="box">
<div class="close">✖</div>
<h6>Video</h6>
<div class="content">
@Alexander-Pop
Alexander-Pop / footer-on-the-bottom-of-the-page.html
Created September 26, 2022 17:45
Make Footer Stay at Bottom of Page with Bootstrap #html #css #bootstrap #sticky #footer #layout
@Alexander-Pop
Alexander-Pop / Drop-down-Country-State-City-Api.html
Created August 28, 2020 15:30
[Drop down Country State City using geodata.solutions Api] #api #html #geodata
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="//geodata.solutions/includes/countrystatecity.js"></script>
@Alexander-Pop
Alexander-Pop / generateFibonacciSeries.php
Last active August 4, 2022 10:36
PHP - Generate Fibonacci Series #loop #foreach
<?php
//version 1
function generateFibonacciSeries($input) {
$range = range(0,$input);
$output = [];
foreach($range as $number) {
if($number == 0 || $number == 1) {
array_push($output, $number);
} elseif (array_key_exists($number+1, $range)) {
@Alexander-Pop
Alexander-Pop / ProductCustomer.php
Last active June 27, 2022 02:52
Magento 2 - Filter product / customer using search criteria #magento2 #product #search #customer
<?php
namespace Namespace\MyModule\Block
use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Customer\Api\Data\CustomerInterface;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\View\Element\Template;
class useCriteria extends Template
@Alexander-Pop
Alexander-Pop / AddCustomQuoteOrderItemAttribute.php
Last active June 27, 2022 02:49
Magento 2 - Add Quote / Order Item / custom Customer Attribute (Patch/Schema) #magento2 #quote #order #attribute
<?php
namespace MyNamespace\MyModule\Setup\Patch\Schema;
use Magento\Framework\DB\Ddl\Table;
use Magento\Framework\Setup\Patch\SchemaPatchInterface;
class AddCustomQuoteOrderItemAttribute implements SchemaPatchInterface
{
/**