Skip to content

Instantly share code, notes, and snippets.

View yoneda's full-sized avatar
🏠
working from home

Kohei Yoneda yoneda

🏠
working from home
View GitHub Profile
def removeMention(text):
startIndex = text.find("@")
endIndex = 0
index = startIndex
while True:
s = text[index]
print s
if s==" ":
endIndex = index
break
@yoneda
yoneda / preprocess.py
Created April 23, 2017 17:16
preprocess for japanease language
# coding:utf-8
import re
import jaconv
# @メンションを削除
def removeMention(text):
startIndex = text.find("@")
endIndex = 0
index = startIndex
@yoneda
yoneda / tweet_per_time.py
Last active September 1, 2017 16:35
draw graph by tweet time
#coding:utf-8
import json
import requests
import time
import numpy as np
import matplotlib.pyplot as plt
from requests_oauthlib import OAuth1
from datetime import datetime, timedelta
from email.utils import parsedate_tz
# coding: utf-8
import math
def calc_cos(dictA, dictB):
"""
cos類似度を計算する関数
@param dictA 1つ目の文章
@param dictB 2つ目の文章
@return cos類似度を計算した結果。0〜1で1に近ければ類似度が高い。
"""
@yoneda
yoneda / regex.py
Last active November 28, 2017 15:06
#coding:utf-8
# 正規表現のためのライブラリ「re」を導入
import re
# 正規表現のパターン
# [\d]は任意の数値という意味、[\d+]で任意の数値が1個以上連続しているという意味
# なので、(\d+年\d+月\d+日)は
# 任意の数値の連続 + 年 + 任意の数値の連続 + 月 + 任意の数値の連続 + 日 という意味になる。
pattern = r"(\d+年\d+月\d+日)"
<?php
date_default_timezone_set('Asia/Tokyo');
$url = "https://scrapbox.io/api/pages/yoneda/?limit=3";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$results = curl_exec($curl);
curl_close($curl);
@yoneda
yoneda / regtest.py
Created January 29, 2018 18:38
replace string using regular expression in python
# coding:utf-8
import re
text = "apple_100"
anapat = r"(\w+_)(\d+)"
reppat = r"\2"
result = re.sub(anapat,reppat,text)
print(result)
@yoneda
yoneda / pyprint.py
Created February 10, 2018 16:28
python print test
# coding: utf-8
num = 11
print("num is ... {}".format(num))
name = "tarou"
print("name is ... {}".format(name))
fruits = {"apple":100,"orange":400}
print("fruits is ... {}".format(fruits))
@yoneda
yoneda / test.js
Created March 10, 2018 12:58
javascript exe test
// js単体でプログラムを動かしたい時は、
// $ node test.js
// でOK
var a = 50;
var b = 60;
var result = a + b;
console.log("結果は:"+result);

テクノロジーデザイン1 でやったこと


目次

  • redux について
  • redux の良いところ
  • good/motto