Rendering fontcustom icons in print view in Chrome and Safari

So, I’ve got a bunch of fontcustom icons I’m using on a website. Great project, makes it really easy to generate icons into a font that renders well on pretty much every device. Except when printing in Chrome and Safari. I had several icons sitting in table cells, and their height expanded to the height of the full printable page. Meaning, there was a single row per page, and a giant chunk of white space under the row. The icon was doing something to tell the print view to start a new page. Super strange.

Unfortunately, I didn’t figure out why the heck this was happening. However, I did figure out a workaround. This guy in your css stylesheet will apply changes only to the print view for Chrome and Safari:


@media print and (-webkit-min-device-pixel-ratio:0)

I created .gif versions of the icons I needed. Then, for these icons, I overwrite the :before pseudo-element to render the .gif I created instead of the font. I also needed to set the font-family to none. So, basically this (included within that @media element) (Also, this is SASS, but if you know CSS you can figure out what’s up):


.icon-skip{
  &:before{
    font-family: none;
    content: url('../images/icon-skip-print.gif');
  }
}

Watch out for form fields when doing a javascript-based find and replace in your DOM!

So let’s say you’re having a bomb night in, and get a sudden urge to build a Google Chrome extension. Let’s say that your extension involves finding and replacing text in the dom. So, you can cycle through all of the nodes in the dom, and grab anything with a nodeType of 3, which means it’s text. You get that bad boy working, get all of your buddies to install it. And then someone has to edit some content.

And, oops. The swapped copy is now live for all to see, regardless of having any extension installed, or even being on Chrome.

Soo, you can check┬ánode.parentNode.nodeName, and if it’s INPUT or TEXTAREA or a similarly potentially sneaky form element, I suggest skipping those when doing your find and replace!

Drupal menu_callback item using ajax callback renders full page

It’s pretty annoying when you only want a few variables, rendered nicely on screen with your tpl.php, and you end up getting the entire page when you do an ajax callback to that function. Apparently you need to print/echo whatever you want rendered on the page rather than return it (as you would for a normal menu item).

Which is how I ended up with infinitely nested page instances. Fun!

So like 12 years ago, I wrote a song about Java

I don’t know why I’m not asleep right now. I got distracted and was looking through old stuff, and apparently I wrote a song about Java a long time ago. So I’m gonna post it, because the internet is for po…sting songs about java.

I met it in a program due the week
before last, and it's future is looking quite bleak

oh the data
d-a-t-a data

I tried to do a ParseInt but it wouldnt work
When I typed "javac" the whole thing went berzerk

oh the data
d-a-t-a data

I've got 5000 methods and they all look the same
Nothing is working and I just want to maim

all my data
d-a-t-a data

my prog 5 is fickle, my brain calls defeat,
the 80x86 assembler aint lookin' 1337

poor poor data
d-a-t-a
da da da da data...

Well I've been staring at this class for hours
So I write crappy songs while my brain sprouts flowers
I'm pushing the limits crankin' out schloads of code
If I push any more my pancreas will explode!


Pick up the pen, write some "if" "then" "else" "while"
Try to make it come together as I stare at a pile
of my data
d-a-t-a data

so I took .stack
subtract from LOC
I find .stack length
And I'm getting sick of writing this so I'll stop...

Failing to load a large Drupal database locally on your Mac Mountain Lion system

OK, so technically this could apply to non-Drupal databases, but Drupal was my particular issue here. Had a new hard drive, trying to get all of my sites up, and was having a tough time with a several gig large Drupal database. When it’s pretty big, you’ve gotta load it into MySQL via the command line. And, I was getting this error:

MySQL server has gone away

And then I’d go check MySQL and it would would still be there and I’d be all like, “You is a liar!” to my error. Cause that’s real effective.

As it turned out, I just needed to go into /etc/my.cnf and crank max_allowed_packet up to 64MB. Database loaded fine after that.

On a related note, once I loaded in my Drupal site, it looked all janky, like there was no css. Just straight up clearing caches wasn’t doing it. Had to go into /admin/config/development/performance and turn off pretty much all of the cache options, and from there my theme finally took hold.

OMG I am in love with SVG graphics + CSS transitions

