Skip to content

Instantly share code, notes, and snippets.

View idoshamun's full-sized avatar

Ido Shamun idoshamun

View GitHub Profile
idoshamun /
Last active May 21, 2020 19:51
Daily's CLA based on Microsoft's CLA

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”), and conveys certain license rights to Ido Shamun and its affiliates (“Daily”) for Your contributions to Daily open source projects. This Agreement is effective upon Your acknowledgment via the CLA Assistant tool. All prospective contributors to Daily 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 Daily under this Agreement.

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

idoshamun / sync.js
Created October 9, 2018 06:14
Optimistic Offline-First Apps With Vuex
View sync.js
const plugin = (store) => {
store.subscribe((mutation, state) => {
switch (mutation.type) {
case '...':
// dispatch request
case '...':
// dispatch request
idoshamun / loadState.js
Created October 8, 2018 15:49
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 / store.js
Created October 8, 2018 15:42
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';
export default new Vuex.Store({
state: {
idoshamun / storage.js
Last active June 17, 2019 14:07
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 / cache.js
Last active June 17, 2019 14:18
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 / Dockerfile
Created November 3, 2017 07:39
Dockerizing Scala Application
View Dockerfile
FROM openjdk:8-jre-alpine
RUN mkdir -p /opt/app
WORKDIR /opt/app
COPY ./ ./app-assembly.jar ./
idoshamun / withBrowserStack.groovy
Created August 22, 2017 06:44
BrowserStack integration with Jenkins
View withBrowserStack.groovy
#!/usr/bin/env groovy
def call(body) {
lock(label: 'BrowserStack', quantity: 1) {
// 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/"
try {
idoshamun / icla.txt
Created November 10, 2016 17:30
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 / deleteSubscriptions.js
Last active June 12, 2016 12:52
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) => {