Decorative image frame

Solito

Buring silence in SHA.

Solito

Hard & Soft Dependencies

ref: https://magento.stackexchange.com/questions/151250/whats-a-hard-dependency-and-whats-a-soft-dependency

Hard Dependency

a module cannot function without the other modules on which it depends

  • The module contains code that directly uses logic from another module (instances, class constants, static methods, public class properties, interfaces and traits).

  • The module contains strings that include class names, methods names, class constants, class properties, interfaces, and traits from another module.

  • The module de-serializes an object declared in another module.

  • The module uses or modifies the database tables used by another module.

    Read More...

JS-Label

标签(label),相当于定位符,用于跳转到程序的任意位置。

  1. 配合break

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    top:  // Label
    for (var i = 0; i < 3; i++){
    for (var j = 0; j < 3; j++){
    if (i === 1 && j === 1) break top; // 注意,不加引号
    console.log('i=' + i + ', j=' + j);
    }
    }
    // i=0, j=0
    // i=0, j=1
    // i=0, j=2
    // i=1, j=0
    Read More...

JS对象引用

如果不同的变量名指向同一个对象,那么它们都是这个对象的引用,也就是说指向同一个内存地址。修改其中一个变量,会影响到其他所有变量。

1
2
3
4
5
6
7
8
var o1 = {};
var o2 = o1;

o1.a = 1;
o2.a // 1

o2.b = 2;
o1.b // 2
Read More...

Migrate local video header to cloud storage

Since the Ocean theme includes and initiates the videos and images about header via local folder themes/ocean/source/images/ocean/, the page loads slowly at mobile device. So I decided to transfer these large files to cloud side to promote loading speed.

  1. Find the local image folder as referred above.

  2. upload these files to cloudinary, it provides plugin as a module to js file:

    1
    cloudinary.videoTag('gitblog/ocean/ocean_j5rpnt').toHtml();

    the src ref-way can be find at “edit” page by right clicking on cloudinary/file.
    Here I did not use this short path cuz I am not in need of a large quantity of inserted files.

    Read More...

Post photos to Gallery

How to post a photo to blog gallery

1
2
3
4
5
$ hexo new page gallery      // create 'gallery' page

$ hexo new page about // create 'about' page
$ hexo new page tags // 'tags' page
$ hexo new page categories // 'categories' page

2. Find the index.md and modify it.

After step 1, there will be folders named “gallery”, “about”… under /source/.

Read More...

CDT App Lifecycle

Apps that run in the container have their lifecycle managed.
The container checks for various functions implemented by the app. If those functions are implemented, the container will execute them accordingly. The following functions are supported by the container:

1. void onStart()

This method is called when the app is first instantiated in the current tab for the first time.

1
2
3
onStart: function() {
// Code here
}

2. void onPause()

This method is called when the user has left your app to view a different app.

Read More...

Require JS - define模块定义

CMD (Common Module Definition)
在 CMD 规范中,一个模块就是一个文件。代码的书写格式如下:

define(factory);

define 是一个全局函数,用来定义模块。

1. factory为函数时,表示模块的构造方法:

1
2
3
define(function(require, exports, module) {
// 模块代码
});

执行该构造方法,可以得到模块向外提供的接口。
factory 为对象、字符串时,表示模块的接口就是该对象、字符串

Read More...