So let’s just say that this is my first time working with SVG. Never touched the stuff before, but I’d heard the rumors. So, SVG? It’s a graphic generated from code that you can actually read, all living in an XML file. So I can make a graphic, and if I’m feeling like a bum and don’t want to open Illustrator or whatever, I can just pop open that XML file and tweak it from there. Assuming it’s a stupidly simple graphic and the change I want to make is really easy, like a color change or border width or something.

Anyhow, all you need to do is make an image in Illustrator or similar vector-based program, save as SVG, and rock it! (emphasis on the rocking it). Anyhow, file size seems pretty tiny (for the graphics I’ve been working on) and since they’re vector, you can totally render them at different sizes just with your CSS as well.

I made 3 different clouds, see, for a release that hasn’t gone out yet so unfortunately I can’t link to it. Anyhow, I’ve got them rendering at different sizes, and am using the css transition property along with keyframes classes to have them slide across the screen at different speeds. And, since the graphics are transparent, they have a sweet overlay effect when passing by another cloud (z-index going on up in here). All for a semi-subtle effect behind some text, as well as a semi-transparent div so there’s super layered action going on. Which again, I can’t show off cause it’s not live. But I can still be excited about it!

It would be awesome to learn to just straight up write SVGs, see what kind of graphics I could make without ever having to touch a graphics program. Honestly, I get peeved when people suggest that art and math are two completely different disciplines, as I’ve always seen them as completely intertwined.

