Skip to content

Instantly share code, notes, and snippets.

@nim23
nim23 / gist:7acf0119fa8db110e2b15a06fcaca112
Created June 30, 2018 13:45 — forked from mobmad/gist:433ba54e9cb97d6d7771
Create self-signed certificate for wiremock and configure a java client under test for HTTPS

1. Generate self-signed certificate

keytool -genkey -alias wiremock -keyalg RSA -keysize 1024 \
    -validity 365 -keypass password -keystore identity.jks -storepass password

Important: keypass must equal storepass, or else you'll receive java.io.IOException: !JsseListener: java.security.UnrecoverableKeyException: Cannot recover key

2. Start wiremock with the new keystore and HTTPS enabled

@nim23
nim23 / WaitForUI.js
Created October 24, 2017 04:27 — forked from tauqeerkhan12/WaitForUI.js
InteractionManager example
import React, { PureComponent } from 'react';
import { View, InteractionManager, StyleSheet, ActivityIndicator } from 'react-native';
import { colors } from 'globalStyles';
const styles = StyleSheet.create({
loaderContainer: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
@nim23
nim23 / icons.sh
Created January 25, 2017 20:18 — forked from tj/icons.sh
show_icons() {
defaults write com.apple.finder CreateDesktop true
killall Finder
}
hide_icons() {
defaults write com.apple.finder CreateDesktop false
killall Finder
}
@nim23
nim23 / introrx.md
Created January 23, 2017 11:21 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@nim23
nim23 / index.js
Created January 22, 2017 17:34 — forked from queckezz/index.js
react, recompose, xstream
import { componentFromStream, setObservableConfig } from 'recompose'
import xstreamConfig from 'recompose/xstreamObservableConfig'
import { h, p, div, h1, h2 } from 'react-hyperscript-helpers'
import { render } from 'react-dom'
import xs from 'xstream'
setObservableConfig(xstreamConfig)
const Users = componentFromStream((props$) => {
var page = new WebPage(),
address, output, size;
//capture and captureSelector functions adapted from CasperJS - https://github.com/n1k0/casperjs
capture = function(targetFile, clipRect) {
var previousClipRect;
var clipRect = {top: 0, left:0, width: 40, height: 40};
if (clipRect) {
if (!isType(clipRect, "object")) {
throw new Error("clipRect must be an Object instance.");
#import "MyCustomView.h"
@implementation MyCustomView
{
UIColor *squareColor;
}
- (void)setIsRed:(BOOL)isRed
{
squareColor= (isRed) ? [UIColor redColor] : [UIColor greenColor];
var React = require('react-native')
var {
ListView,
ActivityIndicatorIOS,
StyleSheet,
View,
Text,
} = React
// must be less than ~50px due to ScrollView bug (event only fires once)
// note there may be a better way to abuse flexbox than this :)
var React = require('react-native')
var { View, TextInput } = React
var BorderedInput = React.createClass({
getInitialState() {
return { i: 0 }
},