I want to make a shopify theme using react.
You have a bunch of template files that have access to global server-side variables with liquid e.g. {{ product.title }}
. Think wordpress or any other theme-based system.
/theme
Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.
For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.
This gives an ongoing list of file-type magic numbers.
var Rx = require('rx'); | |
function EventAggregator() { | |
this._subject = new Rx.Subject(); // Can be ReplaySubject too | |
} | |
EventAggregator.prototype.publish = function (type, data) { | |
this._subject.onNext( { type: type, data: data }); | |
}; |
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |
Sparked from this twitter conversation when talking about doing fast async rendering of declarative UIs in Preact
These examples show how it's possible to starve the main event loop with microtasks (because the microtask queue is emptied at the end of every item in the event loop queue). Note that these are contrived examples, but can be reflective of situations where Promises are incorrectly expected to yield to the event loop "because they're async".
setTimeout-only.js
is there to form a baselineimport { Fetch, Utils } from 'teambition-sdk' | |
import { Observable } from 'rxjs/Observable' | |
import { Subject } from 'rxjs/Subject' | |
import { ReplaySubject } from 'rxjs/ReplaySubject' | |
import { AjaxResponse } from 'rxjs/observable/dom/AjaxObservable' | |
import { Subscriber } from 'rxjs/Subscriber' | |
import * as config from 'config' | |
export interface ChunkMeta { | |
fileType: string |