Skip to content

Instantly share code, notes, and snippets.

View ManojKiranA's full-sized avatar
🔍
Focusing

Manoj Kiran ManojKiranA

🔍
Focusing
  • Postiefs Technologies Private Limited
  • Coimbatore
View GitHub Profile
<?php
/**
* Dumps a given variable along with some additional data.
*
* @param mixed $var
* @param bool $pretty
*/
function dd($var, $pretty = false)
{
@ManojKiranA
ManojKiranA / php_url_parse.php
Created December 13, 2018 08:53 — forked from xoptgah/php_url_parse.php
PHP url snipp #PHP
<?php
// Examples for URL: https://example.com/subFolder/yourfile.php?var=blabla#12345
//built-in function
$x = parse_url($url);
$x['scheme'] 🡺 https
$x['host'] 🡺 example.com (or with WWW)
$x['path'] 🡺 /subFolder/yourfile.php
$x['query'] 🡺 var=blabla
$x['fragment'] 🡺 12345 // hashtag outputed only in case, when hashtag-containing string was manually passed to function, otherwise PHP is unable to recognise hashtags in $_SERVER
@ManojKiranA
ManojKiranA / README.md
Created December 25, 2018 07:21 — forked from mul14/README.md
Simple Laravel Search Trait

Usage

Put SearchTrait.php in app directory. Then use SearchTrait in your model, like so

use App\SearchTrait;
use Illuminate\Database\Eloquent\Model;

class Article extends Model {
@ManojKiranA
ManojKiranA / git-tag-delete-local-and-remote.sh
Created March 18, 2019 15:39 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@ManojKiranA
ManojKiranA / error_blade_directive.php
Created March 29, 2019 22:25 — forked from calebporzio/error_blade_directive.php
A little Blade directive to make working with validation errors a bit nicer.
<?php
// Usage:
// Before
@if ($errors->has('email'))
<span>{{ $errors->first('email') }}</span>
@endif
// After:
@ManojKiranA
ManojKiranA / README.md
Created April 2, 2019 08:00 — forked from shgysk8zer0/README.md
Generate random images in PHP

Generate random images in PHP

sample

Why?

  • Because you can
  • Because you have time to spare
  • Maybe you think they look cool or want to save them for wallpapers or something
  • Maybe it reminds you of that one time... You know which time I'm talking about

Requirements

@ManojKiranA
ManojKiranA / phpresult.txt
Created June 1, 2019 13:02 — forked from linkimfly/phpresult.txt
The effect you want
desc:
In addition, if the current time is less than 30 minutes from endhour, expired is also counted as expired.
Array
(
[0] => Array
(
[date] => 2019-06-01
[week] => Saturday
[subdate] => 06-01
@ManojKiranA
ManojKiranA / JsonTexter.php
Created July 1, 2019 11:51 — forked from sarfraznawaz2005/JsonTexter.php
read and write php array to json file
<?php
/*
Class for reading and writing array data in json format
Author: Sarfraz Ahmed ([email protected])
*/
class JsonTexter
{
protected $file = null;
public function __construct($file)
<?php
use Illuminate\Database\Query\Builder;
Builder::macro('orderByNulls', function ($column, $direction = 'asc', $nulls = 'last', $bindings = []) {
$column = $this->getGrammar()->wrap($column);
$direction = strtolower($direction) === 'asc' ? 'asc' : 'desc';
$nulls = strtolower($nulls) === 'first' ? 'NULLS FIRST' : 'NULLS LAST';
return $this->orderByRaw("$column $direction $nulls", $bindings);
});
@ManojKiranA
ManojKiranA / AppServiceProvider.php
Created July 17, 2019 07:19 — forked from reinink/AppServiceProvider.php
Eloquent addSubSelect()
<?php
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Query\Expression;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function boot()