胡军的网络日志

pursue next update


  • 首页

  • 关于

  • 归档

  • 标签

bluebird带给我的惊喜

发表于 2016-03-13   |  
背景用Node.js开发App服务端Api.框架:Express,Promise库:bluebird. 局限我没用过ES7的await,async语法,所以无法比较.另外,bluebird也了解的不详细,如有写的不对的地方,实属正常,欢迎讨论. 惊喜出现的过程从callback到async开始只用Node的传统callback嵌套方װ ...
阅读全文 »

Clojure的sequence抽象

发表于 2016-03-11   |  
来源:Clojure for the brave and true 什么是Programming to Abstractions?是一种设计函数库的原则,Clojure采用了这种原则.即把具有相似特征的数据结构抽象成某个概念,比如sequence.之后这些类的数据都可以用同一个函数操作. 类似的东西Javascript的Lodash库v ...
阅读全文 »

今天听了陈天老师的函数式编程的分享

发表于 2016-02-27   |  
重点一FP的核心是组合,一些比较难懂的概念(比如monad), functor),都是为了强化FP的组合功能. 重点二FP非常有利于实现OpenClose原则,既Open to extension, close to modification. 重点三Javascript的Promise是一种monad.
阅读全文 »

Rails Many to Many Associations

发表于 2013-10-20   |  
has_many through requires a join model name your join table anything ex: memberships Pros: more flexible, can add additional attributes(solumns) to join tableCons: additional join model required has_and_belongs_to_many no join model necesary assumes join table based on convention ex: groups_users Pors: easier, no join model Cons: not as flexible, can’t add additional attributes(solumns) to join table
阅读全文 »

Deployment Options

发表于 2013-09-27   |  
Managed Google App Engine Heroku cons: no server access, constrained enviroment pros: don’t need devops skills Self Service VPS pros: your own virtualized environment/server cons: need devop/sysadmin skills AWS, Rackspace, Digital Ocean, Linode Physical Machines colocation Shared host your app in a dir, other apps in other dir roomates pro: very cheap cons: too many to list Vendors Dreamhost
阅读全文 »

HTTP and MVC

发表于 2013-09-17   |  
HTTP: Request verb/method (GET or POST) url parameters Response status code (200, 301, 404, 500) payload Stateless: we have to rebuild the world at every request. MVC: Model, View, Controller Controller routes to appropriate action based on request action my talk to model, and then either redirect (301) or render view (200) as the response Important Sinatra concepts: Rendering template allows access by template to ivars set up in action Template have access seeeion hash session params
阅读全文 »

Tools of Modern Web Development

发表于 2013-09-17   |  
juggle many layers of technologies, all with different syntax & behaviors, and understand how they integrate with each otherOther things web developers must be aware of: best practices security concerns browser compatibility mobile operating systems FrontEnd Javascript frameworks jquery … MVC backbone.js Ember.js … ajax coffeesript HTML erb haml … CSS sass … mobile responsive MiddleWare APIs URLs REST request/response processing security xss, crsf, code injection, etc BackEnd database relational MySql Postgres NoSql document MangoDB web services REST SOAP MISC deployment background processing git bundler ...
阅读全文 »

Porcess of Building Web App using Rails

发表于 2013-09-17   |  
build mock up build domain model build relation DB that support all business logic build url points, control actions, template
阅读全文 »

Ruby's inheritance

发表于 2013-09-12   |  
class Animal attr_accessor :name def initialize(name) @name = name end def speak "#{ name } is speaking!" end end class Dog < Animal def speak "#{ name } is barking!" end end class Cat < Animal end fido = Dog.new('fido') puts fido.name puts fido.speak kitty = Cat.new('kitty') puts kitty.name puts kitty.speak puts Dog.ancestors produce fido fido is barking! kitty kitty is speaking! Dog Animal Object Kernel BasicObject
阅读全文 »

Ruby's composition

发表于 2013-09-12   |  
module Swimmable def swim "#{ name } is swimming!" end end module Fetchable def fetch "#{ name } is fetching!" end end class Animal attr_accessor :name def initialize(name) @name = name end def speak "#{ name } is speaking!" end end class Mammal < Animal def warm_blooded? true end end class Dog < Mammal include Swimmable include Fetchable def speak "#{ name } is barking!" end end fido = Dog.new('fido') puts fido.swim produce fido is swimming! Dog Fetchable Swimmable Mammal Animal Object Kernel BasicObject
阅读全文 »
123
胡军

胡军

学习是一种生活方式

24 日志
7 标签
RSS
GitHub Twitter
© 2016 胡军
由 Hexo 强力驱动
主题 - NexT.Pisces