Thursday, April 30, 2015

Personal Code for 4/30/15








Sometimes the most satisfying feeling in the world can be that moment when you realize you’ve been going about something all wrong… and then you start over.

I split my weekend between fighting a fever (ie sleeping and drinking lots of water) and trying to teach my computer how to speak Jillian.

It didn’t work.

I was still quite feverish on Sunday night and no matter how many times enunciated to my laptop (in perfectly formed JavaScript) “take whatever text I gave you and reverse the order of the letters in each word while leaving all spaces and symbols in place.” It just kept doing the wrong thing.

                                                   

I blame the fever. I know it must’ve been frying my brain ‘cause when I was trying to think of the right adjective to smack talk with my friend at dinner on Saturday night, all I could come up with was “don’t look so… uhm.. .you know that thing where you haven’t seen something before and you’re eyes get wide and stuff? Well, don’t look so that word when I say how impressive I am.”

I wasn’t impressive last weekend though, so maybe that’s why Arthur looked startled maybe he was surprised that I wasn’t up to my usual standards of awesome.

I was patient though. All weekend long I kept plugging along at my code. My stupid code that just didn’t do what it was supposed to.

And then on Monday morning. I woke up and I had an epiphany. “I just need to start the fuck over! What I’m doing doesn’t work!” I wanted to throw my sheets off and run through the streets like Galleo and shout. “I have no fucking clue what I’m doing! I’m starting from scratch! I’m starting from scratch!”

But instead I outlined what I wanted to do. I broke the problem into bite sized pieces and as I found free moments at work and as the night rolled on. I worked away at it… until I finally had a 65 line bohemuth of code that very nearly did what I wanted… so I sent it off to the coding school that had asked me to showcase my brilliance.



