Skip to content

Instantly share code, notes, and snippets.

@Yangwendaxia
Yangwendaxia / fork-and-push.md
Created January 14, 2019 02:18 — forked from zxhfighter/fork-and-push.md
如何给开源项目贡献代码

如何给开源项目贡献代码

分两种情况:

  • 代码仓库管理者给你添加该仓库的写入权限,这样的话可以直接push
  • 如果不能直接push(大多数情况),采用经典的fork & pull request来提交代码,下面讲述这种情况

fork & pull request

例如有个仓库https://github.com/ecomfe/esui.git,其采用了经典的分支开发模型,稳定后的代码提交到master分支,其余特性则在dev分支上进行开发,待成熟后合并回master分支。

The content of this article is from Vinay Sahni's Best Practices for Designing a Pragmatic RESTFul API. Really enjoyed this article!

Key requirements for the API

some requirements that the API must strive for:

  1. It should use web standards where they make sense
  2. It should be friendly to the developer and be explorable via a browser address bar
  3. It should be simple, intuitive and consistent to make adoption not only easy but pleasant
  4. It should provide enough flexibility to power majority of the Enchant UI
  5. It should be efficient, while maintaining balance with the other requirements

#如何一步一步打造高可扩展性的应用程序? 随着项目的规模越来越大,项目的维护性可能会变得越来越差,有时可能会出现牵一发而动全身的情况。如果需要修改某个功能的代码,就会耗费大量的人力和时间。此时,高可扩展性、低耦合的应用程序就变得非常重要了。构建高扩展性的应用的要点在于构建组成该应用的小的、单个的模块。 编写自包含、自封装、不影响其他组件的代码,最大化地减少依赖。利用一系列用于架构解耦和测试的工具,以及各种设计模式解决方案。比如依赖注入(dependency injection)、观察者模式(observer pattern)、中介者模式(mediator pattern)、外观模式(facade pattern)、命令模式(command pattern),面向对象(OOP)工具集。

http://www.csdn.net/article/2013-07-22/2816305-scalable-testable-maintainable-application

#如何保证Web应用程序安全性? Web应用程序是当今多数企业应用的前沿阵地。本文分析了保障Web应用程序的安全未必意味着延长开发周期以及如何保证Web应用程序安全性。

http://netsecurity.51cto.com/art/201302/380277.htm

#软件设计中的易用性

Mac 环境变量设置(Git 安装为例)

打开环境变量配置文件

vim ~/.bash_profile

添加GIT安装路径到当前环境变量

export PATH ="/usr/local/bin:$PATH" ...

让环境变量生效

source ~/.bash_profile

1. Laravel 5.1 上实现 Carbon 类本地化

在 app/Providers/AppServiceProvider.php 的boot()方法加上:

\Carbon\Carbon::setLocale('zh');

参考http://carbon.nesbot.com/docs/#api-localization

#2. Model Factory 生成本地化数据 在 AppServiceProvider.php boot() 方法内加入如下内容:

#Laravel 5.1 利用 Seeder 生成测试数据(范例)

1. 生成 Model 文件及数据表定义文件

    php artisan make:model Lesson -m

2. 定义数据表,生成数据库表

    
class CreateLessonsTable extends Migration

#实现定时任务(范例) ##1. php artisan make:console LogInfo ##2. 在项目Console/Commands 文件夹下编辑 LogInfo.php

        protected $signature = 'lesson:log';
        protected $description = 'Log Info';

        public function handle(){
            \Log::info('It Works'); //这里你可以实现自己的定时任务功能逻辑
@Yangwendaxia
Yangwendaxia / 0_reuse_code.js
Created November 19, 2016 03:00
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console