Skip to content

Instantly share code, notes, and snippets.

@alex-sherwin
alex-sherwin / ScrollableView.swift
Created June 14, 2021 01:21 — forked from jfuellert/ScrollableView.swift
A scrollable SwiftUI view, UIScrollView wrapper. ScrollableView lets you read and write content offsets for scrollview in SwiftUI, with and without animations.
import SwiftUI
struct ScrollableView<Content: View>: UIViewControllerRepresentable, Equatable {
// MARK: - Coordinator
final class Coordinator: NSObject, UIScrollViewDelegate {
// MARK: - Properties
private let scrollView: UIScrollView
var offset: Binding<CGPoint>
@alex-sherwin
alex-sherwin / psql_statement_timeout_single_statement.sh
Last active September 12, 2017 16:41
Execute postgresql psql with a single statement while setting statement_timeout
#!/bin/bash
# This is useful because when executing psql via "docker exec" because it can be quite painful to try and pipe in a
# multi-command statement, where -c only supports a single statement but is simpler to script inside a "docker exec"
# This example fully captures all stdout/stderr as well for logging purposes
# Note the -d/--dbname option supports connection strings from libpq
# see https://www.postgresql.org/message-id/577A8BBE.7010908%40mysoftforge.com
@alex-sherwin
alex-sherwin / asciinema-to-scriptreplay
Created March 15, 2017 01:16 — forked from izabera/gist:223f58d20be61911e62b
convert between asciinema and scriptreplay
#!/bin/bash
exec {times}> times {typescript}> typescript < "${1-/dev/stdin}"
while read -r; do [[ $REPLY = ' "stdout": [' ]] && break; done # skip to this line
LANG=C
printf "Script started on %(%c)T\n" -1 >&"$typescript" # dummy
while read -r open; [[ $open = '[' ]]; do
read -r elapsed; read -r string; read -r close
eval printf %b%n "$string" characters >&"$typescript" # put count in $characters
printf "%s %s\n" "${elapsed%,}" "$characters" >&"$times"
done
package varnames;
/**
* Characters you can use in java identifiers... for good practice...
*/
public class VarNames {
public static void main(String[] args) throws Exception {
for (int i = Character.MIN_CODE_POINT; i <= Character.MAX_CODE_POINT; i++)
if (Character.isJavaIdentifierPart(i) && !Character.isAlphabetic(i))
Version: 1.4.5
Service: router
Protocol: weave 1..2
Name: ea:fd:8a:bb:5e:7a(devenv-alex)
Encryption: disabled
PeerDiscovery: enabled
Targets: 1
Connections: 1 (1 failed)
Peers: 1

Cornerstone does not yet officially support Kaleidoscope 2, so to work with the latest beta of Kaleidoscope 2 (Build 99 and up) here is how to get set up:

Follow the instructions here Cornerstone External Compare Tools under the heading Custom Compare Scripts

The custom scripts contents should be

#!/usr/bin/env bash

/usr/local/bin/ksdiff --partial-changeset -- "$1" "$2"
@alex-sherwin
alex-sherwin / idea.vmoptions
Created August 8, 2014 02:31
idea.vmoptions OS X
-Xms64m
-Xmx512m
-XX:ReservedCodeCacheSize=128m
-XX:+UseCompressedOops
-XX:+UnlockExperimentalVMOptions
-XX:+UseConcMarkSweepGC
-XX:+AggressiveOpts
-XX:+UseAdaptiveGCBoundary
-XX:+UseSplitVerifier
-XX:CompileThreshold=10000
@alex-sherwin
alex-sherwin / idea64.exe.vmoptions
Created July 10, 2014 18:06
idea64.exe.vmoptions
-ea
-server
-Xms128m
-Xmx1024m
-Xss16m
-XX:ReservedCodeCacheSize=256m
-XX:+DoEscapeAnalysis
-XX:+UseCompressedOops
-XX:+UnlockExperimentalVMOptions
-XX:+UseConcMarkSweepGC
@alex-sherwin
alex-sherwin / gist:9642535
Created March 19, 2014 14:18
IntelliJ IDEA .vmoptions
-ea
-server
-Xms394m
-Xmx1024m
-Xss16m
-XX:PermSize=350m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=256m
-XX:+DoEscapeAnalysis
-XX:+UseCompressedOops
@alex-sherwin
alex-sherwin / ExtJS_4_1_2.sublime-completions
Created October 16, 2012 17:01
Sublime Text 2 ExtJS Completions
{
"scope": "source.js -string -comment -constant",
"completions": [
{ "trigger": "customtrigger.allowBlank\tBoolean", "contents": "allowBlank: $1${2:,}" },
{ "trigger": "customtrigger.allowOnlyWhitespace\tBoolean", "contents": "allowOnlyWhitespace: $1${2:,}" },
{ "trigger": "customtrigger.blankText\tString", "contents": "blankText: '$1'${2:,}" },
{ "trigger": "customtrigger.checkChangeBuffer\tNumber", "contents": "checkChangeBuffer: $1${2:,}" },
{ "trigger": "customtrigger.checkChangeEvents\tString[]", "contents": "checkChangeEvents: ['$1']${2:,}" },
{ "trigger": "customtrigger.dirtyCls\tString", "contents": "dirtyCls: '$1'${2:,}" },