Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Kang Yoosam KangYoosam

🏠
Working from home
View GitHub Profile
@KangYoosam
KangYoosam / MigrateSessionToRedisFromFile.php
Created Feb 6, 2020
【Laravel】File管理していたsession情報をredisに移行するコマンド
View MigrateSessionToRedisFromFile.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Redis;
class MigrateSessionToRedisFromFile extends Command
{
/**
@KangYoosam
KangYoosam / file0.txt
Created Dec 29, 2018
Redisのバックアップファイル場所をチェックする ref: https://qiita.com/kangyoosam/items/6775ebc72746dd03561a
View file0.txt
redis-cli bgsave
View gist:e6cc36e0461b37e33f65e7d7df0e2128
update user set email = replace(email, left(email, instr(email, '@')-1),concat('xxxxxxx_', id));
@KangYoosam
KangYoosam / file0.txt
Created Feb 18, 2018
【メモ】コマンドラインからPull Requestを出すシェル関数 ref: https://qiita.com/kangyoosam/items/67f30ca49a275732349d
View file0.txt
# opens a PR from the current branch
function opr() {
parentBranch=$1
currentBranch=`git branch | grep "*"`
repoName=$(git remote show origin -n | ruby -ne 'puts /^\s*Fetch.*:(.*).git/.match($_)[1] rescue nil')
open -a /Applications/Google\ Chrome.app https://github.com/${repoName/* /}/compare/${parentBranch/* /}...${br/* /}
}
View 毎日3時に自動pushするcronスクリプト
0 3 * * * cd /path_to_your_git_root_directory; git add -A; git commit -m "Daily backup"; git push origin master;
View CollectionMacroServiceProvider.php
// 同じ名前のメソッドが存在しないかチェック
if (! Collection::hasMacro('transpose')) {
/*
* Transpose an array.
*
* @return \Illuminate\Support\Collection
*/
Collection::macro('transpose', function () {
$items = array_map(function (...$items) {
return $items;
@KangYoosam
KangYoosam / gist:ad492d28299ce0f9aaf1dd9966f431fd
Created Nov 6, 2016
Navmeshでターゲットの方向へ向かっていく
View gist:ad492d28299ce0f9aaf1dd9966f431fd
public class Move : MonoBehaviour {
public GameObject target;
void Start () {
NavMeshAgent agent = GetComponent<NavMeshAgent> ();
agent.speed = 1;//このようにスクリプトからNavMeshのプロパティをいじれる。
agent.destination = target.transform.position;
}
}
@KangYoosam
KangYoosam / file0.php
Last active Mar 19, 2018
Laravel5.3のQueue非同期処理 (AWS3へ画像アップロード) ref: https://qiita.com/kangyoosam/items/0ef7822aaac0883175b7
View file0.php
<?php
namespace App\Jobs;
use App\Models\Channel;
use File;
use Storage;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;