Skip to content

Instantly share code, notes, and snippets.

@psayre23
psayre23 / gist:c30a821239f4818b0709
Last active October 22, 2024 12:13
Runtime Complexity of Java Collections
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
@psayre23
psayre23 / README.md
Created July 8, 2014 19:51
Airsquirrels Reflector Load on Login

Background

I need a way to automatically load Reflector for Mac OSX when a user signs in. This is my solution. Start by opening the console.

Step 1

Open Reflector using sudo. This will setup the global settings. Enter your license key here and your users won't have to enter it.

@psayre23
psayre23 / gist:3330084
Created August 12, 2012 06:11 — forked from paulirish/gist:366184
html5 geolocation with fallback.
// geo-location shim
// currentely only serves lat/long
// doublecheck the ClientLocation results because it may returning null results
(function (geolocation) {
if (geolocation) return;
@psayre23
psayre23 / cssColors.js
Created August 3, 2012 17:30
CSS Colors
(function () {
var colorRegex = new RegExp([
'#[A-F0-9]{6}\\b', // #666666
'#[A-F0-9]{3}\\b', // #333
'rgb\\s*\\((?:(?:\\d{1,3}\\b\\s*,\\s*){2})\\d{1,3}\\s*\\)', // rgb(1, 2, 3)
'rgba\\s*\\((?:(?:\\d{1,3}\\b\\s*,\\s*){3}(?:\\d|\\d?\\.\\d+))\\)' // rgba(4, 3, 2, 1.0)
].join('|'), 'i');
var toHex = function (num) {
@psayre23
psayre23 / gist:3245159
Created August 3, 2012 06:42
GistMark Test
alert('working');
alert('with two lines');