Skip to content

Instantly share code, notes, and snippets.

@jonathan-beebe
jonathan-beebe / git_snippets.md
Last active January 21, 2024 18:32
git snippets

Cleanup

Run this command periodically to clean loose objects and compress stuff.

git gc --aggressive

General

List all local branches sorted by last commit date, oldest last

@jonathan-beebe
jonathan-beebe / AppDelegate.swift
Last active November 1, 2023 19:11
Detect if a Swift iOS app delegate is running unit tests
import UIKit
// Detect if the app is running unit tests.
// Note this only detects unit tests, not UI tests.
func isRunningUnitTests() -> Bool {
let env = NSProcessInfo.processInfo().environment
if let injectBundle = env["XCInjectBundle"] {
return NSString(string: injectBundle).pathExtension == "xctest"
}
return false
@jonathan-beebe
jonathan-beebe / Facebook Friend Request via js
Created December 9, 2010 22:53
Using the Facebook Javascript API you can execute a friend request
FB.ui(
{
method: 'friends.add',
id: fbid // assuming you set this variable previously...
},
function(param){
console.log(param);
@jonathan-beebe
jonathan-beebe / main.dart
Last active March 23, 2023 20:22
Flutter Responsive Grid Layout
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@jonathan-beebe
jonathan-beebe / main.dart
Last active March 21, 2023 20:37
DartPad Playground
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'dart:math';
void main() => runApp(
ChangeNotifierProvider(
create: (_) => ThemeProvider(),
child: const MyApp(),
),
);
@jonathan-beebe
jonathan-beebe / Garmin Connect IQ Custom Drawable
Last active December 13, 2021 21:27
Garmin Connect IQ Custom Drawable
A sample of creating a custom drawable, both in xml and via code.
@jonathan-beebe
jonathan-beebe / vundle_swift_vim_instructions.md
Last active November 30, 2021 16:24
Using Apple’s Swift vim plugin with Vundle

Source of original vim config: https://github.com/apple/swift/tree/master/utils/vim

# use `svn checkout…` to grab just the subfolder from github
svn checkout https://github.com/apple/swift/trunk/utils/vim
# rename to something a bit more specific
mv vim vim-swift
cd vim-swift
rm -rf .svn
# init git
@jonathan-beebe
jonathan-beebe / README.md
Last active April 13, 2021 13:42
git: Find all merged ancestors branches and create commands to delete them.

To find all ancestor branches

./get_ancestor_branches.sh

To create the delete commands for all ancestor branches and echo them as text (not invoking them)

@jonathan-beebe
jonathan-beebe / negotiating used car from dealer.md
Last active January 8, 2021 06:10
Negotiating a cash purchase of used car from a dealer

Negotiating a used car purchase from a dealer

(assuming you are paying cash)

Preparation

  • Arm yourself with information.
    • Kelly blue book value. Helps inform what a reasonable price will be.
    • Black book value. Helps define the dealer’s bottom price, what they would acquire the car for in a trade-in.
  • Common car problems and their cost.

YYYY-MM-DD Spike Name

Purpose: Problem statement (try to avoid solution-ing here.)

IS

  • List of things that this is.

IS NOT