The Professional Steve

Tutorials, developer resources and stuff

Article: The Gig Economy

Jobs may be going away folks:

http://www.theguardian.com/commentisfree/2015/jul/26/will-we-get-by-gig-economy

This article predicts that the trend of working a series of short-term gigs rather than having a steady employer is probably what the future of work will look like.

This dovetails nicely with a book I’ve been reading, The End Of Jobs, in which it is predicted that entrepreneurship will become the new safe bet for your future, and traditional jobs, along with traditional college educations, will go the way of the Dodo.

Now you don’t need to open Xcode to make React Native apps.

Kewl…..

https://github.com/facebook/react-native/commit/9490c2c759fc2d88907a7a450d307be7f717853a

Don’t Worry If You’re Wrong

Just came across this tweet about Cunningham’s Law, which is as follows:

“The best way to get the right answer on the Internet is not to ask a question, it’s to post the wrong answer.”

This makes perfect sense. It takes advantage of the human tendency to want to correct others, rather than appealing to the desire to help.

It also inspires me to keep posting stuff on the internet despite my lack of experience. Also, as John Somnez and others are fond of saying, you only need to be ahead of someone by a little to be able to help them.

So, do your best to figure out the right answer, but don’t over-worry if you get it wrong. It’s fine, we’re all learning.

 

 

The WordPress API

Here’s a pretty good and detailed treatment of the new WordPress API. They call it REST, but it doesn’t seem to be strictly REST, according to my understanding. It does, however, allow you to make AJAX calls to WordPress in a JavaScript application, or talk to a WordPress instance from a mobile app. And, of course, other server-side applications could talk to a WordPress instance via the API.

WordPress Coding Standards

Ya gotta have standards. Here are WordPress’s. Specifically here are WordPress’s coding standards for CSS, HTML, JavaScript, and PHP. Also here are the documentation standards for PHP and JavaScript as well as some general best practices from WordPress’s core contributor handbook.

 

Productivity App Recommendation: Habitica

Back in, oh…, 2012 or so. Somebody showed me this weird little habit tracking app/game called Habit RPG. In it, you play a standard NES-style RPG character. You play the game by setting up habits for yourself. If you do the habit, you press a button to get EXP and gold, if neglect the habit, you press another button and lose HP. Gain enough EXP and you level up. Get enough gold and you can buy in-game stuff (armor and weapons, etc). Lose enough HP and your character will die and you have to start all over again.

Back when I discovered the app, its developer had made a Kickstarter. I gave a few bucks to it, used the app for a while, then school got the best of me.

If you want no ability to improve your life (except in one area, your education) go to school full-time. At least that’s how things went for me. for me. No time to exercise, no time or energy to sleep or eat right, it’s not fun.

Funny thing is, things were like that for me after I got a full-time job too, until I got another full-time job, one with a flexible schedule that allows me to work from home.

Now that I finally feel like I have time to breathe, I’ve decided to add some habits to my day, but unlike in The Dark Times I’m actually succeeding!

…. So far.

I’ve been running, meditating, and sleeping 8 hours a night (among a few other good habits) for the last 5 days straight. Now that I have time and energy to do these things, the incentives and disincentives Habitica gives me (apparently they changed their name from Habit RPG since I last used the app) are enough to keep me going. I’m very optimistic that I can keep this up and add more habits.

I’m particularly optimistic about a new habit I’ve added that I want to share with you. I’ve labelled it “Finish task in estimated time”. If I finish a task in the time I estimate, I get EXP and gold, if not I lose HP.

I’ve struggled with the fact that I tend to do everything too slowly. I’m also terrible at estimating how long something is going to take me. This one habit is helping me to solve both problems.

I realize that I could always estimate an extremely long time for a given task. This would give me easy points. My brain, thankfully, doesn’t work that way. I see this as an opportunity to test myself. How little time can I give myself and still not lose HP? It’s making me faster, and helping me to think about how long things take (as well as how to cut that time) in ways I really haven’t before.

I can’t recommend this app enough.

Making A Game In Python Part 12: Fixing Bugs?

Here’s the link to the github for this project and the link for all 11 previous posts.

With any program you write, expect bugs, problems in your code.

I’m dealing with one right now. In the game, if a player enters a choice that the game doesn’t understand, it’s supposed to print an “invalid choice” message, defined in the .game file.