And they basically said. “Woooow. This is way too long. You are not asking yourself the right questions.” And I already knew the importance of asking the write questions… the teacher gave me a few tips (which basically equated to step by step instructions on how to actually write the code (and which required that I google for help far more than I’d thought I was allowed.) … and then… a half hour later… Eureka! I had it. I finally got with this program…


var text = prompt("enter some text"); var word = []; var output = "";


for(i=0; i<text.length; i++)


{if (text[i].match(/[a-z]/))


{word.push(text[i]);}


else


{word.reverse();


output += word.join("");


output += text[i];


word = [];} }




console.log (output);

Thursday, April 23, 2015

Personal Code for 4/23/15



I am going to have a technical interview either tomorrow or Saturday for a coding school in the Bay Area. I read a few articles. Brushed up on some jargon and have no idea how its going to go. I am hoping it goes something like this:

Interviewer: "Can you please tell me how you would write a code to recreate the song 99 bottles of beer on the wall"
Me: Why yes. Yes I can.
Interviewer: "Have you ever gotten really close to getting an amazing tic tac toe game with multiple options for computer opponents that have the funniest dialogue as you play the game, but then something happened where it didn't run?"
Me: "why yes. Yes I have. And I know I will get it to run. This weekend. I am going to debug it this very weekend."
Interviewer: (clears his throat, clearly impressed by my stick-to-itiveness.) "Wow, I'm impressed with your stick-to-itiveness."
Me:"This is a phone interview, so you can't tell, but I'm blushing right now."
Interviewer: "Whelp, I think I've heard all I need to. I will get back to you tomorrow and let you know what code we want you to build for the next phase of the interview process."
Me: "Awesome! Thank you so much."
END CALL

Anyway, at lunch I had my friend Maddy be my interviewer and she asked me to tell her how I'd make a tetris game...

So here is how I'd make a tetris game

shape = [1,2,3,4,5,6]

Class Shapes (shape)
class Square
end
class Line
end
class L
end
class T
end
class backwardsL
end
class GiantBlobOfAllShapes

method to make each pixel of the shape move as the player moves it or default to falling straight down

method random number generator to select next shape to drop ( assign each shape a numeric value eg shape = 1, shape =2 etc)
method timer  for the speed
method increase speed after given a mount of time or given amount of lines

method disappear lines

end

Sigh. I miss Tetris. It was hard to play for just long enough to get that screenshot and then quit... but alas, I have an interview to nail tomorrow.

Tuesday, April 21, 2015

My Personal Code for 4/21/15



I have an interview tomorrow with a coding bootcamp in Woodside. I wanted to run through some practice interview questions, so using the questions I was asked during my first code bootcamp interview (with another school), I wrote a program to feed me questions that I could respond to and then I tried to think of a few points that I want to try to work into the interview that I could relate to the questions… here is the program that I wrote (in javascript).

var questions = [a, b, c, d, e]

var a = "Tell me about yourself and how you got where you are."
var b = "Why do you see computer programming as the next step."
var c = "When did you do programming before/ what did you like about it -- what was your favorite part"
var d = "Tell me about where you want to go moving forward after the program environment you'd like to be in etc"
var e = "What are your hobbies/ what do you do?"

var stories = [f, g, h, i, j]

var f = "Teaching -> G Gnome rap"
var g = "Writing a book/ writing group "
var h = "Working at Verengo / Corporate environment"
var i = "Writing group/ community learning"
var j = "Gardening and Cooking"


var selectQuest = function (questions)
   {while (questions.length > 0)
   {
  numb = Math.floor((Math.random() * questions.length) + 0);
    var givenQuest =questions[numb];
    var reply = prompt (givenQuest);
    console.log (givenQuest);
    console.log ("you said " + reply);
    console.log ("points you should have touched")
   
    switch(givenQuest)
    {
    case a:
    console.log (f);
    console.log (h);
    break;
    case  b:
    console.log (h);
    break;
    case c:
    console.log (i);
    break;
    case d:
    console.log (i);
    console.log (f);
    break;
    case e:
    console.log (i);
    console.log (j);
    break;
    default: console.log ("talk about unicorns");
};

 questions.splice(numb,1);
 console.log(" ")
 }
   }

selectQuest (questions)

*****

This was my output for my first (successful) run…

When did you do programming before/ what did you like about it -- what was your favorite part

you said:
 I did programming for the first time when I was in college. I was required to take intro to c++, so I did, and I liked it, but I was hell bent on getting a degree in Environmental studies so I could be a park ranger or something, so I didn't think much about pursuing computer science until I started to meet people who are programmers and they thought I would enjoy it and might be good at it so about a year ago I started doing some exercises on code academy and I've kind of dabbled here and there ever since. Fav part is efficiency of language… when you hit on that perfect something…

 points you should have touched
 Writing group/ community learning  

Tell me about where you want to go moving forward after the program environment you'd like to be in etc

 you said
I want to work in an environment where I will be challenged and will be able to reach out to my peers to get and offer support and advice and where I can feel like I am contributing. I want there to be more of something at the end of the day than there was at the beginning and I want to have peers who I can turn to and be like "dude, I just accomplished this thing" and we can geek out about it. 

points you should have touched
 Writing group/ community learning Teaching -> G Gnome rap  

What are your hobbies/ what do you do?

you said
 I enjoy everything to do with vegetables. I like to grow them, cook them, eat them, compost them. I also like to write. I go to a couple local writing groups through meet up and I like to do outdoorsy/ athletic things when I can.

points you should have touched
Writing group/ community learning Gardening and Cooking  

Why do you see computer programming as the next step.
you said
technology brings people together in unique ways. It can be used to find common threads between people to bring them together or to make a learning experience more personalized and relatable. I just really appreciate the way technology can enhance experiences and interactions off the screen and I want to be a part of that.  points you should have touched
Working at Verengo / Corporate environment  

Tell me about yourself and how you got where you are.

you said
A couple years back I was working at a moving company in the Bay area and I just didn't feel like I was doing enough with my life, so I decided I wanted to be a teacher. My brother is a teacher in AZ and he told me if I could pass a science test I would have no problem getting a job in AZ as a teacher -- despite the fact that I do not have any background in education, so I studied for a few months, took a couple online classes, got some shots and finger prints and BAM got offered a job at every school I applied to. However, I didn't have any idea what it was like to work with a class room full of students until I was actually there in that environment and as it turns out, it is very isolating to be the only adult and I prefer to work with adults rather than kids, so I bowed out of that, took some time off and wrote a book then decided to get a job for a solar company which is where I am now. And there are a lot of things I enjoy about myjob, but I still don't feel like I am being challenged enough and creating enough. I want a job where there is more at the end of the day than there was at the beginning 

points you should have touched

Teaching -> G Gnome rap Working at Verengo / Corporate environment

My Personal Code for 4/20/15

At work on Friday, the first phone call I received was from a gentleman in California who is in the very early stages of his solar project (We haven't even designed his solar system yet), who wanted to know if my company had put balloons in his front yard. I was baffled as to why he would think this, but apparently his sales rep had told him that we might have a bbq in his front yard on the day of install. That sounded like something our marketing director had mentioned a while back, so I brought it up to my manager, who laughed. "No. As far as I know we aren't putting balloons in anyone's front yard."

"Well, I thought it was over the top, but I have no idea who put these balloons in my yard." The man grumbled.

Despite the man's disgruntled response to the balloons, my mind wizzed off into fantasy land. That would be so fun and exciting to wake up and find balloons in your yard and have no idea who they came from. A happy mystery to find out who was so sweet. 

So obviously I went to the supermarket that evening to buy helium balloons with sweet sentiments plastered over their plump mylar surface: "You're #1", "You're the Best", "Just because You're you!" My friend and I decided we would deliver them to houses in our area where the front yard looked like it was in disrepair-- people who looked like they had a lot on their plate and could use something to cheer them up. Also, I decided to leave one in my friend Arthur's yard -- because when it comes to good people, he really is the best.

The operation was a wild success... at least as far as I know. We ended up deciding to deliver balloons to three people we know as well as three people we do not-- and sort of gauge the reaction of people we know to see wether it was a success or not... well 2/3 of the people we know reported on their FB that they were tickled and baffled.




Soo as part of my write a code about something I did today project... I wrote the following code for a really boring choose your adventure style game (in Ruby)...


def buy(balloons) #how much will you pay to purchase balloons
   @balloons = balloons
      cost = @balloons*3
      puts "you spent $ #{cost} on #{@balloons} balloons. Lets give them out."
   end
 
    def distrib (balloons) # where will you leave them
    @balloons = balloons
    while @balloons > 0
    puts "You come to a house. Is this Arthur's house? y or n?"
    @arthur = gets.chomp.downcase
        unless @arthur == 'y' or @arthur == 'n'
        puts "You come to a house. Is this Arthur's house? y or n?"
    @arthur = gets.chomp.downcase
    end #unless valid answer
    puts "Is there a lawn here? y or n?"
    @lawn = gets.chomp.downcase
        unless @lawn == 'y' or @lawn == 'n'
        puts "Is there a lawn at this house? y or n?"
    @lawn = gets.chomp.downcase
end # unless lawn
        if @lawn == "n" or @arthur == "y"
        puts "lets leave a balloon here."
            @balloons -= 1
        else
            puts "well, they probably don't need a balloon then."
        end #if lawn
            puts "you have #{@balloons} left. Let's give out some more."
    end #while balloonss >0
    end # distrib

buy(6)
distrib(6)