Skip to content

Instantly share code, notes, and snippets.

Avatar

Julian Krispel-Samsel juliankrispel

View GitHub Profile
View anything
MyOtherVariable = 39km
@juliankrispel
juliankrispel / lambda.webpack.config.js
Created Sep 28, 2020
Simple Webpack for compiling Typescript Lambda deployment packages
View lambda.webpack.config.js
const path = require('path');
const { readdirSync } = require('fs');
const exec = require('child_process').execSync;
const dir = 'src'
const entry = readdirSync(dir)
.filter(item => /\.(t|j)s$/.test(item))
.filter(item => !/\.d\.(t|j)s$/.test(item))
.reduce((acc, fileName) => ({
...acc,
@juliankrispel
juliankrispel / aws-lambda-api-gateway.tf
Last active Sep 17, 2019
Terraform config for basic lambda and api gateway integration
View aws-lambda-api-gateway.tf
provider "aws" {
region = "eu-west-1"
profile = "my-profile"
}
resource "aws_iam_role" "iam_for_lambda" {
name = "iam_for_lambda"
assume_role_policy = <<EOF
{
View gist:5dcd61a91f5d3072289022977f565faf
import { EditorState, Modifier } from 'draft-js';
import { TAB_CHARACTER } from './CONSTANTS';
const changeIndent = (editorState, isDedent) => {
const selection = editorState.getSelection();
const contentState = editorState.getCurrentContent();
let blockMap = contentState.getBlockMap();
const blockKeys = blockMap.keySeq();
const selectionStartKey = selection.getStartKey();
const selectionEndKey = selection.getEndKey();
@juliankrispel
juliankrispel / ClientRect.jsx
Created Oct 18, 2018
Simple Render Prop component to poll element measurements
View ClientRect.jsx
import React, { PureComponent } from 'react'
/*
* PollBounds
* render with referenced element measurements
* @param measureRef: React.Ref
* @param pollTime: number - polling time for polling client rect
* @param children({ bounds })
*/
View render-observable.jsx
<RenderObservable
observable={interval(2000).pipe(startWith(0))}
>
{({ value, value$ }) => <div>
<Number>Value of {value}</Number>
<RenderObservable
observable={value$ && merge(value$, interval(300))}
>
{({ value }) => <Number>Value of {value}</Number>}
</RenderObservable>
@juliankrispel
juliankrispel / react-rxjs.js
Created Jun 19, 2018
Extremely basic way of rendering observables as components
View react-rxjs.js
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import { interval } from 'rxjs'
class RenderObservable extends Component {
state = {
value: null
}
@juliankrispel
juliankrispel / index.js
Created Nov 8, 2017
TSB Statement crawler
View index.js
/* Configure these parameters to crawl for your statements */
const userId = '<your-user-id>';
const password = '<your-password>';
const secret = '<your-secret>';
const dateStringUntil = '<date>';
const Nightmare = require('nightmare');
const nightmare = Nightmare({ show: true });
const createCsvWriter = require('csv-writer').createObjectCsvWriter;
@juliankrispel
juliankrispel / djsp-mentions-example.jsx
Last active Oct 3, 2017
Pseudo-code Example for a mention plugin implementation with a new draft js plugins api.
View djsp-mentions-example.jsx
import React, { Component } from 'react';
import { EditorState } from 'draft-js-plugins';
import Editor from 'djsp.editor';
import autocompletePlugin from 'djsp.autocomplete';
import selectionPositionPlugin from 'djsp.selection-position';
import entityDecoratorPlugin from 'djsp.entity-decorator';
import Popover from 'djsp.popover';
import ListBox from 'djsp.listbox';
import addEntity from 'djsp.add-entity';
View git_dreamhost_deploy.sh
#!/bin/sh
#
# This hook does two things:
#
# 1. update the "info" files that allow the list of references to be
# queries over dumb transports such as http
#
# 2. if this repository looks like it is a non-bare repository, and
# the checked-out branch is pushed to, then update the working copy.
# This makes "push" function somewhat similarly to darcs and bzr.