The problem is that it’s printing that message no matter what.

At the moment, the way the game determines if a choice is valid is a flag that’s set in player data. The key is, naturally, “last_choice_was_valid”.

I’m writing this post as I’m trying to fix this bug (oh, I’m sure I’ll edit it a bit later, but I’m basically writing my thoughts down as I have them and then posting them) and I’m wondering if I need to change how I handle user input. Maybe I need to have a function that grabs user input, puts it in the process_user_input function and then modifies the player object.

This is a bit similar to how Elm does things, you have a model (our player), an update function that processes user input (among other things), and finally a view function that takes the model and displays it.

I’m going to give it a try. Then I’ll write some more, telling you how I did.

……

Well…. I added more bugs. Applying conditions no longer works, nor does replacing place-holders (like the player’s or the penguin’s names).

I really like this change in architecture though, so I’m gonna keep it. Once I’ve got it finished I’ll blog about the change and how it’s similar to how Elm does things.

I’ll also blog about my fixes as soon as they’re in. Meanwhile I’ve got other stuff to do.

Making A Game In Python Part 11: Player Inventory

Alright! Now it’s time let the player get stuff like weapons and armor and other stuff!

(Btw, here’s a page with all the previous posts about this project and here’s the github.)

Here’s the actions I made for adding to and viewing your inventory:

def add_to_inventory(player_data, game_data, options):
    if "inventory" not in player_data:
        player_data["inventory"] = {}
    if options["item"] not in player_data["inventory"]:
        player_data["inventory"][options["item"]] = 1
    else:
        player_data["inventory"][options["item"]] += 1
    print options["item"] + " added to inventory!\n"

    print "press enter/return \n"
    raw_input()

def view_inventory(player_data, game_data, options):
    if "inventory" in player_data and len(player_data["inventory"].keys()):
        for item in player_data["inventory"].items():
            print str(item[0]) + " x " + str(item[1]) + "\n"
    else:
        print game_data["display"]["inventory_empty"] + "\n"
        
    print "press enter/return \n"
    raw_input()

The reason each function’s last statement is raw_input() is that the player won’t get to see what each displays otherwise.

add_to_inventory adds an inventory dictionary to player_data if it doesn’t already exist. If the item being added doesn’t already exist in inventory, a key is created for it and it’s initial value is set to 1 (since the player will now have one of the item). If the player already has 1 or more of the item, another is added to the count.

(There is a piece of the game json that describes each item, but the code doesn’t use it yet.)

view_inventory is just a for-loop that displays each item the player has and the quantity they have it in. It also has some code to handle things if the player has an empty inventory.

I’ve also added a display section to game_data. That way a game maker can have custom messages for all kinds of game events such as quitting, adding stuff you your inventory, etc.

The problem I have with inventory now is that I have to actually put in the inventory choice in every single scene. I want default choices.

Announcing A New Blog About The Elm Programming Language

Hey all, I’ve got a new blog, elmbranches.com all about the Elm programming language.

So what does that mean for this blog?

I still plan to keep it, but I’ll no longer keep it to a strict update schedule. I’ll post things that I find interesting at a pace that’s comfortable for me.

There’s lots of non-Elm stuff I’m into. I’ll probably write a lot about WordPress as I’m now doing WordPress development for my day job. I’ll write about Python and Vim and a whole bunch of other stuff I like.

In short, this blog is no longer a site I’m using to advance my career. It’s now just for fun.

Talk to y’all soon.🙂

My Bluehost Adventure

I’m planning on starting a new blog about the Elm programming language and I’ve been recommended bluehost in the past. So I started a blog there and immediately ran into a technical issue. I tried chat tech-support and they asked me for the last 4 characters of my password before they were wiling to help me.

…What?

How do they have access to any part of my password? It should be encrypted. Obviously I refused.

I looked up how to cancel and found out that I have to keep the shiny new domain I registered with them for 60 days.

My plan is to move this new domain as well as the two others I own to hover, and set them all on one digital ocean instance using WordPress’s multi-site feature. But it seems like less of a pain to just wait 60 days until I do this.

Btw, the technical issue resolved itself, but I’m still not happy.

Ugh, never using Bluehost again.

Follow

Get every new post delivered to your Inbox.

Join 223 other followers