Skip to content

Instantly share code, notes, and snippets.

@jlyman
jlyman / modelMapper.js
Created Jan 20, 2018
Javascript ES6 API to model mapper functions
View modelMapper.js
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 Apr 4, 2016
Example of getting Mocha going with React Native
View .babelrc
{
"presets": ["react-native"]
}
@jlyman
jlyman / iOSSidePanResponder.js
Created Mar 31, 2016
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.
View iOSSidePanResponder.js
/**
* 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 Oct 21, 2015
Current version of codesigner script I'm trying to use to sign Electron apps for use on OS X (not MAS).
View electron-codesigner.sh
# 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"
View keybase.md

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:

View roll-your-own-logmein.md

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 Sep 26, 2012
MassTransit refusing to work with errored out messages are moved back to the regular queue.
View gist:3790668
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 Sep 5, 2012
MassTransit creating 6 copies of an errored out message with RabbitMQ
View gist:3644816
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MassTransit;
namespace JMMQConsoleApp
{
class Program
{