Skip to content

Instantly share code, notes, and snippets.

FILES="./*.md"
for f in $FILES
do
#echo "Processing $f file to '${f/\.md/.mediawiki}'"
pandoc -f markdown_mmd "$f" -t mediawiki -o "${f/\.md/.mediawiki}"
done
@atomoil
atomoil / gist:1fbd9ac806b3f81fb425a9357509a3e0
Created November 19, 2020 00:07
tinkercad-shapes-to-markdown.js
"* Page "+document.querySelector(".item.active").innerText+"\n"+(Array.from(document.querySelectorAll(".sidebar-item")).map( item => " - " + item.querySelector(".item-name").innerText + "\n - <img src='" + item.querySelector(".item-icon img").src + "'>").join("\n"))
extension CGPoint {
func midBetween(_ other: CGPoint) -> CGPoint {
return CGPoint(x: (self.x + other.x) / 2.0,
y: (self.y + other.y) / 2.0)
}
func perpedicularTo(_ other: CGPoint, distance: CGFloat) -> (CGPoint, CGPoint) {
// Vector from p to p1;
var diff = CGPoint(x: other.x - self.x, y: other.y - self.y);
@atomoil
atomoil / show_commit_name.yaml
Last active March 19, 2020 18:32
Show the commit name in a Github Action
jobs:
jazzy:
runs-on: ubuntu-latest
steps:
- name: Get the version
id: commit_name
run: echo ::set-output name=NAME::${GITHUB_REF#refs/*/}
- name: Echo commit name
run: echo ref is ${{ steps.commit_name.outputs.NAME }}
extension UserDefaults {
static func syncSettingsBundle() {
if let bundlePath = Bundle.main.path(forResource: "Settings", ofType: "bundle"),
let plistPath = URL(string: bundlePath)?.appendingPathComponent("Root.plist").absoluteString {
let defaultDefaults = UserDefaults.defaultsForPlist(path: plistPath, defaults: [:])
UserDefaults.standard.register(defaults: defaultDefaults)
}
}
@atomoil
atomoil / compare-branches.sh
Created July 20, 2018 10:59
Comparing Localizable Strings in diff branches with sorting
diff -uwB <(git show origin/branch:path/to/en.lproj/Localizable.strings | sort | sed -n 's/"\(.*\)" =.*/\1/p') <(git show develop:path/to/en.lproj/Localizable.strings | sort | sed -n 's/"\(.*\)" =.*/\1/p')
@atomoil
atomoil / find-tasks-in-epic.jql
Last active May 25, 2018 10:56
JQL query to get all open tasks / sub tasks in an EPIC
("Epic Link" in ("SMLS-676") OR parentEpic in ("SMLS-676")) AND status in (Backlog, "In Progress", "Selected for Development")
/**
// Example:
// dictionary will be a dictionary with keys for every unique value of object.propertyToGroupBy
// the value of each being an array of objects
var dictionary = arrayOfObjects.group { $0.propertyToGroupBy }
// dictionary will be a dictionary with 2 keys 'Important' and 'Other' each containing an array of ItemType objects
var dictionary = arrayOfObjects.group { (item:ItemType) -> String in
if item.differentPropertyToGroupBy == "some value" {
return "Important"
@atomoil
atomoil / gist:4649523
Created January 27, 2013 18:15
iOS - Find all of the fonts available to an app, and more usefully the name that objective-c references them with.
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
fontNames = [[NSArray alloc] initWithArray:
[UIFont fontNamesForFamilyName: