Skip to content

Instantly share code, notes, and snippets.

View marcolabreu's full-sized avatar

Marco L. Abreu marcolabreu

View GitHub Profile
@marcolabreu
marcolabreu / Duplicate_Lines_in_Xcode_Keybinding.md
Last active July 21, 2020 08:39 — forked from emotality/duplicate_line_xcode.md
Xcode - Duplicate Line key binding

Key binding to duplicate lines in Xcode 11

Many posts and solutions add 3 different commands to IDETextKeyBindingSet.plist, but only Duplicate Lines is currently required.

  1. Delete Line already exists in Xcode 11, just add a keybind to it.
  2. Duplicate Current Line is not necessary because the solution bellow works correctly if the cursor is in a line or if multiple lines are selected. In both cases, it has some benefits over commands found in older posts: the clipboard is not touched, and a single undo reverts the change.

Steps

  1. Open below directory in Finder with Cmnd + Shift + G
@marcolabreu
marcolabreu / IDETextKeyBindingSet.plist
Last active July 21, 2020 08:08
Add line duplication to Xcode key bindings located at /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Lots of code already there -->
<!-- Add the following key and dict after installing or updating Xcode -->
<key>Duplication</key>
<dict>
@marcolabreu
marcolabreu / apple-receipt-firebase-validator.ts
Last active January 6, 2023 12:29
Firebase function to validate Apple receipts
import {https} from 'firebase-functions';
import bent = require("bent");
/*
* Docs
* https://firebase.google.com/docs/functions/typescript
* https://developer.apple.com/documentation/appstorereceipts/verifyreceipt
*/
/*

Keybase proof

I hereby claim:

  • I am marcolabreu on github.
  • I am marcoabreu (https://keybase.io/marcoabreu) on keybase.
  • I have a public key ASDLTGGUgyN33htcQzA9tktwjM4mZPFDjN0gD8bMB3LMZQo

To claim this, I am signing this object:

@marcolabreu
marcolabreu / dir_file_count.sh
Last active April 14, 2017 11:53
Reports the total file count for all directories in the current directory
#! /bin/sh
for dir in $(find . -maxdepth 1 -type d); do
echo "${dir}: $(find ${dir} -type f | wc -l)"
done