Skip to content

Instantly share code, notes, and snippets.

View cygeorgel's full-sized avatar

Cyrille Georgel cygeorgel

View GitHub Profile
@cygeorgel
cygeorgel / CreateSurveyQueriesTable
Created February 11, 2020 11:55
Invites to reply to a survey
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSurveyQueriesTable extends Migration
{
/**
* Run the migrations.
<?php
namespace App\BlueRock\Services;
use App\Customer;
class Telecom0545Service
{
public function resellersUpdate()
{
public function wlrRules()
{
$file_ids = [
5,
15,
17,
23,
47,
50,
public function handle()
{
$path = 'import';
$filename = 'sepa.csv';
$content = Storage::disk('ftp')->get($path . '/' . $filename);
Storage::disk('local')->makeDirectory($path);
public function resellersUpdate()
{
$item_id = 69;
Customer::where('isReseller', true)
->chunk(10, function($customers) use ($item_id) {
foreach ($customers as $customer) {
$count = 0;
if ( ! function_exists('get3CXDateFormat')) {
function get3CXDateFormat($date)
{
list($day, $hour, $a) = explode(' ', $date);
list ($day, $month, $year) = explode('/', $day);
list($h, $m, $s) = explode(':', $hour);
@cygeorgel
cygeorgel / ClassStopwatch.php
Created November 25, 2019 20:13
Stop watch
<?php
// this needs to be completely redesigned
// some parts can give you an idea of
// how was working the old system
Class StopWatch
{
private $eventsTypes = array(
'start',
@cygeorgel
cygeorgel / BrtoolsParseXmlCommand.php
Created November 12, 2019 12:54
Parse XML Sepa files and send them to csv
<?php
namespace App\Console\Commands;
use App\Term;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
use League\Csv\Writer;
use Nathanmac\Utilities\Parser\Parser;
function splitEmailsByAttachmentWeightLimit(array $attachments, $weightLimit = 25)
{
$distinctEmails = [];
$attached = [];
arsort($attachments);
foreach ($attachments as $key => $value) {
if ( ! in_array($key, $attached)) {
$attachments = [
0 => 4,
1 => 4,
2 => 5,
3 => 9,
4 => 8,
5 => 7,
];