Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Madalin Tache niladam

🏠
Working from home
Block or report user

Report or block niladam

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@niladam
niladam / Example.js
Created Sep 24, 2019 — forked from vaibhavpandeyvpz/Example.js
Laravel, Axios & Logout Over AJAX
View Example.js
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 — forked from donnierayjones/LICENSE
Render Bootstrap as "small" layout when printing
View LICENSE
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 — forked from laravel-shift/.php_cs.laravel.php
PHP CS Fixer - Laravel Ruleset
View .php_cs.laravel.php
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'phpdoc_indent' => true,
'binary_operator_spaces' => [
'operators' => ['=>' => null]
],
View eloquent_search.php
// 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.'%' : '');
});
@niladam
niladam / error_blade_directive.php
Created Mar 29, 2019 — forked from calebporzio/error_blade_directive.php
A little Blade directive to make working with validation errors a bit nicer.
View error_blade_directive.php
<?php
// Usage:
// Before
@if ($errors->has('email'))
<span>{{ $errors->first('email') }}</span>
@endif
// After:
@niladam
niladam / webpack.mix.js
Created Mar 2, 2019 — forked from calebporzio/webpack.mix.js
A webpack.mix.js file for writing NPM packages the way you write JS in a Laravel app.
View webpack.mix.js
let mix = require('laravel-mix');
mix.js('src/index.js', 'dist/foo.js').sourceMaps();
mix.webpackConfig({
output: {
libraryTarget: 'umd',
}
})
@niladam
niladam / shoot-sharing-image.js
Created Jan 4, 2019 — forked from drewm/shoot-sharing-image.js
Dynamic Social Sharing Images
View shoot-sharing-image.js
const puppeteer = require('puppeteer');
const imagemin = require('imagemin');
const imageminPngquant = require('imagemin-pngquant');
// Get the URL and the slug segment from it
const url = process.argv[2];
const segments = url.split('/');
const slug = segments[segments.length-2];
(async () => {
View nova-hot-reloading.php
<?php
class FieldServiceProvider extends ServiceProvider{
/**
* Bootstrap the field services.
* @return void
*/
public function boot()
{
Nova::serving(function (ServingNova $event) {
$files = app('files');
View gist:cb7b4102c6bf0ad077d558055ba24b30
<?php
require __DIR__ . '/vendor/autoload.php';
use GuzzleHttp\Client;
$url = "https://domain.tld/large-file.mp4";
$tmpFile = tempnam(sys_get_temp_dir(), 'guzzle-download');
$client = new Client(array(
View intervention-image-placeholder.php
<?php
//Intervention Image Package:
//http://image.intervention.io
Route::get('generate', function(){
$text = 'image/jpg';
$width = 1600;
$height = 1000;
$centerH = $width/2;
You can’t perform that action at this time.