Funky world of Juha

Bizarre and funky world of Juha

Git hooks: Pre commit & grunt January 28, 2013

Filed under: Frontend,git — juhq @ 4:07 pm

I’ve found the powers of git hooks recently. There are multiple hooks, for local client and for server. These will save you a lot of time and money when used properly.

 

In this article, I’m going to talk a bit about pre commit hook, which I’ve found to be the most important for my work.

Pre commit hook will run any command you want, before each commit. You can automate tests, do validation, building etc.

This should usually prevent you from pushing bad code to the server.

 

Hooks can also be set to the server, for example pre-receive hook, which you can command to run the same grunt for each push. This has the downside of not preventing bad code from being pushed to the server.

 

 

But let’s talk a bit about pre commit with grunt.

 

First, you’re going to need to install grunt

$ npm install grunt

Then set up your git hook

$ nano .git/hooks/pre-commit

To run grunt against your project on each commit, simply copy&paste the following code.

#!/bin/sh
grunt
if [ $? -ne 0 ]; then
 echo "Grunt failed, please fix code and recommit"
 exit 1
fi
exit 0

Now add grunt.js file to project root folder, with the following basic configuration.

module.exports = function(grunt) {
  // Project configuration.
  grunt.initConfig({
    lint: {
      all: [
        'grunt.js',
        '**/*.js'
      ]
    }
  });
  // Default task.
  grunt.registerTask('default', 'lint');
};

On each commit, git will now automatically run grunt against your codebase. For this example, I’m only using jslint to catch coding errors.

Grunt is a powerful tool which has over 300 different plugins, you can run automated tests, build your project, minify/uglify codebase, deploy your code to Amazon S3 and much, much more.

If your code is fine, the commit will continue as normal, but if your code has some issues, the hook will prevent you from committing bad code, which could break your project.

If your code passes, you should see something like this

Grunt ok

If your code has issues, you should see something like this

Grunt fail

More about hooks: Git hooks

Get grunt: Grunt

 

Installing Memcached graphs to munin July 15, 2011

Filed under: Memcached,Servers — juhq @ 3:01 pm

Munin is a great statistics tool that every developer and website owner should know and user.

Today I was adding statistics for memcached, for every plugin that I could find from Munin Exchange and it didn’t take too long to realize that typing all the commands by hand, to 8 different servers, is going to take for ever.

So I copied all the steps into my notepad (oldskool) and combined the steps into easily copy & pasted steps.

Before you can install these plugins, you need to have perl-Cache-Memcached installed on the server.

As I’m using CentOS, the command is yum install perl-Cache-Memcached

Now for the interesting part of installing every memcached plugin to munin easily.

wget http://exchange.munin-monitoring.org/plugins/memcached_hits_/version/1/download && mv download memcached_hits && cp memcached_hits /usr/share/munin/plugins/ && chmod 777 /usr/share/munin/plugins/memcached_hits && ln -s /usr/share/munin/plugins/memcached_hits /etc/munin/plugins/memcached_hits_127_0_0_1_11211 && ls -al /etc/munin/plugins && /usr/sbin/munin-run memcached_hits_127_0_0_1_11211
wget http://exchange.munin-monitoring.org/plugins/memcached_bytes_/version/1/download && mv download memcached_bytes && cp memcached_bytes /usr/share/munin/plugins/ && chmod 777 /usr/share/munin/plugins/memcached_bytes && ln -s /usr/share/munin/plugins/memcached_bytes /etc/munin/plugins/memcached_bytes_127_0_0_1_11211 && ls -al /etc/munin/plugins && /usr/sbin/munin-run memcached_bytes_127_0_0_1_11211
wget http://exchange.munin-monitoring.org/plugins/memcached_requests_/version/1/download && mv download memcached_requests && cp memcached_requests /usr/share/munin/plugins/ && chmod 777 /usr/share/munin/plugins/memcached_requests && ln -s /usr/share/munin/plugins/memcached_requests /etc/munin/plugins/memcached_requests_127_0_0_1_11211 && ls -al /etc/munin/plugins && /usr/sbin/munin-run memcached_requests_127_0_0_1_11211
wget http://exchange.munin-monitoring.org/plugins/memcached_traffic_/version/1/download && mv download memcached_traffic && cp memcached_traffic /usr/share/munin/plugins/ && chmod 777 /usr/share/munin/plugins/memcached_traffic && ln -s /usr/share/munin/plugins/memcached_traffic /etc/munin/plugins/memcached_traffic_127_0_0_1_11211 && ls -al /etc/munin/plugins && /usr/sbin/munin-run memcached_traffic_127_0_0_1_11211
wget http://exchange.munin-monitoring.org/plugins/memcached_items_/version/1/download && mv download memcached_items && cp memcached_items /usr/share/munin/plugins/ && chmod 777 /usr/share/munin/plugins/memcached_items && ln -s /usr/share/munin/plugins/memcached_items /etc/munin/plugins/memcached_items_127_0_0_1_11211 && ls -al /etc/munin/plugins && /usr/sbin/munin-run memcached_items_127_0_0_1_11211
wget http://exchange.munin-monitoring.org/plugins/memcached_connections_/version/1/download && mv download memcached_connections && cp memcached_connections /usr/share/munin/plugins/ && chmod 777 /usr/share/munin/plugins/memcached_connections && ln -s /usr/share/munin/plugins/memcached_connections /etc/munin/plugins/memcached_connections_127_0_0_1_11211 && ls -al /etc/munin/plugins && /usr/sbin/munin-run memcached_connections_127_0_0_1_11211

