Last active
December 10, 2015 17:08
-
-
Save bfricka/4465490 to your computer and use it in GitHub Desktop.
Revisions
-
bfricka revised this gist
Apr 1, 2013 . 1 changed file with 17 additions and 17 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,20 +2,20 @@ # I prefer this syntax for interacting with storage. class Stor # Constructor sets defaults for amplify # and optionally for expiration and key constructor: (key, exp) -> @key = if key? then key else undefined @exp = if exp? then exp else null @amp = amplify.store get: (key = @key) -> @amp(key) set: (val, key = @key, exp = @exp) -> @amp(key, val, { expiration: exp }) remove: (key = @key) -> @amp(key, null) empty: -> self = @ storage = self.amp() _.each storage, (itm, key) -> self.amp(key, null) -
bfricka created this gist
Jan 6, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ # This is really just an interaction wrapper for amplify # I prefer this syntax for interacting with storage. class Stor # Constructor sets defaults for amplify # and optionally for expiration and key constructor: (key, exp) -> @key = if key? then key else undefined @exp = if exp? then exp else null @amp = amplify.store get: (key = @key) -> @amp(key) set: (val, key = @key, exp = @exp) -> @amp(key, val, exp) remove: (key = @key) -> @amp(key, null) empty: -> self = @ storage = self.amp() _.each storage, (itm, key) -> self.amp(key, null)