Wednesday, March 29, 2017

Ruby related: Inspecting methods, Getting Source Location

http://stackoverflow.com/questions/4664578/how-do-i-inspect-the-methods-of-a-ruby-object
obj.class.instance_methods(false)

http://stackoverflow.com/questions/3393096/how-can-i-get-source-code-of-a-method-dynamically-and-also-which-file-is-this-me

 Use source_location:
class A
  def foo
  end
end
file, line = A.instance_method(:foo).source_location
# or
file, line = A.new.method(:foo).source_location
puts "Method foo is defined in #{file}, line #{line}"
# => "Method foo is defined in temp.rb, line 2"

Saturday, March 25, 2017

Modules vs Microservices

https://www.oreilly.com/ideas/modules-vs-microservices
https://www.reddit.com/r/programming/comments/61f13z/modules_vs_microservices/

Excerpt:
Much has been said about moving from monoliths to microservices. Besides rolling off the tongue nicely, it also seems like a no-brainer to chop up a monolith into microservices. But is this approach really the best choice for your organization? It’s true that there are many drawbacks to maintaining a messy monolithic application. But there is a compelling alternative which is often overlooked: modular application development. In this article, we'll explore what this alternative entails and show how it relates to building microservices.

Monday, March 20, 2017

Rails - logger enhancements

https://github.com/jrochkind/formatted_rails_logger

FormattedRailsLogger
Monkey-patches Rails BufferedLogger (the standard Rails logger) to accept a formatter just like ruby Logger does. Provides a formatter that includes timestamp and severity in logs, while taking account of Rails habit of making space in the logfile by adding newlines to the beginning of log message.

What is hard to do using React.js compared to jQuery?

https://www.quora.com/What-is-hard-to-do-using-React-js-compared-to-jQuery

Just name a few that React is not good at

1. Async loading. Async loading is a must-have for Single Page App but React doesn't have a native support for Async loading.
2. Animation. You have to fall back to other library for animation.
3. Integration with other library. You don't want to rewrite all available cool library in React, do you?
 
When working with async loading, animation and integration with other jQuery library, you end up have too many work-around in your code and you can hardly call your framework React.

React related - Redux vs setState()

Saturday, March 18, 2017

RxJS, Most.js, xstream

Libraries like xstream, RxJS or Most.js, greatly simplify code related to events, asynchrony, and errors.
http://reactivex.io/rxjs/manual/tutorial.html
https://github.com/cujojs/most/
https://github.com/staltz/xstream

Comparing RxJS and xstream: from https://medium.com/@AlbertKlusky/rxjs-be-careful-with-that-axe-eugene-a1763d115e30#.fmw8sa3au
I relay like rxjs. It’s very powerful tools, but at the same time it’s super dangerous. I know that creator of framework Cycle.js — AndrĂ© Staltz — resigned from using Rxjs and switched to xstreams. Main problem which forced him to switch to xstream was confusion around hot and cold observables. I think the same. Rxjs would be much easier without cold observable, if everything would be hot like with xstreams. Cold streams are handy but are super dangerous. Similar like with two way data binding. It’s cool feature, but super dangerous.

quokkajs - The Live Scratchpad for JavaScript

The Live Scratchpad for JavaScript
https://quokkajs.com/

(To be used with VS Code)

Getting Started: https://quokkajs.com/docs/index.html#getting-started

ViaJS - A JavaScript library that allows you to load HTML content dynamically

ViaJS - A JavaScript library that allows you to load HTML content dynamically
https://github.com/abdi0987/ViaJS

This seems like a simple library to learn and use. (Have to try it out)

Nito - A jQuery library to build user interfaces, inspired by React

Nito: A jQuery library to build user interfaces, inspired by React

Friday, March 17, 2017

ES6 - const (for objects and arrays)

Excerpt from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const


// const also works on objects
const MY_OBJECT = {'key': 'value'};

// Attempting to overwrite the object throws an error
MY_OBJECT = {'OTHER_KEY': 'value'};

// However, object keys are not protected,
// so the following statement is executed without problem
MY_OBJECT.key = 'otherValue'; // Use Object.freeze() to make object immutable

// The same applies to arrays
const MY_ARRAY = [];
// It's possible to push items into the array
MY_ARRAY.push('A'); // ["A"]
// However, assigning a new array to the variable throws an error
MY_ARRAY = ['B']

React related: Mobx

Monday, March 13, 2017

ES6 - new syntax about 'const'

ES6 - What do function parameter lists inside of curly braces do in es6?


const func = ({ param1, param2 }) => {
    //do stuff
}

It is destructuring, but contained within the parameters. The equivalent without the destructuring would be:

const func = o => {
    var param1 = o.param1;
    var param2 = o.param2;
    //do stuff
}

It is basically shorthand for {param1: param1, param2: param2}


Microservices for Frontend

Microservices for Frontend: https://www.mosaic9.org/

Tuesday, March 7, 2017

Saturday, March 4, 2017

Learn to Draw


Code Reviews

http://monotonically-unstable.github.io/programming/2017/03/03/methodical_code_reviews/
Excerpt:
Whenever I trained a new team member on how to do code reviews, I instructed two major rules. In short, they went along these lines:
  1. Never make the other person feel bad about his/her work.
  2. Never give a review note that is based on a gut feeling.

Rails - see list of instance variable names

Followers

Blog Archive