Skip to content

Instantly share code, notes, and snippets.

View andrealufino's full-sized avatar
🌱

Andrea Mario Lufino andrealufino

🌱
View GitHub Profile
@AymaneHrouch
AymaneHrouch / autosub_reddit.js
Last active July 4, 2024 17:06
Auto subscribe to a lot of subreddits after you move to a new account.
/*
-Visit https://old.reddit.com/subreddits/ using your old account
-Copy link address of "multireddit of your subscriptions"
It will give you a link address like this: https://old.reddit.com/r/[subreddit1+subreddit2...+subredditN]
Please note that if you have a lot of subreddits the link won't work because there's a limit to the link's length, you can simply split it to two or three links
-Visit that link (or links) using your new account.
-Open the console by pressing F12 and then clicking the console tab
-Past the code bellow and press enter. You're welcome :)
*/
const sub = () => {
import Foundation
extension CustomStringConvertible {
var description: String {
var description: String = "\(type(of: self))("
let selfMirror = Mirror(reflecting: self)
for child in selfMirror.children {
if let propertyName = child.label {
@edc0der
edc0der / ActivityIndicatorOverlay.swift
Last active December 17, 2023 13:37
iOS + Swift: Display activity indicator overlay - UIViewController extension
import UIKit
fileprivate let overlayViewTag: Int = 999
fileprivate let activityIndicatorViewTag: Int = 1000
// Public interface
extension UIView {
func displayAnimatedActivityIndicatorView() {
setActivityIndicatorView()
}
//
// Spinner.swift
//
// Created by Michał Majchrzycki on 28.03.2018.
// Copyright © 2018 Prograils.com. All rights reserved.
// Check whole tutorial at: https://prograils.com/posts/reusable-activity-indicator-with-swift
import UIKit
open class Spinner {
@cmikeb1
cmikeb1 / fetchCoinPrice.scpt
Created June 9, 2017 01:12
AppleScript to retrieve crypto currency prices
validate_sheet()
set coins to {}
-- retrieve the list of coins from number
tell application "Numbers"
tell table 1 of sheet 1 of document 1
set cntRow to count row
set cntCol to count column
@vnagendra
vnagendra / LoadingButton.swift
Last active August 25, 2022 07:39 — forked from rajohns08/LoadingButton.swift
iOS / Swift - UIButton subclass for showing loading spinner aka activity indicator inside button
import UIKit
class LoadingButton: UIButton {
var originalButtonText: String?
var activityIndicator: UIActivityIndicatorView!
@IBInspectable
let activityIndicatorColor: UIColor = .lightGray
@dedeexe
dedeexe / UITextField+MaskPattern.swift
Last active November 16, 2018 21:14
Adding Mask to a TextField
//
// UITextField+MaskPattern.swift
// MaskedTextField
//
// Created by dede.exe on 10/07/16.
//
// It's totally base on article : "http://vojtastavik.com/2015/03/29/real-time-formatting-in-uitextfield-swift-basics/"
// And I don't mind if the original author allow me to publish it :)... But I'll keep the reference
// I modified the original implementation to keep it as an Extension...
//
@werediver
werediver / WiFiSsid.swift
Created July 14, 2016 12:47
Get the connected Wi-Fi network SSID on iOS (in Swift).
import Foundation
import SystemConfiguration.CaptiveNetwork
func getWiFiSsid() -> String? {
var ssid: String?
if let interfaces = CNCopySupportedInterfaces() as NSArray? {
for interface in interfaces {
if let interfaceInfo = CNCopyCurrentNetworkInfo(interface as! CFString) as NSDictionary? {
ssid = interfaceInfo[kCNNetworkInfoKeySSID as String] as? String
break
@lornajane
lornajane / mac.md
Last active July 6, 2024 02:26
Keyboard Only OS X

Keyboard-only Mac Cheatsheet

Hi, I'm Lorna and I don't use a mouse. I have had RSI issues since a bad workstation setup at work in 2006. I've tried a number of extra hardware modifications but what works best for me is to use the keyboard and only the keyboard, so I'm in a good position and never reaching for anything else (except my coffee cup!). I rather unwisely took a job which required me to use a mac (I've been a linux user until now and also had the ability to choose my tools carefully) so here is my cheatsheet of the apps, tricks and keyboard shortcuts I'm using, mostly for my own reference. Since keyboard-only use is also great for productivity, you may also find some of these ideas useful, in which case at least something good has come of this :)

Apps List

There's more detail on a few of these apps but here is a quick overview of the tools I've installed and found helpful

Tool Link Comments
@icoxfog417
icoxfog417 / NSDateExtension.swift
Created December 24, 2014 07:45
NSDate Extension(swift)
import Foundation
extension NSDate {
var calendar: NSCalendar {
return NSCalendar(identifier: NSGregorianCalendar)!
}
func after(value: Int, calendarUnit:NSCalendarUnit) -> NSDate{
return calendar.dateByAddingUnit(calendarUnit, value: value, toDate: self, options: NSCalendarOptions(0))!
}