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
@ManojKiranA
ManojKiranA / alpine-todo.html
Created May 18, 2020 11:40 — forked from kez/alpine-todo.html
Alpine.js Todo App Demo (with Tailwind). Please feel free to fork and refactor with improvements! Motivation/details here https://www.kdobson.net/2020/alpine-js-todo-demo/)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Alpine.js Todo Demo</title>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.js" defer></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tailwindcss/ui@latest/dist/tailwind-ui.min.css">
<meta charset="utf-8">
</head>
@ManojKiranA
ManojKiranA / HasFilters.php
Created February 6, 2020 00:13 — forked from nkeena/HasFilters.php
A simple trait that provides robust filtering by a model's attributes
<?php
namespace App\Traits;
use Illuminate\Support\Str;
trait HasFilters
{
public function scopeFilter($query, $filters = [])
{
@ManojKiranA
ManojKiranA / SingletonModel.php
Created January 25, 2020 02:04 — forked from mpociot/SingletonModel.php
Making it easier to work with single row models in Laravel
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SingletonModel extends Model
{
protected function store($data = [])
{
<?php
namespace App\Merge;
class Marge
{
protected $data = [];
public function setData($data)
{
@ManojKiranA
ManojKiranA / HttpCode.php
Created September 13, 2019 14:49 — forked from Yentel/HttpCode.php
PHP Class with all HTTP Status codes (Laravel)
<?php
namespace App\Http;
class HttpCode
{
/*
* HTTP Status Codes & their meaning
* Source: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
* By: Yentel Hollebeke - https://github.com/yentel
@ManojKiranA
ManojKiranA / short-number-format.php
Created August 30, 2019 19:55 — forked from RadGH/short-number-format.php
Short Number Formatter for PHP (1000 to 1k; 1m; 1b; 1t)
<?php
// Converts a number into a short version, eg: 1000 -> 1k
// Based on: http://stackoverflow.com/a/4371114
function number_format_short( $n, $precision = 1 ) {
if ($n < 900) {
// 0 - 900
$n_format = number_format($n, $precision);
$suffix = '';
} else if ($n < 900000) {
@ManojKiranA
ManojKiranA / ColumnSortable.vue
Created August 26, 2019 12:42 — forked from andrii-trush/ColumnSortable.vue
VueJS component for Laravel pagination + column sortable (https://github.com/Kyslik/column-sortable)
<template>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th class="text-nowrap">
<a href="#" @click.prevent="sortChange('name')">
<span>Name</span>
<i class="fa" :class="getClass('name', 'alpha')"></i>
</a>
<?php
namespace App\Traits;
use Carbon\Carbon;
use Jenssegers\Date\Date;
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
trait HasTranslatedDates
{
@ManojKiranA
ManojKiranA / logging.php
Created August 26, 2019 12:14
Split your Laravel daily logs by year/month folders
<?php
// ./config/logging.php
return [
/*
|--------------------------------------------------------------------------
| Split your daily logs by year/month folders
|--------------------------------------------------------------------------
@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()