Bohdan Zhuravel

twitter   facebook   goodreads   letterboxd   

Linux geek, web developer, Pixies fan. Utopian in beliefs. Hopeless romantic. Sitcom addict. Adore American culture and miss the 60's. Interested in practicing my English, so some posts may be in English while others are in Russian, depending on my mood. Feel free to correct me :)

May 31, 2012 at 10:16pm

0 notes

It’s two months since I don’t eat cows. I like cows. They’re big and smart, like deers and moose. I eat in McDonald’s like once a week, and now I only eat chicken burgers. They taste bad, but it’s nice to think that maybe one less cow will be murdered just because it tastes good.

May 13, 2012 at 11:57pm

0 notes

Benchmarking and testing your PHP script with microtime

$timer = new Timer;
$timer->start();
// some code...
$timer->stop();
// some more code...
$timer->stop(true);

/**
 * PHP script execution timer
 * @author Bohdan Zhuravel
 * @version .1
 */
class Timer {

  private $time;

  const format = 
          "<strong>Execution Time</strong>: %s seconds<br />";

  public function start() {
    $this->_set();
  }

  public function stop($die = false) {
    $this->_get() or $this->_set();
    $s = round($this->_time() - $this->_get(), 4);
    $this->_set();
    printf(self::format, $s);
    $die and die;
  }

  private function _get() {
    return $this->time;
  }

  private function _set() {
    $this->time = $this->_time();
  }

  private function _time() {
    $time = explode(' ', microtime());
    $time = $time[1] + $time[0];
    return $time;
  }

}

#php #microtime

May 2, 2012 at 12:14am

0 notes

Sorry I haven’t posted lately. I fear I’ve run out of things to say.
Like we’re on an awkward 4th date, staring at each other in silence.
Here are some photos of me chillaxing though.

#me

April 4, 2012 at 8:50am

0 notes
@ work (Taken with instagram)

@ work (Taken with instagram)

February 29, 2012 at 8:47pm

0 notes

Things that keep me awake at night #3

There’s a place in your life where you put away your dreams, because stability is more important than blah blah blah. So if you don’t at least take a genuine swing at being who you want to be now, when you don’t have a family yet, chances are high you’ll end up being a lousy model to your children.

#things that keep me awake at night

January 28, 2012 at 11:45pm

0 notes

This picture above describes how I felt for the past two weeks.
I had really bad teeth, I mean really bad. I think it had gotten so fragile and sensitive because of the years of drinking coffee and brushing once a day. Every now and then I felt pain but I didn’t do anything with it because the pain was bearable and very quick. But then two weeks ago I felt excruciating toothache and went to my first dentist appointment since… it’s been so long I can’t even remember when, and my reluctance to visit the dentist cost me, in total, around 1200 dollars. Not to mention that I couldn’t eat (and speak) normally because I could barely open my mouth and chewing was extremely painful. But now I’m writing this while eating Greek salad and it feels like the happiest day of my life.

10:30pm

5 notes

CSS Cross-Country solutions

http://www.codeschool.com/courses/css-cross-country

Level 1

Challenge 1/6 : External Stylesheets

index.html:
<!doctype html>
<html lang="en">
  <head>
    <title>Sven's Snowshoe Emporium</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <section class="content">
      <header>
        <h1>Sven's Snowshoe Emporium</h1>
      </header>
    </section>
  </body>
</html>
style.css:
body {
  color: #4b4648;
  font-family: tahoma, arial, sans-serif;
  font-size: 14px;
}
.content {
  border: 1px solid #cac3c6;
  margin: 0 auto;
  padding: 20px;
  width: 260px;
}
h1 {
  color: #6d9fac;
  font-size: 22px;
  text-align: center;
}

Challenge 2/6 : ID Selector

#slogan {
  text-align: center;
  font-style: italic;
}

Challenge 3/6 : Compound Selector

