Skip to content

Instantly share code, notes, and snippets.

View leogdion's full-sized avatar

leogdion leogdion

View GitHub Profile
#!/bin/bash
DEST_REPO=$1
DEST_BRANCH=$2
MESSAGE=$(git log -1 HEAD --pretty=format:%s)
SOURCE_BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
git remote add destination $DEST_REPO
git fetch --all
git checkout -b destination-merging SOURCE_BRANCH
@leogdion
leogdion / gen-samples.swift
Last active April 20, 2020 14:51
Generate Samples for Speculid
#!/usr/bin/swift sh
import Foundation
import PromiseKit // @mxcl ~> 6.5
import ZIPFoundation // @weichsel ~> 0.9.0
// swiftlint:disable line_length
let appiconCompressed = "/Td6WFoAAAD/EtlBAgAhARYAAAB0L+Wj4A/PAildAD2IiScTleJp4I3wK/qYuY+Q19WElc6w3zOWoXmUZxfss8ijNG8Vq2i9AdIyvN9cU1rQmMdrXAC2orQ3kyyb0BJo8+Ro1epyzZhvRhZJfDJ4nzxJa466P+vtAVP6tpB0nD4+krz6y6a25Zci6vVgZIwVXy7c1I0lHOsY06z9m72gQyV/J8y39C/wW7hG3q06VyT0EFi2YcK5HQLiCGT2CAWvgv+9VS5nBs5TEAi17QOYk8U03t5kqKHxPRXDEa+tTQp8nVrak8zMZmRrAHQNx32X04rOYd14G5n4a9yLyO08hFNBnISIdzmc1icg0XGR217sTtcn+Q3Wb0J0gGFkq8E0EWW7FhLle3Gv7P2F4GyMwGFsGBhLxAZf4sYCl4GDII7pZxnzf3yN6YDmXnUYvRrJdQy68j8rsB6AyYVOZG1Y8jdl9TQrxZFo9wVR+yr2MvhXbfIIXyzHBn7aeLyoWMmdtEVUda+kNhiVJSjDyC7QLstG6DqqDBGTe71FK4+OnAma1tdU4jmajQ+KmniTgIlpjWLk7xahFHOnRtiG6xWnZImuAeQxt1z2VyNC2kD4hEnwVErnO+pjsh+fnovbPBE/FcPP5NMUkomNBq3H0E+ibppLd7rW0QTz88eaqZkz/GARIB1ES5IufHmezsC/+vK19iPRoKyHxBrgnTSnw351wNLLNk2TH1Kq4HaJQn0kJnj6XJhUhf6/8VewSBomM3OjOSck2FfidOwAAAAAAAG9BNAfAABiL6+hqAAK/AIAAAAAAFla"
let imageSetCompressed = "/Td6
@leogdion
leogdion / multiply.swift
Last active March 17, 2020 21:00
"Multiply" and Modify Sequences
func product<Multiplier, Factor>(
_ sequence: [Factor],
_ other: [Multiplier]
) -> [(Factor, Multiplier)] {
return other.flatMap { value in
sequence.map { element in
(element, value)
}
}
}
<html><head>
<script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-109657405-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-109657405-1');
</script>
<html>
<body>
<script type="application/json" id="episodes">
[
{
"title": "036. When to Quit",
"url": "/episodes/036-when-to-quit",
"tag": "prioritizing",
"tag__1": "reviews",
"tag__2": "",
awk '
/^(class|protocol|extension|struct|enum) ([a-zA-Z]+)/ {close(file); ++count; file=$2"."$1".swift"; print file; close file;}
file {print line > file}
{line=$0}
' RssReader.swift
@leogdion
leogdion / resume.md
Last active February 14, 2024 17:54
@leogdion
leogdion / .gitignore
Last active July 20, 2019 16:52
An example of turning podcast clip into a video clip for empowerapps.show
# Created by https://www.gitignore.io/api/macos
# Edit at https://www.gitignore.io/?templates=macos
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
public struct Tweet : Codable {
public let created_at : Date
public let id : Int
public let full_text : String
public let display_text_range : [Int]
public let entities : TweetEntities
public let source : String
public let in_reply_to_status_id : Int?
public let in_reply_to_user_id : Int?
public let in_reply_to_screen_name : String
@leogdion
leogdion / fix_dylibs.sh
Last active April 26, 2023 11:08
Fixing Dynamic Library References in Xcode Projects https://learningswift.brightdigit.com/?p=195
#!/bin/sh
FRAMEWORKS_FOLDER_PATH="`dirname $1`/Frameworks/"
LIBS=`otool -L "$1" | grep "/opt\|Cellar" | awk -F' ' '{ print $1 }'`
for lib in $LIBS; do
EXPECTED_PATH="`dirname $1`/Frameworks/`basename $lib`"
if [ ! -f $EXPECTED_PATH ]; then
IFS='.' read -ra FILENAME_COMPS <<< "`basename $lib`"
ACTUAL_PATH=`find $FRAMEWORKS_FOLDER_PATH -name "${FILENAME_COMPS[0]}*.*"`
install_name_tool -id @rpath/`basename $ACTUAL_PATH` "`dirname $1`/Frameworks/`basename $ACTUAL_PATH`"