Skip to content

Instantly share code, notes, and snippets.

@localdisk
localdisk / ubuntu-post-install.sh
Last active Jan 14, 2021
ubuntu-post-install.sh
View ubuntu-post-install.sh
#!/bin/bash
echo "install start."
# 時間をあわせる
sudo timedatectl set-local-rtc true
# add repository
# sudo add-apt-repository ppa:mattrose/terminator # terminator
sudo add-apt-repository ppa:atareao/atareao -y # screenkey
View brew.sh
#!bin/sh
brew tap "homebrew/bundle"
brew tap "homebrew/cask"
brew tap "homebrew/core"
brew tap "sanemat/font"
brew tap "homebrew/cask-fonts"
# vsc
brew install "git"
@localdisk
localdisk / Tagify.php
Last active Nov 25, 2021
Livewire Tagify Component
View Tagify.php
<?php
namespace App\Http\Livewire;
use App\Models\Tag;
use Illuminate\View\View;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\Container\BindingResolutionException;
use Livewire\Component;
@localdisk
localdisk / Role.php
Created Dec 29, 2019
User Role sample.
View Role.php
<?php
class Role extends Model
{
public function users()
{
// permissions まで含めると morphedByMany がよさそう
return $this->belongsToMany(User::class);
}
}
@localdisk
localdisk / .php_cs
Last active Sep 30, 2019
俺なりの .php_cs
View .php_cs
<?php
declare(strict_types=1);
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'align_multiline_comment' => true,
'array_syntax' => ['syntax' => 'short'],
View DevelopServiceProvider.php
<?php
namespace Yaranaio\Providers;
use Barryvdh\Debugbar\Facade;
use Barryvdh\Debugbar\ServiceProvider as DebugbarServiceProvider;
use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\ServiceProvider;
View firebase.auth.twitter.js
import firebase from 'firebase/app';
import 'firebase/auth';
import firebaseCofnig from '../config/firebase';
let _firebase;
let _provider;
export default class Auth {
static initialize() {
if (!_firebase) {
@localdisk
localdisk / auth.js
Created Jun 30, 2018
雑な Firebase Twitter login
View auth.js
import firebase from 'firebase/app';
import 'firebase/auth';
//export default Object.assign({}, {
// apiKey: process.env.MIX_FIREBASE_API_KEY,
// authDomain: process.env.MIX_FIREBASE_AUTH_DOMAIN,
//});
// ↑は config/firebase の内容
import firebaseCofnig from '../config/firebase';
@localdisk
localdisk / Cart.php
Created Apr 15, 2018
Interfaceとclassを1ファイル
View Cart.php
<?php
declare(strict_types=1);
namespace Localdisk\Cart;
interface CartInterface
{
public function add(Product $product): void;
}
View .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/matsuo/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"