Subscribe: Random Thoughts
http://tumble.jeremyhubert.com/rss
Added By: Feedage Forager Feedage Grade A rated
Language: English
Tags:
check  code  color  don  file  good  great  hex  instagram  ldquo  new  people  place  rdquo  refraction  server  svn  working 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Random Thoughts

Jeremy Hubert Baker's Random Thoughts



A collection of thoughts from Jeremy Baker, a curious and adventurous geek living in San Francisco.



 



ReactJS value vs defaultValue

Thu, 14 Aug 2014 16:36:00 -0700

This was an annoying gotcha that took me a few minutes to figure out. I had set the value property of a text area to '' and that prevented any typing in the field from showing up. I wasted some time trying to figure out why the iOS keyboard wasn’t working, not thinking that it could be a ReactJS issue.

The value property of an input field is going to always be the value of the input. This should typically be used if you want the content of an input to be in sync with a specific value.

If you just want to set the initial value of an input, use the defaultValue property instead.

http://facebook.github.io/react/docs/forms.html




The MightyHive Blog: Faster Than You Read This: Simple Deployments with CircleCI

Tue, 22 Oct 2013 10:12:25 -0700

The MightyHive Blog: Faster Than You Read This: Simple Deployments with CircleCI:

mightyhiveblog:

At MightyHive we’ve spent the past year iterating on software to change the way enterprises advertise online, building new products, and growing as an engineering team. Like any software company we iterate on a lot of ideas, and like any internet application deployment is a fundamental element of…




Rants & Raves: Presidential Innovation Fellow

Mon, 24 Jun 2013 15:03:59 -0700

Rants & Raves: Presidential Innovation Fellow:

sdotmarty:

Last week I (finally) announced that I had left Twitter, today I announce why the return to Washington, D.C. I’ve been asked to utilize the unique skills and experiences I’ve accumulated over the past decade, to serve my country; I’ve been selected by the Executive Office of the President of…




Color picking on OSX Lion

Wed, 25 Jan 2012 10:14:49 -0800

(image)

Doing the rapid prototyping that I do, I’ve often relied on Apple’s Digital Color Meter to grab HEX color codes. However, upon upgrading to OSX Lion I found the hex values to no longer be available.

My quest to figure out a replacement lead me to discover a few things.

First, you can create custom color pickers and add them to the standard OSX color tool that is used by most native apps (Preview, Pages, etc). I didn’t know this, but it’s quite cool.

Jesper over at wafflesoftware.net has created Hex Color Picker, an extension that you can drop in to add Hex functionality. It’s quick and effective, as long as you have access to the OSX color tool.

That’s where this tip about replacing the digital color meter comes in handy. It shows you how to write a quick applescript to launch the color picker at any point in time. I named the application DCM so that I could just open spotlight and get to it quickly.

And then, the kicker.

While reading through the comments on that previous tip, I came across one from Aaron Stroud:

"DigitalColor Meter still supports hex values, they've just hidden it.

View > Display Values > as Hexadecimal.

Shift + ⌘C copies the hex value."

Turns out it’s been there all along. After making that change to the Digital Color Meter, I can now grab hex values quickly again. Huzzah!




