Skip to content

Instantly share code, notes, and snippets.

View GeekTree0101's full-sized avatar
💰

David Ha (小河) GeekTree0101

💰
View GitHub Profile
@timols
timols / ruby_haversine.rb
Created March 29, 2013 01:15
Ruby implementation of the haversine distance formula
##
# Haversine Distance Calculation
#
# Accepts two coordinates in the form
# of a tuple. I.e.
# geo_a Array(Num, Num)
# geo_b Array(Num, Num)
# miles Boolean
#
# Returns the distance between these two
@ericcj
ericcj / UIView+TLLayout.h
Created August 29, 2013 13:15
crazy that hiding a uiview doesn't affect its autolayout constraints. here's a category for the rest of the world who uses dynamic interfaces
#import <UIKit/UIKit.h>
@interface UIView (TLLayout)
@property (nonatomic, strong) NSArray *hiddenConstraints;
// set hidden and remove any constraints involving this view from its superview
- (void)hideAndRemoveConstraints;
- (void)showAndRestoreConstraints;
@nacyot
nacyot / 2013-03-04-ruby-trivias-you-should-know-4.md
Last active April 17, 2024 05:01
알아두면 도움이 되는 55가지 루비 기법
@fahied
fahied / accessibilityTableCell
Last active March 13, 2020 03:23
Set Accessibility to custom UITableViewCell
In Voice-Over , in order to make an element accessible :-
1. you have to set setIsAccessibilityElement property as true which i don't find in your code.
2; The other important point is that to make child elements (subviews) to be accessible , you have to seperately make them accessible while the parent should not be accessible(you have to specify this also).
Implement the UIAccessibilityContainer Protocol in your custom - cell.
NSString *title = titleofcell;
cell.accessibilityValue = title;
cell.accessibilityLabel = [NSString stringWithFormat:@"item %ld", (long)indexPath.row];
cell.accessibilityTraits = UIAccessibilityTraitButton;
@eoghain
eoghain / CustomInteractiveAnimationNavigationController.swift
Last active September 21, 2023 07:33
UINavigationController that implements swipe to push/pop in an interactive animation. Just implement the InteractiveNavigation protocol on your ViewControllers you add to the nav stack to get custom transitions. Or implement a single animation and return it instead of the nil's in the UIViewControllerTransitioningDelegate and all transitions wil…
import UIKit
protocol InteractiveNavigation {
var presentAnimation: UIViewControllerAnimatedTransitioning? { get }
var dismissAnimation: UIViewControllerAnimatedTransitioning? { get }
func showNext()
}
enum SwipeDirection: CGFloat, CustomStringConvertible {
@liddack
liddack / app.js
Last active November 1, 2020 10:31
Crowdin Source Update String Notifier for Discord Project
// Loading logger module
const log = require('fancy-log')
log.info('Loading...')
// Loading the rest of the modules
const Webhook = require("./webhook"),
express = require('express'),
TurndownService = require('turndown'),
turndownService = new TurndownService(),
events = require('events'),
@MuhsinFatih
MuhsinFatih / fix-macos-python.md
Last active July 13, 2024 21:37
How to recover from messed up python installation on mac, and never have to mess with apple's shitty python confusion factory

I am assuming you are here because like me, you installed a bazillion different python interpreters on mac and the whole thing is a spagetti. Today, I finally fixed my python installation. Whatever I install for python2 or python3 using pip JUST.WORKS.. My god! finally.

What the hell?

Here is what I had messed up, which you also probably did:

  • I had too many different python interpreters
  • Too many different symlinks which I lost track of
  • almost no package I installed with pip worked without a headache
  • any attempt to fix using online resources made it worse.
@magi82
magi82 / HookModelProtocol.swift
Last active July 27, 2019 13:09
Hookable.swift
protocol HookModelProtocol {
associatedtype HookModel
}
@mattt
mattt / UIViewControllerPreview.swift
Last active January 8, 2024 23:09
Generic structures to host previews of UIView and UIViewController subclasses.
import UIKit
#if canImport(SwiftUI) && DEBUG
import SwiftUI
struct UIViewControllerPreview<ViewController: UIViewController>: UIViewControllerRepresentable {
let viewController: ViewController
init(_ builder: @escaping () -> ViewController) {
viewController = builder()
}