I taught javascript all day
December 6, 2014, 1:25 am

I tutored a student today for 5 hours about javascript. It was intense. When you're a teacher of code, you run a thin line between getting good code into your students' hands, and actually having them understand what the heck you just gave to them. When it comes to Javascript there is a LOT of stuff you can do to be cute and ridiculous, and it just makes NO sense when you try to explain it.

Let me give you an example.


The weirdest part about this isn't even the closure. The closure is fascinating, but the more stupid part is that first semicolon. How do you explain that to someone? Well, you see, child, some people's code is absolute shit, and someone might take your code and try to compile it with other code, and if the other code is bad, it will break your code, so you should just put in a little insurance to break their code before their code breaks your code.

It's so dumb. I love it. I love the dumbness of Javascript so much.

To the girl with the drawable hair
December 4, 2014, 8:37 pm

Hi. I totally ran up on you in the BART, and gave you my card. Did you like the drawing? I made some comment about you getting drawn again. It was a genuine offer. If you ever want to get drawn again, please email me. I only had about 10 minutes this time, it wasn't enough.

I draw people on the BART in San Francisco all the time. Although, this is actually the first time I've asked anyone if they wanted to be drawn for reals.

The deeper I get, the dumber I feel
December 4, 2014, 1:35 pm

It's pretty hard to stop learning if you're at all interested in a subject. But goddamn, if programming isn't an endless hole of more and more stuff to learn.

Here's something I've realized about new programmers. They all want to try to trick themselves by shortening variable names. Don't this, kids. Make your variables as descriptive as possible. You get dumber and dumber as you learn more and more, and it becomes impossible to remember or even care what all your shortened variable names meant. Just say what you mean, and don't try to be cute.

What's the point of Git?
December 2, 2014, 3:31 pm

Github is not the be all end all of Git. Git without the hub is totally possible, and honestly something that I can't believe isn't being taught to everyone.

So let's get started.

Git without the Hub

Git requires one thing; Git. Git is the language of version control. What is version control? Version control is your way of keeping track of previous states of your various projects. It's like saving, except it's more like snapshots. A snapshot of an entire project. Images, videos, vector files, scripts, documents? All can be controlled by git to be able to roll back to a previous state if necessary.

What's great is you don't need anything other than a terminal to work it. Now if you're on Windows you might be saying "I don't have a terminal". That's right, but you're also on a bad system for development. Windows might be great for graphics, but *NIX systems will always be the place to do dev work. Luckily when you install Git, it will probably give you an application called git-bash. This program will emulate a unix terminal, and all of its commands. So whenever I say open a terminal, I'm telling you Windows users to open up git-bash.

git init

Here's the easy part. Open a terminal. cd to your project directory. Everything you want to track will need to go in one main folder.

~/ $ cd ~/Development/Project/

You might as well ls your files to make sure you're in the right folder.

Project/ $ ls

Great, now that we know how to move around in the terminal, let's go ahead and initialize our folder for git.

Project/ $ git init

If you ls again, you won't notice anything special, but if you ls -a you should now notice a hidden folder showing up called .git. That's where all the magic happens. And when I call it magic, you should know well enough to leave it alone, and allow yourself to be bewildered, because ain't no excuse I can up with to want to dive into that mess of a folder. Suffice to say, thar be magic, and that's where it happens.

git add

So now that we have a sweet .git folder we can actually add some files for tracking. If you're daring, and your project isn't already too very large, you can try out a git status to see how many files are currently untracked. By the way, Git's messages are usually very helpful as to what's going on, so don't just shuffle by them.

Alrighty. Now that you know you have untracked files. Let's add them to the tracking system. You can add each individually, git add file.html, but I actually just got a hernia thinking about that, so an easier way is to just add them all at once.

Project/ $ git add .

That will add every single file recursively into your project as a tracked item. Awesome! If you git status again (do it a lot) you will see that there are now a bunch of green files ready for commitment.

Get over your fear of commitment

Commit often. That's the motto. Commiting with Git is like taking a snapshot of the project. Every time you want to save, go ahead and commit. But hold on there, sparky. Every committal must have a message telling the system, you, and any other team members, why this commitment took place. This step seems unnecessary to first-timers, but trust me, it's your first line defense against the stupidity of you. Be descriptive, and tell yourself the reason for saving at this moment. "I fixed the code". "I added corn chips". "I hate greys".

Project/ $ git commit -m "Initial commit"

The next commitment

After you've added all your files, you don't need to keep adding them. You can just commit with an -a flag. This will update any currently edited files that were previously added to the Git tracker.

Project/ $ git commit -a -m "Updated files"

If however you actually do add any new files, those will need to be specifically added, or inductively added with another git add . command. If you would like to remove files from tracking (perhaps because you deleted them) you can simply git rm file.txt to remove them from tracking.

This was a quick introduction to Git without the Hub. I will do another one of these soon all about stepping back through commits, and also another about branching.