Sweet memories of Paris in the summer (Taken with Instagram at...

Mon, 26 Dec 2011 23:31:20 -0800

(image)

Sweet memories of Paris in the summer (Taken with Instagram at Jardin du Luxembourg)




Tips around Vancouver, Canada

Thu, 22 Sep 2011 04:57:24 -0700

I love Vancouver, and frequently have people ask me for recommendations. Instead of writing this all down every time, here they are for reference: Vera’s Burgers. The burgers are just straight up delicious. My favorite location is on Davie St at the beginning of the gay district. I personally love the pilgrim (turkey burger) but pretty much anything you try is great. You pick all of your own toppings, and they have plenty to choose from. Price: $8 - 10 per person Cactus Club Cafe. I love this Canadian restaurant chain. It was started in Vancouver years ago and it’s now one of the most profitable restaurant chains in Canada. Good food at a reasonable price with great service in a trendy venue. It’s my favorite one size fits all place to go. If you go, try a Bellini and some west coast pockets. Hapa Izakaya or Guu. Both restaurants deliver great japanese fusion. Hapa Izakaya is a little more on the classy / expensive side while Guu is on the “What did I just eat? It was Delicious!!” loud asian side. Hapa Izakaya is a safe bet for some great fusion if you’re timid about what you eat. Personally, I prefer Guu because I love the energy and I find the crazy food to be amazing. That being said, I’ve taken people there who were less adventurous and didn’t quite enjoy it like I do. It’s hard to suggest menu items at either place because they change often and are usually seasonal but if you go to Guu and they have Octopus Balls (Balls of Octopus meat), I highly recommend you try them. It’s just like being in Japan. :) SUSHI! You will find good sushi practically everywhere. Rumor has it that sushi chefs from Japan come over to Vancouver in order to practice because we all eat Sushi rolls far more frequently. I believe it. I have had more fantastic Sushi in Vancouver than any city I’ve ever been to.. including Tokyo. Now, that being said, there is a wide range of quality. Some of my personal favorites are Kadoya on Davie Street (near Vera’s) and Tanpopo on Denman St. I go to Kadoya when I’m looking for fun, creative rolls with plenty of yummy. Tanpopo, however, has a great all you can eat weekend lunch for only $13.50. For the last 5 years, we have had a standing Sunday brunch at Tanpopo with anyone who happens to be in town. It’s tradition. :) Japadog. Continuing the Japan craze, Japadog makes hot dogs with a japanese twist. My wife and I went there once and while I thought they were pretty good, she wasn’t a fan. I admit, fishy tasting hot dogs is probably not for everyone… but this place has garnered a lot of celebrity endorsements and has been featured on a couple of food tv shows. Not bad for a hot dog stand on the side of the street. You may want to check it out just to say you tried it. http://www.japadog.com/en/ Poutine. Ok, so.. if you haven’t heard of Poutine, bear with me. You take some perfectly golden french fries, cover them in fresh cheese curds and then pour on hot, delicious gravy. Anyone who doesn’t think fat, fat and fries would taste good needs their head checked. La Belle Patate on Davie and Bute is the place to go. It’s a Belgian fry house that serves nothing but french fries. Great late night food. I highly recommend you check it out… it’s about the only “canadian” food I can think of. Carderos. Now we’re on the fancy side of town. Carderos is an upscale restaurant in Coal Harbour, right on the water. Great food and you’ll be looking out over the water at boats and trees. What more could you ask for? Try the seafood. http://www.vancouverdine.com/carderos0experience.aspx Elbow Room Cafe. This is hands down my favorite breakfast place in Vancouver. Run by two old gay men, the restaurant specializes in good food and verbal abuse. It’s kind of hard to explain in words, but if you find yourself looking for a good brea[...]



Delete all tasks in a Wunderlist

Fri, 02 Sep 2011 07:33:00 -0700

I’ve been experimenting with a CulturedCode Things -> Wunderlist import tool, and it’s resulted in a few mix ups that left hundreds of items not where I wanted them. Instead of being filed in their own list, they are sitting in the inbox. Because it’s the inbox, I can’t just delete the list. To delete them all, I would have to click on each one and confirm the prompt. Kind of a pain in the butt.

Now, Wunderlist doesn’t have an API, but what they do have is a web based version of the tool. So, I figured that I could inspect their code and then write some JavaScript to do the deletion for me. Turns out I was right.

Here is the code I came up with. In order to use it, I’ve turned it into a bookmarklet. Just drag the following link up to your Bookmarks bar in the browser. When you open up a list in Wunderlist and click on the bookmarklet, it will confirm that you want to proceed before removing all of the items.

Delete All Wunderlist Items in a List

If you’re curious about the actual code, you can check it out in this gist: Delete all wunderlist items in a list.

If you have any questions, just let me know. :)




Translating HTML in a Chrome Extension

Thu, 30 Jun 2011 02:05:00 -0700

I have been working on updating my Live CSS Editor chrome extension to add some new features, and in the process, I figured I would set it up so that it could be translated into other languages.

Chrome has a pretty nice translation setup, which you can learn more about on their internationalization docs. It works great for any javascript, css or manifest files, but I wanted to translate the text in the HTML options page.

It turned out to be pretty easy.

