Skip to content

Instantly share code, notes, and snippets.

View niladam's full-sized avatar

Madalin Tache niladam

View GitHub Profile
@niladam
niladam / error_blade_directive.php
Created March 29, 2019 20:00 — 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:
@niladam
niladam / webpack.mix.js
Created March 2, 2019 21:12 — forked from calebporzio/webpack.mix.js
A webpack.mix.js file for writing NPM packages the way you write JS in a Laravel app.
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 January 4, 2019 21:34 — forked from drewm/shoot-sharing-image.js
Dynamic Social Sharing Images
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 () => {
<?php
class FieldServiceProvider extends ServiceProvider{
/**
* Bootstrap the field services.
* @return void
*/
public function boot()
{
Nova::serving(function (ServingNova $event) {
$files = app('files');
<?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(
@niladam
niladam / intervention-image-placeholder.php
Created November 24, 2018 14:17 — forked from bayareawebpro/intervention-image-placeholder.php
FontAwesome SVG, Custom Fonts and Shapes.
<?php
//Intervention Image Package:
//http://image.intervention.io
Route::get('generate', function(){
$text = 'image/jpg';
$width = 1600;
$height = 1000;
$centerH = $width/2;
<?php
//Notes: Special Thanks to OleMartinOrg (https://stackoverflow.com/users/2677898/olemartinorg)
//StackOverflow Source: https://stackoverflow.com/questions/5312349/minifying-final-html-output-using-regular-expressions-with-codeigniter.
//Usage: Place code below in new ViewServiceProvider that's registered after the Laravel version:
//$this->app->singleton('blade.compiler', function () {
// return new HtmlMinifyCompiler($this->app['files'], $this->app['config']['view.compiled']);
//});
//$this->app['view']->getEngineResolver()->register('blade', function () {
// return new CompilerEngine($this->app['blade.compiler']);
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body {
background: repeat url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/7QCIUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAGscAVoAAxslRxwCAAACAAAcAnQAV8KpIENoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbGQgLSBodHRwOi8vd3d3LnJlZGJ1YmJsZS5jb20vcGVvcGxlL0NoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAAABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAADTAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJDAAAEPAAACAxnVFJDAAAEPAAACAxiVFJDAAAEPAAACAx0ZXh0AAAAAENvcHlyaWdodCAoYykgMTk5OCBIZXdsZXR0LVBhY2thcmQgQ29tcGFueQAAZGVzYwAAAAAAAAASc1JHQiBJRUM2MTk2Ni0yLjEAAAAAAAAAAAAAABJzUkdCIElFQzYxOTY2LTIuMQAAAAAAAA
@niladam
niladam / nginx.conf
Created August 18, 2018 20:15 — forked from lkmadushan/nginx.conf
NGINX configuration for multi-tenant PHP application
map $http_accept $api_version {
default 0;
"application/vnd.example.v1+json" 1;
}
server {
listen 80;
listen [::]:80;