This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CM: forked to address key size (not just value size), swapping between KB and MB, ordering by size and logging total localstorage size. | |
// based on answer to question | |
// http://stackoverflow.com/questions/4391575/how-to-find-the-size-of-localstorage | |
(function showLocalStorageSize() { | |
threshold = 256; // the point where we stop displaying KB and start with MB | |
function stringSizeBytes(str) { | |
return str.length * 2; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Screen orientation: | |
if (typeof screen.orientation !== 'undefined') { | |
data.orientation = screen.orientation.angle; | |
} else if (typeof window.orientation !== 'undefined') { | |
data.orientation = window.orientation; | |
} | |
// screen width/height |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using local storage and webworkers to speed up the UX for the homepage ajax requests, and possibly local caching of search results. | |
- Why use local storage? For subsequent page loads, it makes the homepage load feel instant if the ajax calls don't need to happen (but are instead deferred) | |
- Why use webworkers? It offloads the ajax calls to another thread (minor win), plus the intensive work of diffing cached and new json data to see if it's been updated is offloaded and doesn't slow the main thread (major win - I guess). | |
** Angular controller (eg recommendedController) | |
- wants a json feed of items. | |
- calls getcacheitems() on a promise | |
- getcacheitems() returns error or data | |
- does angular stuff to display data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* mixin to extend the us select box and allow colour/size tweaks */ | |
@mixin us-form-select($base-color: $select-base-color, $text-color: inherit, $bg-color: white, $height: 2.4em, $padding: 0.3em 0.6em, $hover-color: $select-hover-color, $active-color: $select-active-color) | |
@extend .us-form-select | |
height: $height | |
padding: $padding | |
border-color: $base-color | |
background-color: $bg-color | |
@if $text-color != inherit | |
color: $text-color | |
+transition(border-color 200ms,color 200ms) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* animation mixins */ | |
@import "compass/css3/shared" | |
@mixin animation ($animation_name, $duration: 500ms, $fill_mode: forwards, $iteration_count: 1, $delay: 0, $direction: normal, $timing_function: ease) | |
+experimental(animation-name, $animation_name) | |
+experimental(animation-duration, $duration) | |
@if $fill_mode != none | |
+experimental(animation-fill-mode, $fill_mode) | |
@if $iteration_count != 1 | |
+experimental(animation-iteration-count, $iteration_count) | |
@if $delay != 0 |
NewerOlder