Skip to content

Instantly share code, notes, and snippets.

View vicc's full-sized avatar

Vicc Alexander vicc

View GitHub Profile
@vicc
vicc / string-truncate.swift
Last active May 4, 2020 02:33 — forked from jesskturner/string-truncate.swift
A little truncate function extension for the default String type (Swift 3 Ready)
extension String {
/**
Truncates the string to the specified length number of characters and appends an optional trailing string if longer.
- Parameter length: A `String`.
- Parameter trailing: A `String` that will be appended after the truncation.
- Returns: A `String` object.
*/
func truncate(length: Int, trailing: String = "…") -> String {
@vicc
vicc / timerModule.js
Last active January 21, 2016 05:59
Timer Module to easily log execution times for functions, promises, etc. on Parse Cloud Code
/*
The Timer Module makes it easy to analyze how long each
of your functions, promises, etc. are taking in Cloud
Code.
Although NSDate.getTime() isn't as accurate as other modern
approaches (e.g console.time, performance.now) it is still
quite helpful.