First, I used an HTML data attribute to specify what the messagename would be for each area. If the element wasn’t already wrapped in an HTML tag that was specific enough, I just wrapped it in a span.

For example:

Live CSS Editor Options

Becomes:

Live CSS Editor Options

This lets me specify what key each section would use from the messages hash. Once that’s setup, a few lines of Javascript does the replacement for me as soon as the page is loaded:

  var objects = document.getElementsByTagName('*'), i;
  for(i = 0; i < objects.length; i++) {
    if (objects[i].dataset && objects[i].dataset.message) {
      objects[i].innerHTML = chrome.i18n.getMessage(objects[i].dataset.message);
    }
  }

This code loops through each element on the page, and if the element has a data-message attribute, it swaps the content of the element with the translation from the messages hash.

Of course, for each messagename you’ve added to the page, you need to setup an equivalent entry in the messages.json file. For more information on this, checkout out the internationalization docs.

This is a fairly simple solution, and dosen’t cover every internationalization situation. However, for taking care of something like an options page, it works just right.




Today we decided to hike up this mountain to a place called...

Sun, 26 Jun 2011 15:00:00 -0700

(image)
We're hiking to the building at the top

(image)
Sure... we're excited now...

(image)
The hike we're about to do.

(image)
What an amazing view!

(image)
The view of Jungfrau with the signpost

(image)
Made it to the top in our finger shoes

Today we decided to hike up this mountain to a place called Harder Kulm. The hike is supposed to take about 2 hours and 30 minutes.




Waiting at SFO for our slightly delayed flight to Paris. :-)

Sun, 05 Jun 2011 21:50:55 -0700

(image)

Waiting at SFO for our slightly delayed flight to Paris. :-)




On being an American

Tue, 01 Feb 2011 15:50:00 -0800

As someone who has a number of rather generic email addresses, I always end up on the strangest mailing lists. Sometimes, I even end up on personal email lists with the people mistaking me for one of their parents or close friends. Usually, I would reply to these and let them know they have the wrong address, but every now and then the content is just far too interesting for me to forgo.

In the latest occurrence, I seem to have ended up on a particularly private list that continually sends me some of the most un-informed and “patriotic” emails I have ever seen. Apparently, the person thinks they are emailing their dad. I have been debating how to respond to this for a while, but I thought I would post some thoughts on the whole liberals vs republicans situation while I mull it over.

A common rally cry that I have seen: “If you’re offended why don’t you get your liberal butt out, and take all the fruits and nuts with ya.

I believe that the divide between the “liberals” and the “republicans” is mostly a farce to keep us worked up and distracted from the real issues. Regardless of what label is assigned to different groups by the media or by our “opponents,” we are all Americans and extensibly, Humans.

I think any American, regardless of political or religious affiliation, would stop to help their fellow man; Whether it be picking them up when they’ve fallen down or giving them a meal when they are going hungry.

At the end of the day, we are all in this together. We are humans, and we all want the best for our friends and family. The misunderstandings are mostly over-emphasized by the media and a lack of understanding.

In every country I have been, I have met people with good morals and people with bad morals. I assure you that the good far outweigh the bad. However, we have all been conditioned to be afraid of change and afraid of the unknown. We have become complacent instead of inquisitive. This, at the end of the day, is at the root of our issues as a culture.

Studies in happiness have shown that we, as humans, are most happy when we can do two things:

  1. Trust our neighbors.
  2. Give.

Every religion on earth, at their core, focuses on those two things. It is through understanding and respect that we gain trust and it is through compassion that we can learn to give. Regardless of what we say every morning, those two behaviors should be at the root of who we are, and try to be, every day.

How can we trust each other if no one is willing to be inquisitive? How do you value someone’s opinion if they don’t understand the topic they are commenting on? How can we be compassionate if we are not willing to understand the plight of our fellow man?

It is far too easy to join hands with people of the same opinion and start a rally cry. Instead, I implore everyone to take the time to research the things they don’t understand and form their own opinion. 

As a country built by immigrants over hundreds of years and hard fought battles, it seems we have lost scope of what mattered in the first place.

We, as Americans, are all in this together, regardless of differences. Not for comfort, but for prosperity. I believe it is important to keep that in mind as we venture into this new world that embraces a global economy and a connected people.




