Skip to content

Instantly share code, notes, and snippets.

View cygeorgel's full-sized avatar

Cyrille Georgel cygeorgel

View GitHub Profile

Keybase proof

I hereby claim:

  • I am cygeorgel on github.
  • I am cgeorgel (https://keybase.io/cgeorgel) on keybase.
  • I have a public key ASBKqmPYXtlCwcSHeBwBV1h3pT-c-efoGLANBU2yyD46kwo

To claim this, I am signing this object:

@cygeorgel
cygeorgel / RemoveFilesFromOvhPublicCloudStorage
Created June 21, 2018 11:18
Remove files from Ovh Public Cloud Storage
// remove files from swift and swiftAlt
$disks = ['swift', 'swiftAlt'];
foreach ($disks as $disk) {
$files = Storage::disk($disk)->files('production/zoho/invoices');
foreach($files as $file) {
@cygeorgel
cygeorgel / UploadFilesToOvhPublicCloudStorage
Last active June 21, 2018 11:23
Upload files to Ovh Public Cloud Storage
// upload files to Ovh Public Cloud Storage
$files = Storage::disk('local')->files('/invoices/zoho/');
$disks = ['swift', 'swiftAlt'];
foreach ($files as $file) {
$filename = str_replace('invoices/zoho/', '', $file);
@cygeorgel
cygeorgel / GetPdfDocumentFromOvhPublicCloudStorage
Created June 21, 2018 11:53
Get Pdf document from Ovh public cloud storage and show it in browser
// Get Pdf document from Ovh public cloud storage and show it in browser
$invoice = Invoice::find($id);
if($invoice->file == true) {
$filename = $invoice->number . '.pdf';
$document = Storage::disk('swift')->get('production/' . $invoice->batch . '/invoices-pdf/' . $filename);
function test($q)
{
global $pdo;
$sth = $pdo->prepare("SELECT * FROM faq WHERE title LIKE ? OR message LIKE ?");
$data = explode(' ', $q);
foreach($data as $element) {
@cygeorgel
cygeorgel / Gentel Import
Created July 16, 2018 08:40
Import calls from Gentel
if($service == 'gentel') {
// locally:
$dir = storage_path('app/cdr/gentel');
$files = scandir($dir);
foreach($files as $file) {
@cygeorgel
cygeorgel / DateTime diff
Last active July 16, 2018 20:04
DateTime diff someDate / today
if (isset ($test->serviceStart)) {
$diff = $test->serviceStart->diff(new \Carbon\Carbon);
$nbMonths = ($diff->format('%y') * 12) + $diff->format('%m');
}
function prorataTemporis($from = '2018-06-15', $to = '2018-08-01')
{
$from = new \DateTime($from);
$to = new \DateTime($to);
$diff = $to->diff($from);
$months = $diff->y * 12 + $diff->m;
$customers_ids = \DB::table('tasks')
->selectRaw('DISTINCT customer_id')
->where('status_id', '>', '2')
->where('status_id', '<', '6')
->pluck('customer_id')
->toArray();
$customers = Customer::whereIn('id', $customers_ids)->get();
wget https://raw.githubusercontent.com/composer/getcomposer.org/1b137f8bf6db3e79a38a5bc45324414a6b1f9df2/web/installer -O - -q | php -- --quiet