PCを新調したのでイロイロと環境構築を頑張る。
今回はRubyの環境構築。
OSはWindows10 64bit でUNIX環境をシミュレートするために babun (cugwin) を使ってみる。
(友人には仮想を使えと怒られた)
| function doPost(e) { | |
| var prop = PropertiesService.getScriptProperties().getProperties(); | |
| const DAYS = [ '12/01', '12/02', '12/03', '12/04', '12/05' | |
| , '12/06', '12/07', '12/08', '12/09', '12/10' | |
| , '12/11', '12/12', '12/13', '12/14', '12/15' | |
| , '12/16', '12/17', '12/18', '12/19', '12/20' | |
| , '12/21', '12/22', '12/23', '12/24', '12/25' | |
| ]; |
| module MinRuby | |
| ( minrubyParse | |
| , minrubyLoad | |
| ) where | |
| import Control.Applicative (empty) | |
| import Data.Either (either) | |
| import Data.Tree (Tree(..)) | |
| import Text.Megaparsec (Parsec, Dec, parse, parseErrorPretty, some, string, space, (<|>)) | |
| import Text.Megaparsec.Char (digitChar) |
| function doPost(e) { | |
| var prop = PropertiesService.getScriptProperties().getProperties(); | |
| const BOT_NAME = 'hunter'; | |
| const BOT_ICON = 'http://drive.google.com/uc?export=view&id=' + prop.ICON_ID; | |
| if (prop.VERIFY_TOKEN != e.parameter.token) { | |
| throw new Error("invalid token."); | |
| } |
| function hunt() { | |
| var prop = PropertiesService.getScriptProperties().getProperties(); | |
| /* Load Spread Sheet */ | |
| var sheet = SpreadsheetApp.openById(prop.SPREAD_SHEET_ID).getSheetByName(prop.SHEET_NAME); | |
| var names = sheet.getRange(1, 1, prop.ROW_NUM, 2).getValues(); | |
| Logger.log(names); | |
| var unuseNames = names.filter( | |
| function(row){ |
| init by gas-hub, just delete this file. |
| module Main where | |
| import Data.Maybe (isJust) | |
| import Text.Read (readMaybe) | |
| import Control.Monad (join) | |
| main :: IO () | |
| main = do | |
| let initState = (Nothing, GradesCounter 0 0 0 0) | |
| _ <- doWhileM updateGrade (isJust . fst) initState |
| import Data.List (unfoldr) | |
| import Data.Tuple (swap) | |
| solve :: Int -> Int | |
| solve n = head $ filter isMultiPalidromic [n..] | |
| isMultiPalidromic :: Int -> Bool | |
| isMultiPalidromic n = countTwo . filter isPalidromic' $ map (`convertRadix` n) [2..n] | |
| isPalidromic :: [Int] -> Bool |