8 inches of fresh powder at squaw and we’re first on the...

Sun, 30 Jan 2011 08:57:26 -0800

(image)

8 inches of fresh powder at squaw and we’re first on the mountain. Epic! (Taken with Instagram at Squaw Valley Ski Resort)




The 21 best new-ish songs that I don't think enough people have heard

Fri, 14 Jan 2011 20:36:10 -0800

The other day, I was hanging out with some co-workers of mine and we started talking about music. It turns out the neither of them had heard many of the songs that I was really into lately. I promised to introduce one of them to my musical tastes, and went home to make a CD.

I then started playing the CD for a few other friends, and it turned out that NONE of them had heard most of the tracks on the CD. Had they not all really liked the CD, I would have just written myself as having odd taste in music. But since they did, I’m writing this post to make sure everyone else can be exposed to the more awesome music.

Another thing that I realized after looking over the album is that almost all of the songs were introduced to me by Morgan Holzer. That girl has wicked taste in music and I highly recommend you check out her PopTen stuff

  1. Sweet Disposition - The Temper Trap
  2. Animal - Miike Snow
  3. Heart Skipped A Beat - The xx
  4. Kiss With A Fist - Florence and the Machine
  5. Little Lion Man - Mumford & Sons
  6. Home - Edward Sharpe and the Magnetic Zeros
  7. Sweet Sixteen - Think About Life
  8. 28 - Nano Whitman
  9. Dance Song - Orchard
  10. Punctual As Usual - The Parson Red Heads
  11. Man of a Thousand Faces - Regina Spektor
  12. Fader - The Temper Trap
  13. The Great Defector - Bell X1
  14. Dying Is Fine - Ra Ra Riot
  15. Bang! Bang! - The Knux
  16. Wish I Stayed - Ellie Goulding
  17. I’ll Kill Her - SoKo
  18. Paris - Friendly Fires
  19. Edward Is Dedward - Emmy The Great
  20. Why Do You Let Me Stay Here? - She & Him
  21. Untouched - The Veronicas

