Skip to content

Instantly share code, notes, and snippets.

Ido Shamun idoshamun

Block or report user

Report or block idoshamun

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@idoshamun
idoshamun / daily-cla.md
Created Jun 17, 2019
Daily's CLA based on Microsoft's CLA
View daily-cla.md

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”), and conveys certain license rights to The Elegant Monkeys Ltd. and its affiliates (“TEM”) for Your contributions to TEM open source projects. This Agreement is effective upon Your acknowledgment via the CLA Assistant tool. All prospective contributors to TEM open source projects must sign this Agreement (digitally or otherwise) before any changes will be merged.

1. Definitions.

“Code” means the computer software code, whether in human-readable or machine-executable form, that is delivered by You to TEM under this Agreement.

“Project” means any of the projects owned or managed by TEM in which software is offered under a license approved by the Open Source Initiative (OSI) (www.opensource.org) and/or documentation offered under an OSI or a Creative Commons license ([https://creativecommons.org/licenses](https://creativecommon

@idoshamun
idoshamun / sync.js
Created Oct 9, 2018
Optimistic Offline-First Apps With Vuex
View sync.js
const plugin = (store) => {
store.subscribe((mutation, state) => {
switch (mutation.type) {
case '...':
// dispatch request
break;
case '...':
// dispatch request
break;
default:
@idoshamun
idoshamun / loadState.js
Created Oct 8, 2018
Optimistic Offline-First Apps With Vuex
View loadState.js
import store from './store';
import { getState } from './storage';
export default function () {
if (store.initialized) {
return Promise.resolve();
}
return getState()
.then(state => store.commit('loadFromCache', state));
@idoshamun
idoshamun / store.js
Created Oct 8, 2018
Optimistic Offline-First Apps With Vuex
View store.js
import Vue from 'vue';
import Vuex from 'vuex';
import cache from './plugins/cache';
import sync from './plugins/sync';
Vue.use(Vuex);
export default new Vuex.Store({
state: {
@idoshamun
idoshamun / storage.js
Last active Jun 17, 2019
Optimistic Offline-First Apps With Vuex
View storage.js
import localForage from 'localforage';
const store = localForage.createInstance({
name: 'app',
});
const mapStateForCache = (state) => {
// Your business logic here
};
@idoshamun
idoshamun / cache.js
Last active Jun 17, 2019
Optimistic Offline-First Apps With Vuex
View cache.js
import { setState } from './storage';
const shouldSkipCache = (mutation) => {
// Your business logic here
};
const plugin = (store) => {
store.subscribe((mutation, state) => {
if (!shouldSkipCache(mutation)) {
setState(state).catch(err => console.warn('failed to cache state', err));
@idoshamun
idoshamun / Dockerfile
Created Nov 3, 2017
Dockerizing Scala Application
View Dockerfile
FROM openjdk:8-jre-alpine
RUN mkdir -p /opt/app
WORKDIR /opt/app
COPY ./run_jar.sh ./app-assembly.jar ./
ENTRYPOINT ["./run_jar.sh"]
@idoshamun
idoshamun / withBrowserStack.groovy
Created Aug 22, 2017
BrowserStack integration with Jenkins
View withBrowserStack.groovy
#!/usr/bin/env groovy
def call(body) {
lock(label: 'BrowserStack', quantity: 1) {
env.BROWSERSTACK_LOCAL_IDENTIFIER = env.BUILD_TAG
// Start the connection
sh "BUILD_ID=dontKillMe nohup /opt/BrowserStackLocal --force-local --only-automate --key ${env.BROWSERSTACK_ACCESSKEY} --local-identifier ${env.BROWSERSTACK_LOCAL_IDENTIFIER} > /var/tmp/browserstack.log 2>&1 & echo \$! > /var/tmp/browserstack.pid"
try {
body()
}
@idoshamun
idoshamun / icla.txt
Created Nov 10, 2016
The Elegant Monkeys Ltd. Individual Contributor License Agreement
View icla.txt
The Elegant Monkeys Ltd.
Individual Contributor License Agreement ("Agreement") V1.0
In order to clarify the intellectual property license granted with
Contributions from any person or entity,The Elegant Monkeys Ltd. ("TEM")
must have a Contributor License Agreement ("CLA") on file that has been
signed by each Contributor, indicating agreement to the license terms
below. This license is for your protection as a Contributor as well as
the protection of TEM; it does not change your rights to use your own
Contributions for any other purpose.
@idoshamun
idoshamun / deleteSubscriptions.js
Last active Jun 12, 2016
Delete all Google Pub/Sub subscriptions
View deleteSubscriptions.js
'use strict';
const async = require('async');
const gcloud = require('gcloud')();
const pubsub = gcloud.pubsub();
const callback = function (err, subscriptions, nextQuery) {
if (!err) {
async.forEach(subscriptions, (subscription, callback) => {
subscription.delete(callback);
You can’t perform that action at this time.