Skip to content

Instantly share code, notes, and snippets.

View thexande's full-sized avatar

Alexander Murphy thexande

  • Ibotta
  • Denver, CO, USA, Planet Earth
View GitHub Profile
@thexande
thexande / vscodeCustom.css
Last active March 19, 2021 03:52
custom VS Code theme css
#workbench\2e parts\2e statusbar {
background: #673AB7;
background: -webkit-linear-gradient(to left, #673AB7, #00BCD4);
background: linear-gradient(to left, #673AB7, #00BCD4);
}
/*#workbench\2e parts\2e statusbar {
/*background: #f857a6;
background: -webkit-linear-gradient(to left, #f857a6, #ff5858);
background: linear-gradient(to left, #f857a6, #ff5858);
@thexande
thexande / mov2gif.sh
Last active September 18, 2016 22:33
# first run brew install ffmpeg && brew install imagemagick
# next, add lines 6 - 9 into your .zshrc or .bashrc file, depending on your shell you use ( zsh or bash )
# restart your terminal!
# then call like "movtogif in.mov out.gif"
movtogif(){
ffmpeg -i "$1" -vf scale=800:-1 -r 10 -f image2pipe -vcodec ppm - |\
convert -delay 5 -layers Optimize -loop 0 - "$2"
}
import UIKit
let currentDate = NSDate()
let dateFormatter = NSDateFormatter()
// Setting the locale.
dateFormatter.locale = NSLocale.currentLocale()
//dateFormatter.locale = NSLocale(localeIdentifier: "el_GR")
//dateFormatter.locale = NSLocale(localeIdentifier: "fr_FR")
@thexande
thexande / SKMultilineLabel.swift
Created January 13, 2017 02:32 — forked from craiggrummitt/SKMultilineLabel.swift
Multi line label in Sprite Kit in Swift
//
// SKMultilineLabel.swift
//
// Created by Craig on 10/04/2015.
// Copyright (c) 2015 Interactive Coconut.
// MIT License, http://www.opensource.org/licenses/mit-license.php
//
/* USE:
(most component parameters have defaults)
let multiLabel = SKMultilineLabel(text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", labelWidth: 250, pos: CGPoint(x: size.width / 2, y: size.height / 2))
@thexande
thexande / SKMultilineLabel.swift
Created January 13, 2017 02:32 — forked from craiggrummitt/SKMultilineLabel.swift
Multi line label in Sprite Kit in Swift
//
// SKMultilineLabel.swift
//
// Created by Craig on 10/04/2015.
// Copyright (c) 2015 Interactive Coconut.
// MIT License, http://www.opensource.org/licenses/mit-license.php
//
/* USE:
(most component parameters have defaults)
let multiLabel = SKMultilineLabel(text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", labelWidth: 250, pos: CGPoint(x: size.width / 2, y: size.height / 2))
@thexande
thexande / zigZagViewBorderPlayground.swift
Last active January 14, 2017 17:25
creates a zig zag view border inside of a swift playground. Create a new playground, and paste in the following code:
import UIKit
import PlaygroundSupport
let uiview = UIView(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
func pathZigZagForView(givenView: UIView) ->UIBezierPath {
let width = givenView.frame.size.width
let height = givenView.frame.size.height
let givenFrame = givenView.frame
let zigZagWidth = CGFloat(7)
let zigZagHeight = CGFloat(5)
@thexande
thexande / ReverseLinkedList.swift
Created January 21, 2018 02:41
A quick and dirty reversed linked list implementation in swift 4.
// Reverse Linked List
class Node {
let value: Int
var next: Node?
init(value: Int, next: Node?) {
self.value = value
self.next = next
}
}
@thexande
thexande / MergeSort.swift
Last active August 15, 2018 21:06
Merge Sort in Swift
func sort(_ array: [Int]) -> [Int] {
guard array.count > 1 else {
return array
}
let left = Array(array[0..<array.count / 2])
let right = Array(array[array.count/2..<array.count])
return merge(sort(left), sort(right))
}
enum Trend {
case ascending
case decending
}
func trend(for sequence: [Int]) -> Trend? {
var trend: Trend?
@thexande
thexande / IntegerArrayIntersection.swift
Created September 3, 2018 22:32
Array Intersection: Find the intersection of a given set of 3 sorted arrays
/// Array Intersection: Find the intersection of a given set of 3 sorted arrays
///
/// - Parameters:
/// - arrayOne: the first sorted array of Integers
/// - arrayTwo: the second sorted array of Integers
/// - arrayThree: the third sorted array of Integers
/// - Returns: an array of intersection points within the given 3 arrays
func findIntersection(arrayOne: [Int], arrayTwo: [Int], arrayThree: [Int]) -> [Int] {
var results: [Int] = []