This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var cellx = require('cellx'); | |
| var a = cellx(55); | |
| var x = cellx((push) => { | |
| //a() //Если раскомментировать эту строку, то x начинает пересчитываться! | |
| setTimeout(() => { | |
| push("test" + a()); | |
| }, 100) | |
| }) | |
| x('addChangeListener', () => { | |
| console.log("addChangeListener, x:: ", x()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var cellx = require('cellx'); | |
| var a = cellx(55); | |
| var x = cellx((push) => { | |
| //a() //Если раскомментировать эту строку, то x начинает пересчитываться! | |
| setTimeout(() => { | |
| push("test" + a()); | |
| }, 100) | |
| }) | |
| x('addChangeListener', () => { | |
| console.log("addChangeListener, x:: ", x()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var cellx = require('cellx'); | |
| var x = new cellx.Cell | |
| cellx.Cell.prototype.if = function (trueCondition) { | |
| this.subscribe(function () { | |
| this.get() && trueCondition() | |
| }); | |
| this.get() && trueCondition() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var state = require('./state'); | |
| var f1 = require('./f1'); | |
| var f2 = require('./f2'); | |
| try{ | |
| f1();//Change state, really bad | |
| var newState = f2();// pure function | |
| //await f3 | |
| //yield* f4 | |
| }catch(e){ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Fib = { | |
| [Symbol.iterator]() { | |
| var n1 = 1, n2 = 1; | |
| return { | |
| // make the iterator an iterable | |
| [Symbol.iterator]() { return this; }, | |
| next() { | |
| var current = n2; | |
| n2 = n1; | |
| n1 = n1 + current; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import jsdom = require("jsdom"); | |
| import React = require("react"); | |
| import ReactElementSymbol = require("react/lib/ReactElementSymbol"); | |
| import ReactDOM = require("react-dom"); | |
| const window = jsdom.jsdom(`<div id="root"></div>`).defaultView; | |
| global['window'] = window; | |
| global['document'] = window.document; | |
| class A extends React.Component<any, any>{ | |
| render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(){var LOG = "Hello, world";var req = require("http").request({hostname: '127.0.0.1', port: 9999, path: '/', method: 'POST',});req.write(LOG);req.end();})() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <IRremote.h> | |
| int RECV_PIN = 11; | |
| IRrecv irrecv(RECV_PIN); | |
| IRsend irsend; | |
| decode_results results; | |
| void setup() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function logClass(target: any) { | |
| // save a reference to the original constructor | |
| var original = target; | |
| // a utility function to generate instances of a class | |
| function construct(constructor, args) { | |
| var c : any = function () { | |
| return constructor.apply(this, args); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const net = require("net"); | |
| const server = net | |
| .createServer(function(socket) { | |
| socket.on("data", function(data) { | |
| if (data.toString() === "close") { | |
| socket.end(); | |
| } else { | |
| socket.write(data.toString()); | |
| } | |
| }); |
OlderNewer