Skip to content

Instantly share code, notes, and snippets.

View corean's full-sized avatar

corean corean

  • connple co., ltd.
  • chuncheon, korea
  • 19:07 (UTC +09:00)
View GitHub Profile
@corean
corean / if.php
Created May 8, 2018 03:54
php if AND연산자 확인용
<?php
echo ((true&&true)?'true<br>':'false<br>');
echo ((true&&false)?'true<br>':'false<br>');
echo ((false&&true)?'true<br>':'false<br>');
echo ((false&&false)?'true<br>':'false<br>');
/*
true
false
false
false
pmset -g
log show --predicate 'eventMessage contains "Previous shutdown cause"' --last 24h
//mdworker disable
sudo mdutil -a -i off
//mdwork enable
sudo mdutil -a -i on
@corean
corean / uuidTrait.php
Last active February 8, 2018 18:43
UUID #laravel #trait
trait UuidTrait
{
/**
* Defines the UUID field for the model.
* @return string
*/
protected static function uuidField()
{
return 'uuid';
}
@corean
corean / jumin.js
Created September 21, 2017 04:35 — forked from composite/jumin.js
주민등록번호 생성기 (주민번호 로직 들어가는 양식 테스트용. 개발 외 목적 사용 금지, 이 프로그램 사용에 대한 법적 책임 일체 없음.)
/**
* 주민번호 생성기
* 사용예) jumin()
* jumin({year:1990, month:3, day: 12, loop: 10}); //1990년 3월 12일생 10개 주민번호 생성.
* 확인예) jumin.verify(확인할 주민번호) 확인할 주민번호는 - 있어도 없어도 무관. 13자리만 맞추면 됨.
* @param {object} options 옵션
* year: 년도, 빈 값으면 랜덤
* month: 월, 빈 값이면 랜덤
* day: 일, 빈 값이면 랜덤
* loop: 생성개수, 빈 값이면 1개 생성.
@corean
corean / usage
Last active September 4, 2017 01:19
[Laravel-Permission]
//Role 지정
$user->assignRole('관리자')
//$user의 모든 roles 리턴
$user->roles()->pluck('name');
//Role 삭제
$user->removeRole('writer');
@corean
corean / User.php
Last active September 4, 2017 10:09
[Laravel] Laravel Eloquent ORM관련 #PHP #Laravel #ORM #Eloquent
//controller에서 패스워드를 인코딩할 필요없이 모델에서 적용
public function setPasswordAttribute($password)
{
$this->attributes['password'] = bcrypt($password);
}
public function getPasswordAttribute($password)
{
return bcrypt($password);
}
@corean
corean / dos
Last active September 4, 2017 00:29
[robocopy]
robocopy h: f: /mir /w:1 r:1 & shurdown -s -f -t 0
@corean
corean / ApiController.php
Created May 23, 2017 02:34
history - serialize()
$history[Carbon::now()->toDateTimeString()] = [
"title" => "무통장입금 저장",
"application_no" => $application_no,
"discount_id" => $discount_id,
"discount_code" => $discount_code,
"premium_expect" => $premium_expect,
"account_id" => $account_id,
"account_name" => $account_name,
];
@corean
corean / show.blade.php
Created April 21, 2017 05:15
ViewErrorBag in Blade
@php
/** @var \Illuminate\Support\ViewErrorBag $errors */
@endphp
@corean
corean / ApplicationsController.php
Created April 21, 2017 04:06
laravel try-catch
try {
//
} catch (\Exception $e) {
return $e->getMessage();
}