Skip to content

Instantly share code, notes, and snippets.

View probablycorey's full-sized avatar
👯‍♂️
Dancing with my twin

Corey Johnson probablycorey

👯‍♂️
Dancing with my twin
View GitHub Profile

hello..

Tables Are Cool
col 1 is left-aligned $1600
col 2 is centered $12
col 3 is right-aligned $1
@probablycorey
probablycorey / log.txt
Created June 11, 2019 22:27 — forked from pifafu/log.txt
Build log
carthage update --no-use-binaries --no-build
*** Fetching PINOperation
*** Checking out PINCache at "3.0.1-beta.8"
*** Checking out PINOperation at "1.1.2"
carthage build --no-skip-current
*** xcodebuild output can be found in /var/folders/6h/ql1brcjx3936vr5vwgblbnc80000rm/T/carthage-xcodebuild.tCygxC.log
*** Downloading PINOperation.framework binary at "Modernize PINOperation"
*** Downloading PINCache.framework binary at "Modernization"
*** Building scheme "PINRemoteImage-tvOS" in PINRemoteImage.xcodeproj
*** Building scheme "PINRemoteImage" in PINRemoteImage.xcodeproj

wow .

Hello

This is a thing

# Extract the unique routes from the data with their start and end coordinates
maps = df[['Route Id', 'Station Id From', 'Lat From', 'Lon From', 'Station Id To', 'Lat To', 'Lon To']].drop_duplicates()
maps['Distance'] = maps.apply(lambda x: distance.distance((x['Lat From'], x['Lon From']), (x['Lat To'], x['Lon To'])).km * 1000, axis=1)
# Merge the distance calculation with the main DataFrame
df = df.merge(maps[['Route Id', 'Distance']], how='left', on='Route Id')
df = df[[x for x in df.columns if not 'From' in x and not 'To' in x and x != 'Route Id']]
@probablycorey
probablycorey / woman.sh
Last active November 10, 2016 02:50
Bash function that enhances the `man` command
# Add this to your .bashrc or .zshrc file for a modern and sophisticated
# alternative to `man`.
function woman() {
man -t $1 | open -f -a /Applications/Preview.app
}
@probablycorey
probablycorey / wow.rb
Created September 23, 2016 23:07
Better date parsing
def parse_date_range(options)
from = Time.zone.parse(options[:from]) rescue ArgumentError
to = Time.zone.parse(options[:to]) rescue ArgumentError
to ||= from.try?(:next_day) || Date.current
from ||= to.begining_of_month
time_range = from..to
days_in_range = (to - from).to_i
to = from + MAX_DAY_RANGE.days if days_in_range > MAX_DAY_RANGE
#!/bin/sh
set -e
BRANCH=$(git branch | sed -n '/\* /s///p')
git branch --set-upstream-to=origin/$BRANCH $BRANCH
#!/bin/bash
set -e
cd "$(dirname $0)/.."
DIST_PATH=dist
APP_NAME=Toolbelt
APP_PATH="$DIST_PATH/$APP_NAME.app"
BACKGROUND_PNG=app/assets/install.tiff
@probablycorey
probablycorey / i-do-not-know.rb
Created January 9, 2015 17:34
How do I unstage a staged deletion?
# Assume my-file.txt has been commited previously
repo = Rugged::Repository.discover(some_dir)
File.delete("my-file.txt")
# This will stage the file deletion
repo.index.remove("my-file.txt") # This doesn't work
repo.index.write
# How do I "unstage" this deletion?
repo.index.add("my-file.txt") # This doesn't work... what will?
@probablycorey
probablycorey / nodegit-bug.js
Created October 13, 2014 21:38
Nodegit bug
var git = require('nodegit');
var repo = null;
var repoPath = process.argv[2]
if(!repoPath) {
console.log("Usage: node nodegit-bug.js PATH_GIT_REPO")
process.exit(1)
}
git.Repository.open(repoPath)