Overriding default id in mongoid

This is an easy one, just want to make sure it’s clear. Add the following field to your model: field :_id, type: Moped::BSON::ObjectId And to allow setting it: 1 def id=(id) 2 self[:_id] = id 3 end Now you can just do obj.id=[Some ObjectId] and save the object.

November 15, 2014 · 1 min · Chen Kinnrot

Nice post about cyber war

Popular Science: The War Of Zeros And Ones. http://google.com/newsstand/s/CBIwvZm5zho

October 5, 2014 · 1 min · Chen Kinnrot

ClusteTV is hiring

Cluster TV is looking for it's next programmer/Superstar! If you can: * Write code like an Effin' machine* Test your OWN code* Speak English like it's your mother's tongue* Handle challenges* Be self-driven & independent We would also appreciate if you'll have: * Great communications skills* Independent thinking* Passion to learn new things* RoR or Angular experience* Coffee script knowledge* NOSQL understanding Then we want you! What we offer: * Great and professional team.* Opportunity to become an integral part of an innovative TV solution.* A chance to learn from the best in the industry.* Full time job in the Tel Aviv area.* Unlimited supply of food and beer. Really.* Flexible work hours. If you like what you see and have da skillz, drop us an email at chen@clustertv.com Or, call me tel: +972 542124335. Good luck!

August 8, 2014 · 1 min · Chen Kinnrot

Karma Rails Angular Jasmine testing - set up in 5 minutes

It took me about an hours and a half because google is not up to date, so here it is: First - as a rails developer, if you don’t have node.js, this is the time to install it. If you don’t use RubyMine as you IDE, I recommend it as well, but whatever you prefer is fine by me. Here you’ll fins instructions about karma installation, follow them carefully. You’ll see that you need to tell karma where is your sources and test sources. I’m working with jasmine, and using angular as a gem, check my configuration: frameworks: [‘jasmine’], // list of files / patterns to load in the browser files: [ //libs ‘http://0.0.0.0:3000/assets/application.js’, ’/Users/chen/.rvm/gems/ruby-1.9.3-p448/gems/angularjs-rails-1.2.9/vendor/assets/javascripts/angular-mocks.js’, ‘spec/javascripts/controllers/sample.js’, ‘spec/javascripts/controllers//_spec.js.coffee’, ‘spec/javascripts/controllers//*_spec.js.coffee’, ‘spec/javascripts/controllers//_spec.coffee’, ‘spec/javascripts/controllers/**/_spec.js’ ] To things you should notice: 1. I use rails assets pipeline to give all my app code js, (just run your server before you test) 2. I add the angular mocks lib All other stuff are basic, I got code in coffee and js so needed a little more lines to find all my tests. this is the way to make this work pretty fast.

February 2, 2014 · 1 min · Chen Kinnrot

Export Hebrew (or any non english language) with php to excel

I found it very annoying that php data to excel is not so straight forward as one might think ,lots of wrong stuff here. The thing is, as a developer you don’t know a lot about encoding. So you don’t really think about it until you have bugs, than you start searching for a better solution, I found this. Meaning you manually convert encoding to support excel, and add BOM. Just wanted to gather a few links together for future use. Enjoy.

January 12, 2014 · 1 min · Chen Kinnrot

Home Base SDK

As a developer@widdit’s incredible android team, I decided to write a how to embed Widdit’s home base sdk in 5 minutes guide, so here it is: Step 1: go to widdit.com and create an account. Step 2: create your first home base in the home base section at widdit site. step 3: go to sdk’s tab and follow the installation instructions step 4: upload your new apk to the market step 5: make money! Good luck.

January 28, 2013 · 1 min · Chen Kinnrot

SpineJS Tip

Never create multiple instances of a controller that generates the same view, cause you're event's registrations will be duplicated over and over again!

December 5, 2012 · 1 min · Chen Kinnrot

Avoid usage of AsyncTask Class on android

Just noticed this method available from API 11 only,  so you should find another implementation to avoid unexpected behaviour. Or don't call the execute method,  why?  If you'll check documentation you'll see that in some versions of android all tasks will run synchronouslly on the same background thread and on some versions it'll run on a pool of threads. Always use the executeOnExecutor option for consistent behaviour between platform version and avoid unexpected behaviour. ...

September 26, 2012 · 1 min · Chen Kinnrot

Nice idea for what's new in my app

People probably don't read/understand what's new in an app when they update it.  Skype did a very nice screen that shows you that something did change

August 31, 2012 · 1 min · Chen Kinnrot

coffee-script is just another version of javascript

Hi, A few months ago I discovered this new stuff called coffee script, and thought to myself, “this is awesome I’ll write less and do more” Today, I tried to continue a development of a pretty fat client side and tried to find myself in the 1000 lines of code I wrote so far (not so many). It was pretty hard, and I’m the only programmer for now, can’t imagine how a new programmer would enter to this project. So… coffee-script is java-script that look better, no other benefits, and if you plan to write a little more than 200 lines of code, consider using some strongly typed language(that can generate debugable java script) with good IDE that’ll help you maintain your code. 

July 8, 2012 · 1 min · Chen Kinnrot