/etc/init.d/munin-node restart

What this will do is that it’ll download the file, rename it, copy it to proper folders, add proper properties, create symbolic link, then list all the symbolic links, test that the plugin works and finally it will restart munin.

 

 

This should be easily converted into simpler and smaller shell script. If you’re thinking of creating a shell script or have a better solution, please feel free to leave a comment🙂

 

My thoughts on hiring friends June 6, 2011

Filed under: Jobs — juhq @ 7:53 am

Hiring friends is easy, firing friends is not.

If you’re in a position to hire people, you’re also in position to fire people.

So if you decide to hire a friend, you have to be ready to fire that friend if things don’t work out.

 

It’s extremely difficult, you should only hire when you have confidence that the person will perform well.

 

How to fix ubuntu 11.04 May 12, 2011

Filed under: Uncategorized — juhq @ 7:31 am

Apt-get remove unity

 

Lead UI/UX Developer – Helsinki May 6, 2011

Filed under: CSS,CSS3,Frontend,Jobs,jQuery — juhq @ 9:26 am

Company Description
DealDash – Social Game-Shopping is looking for their Lead UI/UX Developer. DealDash is an extremely fast growing high-tech startup based in Helsinki and Silicon Valley. Our mission is to make shopping fun through our innovative game-like auction model. With currently more than 150,000 registered users in the US and a dozen servers DealDash has a constant need for increasing scalability and performance. With several upcoming patents; innovation and creativity is a key driver in DealDash´s ongoing product development.
Job Description
Create and direct exceptionally great user experience design according to user-centered design principles.
DealDash, a social game-shopping company is looking for an exceptionally brilliant user experience expert. DealDash´s vision is to revolutionize the entertainment shopping market and to become a market leader. In order to do so, DealDash must provide the ultimate user experience for its users. DealDash combines social gaming with e-shopping.
– As UX lead you will be fully responsible for both the web design and user experience by DealDash users.
– You will be responsible for conceptualizing, planning and executing the entire user experience process at DealDash. This includes, user research and analysis, interaction planning, requirements definition, web design work, graphical and front-end HTML/CSS and jQuery.
– Creating project deliverables that clearly and persuasively communicate the UX strategy and the reasoning behind it. These deliverables include: project plans, discovery findings, research protocols, research findings, personas, task lists, workflows, wireframes, page maps, interaction and behavior specifications, and anything else required to describe UX plans and strategies. Creating these deliverables to Method specifications and within described project timeframes.
– Present concepts and facilitate brainstorm sessions.
– Work closely with the developers and other team members at DealDash – advocating for the best design for the end user.
– Staying abreast of industry best practices for UX design and processes, and for any project, gathering sufficient information to support appropriate UX design for the given platform and technology.
– Design graphics for web design, create clean HTML and CSS, jQuery

Qualifications
– Proven experience leading the UX practice on projects.
– An exceptional portfolio showcasing innovative design solutions.
– 7+ years experience designing workflow, interaction and UI for large-scale, web applications (B2C).
– Extreme obsession to detail. You must be able to work very well with both the big picture as well as the nitty-gritty details.
– BA or MA in Interaction Design, Cognitive Science, or HCI, or equivalent experience.
– Expertise in human interface guidelines, standards, and best practices as they apply to platforms.
– Effective communication skills (both in conversation and in writing).
– Ability to work with technology experts to uncover and understand technology requirements and capabilities as they relate to design deliverables.
– Use appropriate software (e.g., Adobe InDesign and Adobe Illustrator or OminGraffle) to create professional-quality, well-designed deliverables, to Method specifications.

Additional plus:
– Understand game mechanics and what brings fun and excitement into social gaming applications.

Why you should join?
DealDash is run by a small team of passionate, driven entrepreneurs with a vision to transform, grow and become the US market leader in social game-shopping. We are venture capital backed and based in Helsinki, Finland and Sunnyvale, California.
If you are driven, committed to excellence and obsessed about details then we are looking for you.
If you want to create the next-gen platform for game-shopping then we are looking for you.
Location
Development team is based in Helsinki, Finland. Work can be done remotely
Compensation
Salary and potential for early stage equity through stock options.

Apply here!
http://bit.ly/lHG2Et

 

Lead Software Engineer (PHP, MySQL, Memcache) May 2, 2011

Filed under: Jobs,Memcached,MySQL,PHP — juhq @ 8:28 am

Job Description

