@JoseInSanJose

Is CrossFit for me?

The short answer to this question is yes, CrossFit is for everyone. There is a 94 year-old man somewhere around the world doing CrossFit to maintain his physical independence. In a CrossFit gym somewhere in Texas there is a young woman with diabetes who through the CrossFit lifestyle lost over 120 lbs and reversed her disease. You may also find a young man who after the tragic loss of his mother, his health took a dive and at a point weighed over 350 lbs. He found CrossFit and used it to take control of his health and his life.

If after seeing these three stories you are still skeptical, or maybe a bit intimidated by some videos you may have seen of very fit people doing CrossFit, don’t worry, it’s normal. In a CrossFit gym you will find people at pretty much every level of their health and fitness journey. Some are just beginning and others have been at it for a while. Here are 3 reasons why you can and should join a local CrossFit gym.

 

CrossFit is much more than exercise

While exercise and movement is a large part of CrossFit, there is much more to it than the workouts. Nutrition is at foundation of the program.  Don’t worry, nutrition is not about going on a fad diet, or eating salads 3 times a day. In a good CrossFit gym, you will learn how to eat for a balance and healthy lifestyle, while you also learn about exercise.

The CrossFit  gym is also a community. Everyone is welcomed and everyone supports each other. You will feel at home and if you stick around you will make friends. One of the things that stands out about CrossFit gyms is that people stick around for much more than just the exercise. They enjoy the company of the people in their classes and love the community that comes with a CrossFit gym.

 

All the movements have different skill levels

At this point you may be thinking, “OK that’s great but I don’t think I can do some of the exercises I’ve seen people do.” I was once asked by someone looking into CrossFit if they needed to be in shape to be able to join a CrossFit gym. The short answer is no, but I would equate that question to someone asking me if they need to be clean before taking a shower. You jump into the shower to get clean, and you join a CrossFit gym to get fit and healthy. We all start at a different level and that is OK.

Everyone starts their journey at a different level of fitness and all exercise can be scaled to meet the needs of our grandparents or the needs of an Olympic level athlete. Both need to be strong, but the the application of their strength varies in application and degree.

 

“Our understanding is that the needs of Olympic athletes and our grandparents differ by degree, not kind”

-Greg Glassman, founder of Crossfit

 

In other words, you and I need to be strong to do life, to stay healthy and enjoy life, while a professional athlete needs to be the best at their sport. CrossFit works for both because while the person next to you may be doing pull ups, you and I might perform a variation that will help us achieve pulls in the future.

 

There is coach to help you get through every class

One of the traits of CrossFit is that it is constantly varied. This means that you will see exercised from different sports; Gymnastics, weightlifting, running, rowing and many more. Some of these are advance, and it takes time and practice to learn them. For those who wish to learn the advance movements, there is always a coach around CrossFit classes that will explain the exercise and help you over time get better at them.

When I started, I could not do one pull up and probably less than 5 push ups, if that. Today I am not breaking world records in either, but with coaching, consistency and practice I am able to do much more. You too over time will get better at the movements because there will be someone coaching you in every class and help you get better. It’s the closest thing to personal training in group classes, but at a much cheaper rate. Many gyms also offer personal training for those who feel they need one-on-one time to speed up their learning curve.

 

Last thoughts

CrossFit is for everyone and any level of fitness. I have heard stories of disabled individuals doing CrossFit to help them maintain their independence or regain control of their health. All exercises can be scaled for everyone, a beginner, someone with a disability or an advance athlete. There will always be a coach around to help you improve your movement to keep you safe and push the limits of what you can do. And finally, CrossFit gyms have a fun and supporting community, you will find that CrossFitters are some of nicest and most easy going folks around. Sure some of them might be a little crazy, but they are still great folks.

 

@JoseInSanJose

Creating Angular 1 components in ES2015 syntax

Recently I have been working on transitioning my company’s Angular 1x Single Page Application(SAP) to ES2015 to prepare us to update to Angular 2 in the feature. At work we are using Webpack as our bundler with the Babel 6 loader to transpile our code back to ES5.

Note that the following code assumes that you are using a bundler like Webpack with the appropriate loaders. I will not post my Webpack configuration since you can easily find that information on their site as well as Babel’s. The modules are written in a way that you can easily swap the bundler or transpiler with little modifications to your code.

 

Creating an Angular controller in ES2015 syntax

export default class SomeController {
    constructor(someDependency) {
        this.someDependency = someDependency;
        this.title = 'The component title';
    }
    someMethod() {
    }
}

SomeController.$inject = ['someDependency'];

Notice how dependencies are being inject through the constructor method and using $inject. I am exposing the dependency by reassigning it to a property with the same name to the this object. That will make accessible in any of the methods using the this keyword.

Creating a component in ES2015 syntax

import SomeController from './somecontroller.ctrl';

const SomeController {
    template: "<h1>{{vm.title}}</h1>",
    controller: SomeController,
    controllerAs: 'vm'
}

Creating an Angular module as a ES2015 Module

import SomeComponent from './some-component.component';

const SomeModule = angular
    .module('someModule', [])
    .component('someComponent', SomeComponent);

export default SomeModule;

 

The module becomes the single source where everything that belongs to it is declared using Angular’s interface.  It also includes any type of providers or services and will make it much easier to upgrade to Angular 2 because you are creating native classes and object literals when declaring each peace.

One caveat is that the new syntax favors services over factories. You may recall that one of the differences in how they are declared is that factories return an object where services are constructor functions.

Cheers, don’t forget to follow me on Twitter: @JoseInSanJose

@JoseInSanJose

Using HTML5 validation to validate URLs

Recently I came across Raymond Camden’s blog post on how to use HTML5 form validation with pure JavaScript. I thought I would write the URL version. I know, I’m totally stealing his code.

Validate URL:


function isValidUrl(s) {
  var elm = document.createElement('input');
  elm.setAttribute('type', 'url');

  elm.value = s;
  return elm.validity.valid;
}


isValidUrl('http://www.thewaymultimedia.com/'); //true
isValidUrl('www.thewaymultimedia.com/'); // false
isValidUrl('thewaymultimedia'); //false

Sweet, that is pretty simple. Thanks Raymond. Make sure to read Raymond’s blog post, since that’s where I stole the code from. Here is the list of data types you can implement this method for:

  • color
  • date
  • datetime
  • datetime-local
  • email
  • month
  • number
  • range
  • search
  • tel
  • time
  • url
  • week

Of course, it will only work with modern browsers and not all types are supported across the different browser vendor.

@JoseInSanJose

Configure npm to use exact module version and save change to package.json

When you are using NPM it is important to make sure that you install an exact version of a package/module you are using. Not doing so may lead to headaches when the developers maintaining the module make an update with breaking changes, but do not tag the version correctly.

To do so, simply run  npm config set save-exact true

It is that simple. you can also configure NPM to always save any changes to your package.json file.

To do so run: npm config set save-exact true