Skip to content

Instantly share code, notes, and snippets.

View unnamedd's full-sized avatar
🇺🇦
#StandWithUkraine

Thiago Holanda unnamedd

🇺🇦
#StandWithUkraine
View GitHub Profile
@unnamedd
unnamedd / TextFieldTyped.swift
Last active October 9, 2022 21:05
[SwiftUI] Wrapping a UITextField into SwiftUI to use different keyboards, e.g: UIKeyboardType.twitter, UIKeyboardType.numbersAndPunctuation
// Created by Thiago Holanda on 22.06.19.
// twitter.com/tholanda
import SwiftUI
struct ContainerView: View {
@State var decimal = ""
@State var twitter = ""
@State var url = ""
@State var search = ""
@unnamedd
unnamedd / ReplaceChar.swift
Created August 22, 2016 06:41
NSTextAttachment
// MARK: - String Extension
private extension String {
/**
replace characters from the original text to some image
- parameter character: the character that will be used to be replaced by image
- parameter image: image name that will replace the character
*/
func replace(char character: String, image: String) -> NSAttributedString {
@unnamedd
unnamedd / ANSI.md
Created March 8, 2021 22:16 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1b
  • Decimal: 27
@unnamedd
unnamedd / RemoveAccents.m
Last active January 18, 2021 23:51
Remove accents from words using Objective-C
#import <Foundation/Foundation.h>
int main(int argc, char *argv[]) {
@autoreleasepool {
NSString *start = @"CéuÁbÊrtação";
NSData *stringAsciiEncoded = [start dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *simpleString = [[NSString alloc] initWithData:asciiEncoded encoding:NSASCIIStringEncoding];
NSLog(@"Valor: %@", simpleString);
}
@unnamedd
unnamedd / apns.sh
Last active October 28, 2020 10:12 — forked from greencoder/apns.sh
cURL the APNS HTTP/2 API
# Note: You MUST have curl 7.47+ with http/2 support compiled in
curl -v \
-d '{"aps":{"alert":"<message>","badge":42}}' \
-H "apns-topic: <bundle id>" \
-H "apns-priority: 10" \
--http2 \
--cert <certificate file> \
https://api.development.push.apple.com/3/device/<device token>

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r <session_name>
@unnamedd
unnamedd / PreviewDevice+ListOfPads.swift
Created April 25, 2020 18:19
A small extension for PreviewDevice to avoid enter the values in the SwiftUI previews manually
/**
* PreviewDevice+ListOfPads.swift
* Copyright (c) Thiago Holanda 2020
* https://twitter.com/tholanda
*
* MIT license
*/
import SwiftUI
@unnamedd
unnamedd / .screenrc
Created September 7, 2020 19:35 — forked from joaopizani/.screenrc
A killer GNU Screen Config
# the following two lines give a two-line status, with the current window highlighted
hardstatus alwayslastline
hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]'
# huge scrollback buffer
defscrollback 5000
# no welcome message
startup_message off
@unnamedd
unnamedd / MyService.swift
Created August 8, 2019 13:27 — forked from mminer/MyService.swift
Components of XPC service.
import Foundation
class MyService: NSObject, MyServiceProtocol {
func upperCaseString(_ string: String, withReply reply: @escaping (String) -> Void) {
let response = string.uppercased()
reply(response)
}
}
Byobu is a suite of enhancements to tmux, as a command line
tool providing live system status, dynamic window management,
and some convenient keybindings:
F1 * Used by X11 *
Shift-F1 Display this help
F2 Create a new window
Shift-F2 Create a horizontal split
Ctrl-F2 Create a vertical split
Ctrl-Shift-F2 Create a new session