Skip to content

Instantly share code, notes, and snippets.

View niladam's full-sized avatar

Madalin Tache niladam

View GitHub Profile
@niladam
niladam / box-shadow.html
Created October 22, 2020 12:47 — forked from ocean90/box-shadow.html
CSS3 Box Shadow, only top/right/bottom/left and all
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
@niladam
niladam / User.php
Last active September 24, 2020 10:41
Laravel 8 use gravatar as default profile photo
<?php
namespace App\Models;
use Illuminate\Support\Str;
class User extends Authenticatable
{
// [...] Your other User methods/properties here
@niladam
niladam / mv.sh
Created April 19, 2020 12:22 — forked from premek/mv.sh
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@niladam
niladam / generate-ssh-key.sh
Created March 22, 2020 09:54 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa
<?php
namespace App\Concerns;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
trait Resourceable
{
public function toResourceArray(?string $class = null, ?Request $request = null): array
<?php
function faker($property = null)
{
$faker = Faker\Factory::create();
if ($property) {
return $faker->{$property};
}
@niladam
niladam / Example.js
Created September 24, 2019 17:19 — forked from vaibhavpandeyvpz/Example.js
Laravel, Axios & Logout Over AJAX
import React from 'react';
import ReactDOM from 'react-dom';
const handleLogout = () => {
axios.post('/logout')
.then(() => location.href = '/home')
};
function Example() {
return (
@niladam
niladam / LICENSE
Created May 31, 2019 21:08 — forked from donnierayjones/LICENSE
Render Bootstrap as "small" layout when printing
Copyright (C) 2016 Donnie Ray Jones
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@niladam
niladam / .php_cs.laravel.php
Created May 6, 2019 15:24 — forked from laravel-shift/.php-cs-fixer.php
PHP CS Fixer - Laravel Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'phpdoc_indent' => true,
'binary_operator_spaces' => [
'operators' => ['=>' => null]
],
// Add this to the "boot()" method of your "AppServiceProvider"
<?php
\Illuminate\Database\Eloquent\Builder::macro('search', function ($name, $search) {
return $this->where($name, 'LIKE', $search ? '%'.$search.'%' : '');
});