Skip to content

Instantly share code, notes, and snippets.

Baby Yoda is my spirit animal

Berkeley Martinez BerkeleyTrue

Baby Yoda is my spirit animal
View GitHub Profile

Keybase proof

I hereby claim:

  • I am berkeleytrue on github.
  • I am berkeleytrue ( on keybase.
  • I have a public key ASD1MZchoq-cqZLSU9kXEzrmAeDyVXR_DI9v_bk_19me8Qo

To claim this, I am signing this object:

BerkeleyTrue / .travis.yml
Created Jun 5, 2018
greenkeeper lockfile install with npm ci
View .travis.yml
language: node_js
- '8'
- '10'
- if [[ `npm -v` != 6* ]]; then npm install -g npm@6; fi
- npm install -g greenkeeper-lockfile
BerkeleyTrue /
Last active May 23, 2018
Loopback Replication/Synchronization

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.

View event-handler-with-context.jsx
class MyComponent extends React.Component {
constructor() {
this.handleClick = this.handleClick.bind(this);
handleClick(e) {
console.log('Parameter', this.props.param);
console.log('Event', e);
View event-handlers-with-parameters-bind-constructor.js
class MyComponent extends React.Component {
constructor() {
this.handleClick = this.handleClick.bind(this, 'Parameter');
handleClick(param, e) {
console.log('Parameter', param);
console.log('Event', e);
BerkeleyTrue / .profile
Created Sep 2, 2017
Checkout remote pull request
View .profile
gcorpullrequest() {
# gcorpullrequest 123 upstream
# gcorpullrequest 124
echo "What do you want to call the local branch?"
read branchname
if [ $# = 2 ]; then
View karabiner.json
"title": "SpaceKeys",
"rules": [
"description": "l/r shift => ()",
"manipulators": [
"description": "Change left shift press to (",
"from": {
"key_code": "left_shift",
BerkeleyTrue /
Last active Jul 20, 2017
Redirect a url to a localhost port
# First we need to map our localhost + port combo to another ip. You'll need root priviliges for this
sudo ifconfig lo0 alias && \
echo "rdr pass on lo0 inet proto tcp from any to port 80 -> port 3000" | sudo pfctl -ef -
# Now edit /etc/hosts
sudo vim /etc/hosts
# and add the following to the list
# NOTE: Do not edit anthing on this list you did not add
# I choose to use a .dev TLD as these are never going to conflict seeing how google has bought these TLD's
View throw-in-mergemap.js
function epic(actions){
return actions.ofType('FOO')
.mergeMap(action => {
const transformed = transform(action); // may throw collapsing the pipe
return makeThingDoAsyncy(transform)
.catch(e => [foo(e)]); // won't catch above
// imperative
View routes.jsx
import { createServer, at } from 'fyfe';
import { GET, composeRoutes, composeMiddleware } from 'fyfe-compose-routes';
import fyfeDefaults from 'fyfe-defaults';
// composes routes together
// first route to return something other then Void will win
const routes = composeRoutes(
// use a route handler
// Request => Responce|String|Stream|Void
GET('/', renderIndex),
You can’t perform that action at this time.