Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Scheirman subdigital

View GitHub Profile
@subdigital
subdigital / camelCaseLines.js
Created Dec 1, 2021
Boop script that allows camelCase to work on lines
View camelCaseLines.js
/**
{
"api": 1,
"name": "Camel Case Lines",
"description": "Camel Case, but for each line",
"author": "Ben Scheirman",
"icon": "tortoise",
"tags": "camelCase"
}
**/
@subdigital
subdigital / radars.txt
Last active Jun 18, 2021
Xcode Vim Radars
View radars.txt
These are feedbacks I've filed against Xcode 13's Vim support. Please dupe!
Vim mode needs option to turn off audible bell - FB9136734
Vim mode needs option to disable/hide help bar - FB9138240
Vim mode needs CTRL+SHIFT+V columnar select mode - FB9138552
Vim mode missing macros for repeated text operations - FB9138595
Vim mode - support for plugins? - FB9138670
Vim mode - :w should save the file - FB9138695
Vim mode - shift-V doesn’t correctly select the first full line - FB9138796
Vim mode - Allow repeated editing operations with “.” - FB9154817
@subdigital
subdigital / largest_sequence.swift
Created Nov 30, 2016
Given a sorted array of ints, returns the largest consecutive streak contained.
View largest_sequence.swift
func largestSeq(values: [Int]) -> Int {
let initial: (current: Int, max: Int, prev: Int?) = (0, 0, nil)
let result = values.reduce(initial) { acc, el in
if acc.prev == nil {
return (1, 1, el)
}
let current = el - acc.prev! == 1 ? acc.current + 1 : 1
let newMax = max(current, acc.max)
return (current, newMax, el)
@subdigital
subdigital / minimal-vim.sh
Last active Aug 17, 2021
minimal vim setup for linux servers / vms + swift
View minimal-vim.sh
#! /bin/bash
set -e
if [[ -f ~/.vimrc ]]
then
echo "You already have a ~/.vimrc. Aborting to avoid losing data..."
exit 1
fi
View keybase.md

Keybase proof

I hereby claim:

  • I am subdigital on github.
  • I am subdigital (https://keybase.io/subdigital) on keybase.
  • I have a public key whose fingerprint is 21AB 9009 45D6 171D A19F 2B40 0654 48A1 4C7D AF2F

To claim this, I am signing this object:

@subdigital
subdigital / gist:5663295
Created May 28, 2013
Update github branch status from Jenkins
View gist:5663295
gcli status create DeliRadio deliradio-web $GIT_COMMIT \
--params=state:pending \
target_url:$BUILD_URL \
description:"Build #$BUILD_NUMBER is running" \
-f csv
# Your build...
gcli status create DeliRadio deliradio-web $GIT_COMMIT \
--params=state:success \
@subdigital
subdigital / xc
Created Apr 19, 2013
Open the first Xcode workspace or project found
View xc
xcode_proj=`find . -name "*.xc*" -d 1 | sort -r | head -1`
if [ `echo -n $xcode_proj | wc -m` == 0 ]
then
echo "No xcworkspace/xcodeproj file found in the current directory."
exit 1
fi
echo "Found $xcode_proj"
open $xcode_proj
@subdigital
subdigital / install_provisioning_profile.sh
Created Feb 27, 2013
Script to install provisioning profiles on a build server
View install_provisioning_profile.sh
#! /bin/sh
# Takes a provisioning profile and installs it into the system path.
# This requires poking inside the provisioning profile and searching for the
# UUID present at the end of the file.
set -e
if [[ -z "$1" ]]
then
@subdigital
subdigital / pns.m
Created Jan 5, 2013
What are your favorite Xcode Snippets? Add them in the comments.
View pns.m
// Property Nonatomic Strong
// Platform: All
// Completion Scopes: ClassInterfaceMethods
@property (nonatomic, strong) <# class_name #> *<# variable_name #>;
@subdigital
subdigital / convert_to_codesnippet.rb
Created Jan 5, 2013
Use this to convert snippets in plain .m files into the plist codesnippet format required by Xcode. Install the generated codesnippet files with the xcodenippet gem, by @lukeredpath. The format is assumes is pretty specific. The first comment line defines the title, and subsequent comment lines can define the Platform, Completion Scope(s), etc. …
View convert_to_codesnippet.rb
require 'rubygems'
require 'plist'
require 'securerandom'
# Plist format:
# <?xml version="1.0" encoding="UTF-8"?>
# <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
# <plist version="1.0">
# <dict>
# <key>IDECodeSnippetCompletionPrefix</key>