Skip to content

Instantly share code, notes, and snippets.

View id0Sch's full-sized avatar
🕳️
Digging

Ido S id0Sch

🕳️
Digging
View GitHub Profile
@id0Sch
id0Sch / dynamo-util.js
Last active August 29, 2015 14:19
dynamodb-doc wrapper functions
/**
* Created by zeev manilovich and ido schachter on 4/16/15.
*/
var aws = require('aws-sdk'),
Promise = require('bluebird'),
logger = require("./logger"),
config = require('../../config'),
doc = require('dynamodb-doc');
/**
* Created by idoschachter on 5/25/15.
*/
var Promise = require('bluebird');
function promiseA(){
return new Promise.resolve('a');
}
self.dispatchInternal = function (queue, message) {
return self.connection.getQueue(queue)
.then(function (queue) {
return self.connection.sendMessageAsync({
MessageBody: JSON.stringify(message),
QueueUrl: queue.QueueUrl
});
})
.then(function (message) {
self.logger.debug(util.format("dispatched new event: %s, message Id: %s", queue, message.MessageId));
/**
* Created by idoschachter on 4/20/15.
*/
'use strict';
var Promise = require('bluebird');
// Helper methods
function promisify(err, data) {
return function() {
return new Promise(function(resolve, reject) {
/**
* This function compares between two version numbers formatted x.x.x...
* @param v1 - String
* @param v2 - String
* @returns {int}
* -1 if v1 is larger
* 1 if v2 is larger
* 0 if v1 & v2 are equal
*/
versionCompare: function (v1, v2) {
'use strict';
const _ = require('lodash');
const members = ['ido', 'hengli', 'shir', 'eran', 'elad', 'rachel', 'maayan.Ben', 'maayan.Bat', 'igor', 'tamar', 'tal'];
const n = 6;
var chunkedArr = _.chain(members).shuffle().chunk(n).value();
setTimeout(() => {
console.log('making sure Tiki is not with ido');
setTimeout(() => {
console.log('matching good looks to skill');
setTimeout(() => {
Math.random().toString(36).substr(2, 12)
@id0Sch
id0Sch / AsyncComponent.js
Last active September 7, 2017 11:22
AsyncComponent.js
import React, {Component} from 'react'
export default function AsyncComponent(getComponent) {
return class AsyncComponent extends Component {
static Component = null;
state = {Component: AsyncComponent.Component};
componentWillMount() {
if (!this.state.Component) {
getComponent().then(({default: Component}) => {

OpenFaas on Google Container Engine

Setting up faas-netes cli

TODO: add this step combine with https://github.com/openfaas/faas-netes/blob/master/HELM.md

gcloud container clusters get-credentials ${CLUSTER-NAME} --zone us-central1-a --project ${PROJECT-ID}
git clone https://github.com/openfaas/faas-netes
cd faas-netes