Skip to content

Instantly share code, notes, and snippets.

View ksugawara61's full-sized avatar

k2o ksugawara61

  • Kanagawa Japan
View GitHub Profile
@ksugawara61
ksugawara61 / README.md
Last active February 4, 2024 02:23
メモ帳代わりにGistPadを使ってみる #tool
@ksugawara61
ksugawara61 / script.sh
Created July 4, 2020 07:28
Macでbundle installでMYSQL2のエラーが出たときの対処法
$ # see also https://qiita.com/fukuda_fu/items/463a39406ce713396403
$ brew info openssl
openssl@1.1: stable 1.1.1g (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/usr/local/Cellar/openssl@1.1/1.1.1g (8,059 files, 18MB)
Poured from bottle on 2020-06-08 at 09:27:05
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openssl@1.1.rb
==> Caveats
A CA file has been bootstrapped using certificates from the system
@ksugawara61
ksugawara61 / confirm_trigger.sql
Last active August 9, 2019 02:37
MySQL Trigger sample snippet
/* for insert */
insert into articles (title) values ('insert_test');
select * from articles;
select * from trigger_sample;
/* for udpate */
update articles set title = 'update_test' where id = 1;
select * from articles;
select * from trigger_sample;
@ksugawara61
ksugawara61 / .rubocop.yml
Last active July 30, 2019 14:24
Visual Studio Code setting.json
Style/FrozenStringLiteralComment:
Enabled: false
Metrics/BlockLength:
Max: 25
Exclude:
- "Vagrantfile"
@ksugawara61
ksugawara61 / nginx-cors.conf
Last active February 20, 2019 14:57
Nginx CORS設定
location / {
# preflightに対するレスポンス指定
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin '*';
add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE';
add_header Access-Control-Allow-Headers 'Origin, Authorization, Accept, Content-Type';
add_header Access-Control-Max-Age 3600;
add_header Content-Type 'text/plain charset=UTF-8';
add_header Content-Length 0;
@ksugawara61
ksugawara61 / nginx-for-php.conf
Last active February 14, 2019 14:47
Nginx conf for PHP framework
location ~* ^/(assets|files|robots\.txt) { }
location /app {
try_files $uri $uri/ /app/index.php?/$request_uri;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
@ksugawara61
ksugawara61 / calcSimirality.java
Created April 18, 2018 10:41
calc simirality
/**
* リスト間の類似度の計算処理
*
* @param list1 リスト1
* @param list2 リスト2
* @return 類似度 1.0~0.0の間で値を返却
*/
private double calcSimilarity(List<Double> list1, List<Double> list2) {
int length = Math.min(list1.size(), list2.size());
@ksugawara61
ksugawara61 / selector.xml
Last active March 24, 2018 13:52
android view selector
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<!-- 背景色 -->
<solid android:color="#EBEBEB"/>
</shape>
@ksugawara61
ksugawara61 / gist:ed7058091d3e8bc39d67d349f471e8ae
Last active January 25, 2018 02:42
get cookie using javascript
function getCookie(name) {
var result = null;
var cookieName = name + '=';
var allcookies = document.cookie;
var position = allcookies.indexOf( cookieName );
if( position != -1 ) {
var startIndex = position + cookieName.length;
@ksugawara61
ksugawara61 / custom_ua.java
Last active October 16, 2017 03:48
Android WebViewカスタムユーザエージェント
String userAgent = webView.getSettings().getUserAgentString();
webView.getSettings().setUserAgentString(userAgent + "追加したい項目");