Skip to content

Instantly share code, notes, and snippets.

View corean's full-sized avatar

corean corean

  • connple co., ltd.
  • chuncheon, korea
  • 23:41 (UTC +09:00)
View GitHub Profile
@corean
corean / laravel.js
Created June 18, 2023 05:25 — forked from soufianeEL/laravel.js
You use Laravel 5 and you want to send a DELETE request without creating a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. To use, import script, and create a link with the `data-method="DELETE"` and `data-token="{{csrf_token()}}"` attributes.
/*
Exemples :
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}">
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}" data-confirm="Are you sure?">
*/
(function() {
@corean
corean / input.blade.php
Last active June 28, 2022 08:48
laravel input form
<div class="row form-group">
<label for="email" class="col-md-4 col-lg-3 col-form-label must-fill">대표자 이메일</label>
<div class="col">
<input type="text" name="email" id="email"
class="form-control @error('email') is-invalid @enderror"
value="{{ old('email', $partner->email) ?? Auth::user()->email }}"
placeholder="abcd@naver.com">
@error('email')
<span class="invalid-feedback d-block" role="alert"><strong>{{ $message }}</strong></span>
@corean
corean / gist:2416915ae0f20d06931b7b616a0f0ff7
Last active June 23, 2022 15:34
Dropbox except directory in Laravel
xattr -w com.dropbox.ignored 1 \
/Users/corean/Dropbox/iniwedding.new/dev/vendor \
/Users/corean/Dropbox/iniwedding.new/dev/node_modules \
/Users/corean/Dropbox/iniwedding.new/dev/storage
@corean
corean / Laravel-Container.md
Created April 13, 2022 04:51
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

@corean
corean / gist:58a8cd8630f201791eb27b3aef5d8098
Last active December 15, 2021 11:39
MacOS Dropbox 동기화 디렉토리 제외
find ~/Dropbox/Sites -type d | grep 'node_modules$' | grep -v '/node_modules/' | xargs -I {} -t -L 1 xattr -w com.dropbox.ignored 1 "{}" && find ~/Dropbox/Sites -type d | grep 'vendor$' | grep -v '/vendor/' | xargs -I {} -t -L 1 xattr -w com.dropbox.ignored 1 "{}"
public function setItemsAttribute(array $items): void
{
static::saved(function (self $model) use ($items) {
$this->items()->sync($items);
});
}
@corean
corean / filter-v4150
Last active June 2, 2019 23:59
SynologyDrive Filter (~/.SynologyDrive/SynologyDrive.app/Contents/Resources/conf/filter-v4150)
[Version]
major = 1
minor = 1
[Common]
black_char = "\\/"
black_name = "@tmp", "@eaDir", ".SynologyWorkingDirectory", "#recycle", "desktop.ini", ".ds_store", "Icon\r", "thumbs.db", "$Recycle.Bin", "@sharebin", "System Volume Information", "Program Files", "Program Files (x86)", "ProgramData", "#snapshot", "vendor", "node_modules", "framework", "debugbar"
max_length = 255
max_path = 768
@corean
corean / span.js
Created June 1, 2018 01:34
table cell merge rowspan,colsapn using jQuery
/**
*
* 같은 값이 있는 열을 병합함
*
* 사용법 : $('#테이블 ID').rowspan(0);
*
*/
$.fn.rowspan = function(colIdx, isStats) {
return this.each(function(){
var that;
@corean
corean / app\Providers\AppServiceProvider.php
Created May 26, 2018 06:01
Specified key was too long; max key length is 767 bytes
/*
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique(email))
[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
*/
use Illuminate\Support\Facades\Schema;
@corean
corean / debugbar.css
Last active September 4, 2023 06:16
debugbar.css
/* debugbar.css */
body div.phpdebugbar {
font-size: 10px;
}
body div.phpdebugbar-header > div > * {
font-size: 10px;
padding: 2px 5px;
}