Skip to content

Instantly share code, notes, and snippets.

@psayre23
psayre23 / gist:c30a821239f4818b0709
Last active Oct 13, 2021
Runtime Complexity of Java Collections
View gist:c30a821239f4818b0709
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 Jul 8, 2014
Airsquirrels Reflector Load on Login
View README.md

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 Aug 12, 2012 — forked from paulirish/gist:366184
html5 geolocation with fallback.
View gist:3330084
// geo-location shim
// currentely only serves lat/long
// doublecheck the ClientLocation results because it may returning null results
(function (geolocation) {
if (geolocation) return;
View cssColors.js
(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) {
View gist:3245159
alert('working');
alert('with two lines');