Skip to content

Instantly share code, notes, and snippets.

🙃
Do things!

Gregory Shehet A-gambit

🙃
Do things!
  • Grammarly
  • San Francisco
Block or report user

Report or block A-gambit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 1.js
ObjectClone(obj, depth)
//call 1
clone({a: {b: {c: 33}}}, 0) // => {};
//call 2
clone({a: {b: {c: 33}}}, 1) // => {a: {}};
View gist:634d3352cad4e1aa59638d2bcdf0e261
https://docs.google.com/document/d/1E9Sv_RslOEL2648Pw2HNbhy1STqqTc-DXmKnhRzO1Vg/edit#heading=h.uubk69kqpupn
View 1.ts
const path = require('path')
const distPath = path.resolve(__dirname, '../../dist')
const babelLoader = {
loader: 'babel-loader',
options: {
cacheDirectory: true,
presets: ['es2015', 'react', 'stage-0']
}
@A-gambit
A-gambit / ReactiveConf2017.md
Last active Nov 19, 2019
Proposal for lightning talk at ReactiveConf 2017: How do you make friends with React and FRP? 🤔 Start to develop your application using Focal.
View ReactiveConf2017.md

How do you make friends with React and FRP? 🤔 Start to develop your application using Focal.

This is a CFP for the ⚡️Lightning⚡️ talk at awesome ReactiveConf 2017. If you'd like to see this talk, please 🌟 star🌟 this summary and retweet my tweet 🙂 #ReactiveConf

image

Functional reactive programming (FRP) is very popular nowadays. The JavaScript community provides us with excellent tools like RxJS, Bacon, and Kefir. But, as we know, they have nothing to do with React. So how we can use the power of FRP in our React application? Using the correct state management, we can make friends with FRP and React and make our application truly reactive. In my lightning talk, I will talk about Focal

View undo.ts
export class UndoAtom<T> {
private _atom: Atom<T>
_undo: Array<T>
_redo: Array<T>
constructor(atom: Atom<T>) {
this._atom = atom
this._undo = []
this._redo = []
@A-gambit
A-gambit / REACTIVE2016-LIGHTNING-PROPOSAL.md
Last active Jul 11, 2017
Proposal for lightning talk at ReactiveConf 2016: Road from UndefinedLand
View REACTIVE2016-LIGHTNING-PROPOSAL.md

Proposal for a lightning talk at the Reactive 2016.

Keep calm and like/retweet it on Twitter and star this Gist to vote on this talk.

Road from UndefinedLand

Undefiend

I work at Grammarly. We like React and happily use it in our applications. However, sometimes something goes wrong and bugs creep into the code. Here comes testing. It helps make us confident about the quality of our code.

View 1.js
function count(data, parent_id = null, parent_count = 0) {
const nodes = data.filter(_ => _.tree.parent_id == parent_id)
return [
...nodes.map(({enabled, id, title}) => ({
enabled, id, title, parent_count, parent_id,
child_count: data.filter(_ => _.tree.parent_id == id).length
})),
...nodes.reduce((memo, {id}) => memo.concat(count(data, id, parent_count + 1)), [])
]
}
View 1.json
[
{
"title": "Adjectives and Adverbs",
"texts": [
{
"text": "I do not care for this author ...",
"answers": ["any more", "any longer"],
"correct": 0
},
{
View error.js
var ServerSentError = function(_Error) {
_inherits(ServerSentError, _Error);
function ServerSentError(status, data) {
_classCallCheck(this, ServerSentError);
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ServerSentError).call(this));
_this.name = 'ServerSentError';
_this._stackKeeper = new Error();
View 7.js
import readline from 'readline'
export const func = table => ({
newTable: table.map(row => row.map(x => x * Math.max(...row))),
oldTable: table
})
const rl = readline.createInterface({
input: process.stdin,
You can’t perform that action at this time.