It's not how you lie to trick someone
December 2, 2014, 10:32 am

Now I'm not saying third rock from the sun was for everyone, but it came along at a perfect time in society, when it was still kind of ok to pull comedy from horrible situations. I almost feel like a gag like this put in a show today would get pulled for some ridiculous reason, even though it's clearly one of the funniest things EVER. It's so incredibly shocking to see the situation get ratcheted up so quickly, and it shouldn't matter who hit who, it should be about the comedy.

Here, I'll show you the exact same gag, but with dudes.

See? Still funny.

This post has nothing to do with programming.

A little bit here, a little bit there
December 1, 2014, 11:22 am

Fixed the thumbnail generator last night. Dumped all the old thumbnails. Over 400. Seems like a lot. Don't think I even have that many images.

Really happy to be able to blog regularly again. I enjoy writing down my thoughts, and even though this is a spot that I show my students, I feel comfortable writing whatever I want here. Most of my blogging is about code anyways.

I continue to improve my base sass files. If you're interested in those files, they are properly underscored, eg. _base2_classes.scss. I have moved them into a condensed css output now, which should help the download of this site even further. I continue to work on SEO and optimization. It's a job that's never really done. Now that my main site is feeling better, I feel confident I can move forward with a redesign soon. I continue to pull in code from side projects. Smallcode was a little thing I put together to show off tiny bits of javascript, but also just common javascript functions that I need all the time. I also used some php code in there for converting block formatted elements into ordered lists for displaying code. If I get that working with my editor, I'll share it out here.

My blogeditor now has a preview as I type. It is a very zen feeling to type on the left, but look to the right. Always look forward in everything you do. Never be satisfied to pine for the past.


My preview is one letter behind my typing. I wonder if I should fix that...

Nevermind, I fixed it. It's the difference between keypress, and keyup. onkeypress hasn't written the current letter to the input value yet. onkeyup has.

More work gets done
November 30, 2014, 2:03 pm

Slowly, slowly, I'm improving my code. I'm corralling all the random bits of code from all my different projects, and bringing them into one place. I'm fixing a lot of the bad things, and moving forward. I've dropped AngularJS from my main page, and switched to straight php. I never liked how the posts would take a second to load in, and now the site seems to blaze forward a lot better.

I've started hanging out at coffee shops a lot more. Doing code at home is hard to keep up for pace. I have to go out and get myself into an environment where it doesn't feel so comfortable.

Did karaoke last night for the first time in forever at a little bar in Japantown and it was really awesome. Everyone was into it, and it was nice to go to a bar where you had a chance to sing, but you also weren't sequestered in a booth. I was rusty as all hell, but it didn't matter. It felt good to be back. I think I'll go again.

I also added a number of new places over on the sidebar for my stuff, including Twitter and Github. Improved the icons and placement as well. I also pushed up the quality of thumbnails, but I don't know if I'd have to dump them all to get them all to recreate... I should probably know that.

I finally update something
November 24, 2014, 4:02 am

I finally made myself a blog editor. Not that you'll ever see it. I've been having my students learn how to make editors, and I thought it would only be appropriate to make my own. It's simple and dumb, but I like it, so there. And maybe now I will post here more often.

This also means that I finally gave myself a link to blog posts. So, that's actually really nice to be able to make permalinks to individual posts. Let's see if I can't make that work a little better soon.

Some new things
October 14, 2014, 5:07 pm

I've been very much enjoying doing figure drawing and drawing on the San Francisco BART. You can see my BART drawings at my instagram account if you're interested in such things. You might have noticed there's a section on the right of the site showing a number of applications that are worth visiting that I've made. Another fun place to visit is my scripts folder. I've been teaching at the AAU a lot more recently, and it's caused me to create a number of fun new games and scripts.

Another Birthday, Another Website
August 20, 2014, 3:04 pm

Well I bought yet another domain name. Up Up Down Up is just one more in a long line of websites I've purchased around the time of my birth. On the 9th there was much debate about what age I actually was, but it was finally decided that I had in fact turned 33. A respectable age. For my birthday I had a small gathering with some friends, and then I went home and bought Final Fantasy X for the ps3 and I played that for a week.

Now... I don't want any of you to be confused by what I just said. I did not sometimes play final fantasy during that week. No no. I put in over 80 hours of gameplay during that week. And I still haven't beaten any dark aeons. Mainly because getting Tidus' ultimate weapon is a goddamn pain in my ass.

But that might be beside the point. After that week of nothing, I came back to my senses, and started working on my counting script again, because it's actually very useful when you're doing the monster arena in FFX. Working on this script, I added some much needed features, cleaned up some css, and now I think it's worth buying a domain name for it.

Which brings us to now. I'm actually really quite proud of this app, and it is something that I actually need periodically. You might find that you do too. If you do, I'd love to hear how you used it, and if it was successful for you.

No new art today, but there might be new ones over in the side panel.

... I should work more on my main website...