Skip to content

Instantly share code, notes, and snippets.

View hrdtbs's full-sized avatar
🎯
I may be slow to respond.

hrdtbs hrdtbs

🎯
I may be slow to respond.
View GitHub Profile
*{
margin: 0;
padding: 0;
}
/*
Font size: 12
Line height: 1.5
Scale Factor: 1.618
*/
@hrdtbs
hrdtbs / きたない.js
Last active March 16, 2018 12:48
これはだめだ
src = "https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js";
sc = document.createElement("script");
sc.type = "text/javascript";
sc.src = src;
document.body.appendChild(sc);
var tweetText = $(".js-tweet-text.tweet-text:contains('誰か')")
var tweet = tweetText.parents('li')
@hrdtbs
hrdtbs / headlesschrome-selenium-bf4.py
Last active March 17, 2018 09:54
Pythonでスクレイピングしてみようかなって思ったときに最初に書きそうなやつ
# coding: utf-8
from selenium import webdriver
from bs4 import BeautifulSoup
options = webdriver.ChromeOptions()
options.set_headless()
driver = webdriver.Chrome(chrome_options=options)
driver.get('https://www.google.co.jp/')
@hrdtbs
hrdtbs / createJSON.php
Last active March 19, 2018 08:50
PHP get Param, create JSON, create File safety
<?php
$data = [
"AAA"=>"XXX",
"BBB"=>"YYY",
];
function createJSON($data){
return json_encode($data, JSON_UNESCAPED_UNICODE);
}
@hrdtbs
hrdtbs / type-check.js
Created March 19, 2018 10:35
JavaScriptの型判定のような何か、必要になったものから追加
export const isObject = target =>
value !== null && typeof value !== "undefined" && Object(value) === value;
export const isArray = target => Array.isArray(target);
export const isString = target => typeof target === "string";
// template literalという型は存在しないが
export const isTemplateLiteral = target => !!target.raw;
@hrdtbs
hrdtbs / fetch.js
Last active March 19, 2018 12:58
CORS - PHP + JavaScript
const url = "";
const options = {
credentials: 'include',
mode: 'cors'
}
fetch(url, options)
.then(res => res.json())
.then((json) => {
console.log(json)
@hrdtbs
hrdtbs / bash_profile
Created March 28, 2018 07:36
VSCodeで開いているディレクトリ専用のshell
...
if [ -e myscripts.sh ]; then
source myscripts.sh
fi
@hrdtbs
hrdtbs / range.js
Created April 4, 2018 09:34
like python range
const range = (from, to, step) => {
if (from === undefined) return [];
if (to === undefined) return [...Array(from).keys()];
if (step === undefined)
return [...Array(to - from).keys()].map(x => x + from);
return [...Array(Math.ceil((to - from) / step)).keys()].map(
x => x * step + from
);
};
export default range;
@hrdtbs
hrdtbs / YarnCheatSheet.md
Last active April 5, 2018 15:21
Yarn Cheat Sheet

Yarnのインストール

npm i -g yarn

Yarn as npm

npmと同じもの

初期化

@hrdtbs
hrdtbs / python-jupyter-on-mac.sh
Created April 7, 2018 03:58
MacでJupyterをとりあえず動かす
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install python3
pip3 install jupyter
jupyter notebook