Skip to content

Instantly share code, notes, and snippets.

View eugenehp's full-sized avatar
🔬
DeepTech, FinTech, BioTech, Robotics, AI.

Eugene Hauptmann eugenehp

🔬
DeepTech, FinTech, BioTech, Robotics, AI.
View GitHub Profile
@eugenehp
eugenehp / bootstrap.js
Created July 31, 2016 01:04 — forked from Unitech/bootstrap
PM2 / Keymetrics for Heroku/Rackspace/Joyent/Amazon Elasticbeanstalk/Azure...
// Make sure you added pm2 as a dependency in your package.json
// Then in your Procfile, do a simple `node bootstrap.js`
var pm2 = require('pm2');
var MACHINE_NAME = 'hk1';
var PRIVATE_KEY = 'z1ormi9vomgq66';
var PUBLIC_KEY = 'oa0m7nuhdfibi16';
var instances = process.env.WEB_CONCURRENCY || -1; // Set by Heroku or -1 to scale to max cpu core -1
@eugenehp
eugenehp / whatsapp-image-compression
Created May 27, 2016 02:56 — forked from akshay1188/whatsapp-image-compression
Whatsapp like image compression
- (UIImage *)compressImage:(UIImage *)image{
float actualHeight = image.size.height;
float actualWidth = image.size.width;
float maxHeight = 600.0;
float maxWidth = 800.0;
float imgRatio = actualWidth/actualHeight;
float maxRatio = maxWidth/maxHeight;
float compressionQuality = 0.5;//50 percent compression
if (actualHeight > maxHeight || actualWidth > maxWidth) {
@eugenehp
eugenehp / Enhance.js
Created May 3, 2016 07:47 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {

NavigationExperimental notes

Containers

RootNavigationContainer

  • You pass the reducer to this, it actually ultimately receives all navigation calls via onNavigate, which is mostly equivalent to Redux dispatch. It setState and persisting state. it is like the redux "store"
@eugenehp
eugenehp / registry.js
Created April 19, 2016 20:52 — forked from taion/registry.js
Relay type registry
import decamelize from 'decamelize';
import { fromGlobalId } from 'graphql-relay';
import pluralize from 'pluralize';
import getItem from '../api/getItem';
const types = {};
const endpoints = {};
const getItemOverrides = {};
@eugenehp
eugenehp / GraphQL-Relay-Redux.md
Created March 2, 2016 19:28 — forked from idibidiart/GraphQL-Architecture.md
GraphQL/Relay: The End of Redux? ... Perhaps.

GraphQL allows us to define a generic, UI-agnostic data model on the server using a graph schema that encodes the natural relationships within the data. To wire our model to data, we define resolvers in the schema that leverage our db's own query language (SQL, NoSQL, or Graph query language, etc) or in-memory objects to resolve client-defined, graph-oriented queries against our generic data model.

With each components in the UI component tree declaring its own data dependencies, GraphQL/Relay creates a projection of the graph data model that maps to the UI component tree, thus allowing us to have a UI-agnostic data model on the server, while at once giving us and UI-specific projection of the data. The queries from GraphQL server to the database are composed in an efficient manner based on the aggregate data dependencies that are declared by each component in the UI component

@eugenehp
eugenehp / Instructions.md
Created September 29, 2015 01:58 — forked from jodyheavener/Instructions.md
Use Babel (ES6) with Sails JS

Inspired by this issue, with these instructions you should be able to get Babel transpiling your JS in Sails JS for the client side.

  1. Install Grunt Babel npm install --save grunt-babel
  2. Create a babel.js file under tasks/config and add something like the following:
module.exports = function(grunt) {

    grunt.config.set('babel', {
dev: {
@eugenehp
eugenehp / strongloop-heroku.md
Last active August 30, 2015 21:34 — forked from MarcDiethelm/strongloop-heroku.md
How to install a Node.js app using Strongloop on Heroku

How to install a Node.js app using Strongloop on Heroku

with different environments like staging and production no less! new: now with multiple account administration!

  1. Create a Node.js app as you would normally, managing your dependencies with npm in package.json.
  2. Your app should be set up to listen on process.env.STRONGLOOP_PORT || [your usual local port].
  3. Download and install the Heroku toolbelt. This install includes git.

➽ If you need to handle multiple accounts, install the accounts plugin.

@eugenehp
eugenehp / angularjs_directive_attribute_explanation.md
Last active August 27, 2015 05:56 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
"""
Multinomial Logistic Regression (MLR)
=====================================
Multiclass-classification with the MLR classifier
Authors: Adrien Gaidon & Jakob Verbeek
"""