-
-
Save Max-Makhrov/6e87ee9ee145af1d8a5ff6fd163f299a to your computer and use it in GitHub Desktop.
google-calendar-holiday
This file contains 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
scriptencoding utf-8 | |
let s:calendar_list = [ | |
\ ['Australian Holidays', 'en.australian#[email protected]'], | |
\ ['Austrian Holidays', 'en.austrian#[email protected]'], | |
\ ['Brazilian Holidays', 'en.brazilian#[email protected]'], | |
\ ['Canadian Holidays', 'en.canadian#[email protected]'], | |
\ ['China Holidays', 'en.china#[email protected]'], | |
\ ['Christian Holidays', 'en.christian#[email protected]'], | |
\ ['Danish Holidays', 'en.danish#[email protected]'], | |
\ ['Dutch Holidays', 'en.dutch#[email protected]'], | |
\ ['Finnish Holidays', 'en.finnish#[email protected]'], | |
\ ['French Holidays', 'en.french#[email protected]'], | |
\ ['German Holidays', 'en.german#[email protected]'], | |
\ ['Greek Holidays', 'en.greek#[email protected]'], | |
\ ['Hong Kong (C) Holidays', 'en.hong_kong_c#[email protected]'], | |
\ ['Hong Kong Holidays', 'en.hong_kong#[email protected]'], | |
\ ['Indian Holidays', 'en.indian#[email protected]'], | |
\ ['Indonesian Holidays', 'en.indonesian#[email protected]'], | |
\ ['Iranian Holidays', 'en.iranian#[email protected]'], | |
\ ['Irish Holidays', 'en.irish#[email protected]'], | |
\ ['Islamic Holidays', 'en.islamic#[email protected]'], | |
\ ['Italian Holidays', 'en.italian#[email protected]'], | |
\ ['Japanese Holidays', 'en.japanese#[email protected]'], | |
\ ['Jewish Holidays', 'en.jewish#[email protected]'], | |
\ ['Malaysian Holidays', 'en.malaysia#[email protected]'], | |
\ ['Mexican Holidays', 'en.mexican#[email protected]'], | |
\ ['New Zealand Holidays', 'en.new_zealand#[email protected]'], | |
\ ['Norwegian Holidays', 'en.norwegian#[email protected]'], | |
\ ['Philippines Holidays', 'en.philippines#[email protected]'], | |
\ ['Polish Holidays', 'en.polish#[email protected]'], | |
\ ['Portuguese Holidays', 'en.portuguese#[email protected]'], | |
\ ['Russian Holidays', 'en.russian#[email protected]'], | |
\ ['Singapore Holidays', 'en.singapore#[email protected]'], | |
\ ['South Africa Holidays', 'en.sa#[email protected]'], | |
\ ['South Korean Holidays', 'en.south_korea#[email protected]'], | |
\ ['Spain Holidays', 'en.spain#[email protected]'], | |
\ ['Swedish Holidays', 'en.swedish#[email protected]'], | |
\ ['Taiwan Holidays', 'en.taiwan#[email protected]'], | |
\ ['Thai Holidays', 'en.thai#[email protected]'], | |
\ ['UK Holidays', 'en.uk#[email protected]'], | |
\ ['US Holidays', 'en.usa#[email protected]'], | |
\ ['Ukraine Holidays', 'en.ukrainian#[email protected]'] | |
\ ['Vietnamese Holidays', 'en.vietnamese#[email protected]'], | |
\ ['アイルランドの祝日', 'ja.irish#[email protected]'], | |
\ ['アメリカの祝日', 'ja.usa#[email protected]'], | |
\ ['イギリスの祝日', 'ja.uk#[email protected]'], | |
\ ['イスラム教の祝日', 'ja.islamic#[email protected]'], | |
\ ['イタリアの祝日', 'ja.italian#[email protected]'], | |
\ ['インドの祝日', 'ja.indian#[email protected]'], | |
\ ['インドネシアの祝日', 'ja.indonesian#[email protected]'], | |
\ ['オランダの祝日', 'ja.dutch#[email protected]'], | |
\ ['オーストラリアの祝日', 'ja.australian#[email protected]'], | |
\ ['オーストリアの祝日', 'ja.austrian#[email protected]'], | |
\ ['カナダの祝日', 'ja.canadian#[email protected]'], | |
\ ['キリスト教の祝日', 'ja.christian#[email protected]'], | |
\ ['ギリシャの祝日', 'ja.greek#[email protected]'], | |
\ ['シンガポールの祝日', 'ja.singapore#[email protected]'], | |
\ ['スウェーデンの祝日', 'ja.swedish#[email protected]'], | |
\ ['スペインの祝日', 'ja.spain#[email protected]'], | |
\ ['タイの祝日', 'ja.thai#[email protected]'], | |
\ ['デンマークの祝日', 'ja.danish#[email protected]'], | |
\ ['ドイツの祝日', 'ja.german#[email protected]'], | |
\ ['ニュージーランドの祝日', 'ja.new_zealand#[email protected]'], | |
\ ['ノルウェイの祝日', 'ja.norwegian#[email protected]'], | |
\ ['フィリピンの祝日', 'ja.philippines#[email protected]'], | |
\ ['フィンランドの祝日', 'ja.finnish#[email protected]'], | |
\ ['フランスの祝日', 'ja.french#[email protected]'], | |
\ ['ブラジルの祝日', 'ja.brazilian#[email protected]'], | |
\ ['ベトナムの祝日', 'ja.vietnamese#[email protected]'], | |
\ ['ポルトガルの祝日', 'ja.portuguese#[email protected]'], | |
\ ['ポーランドの祝日', 'ja.polish#[email protected]'], | |
\ ['マレーシアの祝日', 'ja.malaysia#[email protected]'], | |
\ ['メキシコの祝日', 'ja.mexican#[email protected]'], | |
\ ['ユダヤ教の祝日', 'ja.jewish#[email protected]'], | |
\ ['ロシアの祝日', 'ja.russian#[email protected]'], | |
\ ['中国の祝日', 'ja.china#[email protected]'], | |
\ ['韓国の祝日', 'ja.south_korea#[email protected]'], | |
\ ['南アフリカの祝日', 'ja.sa#[email protected]'], | |
\ ['台湾の祝日', 'ja.taiwan#[email protected]'], | |
\ ['日本の祝日', 'ja.japanese#[email protected]'], | |
\ ['香港(C)の祝日', 'ja.hong_kong_c#[email protected]'], | |
\ ['香港の祝日', 'ja.hong_kong#[email protected]'], | |
\ ] | |
function! s:urlescape(s) | |
return substitute(a:s, '[#@]', '\=printf("%%%02x", char2nr(submatch(0)))', 'g') | |
endfunction | |
function! s:fetch(id) | |
let res = http#get(printf('http://www.google.com/calendar/feeds/%s/public/full?alt=json&max-results=99999', s:urlescape(a:id))) | |
return json#decode(res.content) | |
endfunction | |
function! s:order_by_startTime(a, b) | |
let a = a:a['gd$when'][0]['startTime'] | |
let b = a:b['gd$when'][0]['startTime'] | |
return a < b ? -1 : a > b ? 1 : 0 | |
endfunction | |
function! s:main() | |
for [name, id] in s:calendar_list | |
echo name | |
let feed = s:fetch(id) | |
for entry in sort(feed['feed']['entry'], 's:order_by_startTime') | |
echo [entry['gd$when'][0]['startTime'], entry['title']['$t']] | |
endfor | |
endfor | |
endfunction | |
try | |
call s:main() | |
endtry |
This file contains 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
Australian Holidays,en.australian#[email protected] | |
Austrian Holidays,en.austrian#[email protected] | |
Brazilian Holidays,en.brazilian#[email protected] | |
Canadian Holidays,en.canadian#[email protected] | |
China Holidays,en.china#[email protected] | |
Christian Holidays,en.christian#[email protected] | |
Danish Holidays,en.danish#[email protected] | |
Dutch Holidays,en.dutch#[email protected] | |
Finnish Holidays,en.finnish#[email protected] | |
French Holidays,en.french#[email protected] | |
German Holidays,en.german#[email protected] | |
Greek Holidays,en.greek#[email protected] | |
Hong Kong (C) Holidays,en.hong_kong_c#[email protected] | |
Hong Kong Holidays,en.hong_kong#[email protected] | |
Indian Holidays,en.indian#[email protected] | |
Indonesian Holidays,en.indonesian#[email protected] | |
Iranian Holidays,en.iranian#[email protected] | |
Irish Holidays,en.irish#[email protected] | |
Islamic Holidays,en.islamic#[email protected] | |
Italian Holidays,en.italian#[email protected] | |
Japanese Holidays,en.japanese#[email protected] | |
Jewish Holidays,en.jewish#[email protected] | |
Malaysian Holidays,en.malaysia#[email protected] | |
Mexican Holidays,en.mexican#[email protected] | |
New Zealand Holidays,en.new_zealand#[email protected] | |
Norwegian Holidays,en.norwegian#[email protected] | |
Philippines Holidays,en.philippines#[email protected] | |
Polish Holidays,en.polish#[email protected] | |
Portuguese Holidays,en.portuguese#[email protected] | |
Russian Holidays,en.russian#[email protected] | |
Singapore Holidays,en.singapore#[email protected] | |
South Africa Holidays,en.sa#[email protected] | |
South Korean Holidays,en.south_korea#[email protected] | |
Spain Holidays,en.spain#[email protected] | |
Swedish Holidays,en.swedish#[email protected] | |
Taiwan Holidays,en.taiwan#[email protected] | |
Thai Holidays,en.thai#[email protected] | |
UK Holidays,en.uk#[email protected] | |
Ukraine Holidays,en.ukrainian#[email protected] | |
US Holidays,en.usa#[email protected] | |
Vietnamese Holidays,en.vietnamese#[email protected] | |
アイルランドの祝日,ja.irish#[email protected] | |
アメリカの祝日,ja.usa#[email protected] | |
イギリスの祝日,ja.uk#[email protected] | |
イスラム教の祝日,ja.islamic#[email protected] | |
イタリアの祝日,ja.italian#[email protected] | |
インドの祝日,ja.indian#[email protected] | |
インドネシアの祝日,ja.indonesian#[email protected] | |
オランダの祝日,ja.dutch#[email protected] | |
オーストラリアの祝日,ja.australian#[email protected] | |
オーストリアの祝日,ja.austrian#[email protected] | |
カナダの祝日,ja.canadian#[email protected] | |
キリスト教の祝日,ja.christian#[email protected] | |
ギリシャの祝日,ja.greek#[email protected] | |
シンガポールの祝日,ja.singapore#[email protected] | |
スウェーデンの祝日,ja.swedish#[email protected] | |
スペインの祝日,ja.spain#[email protected] | |
タイの祝日,ja.thai#[email protected] | |
デンマークの祝日,ja.danish#[email protected] | |
ドイツの祝日,ja.german#[email protected] | |
ニュージーランドの祝日,ja.new_zealand#[email protected] | |
ノルウェイの祝日,ja.norwegian#[email protected] | |
フィリピンの祝日,ja.philippines#[email protected] | |
フィンランドの祝日,ja.finnish#[email protected] | |
フランスの祝日,ja.french#[email protected] | |
ブラジルの祝日,ja.brazilian#[email protected] | |
ベトナムの祝日,ja.vietnamese#[email protected] | |
ポルトガルの祝日,ja.portuguese#[email protected] | |
ポーランドの祝日,ja.polish#[email protected] | |
マレーシアの祝日,ja.malaysia#[email protected] | |
メキシコの祝日,ja.mexican#[email protected] | |
ユダヤ教の祝日,ja.jewish#[email protected] | |
ロシアの祝日,ja.russian#[email protected] | |
中国の祝日,ja.china#[email protected] | |
韓国の祝日,ja.south_korea#[email protected] | |
南アフリカの祝日,ja.sa#[email protected] | |
台湾の祝日,ja.taiwan#[email protected] | |
日本の祝日,ja.japanese#[email protected] | |
香港(C)の祝日,ja.hong_kong_c#[email protected] | |
香港の祝日,ja.hong_kong#[email protected] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment