Skip to content

Instantly share code, notes, and snippets.

@ethan-deng
ethan-deng / SPCache.md
Created March 27, 2015 21:13
Bust SharePoint Client Cache

Bust Client Cache with SPUtility.MakeBrowserCacheSafeLayoutsUrl

    <script src="<%=SPContext.Current.Site.ServerRelativeUrl + SPUtility.MakeBrowserCacheSafeLayoutsUrl("folderUnderLayouts/js/MedInsight.EzInList.js", false)%>"></script>
    <link href="<%=SPContext.Current.Site.ServerRelativeUrl + SPUtility.MakeBrowserCacheSafeLayoutsUrl("folderUnderLayouts/css/easyquery.css", false)%>" rel="stylesheet" type="text/css"  />

React Pitfalls

1.React JSX attribute is case sensitive.

For example, this is valid attribute "colSpan". This is not "colspan".

2.When use array to build component JSX, don't set array length to 0 to re-initiate array. Always set array to []. Set array length to 0 will keep the array reference.

3.Don't do this

@ethan-deng
ethan-deng / AspNetWeb.md
Last active August 29, 2015 14:20
jQuery ajax and ASP.NET Web Services and Web API 2.0

jQuery ajax and ASP.NET Web Services and Web API 2.0

  1. Web Services

Get data

$.ajax({
  type: "POST",
  url: "ServiceName.asmx/WebMethodName",
 data: "{}",
@ethan-deng
ethan-deng / CORS.md
Last active November 4, 2015 07:45
Windows Authentication with Cross Origin Request
@ethan-deng
ethan-deng / ATOM.md
Last active November 27, 2018 00:06

ATOM Editor

Instal linter-eslint package

https://alligator.io/vuejs/vue-eslint-plugin/

Change "Fix errors on save"
Add "text.html.vue" to "List of scopes"

source.js, source.jsx, source.js.jsx, source.babel, source.js-semantic, text.html.vue

Use SASS

  1. Install SASS: npm install SASS -g --save-dev
  2. Run SASS: node_modules\.bin\node-sass --source-map true scss\app.scss build\app.css

NPM

Update NPM

npm install -g npm

NPM Scripts

NPM Scripts run command using binary from the packages in the current location and doesn't use the globally installed package. When using NPM scripts to run build commands, it is not necessary to install build package globally.

List currently installed package versions

npm list --depth=0

The case that you have to use Immutable.js in React

In React, there are scenarios that you have to use Immutable.js if you want to use shouldComponentUpdate to improve performance.

For example if your state is an object or array in a flux data store

  this.var1 = {a:1, b:2};
  this var2 = [1,2,3];

Async Loading of Initail Content with Flux-Alt

The best approach to aysnc load content into data store in Flux-Alt is to

Defined an export method in data store. This is to make sure that all sub components have subscribe the change of the store.

    this.exportPublicMethods({
      load: this.load
    });