Skip to content

Instantly share code, notes, and snippets.

View jormungand's full-sized avatar

Ilya Stroganov jormungand

View GitHub Profile
@jormungand
jormungand / iOS 7 map inset adjust animated
Last active July 29, 2016 17:42
animates center movement correctly
- (IBAction)addInsets:(id)sender
{
[UIView animateWithDuration:0.3 animations:^{
self.topLayoutGuide.length = self.topLayoutGuide.length > 0.0 ? 0.0 : 100.0;
[self.map setNeedsLayout];
[self.map layoutIfNeeded];
[self.map setCenterCoordinate:self.map.userLocation.coordinate animated:YES];
@jormungand
jormungand / lockscreen-bootstrap.sh
Last active August 12, 2020 03:49
wrapper to build small utility which locks macOS screen from command line
#!/bin/bash
##
## usage: bash -c "$( curl -fsSL https://gist.githubusercontent.com/jormungand/5dc331551f3c34346509eb36b27012e6/raw/ )"
##
## credits: http://apple.stackexchange.com/a/123738, https://stackoverflow.com/a/26492632
##
_tmpdir="$( mktemp -d )"
@jormungand
jormungand / Pointer.swift
Created December 14, 2018 17:28
Printing <type: address> of literally any instance (objective-c and swift)
struct Pointer<T: Any>: CustomStringConvertible {
let address: UInt
let description: String
let debugDescription: String
init(to valueTypePtr: UnsafePointer<T>) {
address = UInt(bitPattern: valueTypePtr)
let pointee = valueTypePtr.pointee
description = "<\(type(of: pointee)): 0x\(address.hexString)>"