Thursday, December 18, 2014

Security issues with git : upted required for Git clients

Even though the issue may not affect Linux users, if you are a
hosting service whose users may fetch from your service to Windows
or Mac OS X machines, you are strongly encouraged to update to
protect such users who use existing versions of Git.
 
source :  
 
 http://article.gmane.org/gmane.linux.kernel/1853266
 
 Updated versions on Github are here :
 
 GitHub for Windows and GitHub for Mac 
 
 
 

Thursday, November 06, 2014

making underscore.js dependency to angular js


var app = angular.module('app', ['underscore']);
app.controller('AppController', ['$scope', '_', function ($scope, _) {
  initialize = function () {
    _.keys($scope);
  }
  initialize();
}]);

underscore.factory('_', function () {
  return window._;
});

Thursday, May 08, 2014

Ruby 2.1.0 some useful changes

return in lambda
def yield_me
 yield
end

def run
  yield_me(&lambda {return "call from lambda"})
  "call from run method"
end

run   #=> "call from run method"
The example above would have returned "call from lambda" in  Ruby  previous ruby versions
---------------------------------------------------------------------------------------------------------------
#singleton_class?
class Test
  singleton_class?     #=> false
  class << self
    singleton_class?   #=> true
  end
end

Object#singleton_method
class Test
  def self.one
  end

  def two
  end
end

# returns class method
Test.singleton_method(:one)    #=> #
# doesn't return instance method
Test.singleton_method(:two)   #=> #-----------------------------------------------------------------------------------------------------------------
Method#original_name
To return the un-aliased name.
class Example
  def foo
    "foo"
  end
  alias bar foo
end

example = Example.new
example.method(:foo).original_name            #=> :foo
example.method(:bar).original_name            #=> :foo
Example.instance_method(:bar).original_name   #=> :foo




For more changes please visit here: 

https://github.com/ruby/ruby/blob/v2_1_0/NEWS

Friday, March 28, 2014

Ruby 2.1 and Garbage Collection issue and memory bloats in production unicorn and Phusion passenger

Are you working with Unicorn and getting memory leak issues with ruby 2.1 . A better explained scenario on memory allocation on heap with huge strings ,array and hashes in Ruby 2.1 by this author himself here :

 http://www.atdot.net/~ko1/activities/rubyconf2013-ko1_pub.pdf 

Whats the problem?

in his blog :
http://www.omniref.com/blog/blog/2014/03/27/ruby-garbage-collection-still-not-ready-for-production/

Well not sure about unicorn solution but Aman Gupta has a solution for Phusion Passenger.
as announced an Out-Of-Band garbage collector for Ruby 2.1.

Here is the Phusion Passenger blog on that one and usage.