Skip to content

Instantly share code, notes, and snippets.

@alexshive
alexshive / PinPlayground.swift
Created July 13, 2022 15:06
Write a function that takes a list of pin objects, each with a height attribute, and a number of columns and returns a grid layout. You put the next pin in the column with the shortest total height (sum of heights of pins in the column) so far. If there is a tie, insert the pin into the left most column. Return a list which contains a list for e…
struct Pin {
var id: Int
var height: Int
}
func layout(_ pins: [Pin], col: Int) -> [[Pin]] {
func calcHeight() -> Int {
var sum = Int.max
var indexMax = 0
@alexshive
alexshive / conf.js
Created September 16, 2016 17:52
Chrome Extension testing with Protractor config
exports.config = {
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['--load-extension=/Users/ashive/Developer/extension']
}
},
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['chrome.js']
};
@alexshive
alexshive / MRProgressTest.swift
Last active August 29, 2015 14:08
Swift incorporation of the MRProgress Pod
// Works with tabs
class ViewController: UIViewController {
var overlay = MRProgressOverlayView()
var isAnimated = true
override func viewDidAppear(animated: Bool) {
loadProgressView()
@alexshive
alexshive / FacebookPOPAnimationTest.swift
Last active August 29, 2015 14:08
Facebook POP Swift Animation test. Box enlarges and centers on screen on button click.
//
// ViewController.swift
// FacebookPOPAnimationTest
//
// Created by Alex Shive on 10/29/14.
// Copyright (c) 2014 Alex. All rights reserved.
//
import UIKit
@alexshive
alexshive / social.scss
Created July 18, 2014 17:18
SASS Social Network colors
// Credit Jonathan Suh via https://news.layervault.com/stories/28802-ask-dn-what-are-your-little-sassless-time-savers
$social-colors: (
dribbble: #ea4c89,
facebook: #3b5998,
github: #171515,
google: #db4437,
twitter: #55acee
);
@alexshive
alexshive / modal_save.js
Last active August 29, 2015 14:03
Modal Dialog
/*
// TYPES OF ANIMATIONS
'LINEAR'
'QUAD_IN'
'QUAD_OUT'
'QUAD_IN_OUT'
'CUBIC_IN'
'CUBIC_OUT'
'CUBIC_IN_OUT'
'QUART_IN'
@alexshive
alexshive / Compass Bare Install
Last active December 14, 2017 16:05
Compass install with auto removing generated files
compass create --sass-dir "scss" --css-dir "css" --javascripts-dir "js" --images-dir "img"; mv scss/screen.scss scss/style.scss; rm scss/ie.scss; rm scss/print.scss; rm css/*; compass watch
@alexshive
alexshive / Titanium log function
Created March 12, 2014 20:40
Titanium log function for quick debugging. Typing out Ti.API.log(JSON.stringify(e)); takes too long. Much easier to type in log(e, 1); or log(e,true);
function log(message, parseJSON) {
if(parseJSON) {
message = JSON.stringify(message);
}
Ti.API.log(message);
}
// Works on 3.2.0GA
var win = Ti.UI.createWindow({
backgroundColor : '#ffffff',
exitOnClose : true // this makes it a HEAVYWEIGHT window
});
var myView = Ti.UI.createView();
var curBtn = Ti.UI.createButton({
color : '#000000',
@alexshive
alexshive / gist:8569845
Created January 22, 2014 23:39
Sass watch

$ sass --watch sass:css