Skip to content

Instantly share code, notes, and snippets.

@jetsuit
jetsuit / DateQuartersUtil.php
Last active February 5, 2021 14:41 — forked from steveirl/list_quarters.php
Get a list of (date) quarters between two given dates. Return array of objects with information about each quarter
/**
* Class DateQuartersUtil
* @package UtilsBundle\Classes
*/
class DateQuartersUtil
{
/**
* Return quarters between tow dates. Array of objects
* @param $start_date
* @param $end_date
@jetsuit
jetsuit / delete-all-merged.sh
Created April 5, 2018 10:43
Delete all local branches, merged already (exclude staging, master, dev)
git branch --merged | grep -v "\*" | grep -v "staging|master|dev" | xargs -n 1 git branch -d
@jetsuit
jetsuit / fpm-status.sh
Created February 1, 2018 17:20
Read php-fpm status
#! /bin/sh
COUNTER=0
while [ $COUNTER -lt 1000 ]; do
SCRIPT_NAME=/status \
SCRIPT_FILENAME=/status \
REQUEST_METHOD=GET \
cgi-fcgi -bind -connect 127.0.0.1:9000
sleep 5
let COUNTER=COUNTER+1
done
@jetsuit
jetsuit / Get PHP-FPM memory usage
Created January 31, 2018 17:17
Get PHP-FPM memory usage
ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | grep php-fpm
@jetsuit
jetsuit / PHP group by key value in multi array
Created July 6, 2017 15:10
PHP group by key value in multi array
$arr = [
[
'itemId' => 1,
'itemDescription' => 'ItemDescription',
'product' => 'productA',
'productDescription' => 'ProdADesc'
],
[
'itemId' => 1,
1. Install bundle https://github.com/tehplague/swiftmailer-mailgun-bundle
2. Follow instructions to this bundle
cspoo_swiftmailer_mailgun:
key: "key-xxxxxxxxxx"
domain: "mydomain.com"
http_client: 'httplug.client'(This is required field)
# Swiftmailer Configuration
swiftmailer:
transport: "mailgun"
jms_serializer.naming_strategy_camelCase:
class: 'JMS\Serializer\Naming\IdenticalPropertyNamingStrategy'
jms_serializer.naming_strategy:
class: 'JMS\Serializer\Naming\SerializedNameAnnotationStrategy'
arguments : ['@jms_serializer.naming_strategy_camelCase']