Wednesday, August 22, 2018

PHP Foreach Key by Pointer


Here is a way to add new elements to new array in PHP foreach, by reference on new element.


$items = Item::get();
$formattedItems = [];

foreach ($items as $item) {
    $fm = &$formattedItems[];
    $fm['id'] = $item->id;
    $fm['label'] = $item->label;
    $fm['icon'] = $item->icon;
}


var_dump($formattedItems);

Get Service Instance Anywhere in Laravel

Inject Service Instance by Constructor


Code Example:
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class MyController extends Controller
{
    protected $client;

    public function __construct(Client $client)
    {
        $this->client = $client;
    }

    public function store(Request $request)
    {
        $response = $this->client->message()->send([
            'text' => $request->input('text'),
        ]);
    }
}

Tuesday, June 5, 2018

PHP - remove all except letters, numbers, dashes and blanks

 
PHP - remove all except letters, numbers, dashes and blanks for various cases, like cleaning user input for DB storage, further execution and making it safe.


It's very easy to remove special characters.

$search = preg_replace('/[^a-zA-Z0-9  -]/', '', $search);

Wednesday, February 28, 2018

Image Meta Data&EXIF Removal


Image meta data can contain some information which image uploader wouldn't like to share with broad audience. Luckily, there is a great tool which strips all meta data, also EXIF data. It is working with JPG and PNG image formats.

There are  lot of tools claiming to clean meta data from image, but this one called 

JPEG & PNG Stripper works just awesome! It provides super easy and efficient meta removal.

Need bulk image cleaning? It's piece of cake with this software. Just select your images and drag&drop in application window. Plus, you'll get old school software feeling, back in a days when software did it's purpose, nothing more or less.







JPEG & PNG Stripper link


Friday, December 7, 2012

Lee Scratch Perry movie - Vision of paradise

Well, isn't Lee's movie, its about the Lee Scratch Perry! Volker Schaner, a German guy is taking a movie on Lee's life for last 13 years! Right now the project come to the final phase, where it should be done some final editing costing at minimum $40.000 $20.000.

 
The movie can be seen as a guide for how to change the world with music – with a positive attitude, mindset or, as Lee Perry calls it: “vibration”.
The interview on this project




I you like Lee's work , you can support this project. If you wish to donate,  you can do it on this lee perry movie link.
If you don't know about Lee Perry, it's time to find out him. As he is a living legend, a great MAN, a great musician and a world's peace-fighter, Lee is surely human race avant-garde  in every and each way.

update :

There is a new kickstarter page for this project: Lee Scratch Perrys - Vision of paradise

Facebook page: leescratchperrys.visionofparadise

Official website : visionofparadise.de

Saturday, March 10, 2012

Homemade bread

 Dough
 Baked bread






Of course, if you wish you can use the same dough to make pizza, this one is with onions.

Tuesday, February 28, 2012

We couldn't reach you by email. Please enter a valid email address - Facebook

Recently I've got error a message on facebook.com which says "We couldn't reach you by email. Please enter a valid email address". Personally I don't use nor like Facebook, but it is very valuable tool for some kinds of web promotions.

Slightly looking over the answers on this error message "We couldn't reach you by email. Please enter a valid email address" didnt give me a proper reason for this message. Some people said that FB or their "frauding policy" is guilty for this, but in my case error was caused by the mail delivery failure.

FB account was registered using "some" mail address. "Some" mail address is double-quoted because website-company that registered my mail has shut down my forum nick and my mail with no reason! Couple of last months weird situations has been going about this internet company and has become a forum topics in community in Serbia. I don't want to write company name because they are total losers, in way of internet reasoning.

Anyway, FB didn't make any mistake( which lots of people says) in my case, got the message "You successfully updated your email address. Please check your email to confirm your new address."

Just changed my mail in FB user panel and sat back on the horse. AAAAAAaaaAAAaaaaaaa