Skip to content

Instantly share code, notes, and snippets.

@DJNgoma
DJNgoma / GetAndSortInstagramFollowers.rb
Created October 22, 2016 12:11
CollectAndSortInstagramFollowers
require 'httparty'
txt = open("instagram.txt")
users = txt.read.split("\n")
usersHash = {}
users.each { |u|
url = "https://www.instagram.com/#{u}/?__a=1"
response = HTTParty.get(url)
//: Playground - noun: a place where people can play
import UIKit
// Seems I missed quite the discussion. By default setters and getters are provided on all variables in Swift with the use of either let or var respectively.
// So if on basic types (structs) I want:
// - getters only, I use let.
// - getters/setters, I use var.
@DJNgoma
DJNgoma / NSDecimalNumber.swift
Created April 26, 2016 03:45 — forked from mattt/NSDecimalNumber.swift
NSDecimalNumber Additions for Swift
import Foundation
// MARK: - Comparable
extension NSDecimalNumber: Comparable {}
public func ==(lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> Bool {
return lhs.compare(rhs) == .OrderedSame
}
@DJNgoma
DJNgoma / RoundingToNearest5Cent.swift
Last active January 4, 2018 03:08
Rounding to the nearest 5 cents in Swift or C
// Basic C, but being used in a Swift project of mine.
// Just a simple way of getting any floating number to round up or down to a 5 cent figure for calulations.
let x = 45.23
let y = 23.58
let z = 82.12
a = round(x/0.05)*0.05
b = round(y/0.05)*0.05
c = round(z/0.05)*0.05