<commit_before><?php

// TODO: html format can't be dynamic view if cached to filesystem
//		use javascript?
//		any kind of html 5 component for hidden panels?
//		static implementation can't be limited in timespan
//		can't cache current day marker
// TODO: recurring events present caching issue - when are more events added? Daily?
// TODO: recurring events
//		date: ( [ ([-]nth|every x[+y]) year ][ ([-]nth|every x[+y]) month ][ ([-]nth|every x[+y]) week ][ ([-]nth|every x[+y]) day ] )+
//		time: hour minute
//		duration: [ x days ][ x hours ][ x minutes ]
//      
// TODO: error page should have 500 status
// TODO: proper html output with navigation
// TODO: proper css
// TODO: input discovery
// TODO: input preference storage in config php
// TODO: yaml input
// TODO: more css examples
// TODO: jsonp output (application/javascript)
// TODO: atom format
// TODO: yaml output
// TODO: google calendar input
// TODO: csv input
// TODO: wordpress api
// TODO: textpattern api
// TODO: sql database input
// TODO: web-based UI for config
// TODO: web-based UI input
// TODO: facebook input
// TODO: eventbrite input
// TODO: other useful input formats
// TODO: icalendar feed name and link?
// TODO: icalendar prodid standard?
// TODO: icalendar disallows zero events


function input_json_if_necessary($scriptname,$updated){
	$filename = $scriptname."-master.json";
	if(filemtime($filename) <= $updated){
		return FALSE;
	}
	$handle = @fopen($filename,"r");
	if($handle===FALSE){
		return "JSON: File ".$filename." not found";
	}
	$json = fread($handle,filesize($filename));<commit_msg>committing before new recurrance spec idea<commit_after><?php

// TODO: html format can't be dynamic view if cached to filesystem
//		use javascript?
//		any kind of html 5 component for hidden panels?
//		static implementation can't be limited in timespan
//		can't cache current day marker
//		static file updated once per day
// TODO: recurring events present caching issue - when are more events added? Daily?
// TODO: recurring events
//		date: ( [ ([-]nth|every x[+y]) year ][ ([-]nth|every x[+y]) month ][ ([-]nth|every x[+y]) week ] ([-]nth|every x[+y]) day  )+
//		time: hour minute
//		duration: [ x days ][ x hours ][ x minutes ]
//		week x day y != xth yday of month
//		every 1 months 15th day = 15th of each month
//		every 1 months 2nd week 1st day = monday of the 2nd week of each month (ambiguous - second monday or start of week 2?)
//		[                                ] year
//		[     ][     ][      ] ... [     ] month
//		 ][  ][  ][  ][  ][  ]      ][  ][ week   <-- not aligned
//		|||||||||||||||||||||||||||||||||| day
//		Day part is compulsory - ending with larger denomination doesnt specify single date
//		( ( day 2 ) of week ) of month
//		( day 256 ) of year
//		( ( day 15 ) of month 3 ) of year
//		( ( 2nd day ) of every 2 weeks ) of every 3 years
//		( ( 2nd day ) every week ) every year
//		( 2nd ( 3nd day ) every week ) every month
//		2nd ( ( 3rd day ) of every 2 weeks ) of month
//		S -> ( TY | NY | TM | NM | TW | NW | TD | ND )
//		N -> [0-9]+ 
//		T -> ( N ('th'|'rd'|'nd') ( 'to' 'last' )? | 'last' )
//		TD -> T 'day'
//		ND -> 'every' ( N 'days' | 'day' )
//		TW -> T ( TD | ND ) 'of' 'week'
//		NW -> ( TD | ND ) 'every' ( N 'weeks' | 'week' )
//		TM -> T ( TW | NW | TD | ND  ) 'of' 'month'
//		NM -> ( TW | NW | TD | ND  ) 'every' ( N 'months' | 'month' )
//		TY -> T ( TM | NM | TW | NW | TD | ND ) 'of' 'year' 
//		NY -> ( TM | NM | TW | NW | TD | ND ) 'every' ( N 'years' | 'year' )
//		
//		2nd (every day) of week --> 2nd day in history
//		(2nd day) every week --> every Tuesday
//		(every day) every 2 weeks --> daily on alternate weeks
//		(every 2 days) every week --> every Mon, Wed, Fri, Sun
//		every 2 days --> alternate days
//		2nd (every 2 days) of week --> the first Wednesday in history
//		(every 2 days) every 2 weeks --> Mon, Wed, Fri, Sun on alternate weeks
//		2nd (2nd (2nd day) of week) of month --> Second Tuesday of the second month in history
//		(2nd (2nd day) of week) every month --> second Tuesday every month
//		(2nd to last (2nd day) of week) every month -> second to last Tuesday each month
//      
// TODO: error page should have 500 status
// TODO: proper html output with navigation
// TODO: proper css
// TODO: input discovery
// TODO: input preference storage in config php
// TODO: yaml input
// TODO: more css examples
// TODO: jsonp output (application/javascript)
// TODO: atom format
// TODO: yaml output
// TODO: google calendar input
// TODO: csv input
// TODO: wordpress api
// TODO: textpattern api
// TODO: sql database input
// TODO: web-based UI for config
// TODO: web-based UI input
// TODO: facebook input
// TODO: eventbrite input
// TODO: other useful input formats
// TODO: icalendar feed name and link?
// TODO: icalendar prodid standard?
// TODO: icalendar disallows zero events
// TODO: browser cache headers


function input_json_if_necessary($scriptname,$updated){
	$filename = $scriptname."-master.json";
	if(filemtime($filename) <= $updated){
		return FALSE;
	}
	$handle = @fopen($filename,"r");
	if($handle===FALSE){
		return "JSON: File ".$filename." not found";
	}
	$json = fread($handle,filesize($filename));
{'fraction_non_alphanumeric': 0.1604206500956023, 'fraction_numerical': 0.010133843212237094, 'mean_word_length': 2.7823571945047, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6219333', 'n_tokens_mistral': 1820, 'n_tokens_neox': 1707, 'n_words': 676}