Skip to content

Instantly share code, notes, and snippets.

View finagin's full-sized avatar
🖖

Igor Finagin finagin

🖖
View GitHub Profile
#!/bin/bash
echo "Testing sudo..."
sudo true
if [ $? -ne 0 ]
then
echo "ERROR: You must be able to sudo to run this script.";
exit 1;
fi;
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
@finagin
finagin / Example.php
Created November 24, 2017 10:46
Laravel Console Command Automatic Yes
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class Example extends Command
{
/**
* The name and signature of the console command.
@finagin
finagin / boltproxy.py
Last active November 16, 2017 22:21 — forked from technige/boltproxy.py
Simple proxy server for the Bolt protocol.
#!/usr/bin/env python
# coding: utf-8
# Copyright 2017, Nigel Small
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@finagin
finagin / ResponseMacroServiceProvider.php
Last active July 4, 2018 06:50
Использование макросов http ответов в Laravel при создании API
<?php
namespace App\Providers;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\ServiceProvider;
class ResponseMacroServiceProvider extends ServiceProvider
jQuery.fn.selectText = function () {
this.find('input').each(function () {
if ($(this).prev().length == 0 || !$(this).prev().hasClass('p_copy')) {
$('<p class="p_copy" style="position: absolute; z-index: -1;"></p>').insertBefore($(this));
}
$(this).prev().html($(this).val());
});
var doc = document;
var element = this[0];
console.log(this, element);
<!-- leyouts/app.blade.php -->
@if (View::hasSection('breadcrumb'))
@yield('breadcrumb')
@else
@yield('title', 'Dashboard')
@endif
<!-- files/create.blade.php -->
@extends('layouts.app')
<?php
function panorama($file_name, $water_mark = false, $r = 255, $g = 255, $b = 255)
{
list($width_x, $size) = getimagesize($file_name);
if ($width_x < $size) {
throw new Exception('The panorama must be horizontal');
}
@finagin
finagin / AbstractComparable.php
Last active July 3, 2017 13:55
Comparable & Equalsable abstract class
<?php
namespace Finagin\Ad\Helpers;
use Exception;
abstract class AbstractComparable
{
/**
* Equals $this and $other instances
@finagin
finagin / Laravel Spark disable registration.md
Created April 20, 2017 14:35
Laravel Spark disable registration

Laravel Spark disable registration

php artisan make:command CreateSuperUser

Open app/Console/Commands/CreateSuperUser.php and insert

<?php

namespace App\Console\Commands;