Skip to content

Instantly share code, notes, and snippets.

View kwcto's full-sized avatar

Will Sahatdjian kwcto

View GitHub Profile
@marshallswain
marshallswain / example-usage.js
Last active May 17, 2022 00:34
A FeathersJS hook to implement `findOrCreate`
const findOrCreate = require('./hook.find-or-create.js')
app.service('messages').hooks({
before: {
create: [findOrCreate()]
}
})
@btroncone
btroncone / rxjs_operators_by_example.md
Last active March 30, 2025 21:26
RxJS 5 Operators By Example
@ekryski
ekryski / react-native.js
Last active April 11, 2017 06:37
Feathers React Native Configuration
import { AsyncStorage } from 'react-native';
import feathers from 'feathers/client'
import hooks from 'feathers-hooks';
import socketio from 'feathers-socketio/client'
import authentication from 'feathers-authentication-client';
if(!global._babelPolyfill) { require('babel-polyfill'); }
// Need to require instead of import so we can set the user agent first
const io = require('socket.io-client/socket.io');
@ekryski
ekryski / app.js
Last active February 19, 2019 20:20
How to use socket.io in React Native
// You need to set `window.navigator` to something in order to use the socket.io
// client. You have to do it like this in order to use the debugger because the
// debugger in React Native runs in a webworker and only has a getter method for
// `window.navigator`.
window.navigator.userAgent = 'ReactNative';
// Need to require instead of import so we can set the user agent first
// This must be below your `window.navigator` hack above
const io = require('socket.io-client/socket.io');
const socket = io('http://chat.feathersjs.com', {
@Jpoliachik
Jpoliachik / index.ios.js
Last active August 17, 2021 10:27
ReactNative LayoutAnimation Example
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';
@errordeveloper
errordeveloper / Swarm.md
Last active March 27, 2021 15:03
A quick guide to using Weave Net with Docker Swarm

Weave Net and Docker Swarm

This example show how-to setup a very simple Swarm cluster enabled with Weave Net.

## Infratructure

There are two hosts that have a recent version of Docker Engine running.

These hosts are named host1 and host2, and might have the following in /etc/hosts or you just substitute IP addresses in the commands shown below.

{
"id": "marathon-lb-autoscale",
"args":[
"--marathon", "http://leader.mesos:8080",
"--haproxy", "http://marathon-lb.marathon.mesos:9090",
"--target-rps", "100",
"--apps", "nginx_10000"
],
"cpus": 0.1,
"mem": 16.0,
@goldenice
goldenice / example.js
Last active November 14, 2015 08:38
Generic self contained 'concurrent' worker in javascript
var request = require('request');
var genericMultiWorker = require('./genericmultiworker.js');
var TARGET_URL = 'http://example.com/';
// Example: POSTing to a URL with a maximum of 5 concurrent requests
var addToWorker = genericMultiWorker(5, function(obj, callback) {
request.post(TARGET_URL, obj, callback);
});
@jmreidy
jmreidy / test_mocha.opts
Last active January 9, 2018 11:49
Unit test React Native with Mocha
--compilers js:./test/support/compiler
--require ./test/support/init
@valvoline
valvoline / gist:88d4b1b2489854856ba9
Created October 9, 2015 08:57
Simple UIApplication Debugger for handleNonLaunchSpecificActions related bug
//
// UIApplication+Debug.m
//
// Created by valvoline on 09/10/15.
// Copyright © 2015 ISALabs. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIApplication (Debug)