Skip to content

Instantly share code, notes, and snippets.

View andeeliao's full-sized avatar

Andee Liao andeeliao

  • dreamhaus
  • Shenzhen
View GitHub Profile
@hudson155
hudson155 / plaid_categories.json
Created November 2, 2022 15:15 — forked from arbass22/plaid_categories.json
Plaid Categories
{
"categories": [
{
"category_id": "10000000",
"group": "special",
"hierarchy": [
"Bank Fees"
]
},
{
@maxchuquimia
maxchuquimia / NSAttributedStringConcatenation.swift
Last active May 24, 2019 14:38
Concatenate NSAttributedString in Swift without your code wrapping over multiple lines. Also adding images to attributed strings is supported!
func +(lhs: NSAttributedString, rhs: NSAttributedString) -> NSAttributedString {
let a = lhs.mutableCopy() as! NSMutableAttributedString
let b = rhs.mutableCopy() as! NSMutableAttributedString
a.appendAttributedString(b)
return a.copy() as! NSAttributedString
}
@carlhoerberg
carlhoerberg / reconnect.js
Created May 13, 2015 14:45
How to build reconnect logic for amqplib
var amqp = require('amqplib/callback_api');
// if the connection is closed or fails to be established at all, we will reconnect
var amqpConn = null;
function start() {
amqp.connect(process.env.CLOUDAMQP_URL + "?heartbeat=60", function(err, conn) {
if (err) {
console.error("[AMQP]", err.message);
return setTimeout(start, 1000);
}
@db0company
db0company / topMostViewController.swift
Created January 19, 2015 14:28
Get the top most viewController anywhere in the app (typically from the appDelegate). Get the current visible viewController.
extension UIViewController {
func topMostViewController() -> UIViewController {
if self.presentedViewController == nil {
return self
}
if let navigation = self.presentedViewController as? UINavigationController {
return navigation.visibleViewController.topMostViewController()
}
if let tab = self.presentedViewController as? UITabBarController {
if let selectedTab = tab.selectedViewController {