This file contains 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
import 'dart:convert' as convert; | |
import 'package:cryptography/cryptography.dart'; | |
class MyCrypt { | |
final AesGcm aesGcm; | |
MyCrypt() : aesGcm = AesGcm.with256bits(); | |
static const nonceLength = 12; | |
static const macLength = 16; |
This file contains 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
/** | |
* The useFetchCache hook: fetch API response and save it in the cache. | |
* The next time it uses the cached response. | |
**/ | |
const _cache = {}; | |
export default function useFetchCache(key) { | |
const [data, setData] = useState((key in _cache) ? _cache[key] : null); | |
const [error, setError] = useState(null); |
This file contains 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
# Example of Wordpress docker installation for Gutenberg plugin development where you need node and npm. | |
# Used for plugin development. | |
# Put this docker-compose file in the root of your plugin directory. | |
# This setup removes the src and node_modules directory from the mount to the container. | |
# This will improve the performance for Mac, because it doesn't has to sync so much files. | |
# After running this setup, you can just use npm install on your host. | |
version: '3.3' | |
services: |
This file contains 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
var Artist = Backbone.Model.extend(); | |
var Artists = Backbone.Collection.extend({ | |
model : Artist, | |
url : "http://api.discogs.com/database/search?type=artist", | |
sync : function(method, collection, options) { | |
// By setting the dataType to "jsonp", jQuery creates a function | |
// and adds it as a callback parameter to the request, e.g.: | |
// [url]&callback=jQuery19104472605645155031_1373700330157&q=bananarama | |
// If you want another name for the callback, also specify the |