Skip to content

Instantly share code, notes, and snippets.

@jlyman
jlyman / modelMapper.js
Created January 20, 2018 04:56
Javascript ES6 API to model mapper functions
import assign from 'lodash/assign';
/**
* Converts one type of object to another, in this case to/from our Models to
* plain API response objects.
* @param {object} sourceObj The source object, either a Model or a plain API response object
* @param {array} mapping An array of arrays, the inner arrays containing key mappings between objects.
* Inner array format can be either ['modelPropertyKey', ['apiPropertyKey'] or
* ['modelPropertyKey', apiToModelTransformer(), modelToApiTransformer()]
* @param {bool} isMappingModelToApi True if we are taking a Model object an
@jlyman
jlyman / .babelrc
Last active April 4, 2016 15:03
Example of getting Mocha going with React Native
{
"presets": ["react-native"]
}
@jlyman
jlyman / iOSSidePanResponder.js
Created March 31, 2016 21:28
A very slightly-modified version of the React Native LinearPanResponder that only responds to swipes that originate in the leftmost 10% of the screen (as opposed to anywhere on the screen). This follows default iOS behavior more closely, and removes conflicts with other right-direction gestures on the screen.
/**
* A near straight copy of the default NavigationLinearPanResponder,
* but restricts the recognition of the gesture to coming from just the
* side of the screen, as iOS does by default
*
* @providesModule iOSSidePanResponder
* @flow
* @typechecks
*/
const Animated = require('Animated')
@jlyman
jlyman / electron-codesigner.sh
Created October 21, 2015 16:21
Current version of codesigner script I'm trying to use to sign Electron apps for use on OS X (not MAS).
# Invoke this script with a relative `.app` path
# EX:
# codesign.sh "dist/osx/MyApp-darwin-x64/MyApp.app"
# I had better luck using the iPhoneOS codesign_allocate
export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate"
#export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate"
# Next two are specified in Apple docs:
# export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate"

Keybase proof

I hereby claim:

  • I am jlyman on github.
  • I am jlyman (https://keybase.io/jlyman) on keybase.
  • I have a public key whose fingerprint is 781B 049D 725E 25DC 4023 FC46 D243 7CE2 FFE0 4A5D

To claim this, I am signing this object:

@jlyman
jlyman / roll-your-own-logmein.md
Created January 24, 2014 21:02
Roll your own LogMeIn

Creating your own, personal LogMeIn like network.

Requirements:

  • Cross-platform server component (view Windows/Mac/*nix desktops)
  • Cross-platform or browser-based viewing client
  • Unattended access (no need to accept incoming connections)

Components:

  • VNC or some variant of it for both client and server components
  • Something for NAT traversal?
@jlyman
jlyman / gist:3790668
Created September 26, 2012 21:23
MassTransit refusing to work with errored out messages are moved back to the regular queue.
class Program
{
public class YourMessage { public string Text { get; set; } }
static void Main(string[] args)
{
string newMessageId = "";
Bus.Initialize(sbc =>
{
@jlyman
jlyman / gist:3644816
Created September 5, 2012 21:10
MassTransit creating 6 copies of an errored out message with RabbitMQ
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MassTransit;
namespace JMMQConsoleApp
{
class Program
{