Skip to content

Instantly share code, notes, and snippets.

View tsmsogn's full-sized avatar
:octocat:
Set your status

tsmsogn tsmsogn

:octocat:
Set your status
View GitHub Profile
@tsmsogn
tsmsogn / Selectable.php
Last active June 2, 2021 10:11
Laravel: Create array for select
<?php
namespace App\Traits;
use Illuminate\Database\Eloquent\Model;
trait Selectable
{
public static function toSelectArray()
{
業務上関われない人はどうするのか?
時間をどの程度さいてよいのか
どうその人の査定に影響するのか
お客様からの評価、
定量的に人の評価なんかできるのだろうか?
@tsmsogn
tsmsogn / gist:6862957
Last active April 6, 2020 00:20
PhpStorm: Getting started

System

Mac OS X

設定

  • Command Line で PhpStorm を起動する

Tools > Create Command-line Launcher...

@tsmsogn
tsmsogn / gist:ade22406dfa474363632fd0009fe0d61
Last active November 22, 2019 08:03
Laravel: Paginator#firstPageUrl(),Paginator#lastPageUrl()
  • first page url
$paginator->url(1)
  • last page url
$paginator-&gt;url($paginator-&gt;lastPage())
@tsmsogn
tsmsogn / new_gist_file.md
Last active May 6, 2019 01:48
[ruby]Snippets

Array

  • divide inorder into left and right sub tree with root
root = 3
a = [1, 2, 3, 4, 5, 6, 7]
left, right = a[0, a.index(root)], a[a.index(root) + 1, a.size - a.index(root) - 1]
=> [[1, 2], [4, 5, 6, 7]]
@tsmsogn
tsmsogn / primes.rb
Last active May 6, 2019 01:45
[ruby]Sieve of Eratosthenes with Ruby
def primes(max)
nums = Array.new(max + 1, 1)
nums[0] = nums[1] = 0
(2..Math.sqrt(max)).each do |sieve|
if nums[sieve] == 1
(2 * sieve).step(max, sieve).each do |num|
nums[num] = 0
end
end
@tsmsogn
tsmsogn / new_gist_file.rb
Last active May 6, 2019 01:38
[ruby]Dijkstra with Ruby
# Node
class Node
attr_accessor :id, :edges, :cost, :done
def initialize(id, edges = [], cost = nil, done = false)
@id, @edges, @cost, @done = id, edges, cost, done
end
end
# Edge
@tsmsogn
tsmsogn / gist:7348154
Last active May 6, 2019 01:38
[ruby]rbenv + ruby-build
brew install ruby
rbenv install -l
@tsmsogn
tsmsogn / new_gist_file.md
Last active March 26, 2019 07:09
退職時に、会社から貸与されているPCですること
  • Google Chrome の Sign out
  • Google 日本語入力の補完
  • ASW のプライベートキー
  • GitHub の認証を解除
  • BitBucket の認証を解除
  • Heroku の認証を解除
  • Docker Desktop から Sign out
  • PhpStrom のライセンス解除
  • Slack から Sign out
@tsmsogn
tsmsogn / gist:6102898
Last active March 4, 2019 01:13
[android]Custom DigitalClock
package jp.tsmsogn.digitalclock;
import java.util.Calendar;
import android.content.Context;
import android.os.Handler;
import android.os.SystemClock;
import android.text.format.DateFormat;
import android.util.AttributeSet;
import android.util.Log;