Skip to content

Instantly share code, notes, and snippets.

View Dispatcher.js
var Dispatcher = require('flux').Dispatcher;
module.exports = new Dispatcher();
View ActionCreator.js
var Dispatcher = require('Dispatcher');
var DemoActions = {
calculateSmth: function (demoText) {
Dispatcher.dispatch({
actionType: 'calculateSmth',
text: demoText
});
}
};
View Store.js
var EventEmitter = require('events').EventEmitter;
var Dispatcher = require('Dispatcher');
var DemoStore = assign({}, EventEmitter.prototype, {
demoMethod: function() {
//some functionality
},
emitChange: function() {
this.emit('change');
},
View View.js
var Store = require('Store');
var DemoApp = React.createClass({
componentDidMount: function() {
Store.addChangeListener(this._onChange);
}
componentWillUnmount: function() {
Store.removeChangeListener(this._onChange);
}
View Manifest.json
{
"manifest_version": 2,
"name": "Simple extension",
"description": "Simple description",
"version": 1.0,
"permissions": [],
"content_scripts": [],
"background": {},
"web_accessible_resources": [],
"browser_action": {},
View CSP.js
{
//some props
"content_security_policy": "script-src: 'self'; object-src: 'self'; "
//some props
}
View web_accessible_resource.js
{
//...
"web_accessible_resources": [
"images/*.png",
"style/double-rainbow.css",
"script/double-rainbow.js",
"script/main.js",
"templates/*"
],
//...
View block_example.json
{
"hash": "000000000000000000b57d57fc57e022fbebc6fbdee108095dcf1bfcdd68b4d5",
"ver": 536870912,
"prev_block": "0000000000000000034f2855c116b426305d82a54b29cceb32641da639aeef82",
"mrkl_root": "160ebb4ccf13cd61cdde124e661d6f93f693025ff8cc76baf6cb3de51c76b994",
"time": 1482003305,
"bits": 402885509,
"nonce": 1583068092,
"n_tx": 366,
"size": 125237,
View wildfire.html
<agm-map [latitude]="lat" [longitude]="lng" [zoom]="zoom" (mapReady)="setMapInstance($event)">
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
</agm-map>
View wildfire.component.ts
import { Component } from '@angular/core';
declare const google: any;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title: string = 'medium articles';