Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Baby Yoda is my spirit animal

Berkeley Martinez BerkeleyTrue

💭
Baby Yoda is my spirit animal
View GitHub Profile
@teone
teone / REAME.md
Created Jul 25, 2016
JS Binary Tree
View REAME.md

Binary Tree Implementation

This is a draft implementation of a Binary Tree in Javascript.

No libraaries are used to define the Tree, but mocha and chai are used to test the code, so you should execute npm install before running tests.

The BinaryTree implementation is defined in binary-tree.js, example usages are in index.js (too see them use npm start), test are defined in spec.js and you can execute them with npm test;

TODO

@jquense
jquense / 0. intro.md
Last active Sep 5, 2020
Alternative ways to define react Components
View 0. intro.md

The 0.13.0 improvements to React Components are often framed as "es6 classes" but being able to use the new class syntax isn't really the big change. The main thing of note in 0.13 is that React Components are no longer special objects that need to be created using a specific method (createClass()). One of the benefits of this change is that you can use the es6 class syntax, but also tons of other patterns work as well!

Below are a few examples creating React components that all work as expected using a bunch of JS object creation patterns (https://github.com/getify/You-Dont-Know-JS/blob/master/this%20&%20object%20prototypes/ch4.md#mixins). All of the examples are of stateful components, and so need to delegate to React.Component for setState(), but if you have stateless components each patterns tends to get even simpler. The one major caveat with react components is that you need to assign props and context to the component instance otherwise the component will be static. The reason is

View folder-structure.md

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

@BerkeleyTrue
BerkeleyTrue / LoopbackSync.md
Last active May 23, 2018
Loopback Replication/Synchronization
View LoopbackSync.md

Loopback Sync

Sync in Loopback requires Loopback in the client as well the server.

Loopback attaches a replicate method to each Model Class. Lets say I define a model called 'RemoteMat' in my loopback server. In my client loopback app, I define a local varient of this model called 'LocalMat'.

My app would use Browserify to package Loopback for the client.

On first app load, I would call a Bi-direction replication (or syncronization) method. This is currently not implament in Loopback but it is easy to create. I will go into more detials later.

@malarkey
malarkey / Contract Killer 3.md
Last active Oct 26, 2020
The latest version of my ‘killer contract’ for web designers and developers
View Contract Killer 3.md

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

You can’t perform that action at this time.