(Note: this post was totally inspired by this other post: http://www.garann.com/dev/2013/how-to-blog-about-code-and-give-zero-fucks/ I’ve seriously slacked on blogging. Have apparently given up on the food blogging shindig, but the least I could do is write about things I learn on occasion, given how much I depend on Google and other people’s posts to learn the things that I do.)

On writing, summer, JS, life in general, tl;dr, etc.

So let’s just say I’ve fallen off the writing bandwagon. Not so much for this blog – I never intended it to be all that regular, and will likely never see myself returning to the heyday of livejournal with my 2-3 posts a day and whatnot. However, food blog is pretty much dead in the ground. That one was always intended for a broader audience, and it never quite caught on. At the end of the day, all I really want to do is make food and take a picture of the final product if I feel like it, not tediously document the entire process. Who knows, maybe I’ll come back to it. After all, it did help get me that job I turned down last year.

Time is also running short for NaNoWriMo chopping & outlining. I’ve got the last 2 years’ novels to go through, cull, reorganize, and come up with an outline for this year’s. I’ve got way too many characters and not enough plot. And this isn’t even talking about my awful vampire story or my awful Rapids/Shore CYOA story, though I’m a little bit more OK with those being dead in the water, I suppose. One of these days.

Summer is almost over, which sucks. I figured out my pattern awhile back, that being that I’m most able to get projects done in the summer, and least likely in the winter. Despite my best efforts, seems like every winter I’ve got a month or so where I just lie on the couch, unable to move, wishing I was an inanimate object. And generally feeling guilty about it. I’d like my winter self to take care of herself in whatever ways are possible, so my summer self tries to be incredibly productive so my winter self will be able to catch up on Dexter or whatever. “Productive” for me generally means making art or making websites. Thus far, however, it’s been all home furnishings. I painted and varnished 2 tables, redid some fabric on some bar stools, painted a lampshade. I really should post pictures one of these days. In any case, I’ve still got the art and the web projects waiting to be done. Again, one of these days.

I’m learning stuff at least. Started doing some Backbone.js on codeschool.com. Looks a lot like object oriented PHP, except for javascript. Pretty cool. Would like to maybe do Node.js after that, as I hear good things. I used to hate JS. I still hate bad, resource-wasteful JS that is unnecessary and/or could easily be done by CSS, to be honest. Or should be taken care of server-side. JS used to be so painful to write, just because of all the weirdness between different browsers. I feel like jQuery’s invention and prompt rise in popularity has simplified writing JS so much, that it’s just become more approachable of a language. Mind you, I’ve still got a bit of a wall between me and it, but I’m working on that.

So yeah, I’ve been single over a month now. I suppose part of the problem is that, ever since I’ve hit puberty, I’ve either desperately wanted to be in a relationship, or have been in a relationship. My periods of singledom have been enjoyed for what they are, but there’s always been an underlying current of aching loneliness. I’m going to assume that this is pretty normal for a lot of people, and that with enough time being single the loneliness subsides a bit, or at least becomes easier to ignore. Course, I don’t want to ignore the fact that even *in* relationships, I’ll feel aching loneliness. That might, however, just be general depression leading to existential awareness and whatnot. Anyhow, I’ve got all this free time and I fill it with video games, so that’s super productive!

I find too many things come back to productivity for me. I think I tend to equate my self-worth to the things I produce, and as a result if I’m not doing enough of what I deem “productive”, I get depressed and imagine myself to be a worthless person. Suppose the ideal thing would be to learn to find worth outside of what I create. However, the next best thing seems to be to just produce, as it has the side effect of making me better at what I’m working on, thus increasing skill, being valued at work, and so on. I mean, there are many worse mental afflictions to be dealing with, so I should really not whine about this sort of thing.

And speaking of afflictions, I’ve been on this drug for 2 months now that controls the side effects of the tumors. It’s a birth control like pill, but is not actually birth control, and I am only on it 2 weeks of every 4. First month it was great, to be honest, but month 2 had me starting the pill several days before my period actually started (as my cycle is more like 32 days, not 28), which super confused my body. So, I might take my medication into my own hands and simply start taking them at the beginning of every period, and not every 28 days. Still, the pain is significantly less, which was the primary goal. I admittedly was afraid of the side effects, given it’s similarity to birth control, but they haven’t been as bad as I had feared. The different birth controls I’ve tried before have generally killed my libido, but this one luckily has not done that – think it’s actually giving me some effect in the other direction, which is super awesome being FREAKING SINGLE now so there’s not much I can do with that. Oh, and weight gain. Had a little of that. But you know, if I have to go up half a pants size to get rid of these symptoms, totally worth it.

Reading: I finally finished the Girl with the Dragon Tattoo series, and it was fantastic. Am currently reading Stephen Baxter’s Coalescent, which is pretty interesting thus far. I used to keep a list locally, but have since started using Amazon’s wish list feature to keep books I want to read organized in a list.

Upcoming Events: There’s a Scottish festival I might go to on Sunday, looks fun. Rapids away game at the end of this month, whereupon I get on a bus and go on a looong ride to Kansas City. Should be fun, outside of the teeny things my brain will choose to focus on to create anxiety. Like, I recently had the thought of: at some point we’ll stop to eat breakfast or lunch, and I’ll have to figure out where to sit. This is the crap that stresses me out. If I was told I’d have to punch a bear in the face, I’d be all like “OK, sounds good.” But if I’m told, “You’ll have to go be in a room with some people you don’t know, some acquaintances, some friends, and some people who you aren’t sure are acquaintances or friends,” I’ll get stomach cramps from anxiety. Ugh. Oh well, maybe I can be drunk. Huzzah!

This is long. I’m sorry if you read this far. WordPress is like my imaginary friend that I tell all my problems to. It’s quite cathartic. And, let’s face it, if I wasn’t writing here, I’d probably just be blowing this time on video games anyhow. Curse you, Candy Crush!

An Update on Things

So as it now stands, in a little less than 2 weeks, I’m back to being on my own again. Chris has a really good opportunity to move to Florida, and as right now the only thing that’s holding him in CO is me, he’s going to take that opportunity. It’s more or less breaking my heart, but I have to agree that this will be really good for him, and I wish him the best of luck. We’re quite amicable about everything, and I gotta say I’ve never had a relationship end this well before. And it won’t be ending until the minute he leaves on his long drive down to FL. So I plan on doing my best to make the next 1.5 weeks the best 1.5 weeks Chris has ever experienced.

Course, once he’s gone, I’m stuck here by myself. Mind you, I’m still pretty happy with being in Denver. While I don’t see myself spending the rest of my life here, I like it for the time being. In any case, I’ll probably going to spend a lot of time trying to distract myself. I think it’s, in a way, a bit easier to go through a breakup where you’re really unhappy with the person. After a few days of some cathartic bawling your eyes out, you can start to move on, and see yourself getting to a better place than what you just left. Mind you, Chris and I still have/had our problems, but finding out how ready he is to get out of here, and how unhappy he is being here, clarified those problems in my head and caused me to see them less as problems with us and more as side effects of him coping with his unhappiness. And, for that matter, we’re not even calling it a breakup, and going more for a parting of ways, as we both still feel so positively towards each other. And it really sucks to be in a situation where you really love another person but have to acknowledge that separating is the best decision. And I’m trying to not let my general sadness about everything get in the way of Chris’s happiness, and my happiness that he’s got this great chance to start over in a new place.

Anyhow. I’m going to need to find ways to occupy myself after July 5th. So, you know, if anyone in the Denver area wants to hang out and do whatever I’m probably gonna be up for it.

And on a related note, I’ve got time off the 2nd weekend of July – Thursday through Monday. The initial plan was to drive down to Albuquerque, but I’ve been debating that, both because it’s a long drive to do by yourself, and I’d already been formulating plans on what to do that involved going with another person, and so I’ve got the concern that being in Albuquerque alone will only highlight Chris’s absence, especially since part of the reason to go was to see the Rapids down there. So, I’m sorta looking around for other options right now, either someplace that would be fun to drive to for a long weekend, or someplace I can fly to (preferably a direct flight, and nothing too crazy/far away as I’ve only got 5 days).

Adventures in Tumors

The following may be TMI for anyone who falls into that teeny venn diagram slice where “male” and “wussy” overlap. You have been warned!

So, a little while back, I started bleeding and didn’t stop for 2 months. At points it was very light, but nonetheless, still blood. I’d had a yearly exam 8 months prior, and while I had had to get a colposcopy, everything was relatively fine. Nonetheless, I decided it was high time I got my next exam early.

Lucky for me, the results came back positive, so no cancer for me! However, the doctor recommended that, based on my symptoms, I should get an ultrasound. Got one last week, and just found out the full results today. I’ve got 4 fibroids, which are tumors that live within the uterus, with sizes ranging up to 4cm. According to the internets, fibroids are most common in women in their 40s to 50s, African American women, obese women, and women who eat a lot of red meat. I am none of these things, so I musta hit the Fibroid Lottery! Or there’s a genetic tendency, which I am unsure of and might look into. In any case, three of these fibroids are subserosal, which means they’re just hanging out on the surface of the uterus and not really bothering anything. One of them looks like it might be submucosal, meaning it’s in the lining, and is likely the one that’s causing my nasty little issues.

Anyhow, I talked about options with the doctor. There’s a whole range of things that are generally done for these bad boys, all the way from “nothing” to “hysterectomy”. The latter would be overkill, but there are more minor surgical options to get them removed. However, since my only issue with them at the moment is the pain and the gore, I’m just gonna go on drugs. I’ve historically not gotten along well with birth control (which is often prescribed to regulate bleeding) but I’m going to try something vaguely related – Provera – to see how that works out. If the nasty side effecst of birth control surface, I’ll try Lysteda, which is apparently something you can take just during the week of your period to help things out. And to be honest, the idea of having a period that lasts only a week makes me feel kinda giddy, because for the last year or two I’ve evolved to a 2-3 week kinda girl, which, to be honest, really blows. Also looking forward to not feeling randomly weak and craving steak & spinach salads all the time, because iron. Yay iron!

Anyhow, I should probably be sad that I have tumors, but as I already figured something was wrong with me, I’m just super happy that a.) it’s not cancer and b.) I don’t have to get cut open!

