Skip to content

Instantly share code, notes, and snippets.

View alekseypotapov-dev's full-sized avatar

Aleksey Potapov alekseypotapov-dev

View GitHub Profile
@andrewgleave
andrewgleave / iOSMapKitFitAnnotations.m
Last active May 17, 2024 02:07
Zooms out a MKMapView to enclose all its annotations (inc. current location)
MKMapRect zoomRect = MKMapRectNull;
for (id <MKAnnotation> annotation in mapView.annotations) {
MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate);
MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0);
if (MKMapRectIsNull(zoomRect)) {
zoomRect = pointRect;
} else {
zoomRect = MKMapRectUnion(zoomRect, pointRect);
}
}
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@delebedev
delebedev / OHHTTPStubs+ShortBlocks.h
Created November 1, 2013 16:01
OHTTPStubs+ShortBlocks
void (^stubResponseWithHeaders)(NSString *, NSString *, NSDictionary *);
void (^stubResponse)(NSString *, NSString *);
void (^stubResponseWithStatusCode)(NSString *, int);
@pietbrauer
pietbrauer / Makefile
Created April 26, 2015 10:03
Shutdown and reset all iOS Simulators
erase_sim:
./reset_sim.sh 2>/dev/null; true
//
// Signal+Extensions.swift
// Khan Academy
//
// Created by Nacho Soto on 10/1/15.
// Copyright © 2015 Khan Academy. All rights reserved.
//
import ReactiveCocoa
/// Translation of [Peter Norvig's spell checker](http://norvig.com/spell-correct.html) into Swift 3.
/// Sample input corpus [here](http://norvig.com/big.txt)
/// Swift 2 version: https://gist.github.com/airspeedswift/6d8c9d95f0d812f58be3
import Foundation // purely for IO, most things done with Swift.String
/// Given a word, produce a set of possible alternatives with
/// letters transposed, deleted, replaced or rogue characters inserted
func edits(word: String) -> Set<String> {
if word.isEmpty { return [] }
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active July 21, 2024 05:06
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@miromannino
miromannino / README.md
Created May 16, 2020 19:13
Convert .mov or .mp4 to .gif

How to convert .mov or .mp4 to .gif using the command line

Requirements

brew install ffmpeg
brew install gifsicle

How to convert

@atomgomba
atomgomba / Polymaker PolyFlex 95A.ini
Last active July 8, 2024 16:10
Filament settings for Polymaker PolyFlex 95A (Prusa Slic3r)
# generated by PrusaSlicer 2.3.0+linux-x64 on 2021-01-29 at 10:18:59 UTC
bed_temperature = 50
bridge_fan_speed = 100
compatible_printers =
compatible_printers_condition = nozzle_diameter[0]>0.35 and printer_model!="MK2SMM" and printer_model!="MINI" and num_extruders==1 && ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and single_extruder_multi_material)
compatible_prints =
compatible_prints_condition =
cooling = 1
disable_fan_first_layers = 5
end_filament_gcode = "; Filament-specific end gcode"