Skip to content

Instantly share code, notes, and snippets.

View tristanpendergrass's full-sized avatar

Tristan tristanpendergrass

  • Dropbox
  • Seattle, WA
View GitHub Profile
const processData = someExpensiveFunction;
const mapStateToProps = state => ({
foos: getFoos(state),
});
const MyComponent = props => (
<div>baz: {props.baz}</div>
<SubComponent data={processData(props.foos)} />
);
import { compose } from 'lodash/fp';
import React from 'react';
import { reduxForm, destroy } from 'redux-form';
import { connect } from 'react-redux';
import { withStyles } from 'material-ui/styles';
import ExpTextField from 'common/components/form/ExpTextField';
const styles = {
root: {
// the error that happens when running the server:
> node server.js
/Users/tristanpendergrass/dev/project/server/models/trade.model.js:2
this.ign = data.ign;
^
// trade.model.js
{"name":"EXP API","hostname":"T.local","pid":42588,"level":30,"req":{"method":"GET","url":"/api/content?limit=25&parent=root&skip=0&sort=name","headers":{"host":"localhost:9000","connection":"keep-alive","pragma":"no-cache","cache-control":"no-cache","accept":"application/json, text/plain, */*","origin":"http://localhost:8000","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36","authorization":"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhcGkiOnsiaG9zdCI6Imh0dHA6Ly9sb2NhbGhvc3Q6OTAwMCJ9LCJuZXR3b3JrIjp7Imhvc3QiOiJodHRwOi8vbG9jYWxob3N0OjkwMDIifSwiaWRlbnRpdHkiOnsidHlwZSI6InVzZXIiLCJvcmdhbml6YXRpb24iOiJqYW4xMWRlbW8iLCJ1c2VybmFtZSI6InRwQHQuY29tIiwicm9sZSI6Im93bmVyIiwiY29ubmVjdGlvbklkIjoiZmMzOTk5NmUtODQwMy00YjlmLTlkZmYtZmE4NmEzOWUxNDgzIiwibm9uY2UiOjE0OH0sImlhdCI6MTQ4NDc1MjE0MywiZXhwIjoxNDg0NzcwMTQzfQ.ksJjCSoTfO8oR-rykiZPU6gKo66NDw3ZB1xrUDbx1k8","referer":"http://localhost:8000/content?filter=&order=name&limit=25&page=1&uuid=root"
// contentGrid.directive.js
import angular from 'angular';
import gridTpl from './contentGrid.tpl.html';
import angularServices from 'common/services/angular/index';
import coreServices from 'common/services/core/index';
import 'common/vaadinGrid.css!';
function contentGrid() {
snippet watch
$1.$watch(() => $1.$0, () => {
console.log('$1.$0 is', $1.$0);
});
endsnippet
~/scala/exp-core $ grep -R "ContentFile" ./client/src/
./client/src//app/content/content.controller.js: constructor($scope, $log, $mdBottomSheet, $mdDialog, $filter, $interval, $rootScope, ContentFolder, ContentFile, ContentApp, ContentUrl, Content, Color, ScalaToast, ExperienceTemplate, FileType, Upload, Auth, ExpMenubarTitle) {
./client/src//app/content/content.controller.js: this.ContentFile = ContentFile;
./client/src//app/content/content.controller.js: serviceToCall = this.ContentFile;
./client/src//app/content/content.controller.js: serviceToCall = this.ContentFile;
./client/src//app/content/content.controller.spec.js: let ContentFile;
./client/src//app/content/content.controller.spec.js: ContentFile = {};
./client/src//app/content/content.controller.spec.js: ContentCtrl = $controller('ContentCtrl', { $scope, $state, $mdBottomSheet, $mdDialog, Config, ContentFolder, ContentFile, ContentApp, ContentUrl, Content, FileType, Upload, Auth, ExpMenubarTitle });
./client/src//app/content/co
constructor ($scope, angularServices, coreServices) {
this.$scope = $scope;
Object.assign(this, angularServices._.pick(angularServices, [
'$http',
'$timeout',
'$location',
'$state'
]));
constructor ($scope, angularServices, coreServices) {
this.$scope = $scope;
const { $http, $timeout, $location, $state } = angularServices;
const { config } = coreServices;
this.$http = $http;
this.$timeout = $timeout;
this.$location = $location;
this.$state = $state;
class ContentCtrl {
constructor($scope, contentItems) {
this.readyIntervals = []; // $interval for each content item that we're checking "ready" status of
$scope.$on('$destroy', () => {
this.readyIntervals.forEach($interval.cancel.bind($interval));
});
this.contentItems = contentItems;
this.contentItems.forEach(this.getReadyStatus.bind(this));