Skip to content

Instantly share code, notes, and snippets.

View biplobice's full-sized avatar
🖥️
while (success!==true) { keepMovingForward(); }

Md Biplob Hossain biplobice

🖥️
while (success!==true) { keepMovingForward(); }
View GitHub Profile
@hissy
hissy / output.md
Last active March 7, 2024 21:53
#concrete5 Complete usage and output of Date Helper to localize date time format
$dh = Core::make('helper/date');
Code en_US ja_JP it_IT ru_RU zh_CN
echo $dh->formatDateTime($date); 10/31/19, 5:06 PM 2019/10/31 17:06 31/10/19, 17:06 31.10.2019, 17:06 2019/10/31 下午5:06
echo $dh->formatDateTime($date, true); Oct 31, 2019, 5:06 PM 2019/10/31 17:06 31 ott 2019, 17:06 31 окт. 2019 г., 17:06 2019年10月31日 下午5:06
echo $dh->formatDateTime($date, false, true); 10/31/19, 5:06:38 PM 2019/10/31 17:06:38 31/10/19, 17:06:38 31.10.2019, 17:06:38 2019/10/31 下午5:06:38
echo $dh->formatDateTime($date, true, true); Oct 31, 2019, 5:06:38 PM 2019/10/31 17:06:38 31 ott 2019, 17:06:38 31 окт. 2019 г., 17:06:38 2019年10月31日 下午5:06:38
@kreativan
kreativan / dropzone.php
Last active February 11, 2024 12:17
Upload files with dropzone.js and php
<?php
// process $_POST request
if(isset($_POST["submitDropzone"])) {
// Do something
print_r($_POST);
}
?>
@hissy
hissy / StatusCodeCheck.php
Created June 26, 2018 10:43
#concrete5 Status Code Check Command
<?php
// application/src/Console/Command/StatusCodeCheck.php
namespace Application\Console\Command;
use Concrete\Core\Console\Command;
use Concrete\Core\Database\Connection\Connection;
use Concrete\Core\Http\Client\Client;
use Concrete\Core\Page\Page;
use Concrete\Core\Support\Facade\Application;
use Concrete\Core\Url\Url;
@rhukster
rhukster / sphp.sh
Last active March 30, 2024 10:41
Easy Brew PHP version switching (Now moved to https://github.com/rhukster/sphp.sh)
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
#
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh
# >>> Kept here for legacy purposes
#
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)
@adamwathan
adamwathan / troubleshooting.md
Last active January 19, 2021 04:14
Troubleshooting Valet on macOS Sierra

Troubleshooting Valet on Sierra

Common Problems

Problem: I just see "It works!"

Apache is running on port 80 and interfering with Valet.

  1. Stop Apache: sudo /usr/sbin/apachectl stop
  2. Restart Valet: valet restart
@subfuzion
subfuzion / curl.md
Last active July 25, 2024 08:53
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@hissy
hissy / concrete.php
Last active September 2, 2019 02:47
#concrete5 #5.7 How to work concrete5 behind a load balancer or a reverse proxy
<?php
/**
* Always trust incoming request.
*
* application/config/concrete.php
*
* For more detail, see: http://symfony.com/doc/current/cookbook/request/load_balancer_reverse_proxy.html
*/
@PurpleBooth
PurpleBooth / README-Template.md
Last active July 25, 2024 13:33
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@hissy
hissy / clear_empty_workflow_progress.php
Last active March 14, 2023 19:58
[concrete5] A job to deletes empty "Compare Versions" alerts.
<?php
namespace Application\Job;
use Job as AbstractJob;
use Concrete\Core\Workflow\Progress\PageProgress;
use Concrete\Core\Workflow\EmptyWorkflow;
class ClearEmptyWorkflowProgress extends AbstractJob
{

What's the difference between cascade="remove" and orphanRemoval=true in Doctrine 2

TLDR: The cascade={"remove"} is like a "software" onDelete="CASCADE", and will remove objects from the database only when an explicit call to $em->remove() occurs. Thus, it could result in more than one object being deleted. orphanRemoval can remove objects from the database even if there was no explicit call to ->remove().

I answered this question a few times to different people so I will try to sum things up in this Gist.

Let's take two entities A and B as an example. I will use a OneToOne relationship in this example but it works exactly the same with OneToMany relationships.

class A