Required tools for playing around with memory:
hexdump
objdump
readelf
xxd
gcore
;; mu4e thread fast folding -*- lexical-binding: t; -*- | |
;; This file is not part of GNU Emacs. | |
;; | |
;; This program is free software: you can redistribute it and/or | |
;; modify it under the terms of the GNU General Public License as | |
;; published by the Free Software Foundation, either version 3 of the | |
;; License, or (at your option) any later version. | |
;; | |
;; This program is distributed in the hope that it will be useful, but |
// This is the code for the Flappy Bird game running in a Unix terminal. | |
// Demo: https://twitter.com/daniel_duan/status/1327735679657250816?s=21 | |
// To run it, simply do "swift bird.swift" in a Unix command line. | |
#if canImport(Darwin) | |
import Darwin | |
#else | |
import Glibc | |
#endif | |
enum RawModeError: Error { |
#!/bin/bash | |
set -e | |
_xcrun() { | |
DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer \ | |
xcrun -sdk iphonesimulator \ | |
"$@" | |
} |
description "Starts a SimpleHTTPServer to host 1 Password Anywhere" | |
author "Ivan De Marino <[email protected]>" | |
version "1.0.0" | |
# When to start/stop | |
start on runlevel [2345] | |
stop on runlevel [016] | |
# Keep it running | |
respawn |
static UIImage * UIImageForSwatchOfColorWithSize(UIColor *color, CGSize size) { | |
UIImage *image = nil; | |
CGRect rect = CGRectMake(0.0f, 0.0f, size.width, size.height); | |
UIGraphicsBeginImageContext(rect.size); | |
{ | |
CGContextRef c = UIGraphicsGetCurrentContext(); | |
CGContextSetFillColorWithColor(c, [color CGColor]); |
TLDR | |
If you want the simplest option just start /** [content] */ slashes in your header files. Do it before the @implementation for class comments and above methods for method documentation. | |
Doing this is the minimal for support in LLVM and Appledoc, which means you get CocoaDocs & XCode support. | |
Not TLDR | |
Good examples: | |
https://github.com/marcransome/MRBrew/blob/master/MRBrew/MRBrew.h | |
https://github.com/AFNetworking/AFNetworking/blob/master/AFNetworking/AFHTTPClient.h |
/*/../bin/ls > /dev/null | |
COMPILED=${0%.*} | |
clang $0 -o $COMPILED -framework Foundation; | |
$COMPILED; rm $COMPILED; exit; | |
*/ | |
#import <Foundation/Foundation.h> | |
int main(int argc, char *argv[]) |
CGRectDivide is handy for slicing up a rectangle.
Example of getting a slice and the remaining area of a rectange.
CGRect rect = CGRectMake(0, 0, 240, 150);
CGRect remainder, slice;
CGRectDivide(rect, &slice, &remainder, 120, CGRectMinYEdge);