DealDash – Social Game-Shopping is looking for their Lead Software Engineer. DealDash is an extremely fast growing high-tech startup based in Helsinki and Silicon Valley. Our mission is to make shopping fun through our innovative game-like auction model. With currently more than 150,000 registered users in the US and a dozen servers DealDash has a constant need for increasing scalability and performance. With several upcoming patents; innovation and creativity is a key driver in DealDash´s ongoing product development.

Job description:
We are looking for an exceptionally intelligent, talented and enthusiastic Lead Software Engineer to drive development of our web-application. You will get to work on and deliver an application that will be used by millions of users. You are a self starter eager to make a mark for yourself. You have hands on experience of working in a small agile team / startup and can develop your skills. The company is based in Helsinki, Finland and Sunnyvale, CA.

You should be well connected within the software development community either internationally or locally so that you are able to seek advice from peers in regards to solving complex problems. You should have a healthy strong working habit and be willing to put in extra hours when needed. You will lead our small development team and work closely with the founder and Chief Coder of the company in planning and designing systems that scale and allow us to continue growing our business around the world.

Skills:
• Generalist software engineer: Expertise building scalable systems and algorithms
• Expertise in working with PHP and MySQL
• Experience in working with Memcache
• Experience in working with various PHP frameworks
• Understanding of AJAX, CSS, JavaScript & jQuery
• Experience working with large amounts of data
• Experience working with Facebook or E-Commerce applications a plus

Travel:
Work based at our offices in the centre of Helsinki, Finland (Capital of Nokia)
Kamppi – Autotalo, however you will from time to time be able to travel to our office in Silicon Valley to stay updated on current ongoing developments in the coding community.

Compensation: Includes very competitive salary and early-stage stock options.

Desired Skills & Experience

• Generalist software engineer: Expertise building scalable systems and algorithms
• Expertise in working with PHP and MySQL
• Experience in working with Memcache
• Experience in working with various PHP frameworks
• Understanding of AJAX, CSS, JavaScript & jQuery
• Experience working with large amounts of data

• Experience working with SCRUM

• Experience working with Facebook or E-Commerce applications a plus

• 5+ years web development experience
• 3+ with PHP/MySQL/Apache
• Experience with profiling (e.g. xdebug), load simulation (e.g Jmeter), Linux optimization, database (MySQL) optimization
• Solid understanding of scalable web architectures, queuing and partitioning.
• Solid experience with Subversion, JavaScript, CSS and OO programming
• Agile development experience desirable (XP/Scrum).
• Knowledge of PHPUnit and test-driven development
• Knowledge of open standards
• Bachelors degree or higher in Computer Science or similar/relevant field preferred
• Strong product sense and an interest in building web applications
• Entrepreneurial spirit
• High levels of creativity
• Ability to create specs for projects and to manage their progress
• Ability to handle high pressure / high stress situations

Company Description

DealDash is an extremely fast growing social game-shopping marketplace where more than 150,000 US based shoppers come to bid and compete for some of the best deals on brand new products from iPads to mountain bikes and even high-end holiday packages. DealDash is one of the leading pioneers in the current revolution taking place – the gamification of online shopping. DealDash combines proven game-mechanics with discount shopping to create an insanely fun and thrilling discount shopping experience.

DealDash has received several awards for being one of the most interesting and innovative companies to come from the Nordic markets. DealDash continues its exponential growth in a soon-to-be $1Bn+ market. DealDash is venture capital backed with an extremely strong group of investors from both the Europe and the United States. The team behind DealDash work very hard to provide social game-shoppers with the best possible experience and to build a better product that is competitors through new innovation.

Join us to become a part of an extremely fast growing international high-tech startup company.

Apply today!

http://lnkd.in/U42WSZ

 

CSS Rainbows January 8, 2011

Filed under: CSS3 — juhq @ 3:18 pm

I was sitting on a bus and I started thinking.

How hard it is to create rainbows with CSS?

Is it possible?

Well, atleast for modern browsers it is possible! All you need to know is what are the colors in the rainbow (you can find it easily from wikipedia http://en.wikipedia.org/wiki/Rainbow) and then you might need some help from css3please.com

After that, just add the box_gradient styles to your style, add enough stops (I added 6 stops, as two of the colors are almost identical) and voilà! You got some rainbows in your element!

.rainbow {
  background-image: -moz-linear-gradient(top, #9F59A1, #443090, #1E9FB6, #389C2D, #F7F619, #FB0B0B);
  background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #9F59A1),color-stop(0.2, #443090),color-stop(0.4, #1E9FB6),color-stop(0.6, #389C2D),color-stop(0.8, #F7F619),color-stop(1, #FB0B0B));
}

Small tip, if you want your rainbow be full height and width, add these styles.

.rainbow {
  height: 100%;
  width: 100%;
  position: absolute;
  top:0;
}

Demo can be viewed from http://bin.fi/rainbow.php (won’t work for IE)

 

 
Follow

Get every new post delivered to your Inbox.