Graveyard.css, or Where I’m Putting Old Code Out to Pasture

So I’ve been doing a lot of code cleanup as of late. Meaning I’ve been going through a rather large CSS file and trimming the fat, not to mention doing a bunch of theming changes. I really hate commenting things out as a regular practice, as it looks ugly and still takes up space. Now and then, sure, but when you’ve got hundreds of lines of code in a single file all commented out, I just can’t deal anymore. And, sometimes I realise there’s a bit of code that I dumped a month or so ago that I’d like to find again. In theory, version control should save the day. Course, looking at my commit messages in Git is all like “Fixed layout on landing page!” with changes to a bunch of different files (yeah, I’m super organized).

I’m doing some fairly major reskinning in an area of a site right now, and while there’s code I’m perfectly happy to just delete, there are some styles that I get paranoid I might regret sticking on the ole chopping block. Also, I’m paranoid of someone above me down the line getting reminiscent for a certain look that I killed off. So I came up with the idea for graveyard files. I’ve got a file, graveyard.css, where I’ve started pasting in CSS classes I no longer have a need for, but am not ready to just delete yet. Graveyard.css isn’t loaded by any page, it just hangs out in the CSS directory with the rest of the files and keeps them company. It caters to my natural packrat instinct, and helps cut down the anxiety that comes with deleting several hundred lines of code.

I’ll be starting a graveyard.js pretty soon as well, as I’ll be cleaning up from some functionality that’s been disabled. And, because every JS directory needs a spare closet.