This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| type Server struct { | |
| host string | |
| port int | |
| protocol string | |
| } | |
| func NewServer(host string, opts ...ServerOption) *Server { | |
| server := &Server{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # I'll be doing another one for Linux, but this one will give you | |
| # a pop up notification and sound alert (using the built-in sounds for macOS) | |
| # Requires https://github.com/caarlos0/timer to be installed | |
| # Mac setup for pomo | |
| alias work="timer 60m && terminal-notifier -message 'Pomodoro'\ | |
| -title 'Work Timer is up! Take a Break 😊'\ | |
| -appIcon '~/Pictures/pumpkin.png'\ | |
| -sound Crystal" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #/bin/bash -eu | |
| # 各SNSのユーザーIDが存在するかチェックできます。 | |
| echo "Twitter:" | |
| curl -s -o /dev/null -w "%{http_code}" https://twitter.com/"$1"/ | |
| echo "\nQiita:" | |
| curl -s -o /dev/null -w "%{http_code}" https://qiita.com/"$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create or replace function naturalsort(text) | |
| returns bytea language sql immutable strict as | |
| $f$ select string_agg(convert_to(coalesce(r[2],length(length(r[1])::text)::text || length(r[1])::text || r[1]),'SQL_ASCII'),'\x00') | |
| from regexp_matches($1, '0*([0-9]+)|([^0-9]+)', 'g') r; $f$; | |
| -- for postgres 8.4 | |
| create or replace function naturalsort(text) | |
| returns bytea language sql immutable strict as | |
| $f$ select array_to_string(array_agg(coalesce(r[2],length(length(r[1])::text)::text || length(r[1])::text || r[1])), E'\\000')::bytea | |
| from regexp_matches($1, '0*([0-9]+)|([^0-9]+)', 'g') r; $f$; |