.content { border: 2px solid #ccc; }
.content.home { border: 0; }

Challenge 4/6 : Style Specificity

index.html:
<!doctype html>
<html lang="en">
  <head>
    <title>Sven's Snowshoe Emporium</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <section class="content home">
      <header>
        <h1>Sven's Snowshoe Emporium</h1>
        <h2>"For the Snow-Savvy Shoe-Shopper"</h2>
      </header>
    </section>
  </body>
</html>
style.css:
header { background: #e0e2e6; }

Challenge 5/6 : Floats

aside {
  width: 120px;
  float: right;
  margin-left: 10px;
  margin-bottom: 10px;
}

Challenge 6/6 : Columns

aside { float: right; width: 120px; }
article { float: left; width: 120px; }

Read More

#html5 #css3 #code school solutions

January 26, 2012 at 7:45pm

307 notes
Reblogged from iheartchaos

I Heart Chaos: Fun with math: Dividing one by 998001 yields a surprising result →

iheartchaos:

There’s all sorts of magic to be had with numbers, and many mathematicians have made entire careers in finding these little tricks that are mostly useless, but fun anyway. Unfortunately, a lot of calculators are going to truncate the results of this trick, but if you manage to get a hold of…

January 25, 2012 at 10:26am

692 notes
Reblogged from parislemon
parislemon:

This is actually the craziest chart about Apple following their insane earnings today.
There is exactly one company on that entire list that is not an oil and gas company. And they’re not that far from the top. 

parislemon:

This is actually the craziest chart about Apple following their insane earnings today.

There is exactly one company on that entire list that is not an oil and gas company. And they’re not that far from the top. 

January 22, 2012 at 9:52pm

17 notes

CoffeeScript solutions

http://www.codeschool.com/courses/coffeescript

Level 1

Challenge 1/7 : Variable Assignment

person = "Bohdan"

Challenge 2/7 : Functions

greet = -> alert "Hello CoffeeScript"

Challenge 3/7 : Functions II

greet = (argument) ->
  alert argument

Challenge 4/7 : Functions III

greet = (argument1, argument2) ->
  alert argument1 + " " + argument2

Challenge 5/7 : Functions IV

greet = (name='Stranger') ->
  alert name

Challenge 6/7 : Functions V

greet = (name='Stranger') ->
  "Hello, #{name}"

Challenge 7/7 : Sum Function

sum = (argument1, argument2) ->
  return argument1 + argument2

Read More

#coffeescript #javascript #jquery #code school solutions

January 21, 2012 at 1:29am

1 note

Tom Hanks does the ‘Big’ rap. Again.

1988:

2009:

The spades go, Down! Down! Baby! Down! Down the roller coaster! Sweet, sweet baby! Sweet, sweet delectable! Shimmy, shimmy cocoa pop! Shimmy, shimmy rock! Shimmy, shimmy cocoa pop! Shimmy, shimmy rock! I met a girlfriend a triscuit! She said a triscuit a biscuit! Ice cream, soda pop, vanilla on the top! Ooh Shelly, walking down the street, ten times a week! I met it! I said it! I stole my mother’s credit! I’m cool! I’m hot! Sock me in the stomach three more times!

#big #tom hanks #youtube

January 18, 2012 at 12:24pm

4 notes

#cat #cats #cat traps

January 12, 2012 at 12:38pm

8 notes

jQuery Air: Captain’s Log solutions

http://www.codeschool.com/courses/jquery-air-captains-log

Level 1

Challenge 1/12 : HTML Value

$('ol.economy-class li.row:first li:first').html();

Challenge 2/12 : Text Value

$('ol.economy-class li.row:first li:first a').text();

Challenge 3/12 : Text Value II

$('ol.economy-class li.row:eq(1) li:eq(3)').html();

Challenge 4/12 : Attributes

$('ol.economy-class li.row:eq(1) li:eq(3) a').attr('href');

Challenge 5/12 : Data Attributes

$('ol.economy-class li.row:eq(1) li:eq(3) a').data('seat');

Challenge 6/12 : Click Event

$('div.seating-chart a.available').click(selectSeat);
function selectSeat(event) {
  event.preventDefault();
  $('.selected').removeClass('selected');
  $(this).addClass('selected');
}

Challenge 7/12 : Bind Click Event

$('div.seating-chart a.available').bind({
  click: selectSeat
});

Challenge 8/12 : Using Data Attributes

function selectSeat(e) {
  e.preventDefault();
  $('.selected').removeClass('selected');
  $(this).addClass('selected');
  $('#seatSelected').text($(this).data('seat'));
  $('div#confirm-seat').show();
}

$('div.seating-chart li a.available').click(selectSeat);

Challenge 9/12 : Unbind Event

function selectSeat(e) {
  e.preventDefault();
  $('.selected').removeClass('selected').bind('click', selectSeat);
  $(this).addClass('selected').unbind('click', selectSeat);
  $('#seatSelected').text($(this).data('seat'));
  $('#confirm-seat').show();
}

$('div.seating-chart li a.available').click(selectSeat);

Challenge 10/12 : Multiple Click Handlers

$('div.seating-chart ol.first-class li a.available').click(selectFirstClass);
$('div.seating-chart ol.economy-class li a.available').click(selectSeat);

Challenge 11/12 : Live

$('#confirm-first-class a.confirm-upgrade').live('click', confirmUpgrade);

Challenge 12/12 : Delegate

$("#confirm-first-class").delegate("a.confirm-upgrade", "click", confirmUpgrade);

Read More

#jquery #javascript #code school solutions

January 9, 2012 at 1:25pm

1 note

Better than the original, sounds like it was written for her.
And no, Drake’s version is not the original. Original is by Gil Scott-Heron and Jamie xx.

#florence and the machine #performance #cover #youtube

January 2, 2012 at 11:11pm

0 notes

Things I learned in 2011

  • I had something my children won’t have — analog childhood (rotary phones, cassettes albums, VCRs with tracking problems, 8-bit games consoles and all). It was beautiful. In it’s own ugly way.
  • I am taking a hiatus from this “always available anytime” culture. I remember when you had to be home to answer the phone if you wanted to talk.
  • Still, we are living in the most interesting time in human history. Everything is amazing right now and nobody is happy.
  • English is the language of the world. The language of the Web and wider communication. The language of science, literature and art. The language that unlocks opportunities. It is time to stop calling it foreign language or second language.
  • Watching my friends write in English makes me want new friends.
  • The London rioters were protesting violence with more violence, and that was the most stupid thing I ever heard.
  • Every time Facebook or Twitter releases the new design everyone curses the hell out of it, then they get comfortable with it, and then Facebook or Twitter releases the new design.
  • My Android phone takes longer to reboot than my laptop do and the battery lives two days. Instead of fixing that they are increasing number of cores. Who needs multi-core phone? Are you sending humans into space or what?
  • Reading C system headers is difficult, but educational. Reading C++ system headers is torture.
  • If it is possible to be in love with a book, then I’m in love with this one. Matt Doyle has written the book that is probably the single best book for the person who’s just getting started with PHP, and programming as a whole.
  • Web programming is the science of coming up with increasingly complicated ways of concatenating strings.
  • The American consumer is somebody who bought something — they’re not sure why — but it was five dollars off, so they bought it.
  • Don’t make the mistake of thinking that something or someone will always be around. Never chase love, affection, or attention. If it isn’t given freely by another person, it isn’t worth having. It’s funny how quickly someone can go from being the center of your life to someone you don’t even want to know about anymore. So long, fairwell, auf wiedersehen, adieu to yieu.
  • You can’t force yourself to treat well someone who put you through shit. I believe it was Charles Bukowski who said “the way to end a poem like this is to become suddenly quiet.” No matter what he meant by it.
  • When I hear a song that fits my current life situation, I listen to it 24/7.
  • There’s no such thing as a hopeless situation, just hopeless people in situations. Two things in life are infinite: the universe and options.
  • The only person you need to compare yourself to is who you have been. And the only person you need to be better than is who you are now.
  • If you’re the smartest person in the room, you’re in the wrong room.
  • You’re gonna get judged with whatever you do, so keep doing what you’re doing.
  • Life is about proving your parents wrong by making them proud.
  • Every moment counts. Excellent people know that time is highly valuable. There’s this quote by Donald Trump which I read in one of his books, and I absolutely love it. He said that time is more precious than money, because you can earn back money, but you can’t get back time. That is absolutely true.

I hope you all had a safe and fun New Year. Even those who TL;DR’d.
My New Year’s resolution is the same as last year’s — 1366×768.

#things i learned #things i learned in 2011 #things 2011 taught me