Browsed by
Category: Uncategorized

Using create-react-class in your React apps

Using create-react-class in your React apps

In React 16, Facebook are deprecating the React.createClass() syntax for creating new components, preferring the new ES6 class method. Already from React 15.5.0, they start reminding you about this.

They favour replacing

[code language=”javascript”]var Greeting = React.createClass ();


[code language=”javascript”]class Greeting extends React.Component {}

You should absolutely upgrade to the new ES6 way but that involves some refactoring other parts of the app so if you just want the warnings to go away for now, you need to install the create-react-class npm module and then swap out the parts of your code where it says React.createClass for createReactClass. As they say, it really is a drop-in replacement.
Step 1.

[code language=”bash”]$ yarn add create-react-class[/code]


[code language=”bash”]$ npm install create-react-class —save


Step 2.

Old code

[code language=”javascript”]var MyComponent = React.createClass(….

New Code (remember to import the module)

[code language=”javascript”]import createReactClass from ‘create-react-class’;[/code]

[code language=”javascript”]var MyComponent = createReactClass({
Very simple but not clearly documented anywhere I could find.

Migrate Gitorious to GitLab

Migrate Gitorious to GitLab

For the script, find it on GitHub

Our company recently moved over 200 of our Git repositories from our self-hosted Gitorious server to the brand-new GitLab. Moving over to GitLab has completely changed our workflow. Gitorious hadn’t been getting updates and in fact the company has been bought by GitLab. GitLab offers unlimited users and repositories for free and has a really nice interface.

The problem is that we had over 200 repositories sitting on Gitorious so even a very busy day of a developer moving things over wouldn’t have been an efficient use of time.

We could just grab the information from the Gitorious database but the projects weren’t set up on GitLab yet. To do this, we had to automate adding new  that. Fortunately, GitLab has a full featured and well-documented API for doing things exactly like this so we were able to hook into that. It took a while to get everything right but it’s been relatively painless and we haven’t regretted moving.

One big issue was that many of our servers are locked down and require a reverse-tunnel to get out. We had set that up on our old Gitorious server so after the migration, we slowly went around an fixed the reverse-tunnel to go to GitLab.

git remote set-url origin ssh://git@

There were a few more issues that we slowly stumbled over but I’ll save them for a longer post. The GitLab API actually has an import_url parameter where you can tell it the URL of the Git repository you want to import and you don’t have do clone, push etc but the maximum file size is about 25 MB which wasn’t enough for us.


Making WordPress store its files in a secret folder

Making WordPress store its files in a secret folder

I installed a fresh copy of WordPress but wanted to keep my root directory clean.

The easiest way to do this is just to install it into a directory, change the site address to the root, and then copy the index.php up one level and change the line about requiring the wp-blog/header file to reference the directory you just installed WordPress into.

[code language=”php”]require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ );


[code language=”php”]require( dirname( __FILE__ ) . ‘/newblog/wp-blog-header.php’ );

It’s all here: