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$) => {
@nim23
nim23 / index.js
Created August 11, 2016 08:35
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
const pathToRegexp = require('path-to-regexp')
const re = pathToRegexp('/beta/search/:term*')
console.log(re)
const result = re.exec('/beta/search/1/')
@nim23
nim23 / index.js
Created August 10, 2016 15:55
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
const p = require('path-to-regexp')
console.log(p('/beta/search(?:([^\/]+?))', []))
'use strict'
let wallabify = require('wallabify')
let babelify = require('babelify')
let babel = require('babel')
let es6ToEs5Preprocessor = file => babel
.transform(file.content, {sourceMap: true, filename: file.path, stage: 2})
let wallabyPostProcessor = wallabify({
entryPatterns: ['./src/**/*.spec.js']
},
@nim23
nim23 / bookshelf_koa.js
Created May 30, 2015 19:17
Book shelf koa
'use strict';
const router = require('koa-router')();
const Projects = require('../collection/projects'); //Bookshelf collection/model
router
.get('/projects', function *() {
this.body = yield Projects.forge().fetch();
})
.post('/projects', function *() {
const project = this.request.body;
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.");