Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View cherenkov's full-sized avatar

cherenkov cherenkov

View GitHub Profile
@cherenkov
cherenkov / pedometer.html
Last active August 22, 2021 04:38
ブラウザで歩数計 ios safariで動作確認 ios 13.5.1, https必須
<html>
<head>
<script>
// 重力加速度のしきい値
var GRAVITY_MIN = 9.8;
var GRAVITY_MAX = 12.00;
// 歩数
var _step = 0;
// 現在歩いているかどうか
var _isStep = false;
@cherenkov
cherenkov / .zshrc
Created November 17, 2019 14:04
zsh + zplugin
### Added by Zplugin's installer
source "$HOME/.zplugin/bin/zplugin.zsh"
autoload -Uz _zplugin
(( ${+_comps} )) && _comps[zplugin]=_zplugin
### End of Zplugin installer's chunk
zplugin load zsh-users/zsh-syntax-highlighting # 実行可能なコマンドに色付け
zplugin load zsh-users/zsh-completions # 補完
class String
def caesar; tr 'a-zA-Z', 'n-za-mN-ZA-M' end
def uncaesar; tr 'n-za-mN-ZA-M', 'a-zA-Z' end
end
print "unccl oveguqnl!".caesar
#パスワードにカエサル暗号(シーザー暗号)を使う。Rubyを使った場合:Garbage In Garbage Out
#http://g1g0.com/2012/01/523/
/*
ハマりポイント
apps scriptのソースコードを書き換えたらプロジェクトバージョンを新しくして更新する必要がある。
メニュー > 公開 > ウェブアプリケーションとして導入
「プロジェクトバージョン」をNewにして更新。
アプリケーションにアクセスできるユーザー:全員(匿名含む)
*/
function myFunction() {
var url = "https://docs.google.com/spreadsheets/d/xxxxxxxxxxxxx/edit?usp=sharing";
@cherenkov
cherenkov / youtube_playlist_get_video_url.js
Created September 14, 2018 01:48
youtube再生リストの動画URL一覧を取得する
//力技ですが、URL一覧を取得する方法を考えてみました。
//まず、このような自分が管理するプレイリストを編集する画面に移動する。
// https://gyazo.com/5312815c46bcacd81dd0e1f4b05a1d41
//動画数が100以上だと「もっと見る」とか押さないと隠れているかもしれないので、
//同じ画面内に一度全部表示させてから、
//ブラウザのコンソールを開いて下記のコードをコピペしてEnterすると画面の右下にURL一覧ができます。
(function(){
var ary = [];
document.querySelectorAll('.pl-video-title-link').forEach(function(e){
@cherenkov
cherenkov / gist:792746ceb9e74c7d7836e7a43b66866d
Created June 22, 2018 12:13 — forked from kyontan/gist:7678042
游書体を加えたCSS font-family
/* ヒラギノ角ゴ */
font-family: "ヒラギノ角ゴ Pro", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, "MS Pゴシック", "MS PGothic", sans-serif;
/* ヒラギノ明朝 */
font-family: "ヒラギノ明朝 Pro", "Hiragino Mincho Pro", "MS P明朝", "MS PMincho", serif;
/* From: 游明朝体・游ゴシック体のCSSでの利用 - Qiita [キータ]
* http://qiita.com/shinnn/items/5be7e8106189311559c1
*/
@cherenkov
cherenkov / file0.css
Created June 22, 2018 12:12 — forked from shinnn/file0.css
游明朝体・游ゴシック体のCSSでの利用 ref: http://qiita.com/shinnn/items/5be7e8106189311559c1
.sans-serif {
font-family: "游ゴシック体", "Yu Gothic", YuGothic, sans-serif;
}
@cherenkov
cherenkov / amazon_get_toc.html
Created January 24, 2011 20:49
Yahoo Pipesを使ってクロスドメイン通信でAmazonから目次情報を取得するサンプル。http://q.hatena.ne.jp/1294562027
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script>
$(function() {
var isbn = ['4774127833', '4873113792', '4822248372'],
amz_url = '';
url = Popup.input "amebloのURLを入力してください"
#todo: amebloアプリからsafariで開いた際に余計なパラメータが付くことがありyqlで失敗する。パラメータを除去する
url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D'" + url + "'%20and%20xpath%3D'%2F%2Fimg%5Bcontains(%40src%2C%20%22http%3A%2F%2Fstat.ameba.jp%2Fuser_images%2F%22)%5D%5Bnot(contains(%40src%2C%20%22%3Fcpd%3D%22))%5D'&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys"
json = Browser.json url
#p json
imgs = json['query']['results']['img']
imgs.each do |e|
src = e['src']
if src =~ /\?caw=/
@cherenkov
cherenkov / line_like_chatbot.rb
Last active April 9, 2016 06:54
エビ中とLINEしてる気分になれるChatBotをPictRubyで作ってみた ref: http://qiita.com/cherenkov/items/c6a744639a39a693810b
#line_like_chatbot v0.1
class Chat
def initialize
feed = "http://lineblog.me/ebichu/index.rdf"
count = 10
url = "https://query.yahooapis.com/v1/public/yql?q=SELECT%20title%2Clink%2Cencoded%20FROM%20rss%20WHERE%20url%3D%22" + URI.encode_www_form_component(feed) + "%22%20%7C%20truncate(count%3D" + count.to_s + ")&format=json"
data = Browser.json url
@menu = []
@text = []
data['query']['results']['item'].each_with_index {|item,i|