Skip to content

Instantly share code, notes, and snippets.

View finagin's full-sized avatar
🖖

Igor Finagin finagin

🖖
View GitHub Profile
<!-- leyouts/app.blade.php -->
@if (View::hasSection('breadcrumb'))
@yield('breadcrumb')
@else
@yield('title', 'Dashboard')
@endif
<!-- files/create.blade.php -->
@extends('layouts.app')
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);
@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
@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 / 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.
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
#!/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;
#!/usr/bin/env php
<?php
function crow($dir = __DIR__)
{
$items = scandir($dir);
foreach ($items as $item) {
if (! preg_match('/^\.{1,2}$/', $item)) {
$path = $dir.DIRECTORY_SEPARATOR.$item;
for (var i = 0, l; ; = log[i]; ++i) {
<?php
namespace App;
use Finagin\Support\Singleton;
class Instance extends Singleton
{
protected function __construct()
{