I wrote an article to help people install switches for Phillips Hue smart bulbs.
I wrote an article to help people install switches for Phillips Hue smart bulbs.
I spent the weekend creating a site that holds daily mock presidential elections to inspire us to vote. Record voter turnout will change things for the better. Please use it, share it, get your friends to share it, get Cher to share it.
I just wrote a library to help developers write DOM tests; specifically DOM assertions. It allows you to express expected HTML (DOM structure) using React’s JSX. All the details are in the readme. The library is called html-normalizer and is available on npm and github. Here’s the link. https://github.com/TimothyRHuertas/normalizer
Happy testing
There are several articles on using elastic beanstalk hooks to create and manage (start|stop|restart) background services (this example uses up-start) that govern rake tasks. This is not one of them; rather it is an amendment to those posts intended to provide you with an updated example. I recently upgraded my Elastic Beanstalk application to use Ruby 2.1 (Puma) and my services stopped working. I made some minor changes to get stuff working again.
Disclaimer: There are better ways to accomplish this (see rails sidekiq), but you may still find this useful. Consider it the “copy/paste path of least resistance” for upgrading older projects.
commands:
create_post_dir:
command: “mkdir /opt/elasticbeanstalk/hooks/appdeploy/post”
ignoreErrors: true
create_pid_dir:
command: “mkdir /var/app/current/tmp/pids”
ignoreErrors: true
files:
“/etc/init/resque.conf”:
mode: “000755”
content: |
description “Starts a Resque worker. For example: start resque.”
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 5 20
script
exec /bin/bash <<“EOF”
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
EB_SUPPORT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k support_dir)
. $EB_SUPPORT_DIR/envvars
. $EB_SCRIPT_DIR/use-app-ruby.sh
EB_APP_USER=$(/opt/elasticbeanstalk/bin/get-config container -k app_user)
EB_APP_DEPLOY_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir)
PIDFILE=$EB_APP_DEPLOY_DIR/tmp/pids/resque.pid
LOGFILE=$EB_APP_DEPLOY_DIR/log/resque_workers.log
cd $EB_APP_DEPLOY_DIR
exec su -s /bin/bash -c “bundle exec rake workers:start >> $LOGFILE 2>&1” webapp
EOF
end script
post-stop script
exec /bin/bash <<“EOF”
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
EB_SUPPORT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k support_dir)
. $EB_SUPPORT_DIR/envvars
. $EB_SCRIPT_DIR/use-app-ruby.sh
EB_APP_USER=$(/opt/elasticbeanstalk/bin/get-config container -k app_user)
EB_APP_DEPLOY_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir)
PIDFILE=$EB_APP_DEPLOY_DIR/tmp/pids/resque.pid
LOGFILE=$EB_APP_DEPLOY_DIR/log/resque_workers.log
cd $EB_APP_DEPLOY_DIR
exec su -s /bin/bash -c “bundle exec rake workers:killall >> $LOGFILE 2>&1” webapp
EOF
end script
“/opt/elasticbeanstalk/hooks/appdeploy/post/999_start_resque_job.sh”:
mode: “000755”
content: |
#!/usr/bin/env bash
. /opt/elasticbeanstalk/support/envvars
set -ex
initctl restart resque || initctl start resque
echo ‘resque restarted’
I was super excited to learn about AWS and beanstalk. I created my rails 4 project and used beanstalk to push it. When I went to the url I was greeted by my old friend the nginx error screen. “502 bad gateway”. WTF! I ssh’d in to the box and in the logs I find “You must set config.secret_key_base in your app’s config”. I added config.secret_key_base = ‘dfsdsfsd’ to my application.rb and Bam! Error solved.
Today when experimenting with chrome’s speech recognition I noticed that it censored swear (curse) words. I could not find a property to enable me to talk like a sailor. So I came up with a hack. I intercept the onwebkitspeechchange event and convert censored words to uncensored words. So b**** become bitch, f*** becomes fuck, ect. Here is a demo.
Get the source at http://www.timothyhuertas.com/demo.html
**note this works in chrome only
Happy uncensored searching!
“… he says I can’t sing, I cant dance, but I can make romance, yea!”
Today I went to Google and noticed that their logo was a pretty elaborate animation. I asked myself, “how did they do that?” After thinking about it I considered frame by frame animation. So I pulled up firebug and bam! An image that had each frame in the animation was being sent to the client. Interesting.
http://www.google.com/logos/2011/graham11-hp-sprite.png
I just made this shirt on cafe press.
Today I wasted about 4 hours on this. I was running in to an issue because InetAddress.getLocalHost().getHostAddress() was returning “127.0.0.1” aka the loop back address and not the “real” IP address I expected. It sounds silly, but after hours of Google-ing and head banging it turns out the cause of this was a corrupt hosts file (which I had been looking at all day trying to figure out what I needed to do to it to make stuff work). The moral of the story is if you run in to this problem back up your current host file then replace it with a default one.
Copyright © 2018 Tim’s Blog
Theme by Anders Noren — Up ↑