Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
import Cocoa | |
import Foundation | |
@discardableResult | |
func acquirePrivileges() -> Bool { | |
let accessEnabled = AXIsProcessTrustedWithOptions([kAXTrustedCheckOptionPrompt.takeUnretainedValue() as String: true] as CFDictionary) | |
if accessEnabled != true { | |
print("You need to enable the keylogger in the System Prefrences") |
<!DOCTYPE html><html><head><title></title> | |
<meta name="viewport" content="width=device-width, user-scalable=no"> | |
<meta charset="utf-8"></head><body> | |
<style> | |
@keyframes spin { | |
to { transform: rotate(-10turn); } | |
} | |
#product-logo.spin { | |
animation: spin 500ms cubic-bezier(1, 0, 0, 1) forwards; |
extension CollectionType where Index: BidirectionalIndexType { | |
func lastIndexOf(isElement: Generator.Element -> Bool) -> Index? { | |
return indices.reverse().filter { return isElement(self[$0]) }.first | |
} | |
} |
#include <stdio.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#include <Security/Security.h> | |
// Compile with: | |
// gcc -o ourpath -framework CoreFoundation -framework Security main.c |
import Cocoa | |
// for-in | |
func checkForIn(array: [Int], dict: [Int: String]) { | |
for num in array where dict[num] != nil { | |
num | |
} | |
} | |
checkForIn([1,2,3,4], dict: [1:"one", 2:"two"]) |
#!/usr/bin/env bash | |
# Reset routing table on OSX | |
# display current routing table | |
echo "********** BEFORE ****************************************" | |
netstat -r | |
echo "**********************************************************" | |
for i in {0..4}; do | |
sudo route -n flush # several times |
@interface BPImageView : NSImageView | |
@property SEL clickAction; | |
@end |