Sunday lazy sunday
[minor pseudonymising edits during Drupal to hugo migration for all the good that will do now]
Last night, I was on a roll. I went to bed slightly later than intended.
This morning, 3yo woke me up repeatedly. First, sometime before the sun came up. Then shortly after the sun came up and the blue light was caning my eyes. Then after the sun came up. And shortly after JJ staggered out of bed I did the same seeing as I couldn’t sleep anyway.
You will be assimilated...
Or not. Short version, according to last night’s bizarro dream, there’s going to be a merger between “this” world and “some other dimension/universe” soon if it’s not happening already.
Now that I’m awake I’m wondering if it was Yet Another Incarnation of the Crazy Dog House, though I don’t recall seeing a cliff this time. One day I should probably try to explain The Crazy Dog House, which appears to be a stupidly large mansion not a doghouse.
Camel barge
[minor pseudonymising edits during Drupal to hugo migration for all the good that will do now]
Me: Here [3yo], a green nappy to go with your camo.
3yo: Camo! What’s camo?
JJ: Camoflage.
2yo: Camel barge? What the?!
This work by ryivhnn is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License
Funding, distribution and musings on my sanity (or lack thereof)
Business has been going pretty well. This is great, and it also means I haven’t had a chance to work much on AR. I’ve been proofing and editing the scripts in between banging my head against code and deciphering client requests, and spent a whack of Sunday working on Red, but I’m pretty sure at this stage that I won’t be ready to animate the first ep by the end of the year. I am refusing to have panic attacks about it.
New camera, more aquaponics photos
We finally bought a NAS, it’s living next to the router (which makes logical sense as it has to plug into the router). I’m currently copying all the music and photos onto it and will probably delete them off my computer as part of my cleanup process (moving a bunch of Stuff off the 250Gb ssd to the 2Tb sata).
Moving the iPhoto database was nice and easy (drag, hold down alt when opening iPhoto, selecting where the library had been moved to, delete the original file), and it kind of needed to go elsewhere as it’s 53Gb and going to blow out as I’m shooting RAW.
Sprat does not share my scss enthusiasm
[reformatted the code during migration to make it slightly easier to read, this was a copy/paste from some text conversation and all formatting was lost]
ryivhnn 6/04/12 10:23 PM hee hee other cool thing with sass, i do this:
@mixin inline-block {
display: inline-block;
margin: 0 -2px;
vertical-align: top;
}
and then when i need things inline-blocked etc (in a few places) i do:
#container {
.stuff-what-needs-inlining {
@include inline-block;
}
}
Darqx 6/04/12 10:24 PM i look at that and see what looks to be php mixed with css and want to run away screaming
css notes: fixed middle fluid outer column
Also known as: I’m a blithering idiot.
I spent way too long overthinking this problem and only finding solutions with floats (I have very specific cases where I’ll use floats for layout, also I could have missed anything that didn’t use floats for layout as I was stupidly staying up way too late when working on this). The way to do it is actually embarrassingly easy. I’ll be using it for the header and footer (after I’ve installed Sassy, prepro and phpsass.
Malay, lojban, and pocket money for bookwork
Not “versus” because it’s not a contest. Not really.
I’m about to give up on my Malay Anki deck, mostly because it’s not ordered in a way that makes logical sense to me. I grew up hearing a lot of Malay, sadly I didn’t learn it formally because I couldn’t be bothered going to Malay school on Saturday mornings (I already went to school five days a week, why in the hell would I want to go on a sixth?) and I didn’t pick up nearly enough in daily life (partially because I think my parents were more concerned about me speaking and writing decent English while going through school, partially because I had for a very long time this idiotic notion that if I couldn’t grasp something the very second it was presented then I was obviously too stupid to live, and mostly because I was probably too damn lazy to pay proper attention). I figured that I should just be able to pick it back up, and I did to a degree. I’m not sure how the deck was structured, perhaps relevance to something that wasn’t relevant to me. There were many instances where I wondered why the root word hadn’t been introduced before a word that built off it.
theAbysmal Calendar Drupal module
I think it’s done now.
- fixed an issue where the years weren’t being calculated properly (?!)
- I may be slightly out of sync with the official documentation, at least according to the tests I’ve done on my local so far. This year should match up, and so will key dates (New Year Day and Leap Day). I’ve shifted leap years to fall on multiples of 4 so calculating would be a simple case of if mod 4 is 0, it’s a leap year, if mod 128 is 0, it’s not a leap year, so some of my years will be a day or two out
theabysmal_calendar.info
name = theAbysmal Calendar
description = Converts Gregorian date to theAbysmal date
core = 7.x
package = Date/Time
theabysmal_calendar.module
<?php
/**
* @file
* Converts date from Gregorian to theAbysmal Calendar
*
* theAbysmal Calendar in depth: http://theabysmal.wordpress.com/theabysmal-calendar/
* Currently uses months from the Tranquility Calendar
* (http://www.mithrandir.com/tranquility/tranquility.html) and days in
* highly informal/bastardised lojban as that's how I use it.
*
* @author ryivhnn
*/
/**
* Implements hook_help.
*
* Displays help and module information.
*
* @param path
* Which path of the site we're using to display help
* @param arg
* Array that holds the current path as returned from arg() function
*/
function theabysmal_calendar_help($path, $arg) {
switch ($path) {
case "admin/help#theabysmal_calendar" :
return '<p>' . t("Converts date to theAbysmal Calendar") . '</p><p> </p><p>';
break;
}
}
function node_created_date() {
// grab node create date
$query = db_select('node', 'n') -> fields('n', array('nid', 'created')) -> condition('nid', arg(1)) -> condition('status', 1) -> execute() -> fetchAssoc();
$date = $query['created'];
return $date;
}
function today() {
// grab today's date
$date = time();
return $date;
}
function date_converter($date_ce) {
/**
* doing the calendar converty magic
* owe the algorithm to the software engineer husband
*/
// set the zero date and time for theAbysmal Calendar
$zero_date = mktime(0, 0, 0, 12, 21, 2012);
// this is New Year Day on theAbysmal Calendar
$zero_day = date('z', mktime(0, 0, 0, 12, 22, 2012));
// this is first day which is counted from 0
// calculate theAbysmal year
if ((date('m', $date_ce) == 12) && (date('d', $date_ce) > 20)) {
$year = date('Y', $date_ce) - date('Y', $zero_date);
}
else {
$year = (date('Y', $date_ce) - date('Y', $zero_date)) - 1;
}
/**
* I think theAbysmal Calendar may be following Gregorian leap years to a degree.
* I couldn't find anything explicit in the documentation on the website.
* Because it counts from 0 every 4th number ends up being slightly weird (3, 7, 11, 15).
* I've decided to modify slightly to make leap years occur on multiples of 4 like they do
* on the Gregorian which then makes the not observing the leap year every 128 years
* slightly easy to remember, and also takes an operator out of the maths.
* Yes I can write an entire rationale in the comments but cbf putting in one extra operator.
*/
if ($year % 4 == 0) {
$ly = 1;
if ($year % 128 == 0)
{ $ly = 0;
}
}
else {
$ly = 0;
}
// because the leap years are different, we need to do maths with Gregorian
$gly = date('L', $date_ce);
// "buffers" for the leap year calculations
if ($ly == 0 && $gly == 0) {
/**
* the way the $year_length calculation works, years where it's not a Gregorian
* or theAbysmal leap year come up a bit short, so this pads it out
*/
$leap_buffer = 1;
}
elseif ($ly == 1 && $gly == 1) {
/**
* conversely if the leap years coincide it makes the $year_length a bit longer
* than it should be, so this adjusts
*/
$leap_buffer = -1;
}
else {
$leap_buffer = 0;
}
/**
* working out how long the year is
* need to +1 to make it an absolute value
* add theAbysmal leap year and subtract the Gregorian leap year as required
*/
$year_length = date('z', mktime(0, 0, 0, 12, 31, $year_ce)) + $ly - $gly + $leap_buffer + 1;
// what day number are we up to in the Gregorian, + theAbysmal leap year + the leap buffer
$gregorian_day_of_year = date('z', $date_ce) + $ly + $leap_buffer;
// how many days have passed since theAbysmal start date, plus tA leap year day, less Gregorian leap year day
$days_from_start = ($gregorian_day_of_year - $zero_day + $year_length) % $year_length;
// theAbysmal month converted to an integer
$month_number = intval($days_from_start / 28);
// what day in the month it is
$mday = $days_from_start % 28;
// lojban day names assigned to month names
$days = array(
'xundei' => array('0', '7', '14', '21'),
'najdei' => array('1', '8', '15', '22'),
'peldei' => array('2', '9', '16', '23'),
'ri\'ordei' => array('3', '10', '17', '24'),
'cicnydei' => array('4', '11', '18', '25'),
'bladei' => array('5', '12', '19', '26'),
'zirdei' => array('6', '13', '20', '27'),
);
foreach($days as $key => $value) {
if (in_array($mday, $value)) {
$weekday = $key;
}
}
// Tranquility calendar month names
// the 14th "month" is a 2 day intercalary period for New Year Day and Leap Year Day
$months = array(
'0' => 'Archimedes',
'1' => 'Brahe',
'2' => 'Copernicus',
'3' => 'Darwin',
'4' => 'Einstein',
'5' => 'Faraday',
'6' => 'Galileo',
'7' => 'Hippocrates',
'8' => 'Imhotep',
'9' => 'Jung',
'10' => 'Kepler',
'11' => 'Lavoisier',
'12' => 'Mendel',
'13' => '',
);
foreach ($months as $key => $value) {
if ($key == $month_number) {
$month = $value;
}
}
/*
* intercalary days
*
* check to see if it's December Solstice (Dec 21)
* if it is, it's New Year Day
* if not, it's a weekday
*
* if it's a leap year, Dec 20 is Leap Year Day
*/
if ($month == '') {
$weekday = '';
if (date('d', $date_ce) == 21 && date('m', $date_ce) == 12) {
$mday = "New Year Day";
}
if ($ly == 1 && date('d', $date_ce) == 20 && date('m', $date_ce) == 12) {
$mday = "Leap Day";
}
}
// leading zero silliness
$yrabs = abs($year);
$yrlen = strlen($yrabs);
if ($date_ce < $zero_date) {
$era = 'btAT';
}
elseif ($year == '0000') {
$era = 'tAT';
}
else {
$era = 'tAT';
}
if ($yrlen == 1) {
$year = '000' . $yrabs;
}
elseif ($yrlen == 2) {
$year = '00' . $yrabs;
}
elseif ($yrlen == 3) {
$year = '0' . $yrabs;
}
$daylen = strlen($mday);
if ($daylen == 1) {
$mday = '0' . $mday;
}
return $year . $era . ' ' . $month . ' ' . $mday . ' ' . $weekday;
}
function date_shorten($date) {
/**
* can't help but feel this may be unnecessarily long winded :)
*
* Months and days are put into an array
* the first letter in each is grabbed
* the $date string is searched and the full name replaced with the letter
* then spaces are stripped
*
* I also continued with negative years in the array even though Not Jack
* isn't a huge fan og negative years as the $era was making my short dates
* longer :)
*/
if ($era = 'btAT') {
$neg = '-';
}
$month = array(
'Archimedes',
'Brahe',
'Copernicus',
'Darwin',
'Einstein',
'Faraday',
'Galileo',
'Hippocrates',
'Imhotep',
'Jung',
'Kepler',
'Lavoisier',
'Mendel',
);
foreach ($month as $value) {
$m = $value[0];
$date = str_replace($value, $m, $date);
}
$wday = array(
'xundei',
'najdei',
'peldei',
'ri\'ordei',
'cicnydei',
'bladei',
'zirdei',
);
foreach ($wday as $value) {
$wd = $value[0];
$date = str_replace($value, $wd, $date);
}
$date = str_replace(' ', '', $date);
$date = str_replace('btAT', '', $date);
return $neg . $date;
}
/**
* implements hook_block_info()
*/
function theabysmal_calendar_block_info() {
$blocks['today'] = array(
'info' => t('Today\'s theAbysmal date'),
'cache' => DRUPAL_NO_CACHE,
);
$blocks['posted'] = array(
'info' => t('Converted post date'),
);
return $blocks;
}
/**
* implements hook_block_view()
*/
function theabysmal_calendar_block_view($delta = '') {
$block = array();
switch ($delta) {
case 'today': $block['subject'] = t('Today\'s theAbysmal date');
if (user_access('access content')) {
$date_ce = today();
$block['content'] = date_converter($date_ce);
}
break;
case 'posted': $block['subject'] = t('Converted post date');
if (user_access('access content')) {
$date_ce = node_created_date();
$date = date_converter($date_ce);
$block['content'] = date_shorten($date);
}
break;
}
return $block;
}
?>
Usage instructions
- create a folder called
theabysmal_calendar
insites/all/modules
- copy
theabysmal_calendar.info
andtheabysmal_calendar.module
to files of the same name and save them into the folder you created. Dicth the closing php tags in the module file - if you don’t like the month and week days I’m using, change them to whatever you like in the days and month arrays (two of each, just be aware that the date shortening as it is may look odd with week day and month names that start with the same letter, the date formats can be changed easily enough)
- go to the modules page (I think it’s
Admin >> Modules
, I use the admin toolbar and it’s just there), scroll down toDate/Time
and checktheAbysmal Calendar
on - go to
Admin >> Structure >> Blocks
and activate and position the blocks you want. There are two provided, one converts today’s date and the other converts and shortens a post date. I’m using<?php echo render[$block['content']; ?>
to spit the shortened date into the top of the blog posts
If anyone knows how to write Wordpress plugins and feels like converting it, go nuts. Then tell Not Jack so theAbysmal Calendar blog can have an Abysmal Calendar :)
Simplistic musings on cats and dogs, or ramblings about why pet shops shouldn't sell them
[minor pseudonymising edits during Drupal to hugo migration for all the good that will do now]
I have this bias towards cats and dogs in this piece, because I’ve only ever shared a house with cats and dogs.
My random thought that triggered the blat was that JJ is not going to let me have any more cats.