Also, please don’t just download the songs. All of these artists are hardworking and deserve your dollars. You should be able to find most of them on iTunes. :)




    3 reasons I use Git instead of SVN

    Fri, 14 Jan 2011 18:03:00 -0800

    This was a response to an email from a friend about why he should switch to Git from SVN. Perhaps you’ll find it useful as well. :) ——- Three things come to mind right away: 1) Distributed instead of centralized. With SVN, there is one “true” copy of the code at all times. Everyone checks out the code from this one true copy and checks the code back in when you’re done. There is nothing wrong with this, and in fact, this is also what you will also usually have with Git. The big difference is that you don’t *HAVE* to have it with Git if you don’t want to. For example, with OnceOvers, Dan and I work off of the development installation that is up on Heroku. This acts as the “true” copy right now, meaning that Dan and I both check out  a complete version from the one on the server and push code back into it. This works great for now and is essentially the same as what you would have with SVN. However, as soon as we are ready to take the site live, I will be pushing the site to a production installation hosted somewhere else. This is now the production instance of our website, instead of the development one. The map looks something like this:  So that means that Dan and I can keep pushing and pulling from the development server without worry. When we want to take whatever we have live, we just push the current state to the production server. Additionally, I can also keep another copy of it on GitHub (or any git server) with only a single command. Also, because of the distributed architecture, I can keep pieces of the code in all sorts of places. So, if I wanted to OpenSource a portion of the application but keep another portion of it closed, that’s super easy. The distributed piece is also interesting because you don’t need an internet connection to check in some changes. The advantage to checking in changes is that you can see where they were and roll back to that point in the future. (Kind of a like a checkpoint in Mario) If you are working in SVN, you need to commit the changes to the server before breaking the whole page again or else you might lose your progress. With git, you can check in to the repository on your laptop as many times as you want without needing to connect to the internet, so you can wipe the whole file and be right back where you were within seconds. When you do get to an internet connection, you can just “git push” it to the remote server. Speaking of the remote server, because both copies of the repository are full copies, you don’t have to worry about losing the repository if the hard drive on the server crashes. You just specify a new remote repo and you’re back up and running in minutes with all of the history still intact. I’ve done this a number of times just when moving to a new hosting provider. 2) Super easy to create branches of your work to try new things Now, all this is fine and dandy and not really that compelling since most of it can be done with SVN. However, where it gets really powerful is branching and merging.  As a programmer, even when I’m working with HTML / CSS, I might try some crazy new idea that involves editing a bunch of files even though I’m not sure it’s going to work. With SVN, because I’m working from a server copy, I would either have to checkout the entire repo into another folder and do all my craziness or I would have to start working on it and change all of my files knowing that it would be a pain in the but to go back to the beginning. With SVN this also restricts me from making little changes while in the middle of a big change. Lets say you’re working on a site for a client and y[...]



    sweetwolfshirt: Click here to download the christmas duet...

    Thu, 13 Jan 2011 15:09:31 -0800

    class="tumblr_audio_player tumblr_audio_player_2734908888" src="http://tumble.jeremyhubert.com/post/2734908888/audio_player_iframe/jhubert-blog/tumblr_ldw6pt4V2D1qzr0ow?audio_file=https%3A%2F%2Fwww.tumblr.com%2Faudio_file%2Fjhubert-blog%2F2734908888%2Ftumblr_ldw6pt4V2D1qzr0ow" frameborder="0" allowtransparency="true" scrolling="no" width="540" height="85">

    sweetwolfshirt:

    Click here to download the christmas duet “B*tch, Have Yoself A Merry Little Christmas Time” with Secret Secret Dino Club and Young And Divine

    Please reblog!




    Awesome.

    Thu, 13 Jan 2011 14:59:57 -0800

    (image)

    Awesome.




    Rails 3: Removing or adding www in the url

    Tue, 11 Jan 2011 00:21:00 -0800

    I don’t like having two separate domains that point to the same content for a number of reasons. Caching and SEO optimization are two them that make it worth dealing with for me. Here is how I deal with that in Rails 3.

    Usually, I would handle this in my webserver config file but since I’ve started using Heroku I don’t have access to a config file so the Rails application needs to handle that for me.

    One way to do the redirect is to have some code in your application_controller.rb file that checks for www. and then behaves accordingly. Like this:

    before_filter :strip_www
    
    def strip_www
      if request.env["HTTP_HOST"] == "myapp.com"
        redirect_to "http://www.myapp.com/"
      end
    end

    This functions just fine, however, there is no need to load the entire application stack just to do a redirection.

    Fortunately, Rails runs on Rack which means you can run some pretty awesome middleware and a few of the guys over at pivotal labs have done just that.

    Enter Refraction.

    Refraction is a piece of middleware that gives you a router before the request reaches your main application stack, which means you can intercept the call and perform a redirect on it without loading a bunch of unnecessary code. You can read a lot more about it in the README file on GitHub.

    All I’m going to show you here is how to ADD “www.” to a request that doesn’t have it. These instructions are fairly similar to the README.md, with the exception of the refraction_rules and a small change to the production.rb call.

    First, install the refraction gem. I recommend adding “gem ‘refraction’” to your Gemfile and running “bundle install” in your app. This will also install it on Heroku when you push.

    Once you have done that, we are going to add the following call near the top of your config/environments/production.rb file:

    config.middleware.insert_before(::Rack::Lock, ::Refraction)

    and then create a new file inside the config/initializers/ folder called refraction_rules.rb that has the following content in it:

    Refraction.configure do |req|
      req.permanent! :host => "www.mydomain.com" if req.host !~ /^www./
    end

    Once that’s done, you should be good to go. I tested this on my dev box by setting my /etc/hosts file up to point www.mydomain.com and mydomain.com to 127.0.0.1 which should work nicely for testing. :)

    Good luck!




    Tubing at Cypress (Taken with instagram)

    Fri, 31 Dec 2010 18:43:26 -0800

    (image)

    Tubing at Cypress (Taken with instagram)




    Playing bingo with the family for Christmas (Taken with...

    Sat, 25 Dec 2010 19:58:31 -0800

    (image)

    Playing bingo with the family for Christmas (Taken with instagram)




    Revelstoke on a gorgeous day (Taken with instagram)

    Sat, 18 Dec 2010 16:12:49 -0800

    (image)

    Revelstoke on a gorgeous day (Taken with instagram)