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
function main() { | |
const headers = {Authorization: "Basic " + btoa("user:pass")}; | |
/** | |
* Convert an Array Buffer into a base64 String. | |
* | |
* @param {ArrayBuffer} buffer - The Array buffer to convert. | |
* @returns {String} - The base64 representation of the given Array | |
* Buffer. |
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
diff --git a/calendar.js b/calendar.js | |
index ce462d6..faca709 100644 | |
--- a/calendar.js | |
+++ b/calendar.js | |
@@ -10,17 +10,29 @@ $(document).ready(function() { | |
// Local store in IndexedDB. | |
var store; | |
- | |
var headers; |
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 db = new Kinto({remote: "https://kinto.dev.mozaws.net/v1/", bucket:"central-repository", headers: {Authorization: "Basic " + btoa("user:pass")}}); | |
var collection = db.collection("server_locations"); | |
collection.get("user_id").then(function(resp) { | |
// Do something with your "resp" here. | |
}); |
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
>>> def function(foo, bar, baz="test"): | |
... pass | |
>>> function("foo", baz="test") | |
TypeError: function() takes at least 2 arguments (2 given) |
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
def timeit(what): | |
def wrapper(fn): | |
def wrapped(*args, **kwargs): | |
start = datetime.datetime.now() | |
rv = fn(*args, **kwargs) | |
end = datetime.datetime.now() | |
with open('/tmp/timeit', 'a') as f: | |
f.write('%s start: %s' % (what, start.isoformat())) | |
f.write('%s end: %s' % (what, end.isoformat())) | |
f.write('\n\n') |
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
# You need to install some 32bits libs: | |
sudo apt-get install libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386\ | |
libidn11:i386 libglu1-mesa:i386 liblibxt-dev:i386 libasound-dev:i386 | |
# And you should be all good. |
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
generate_site: | |
SITENAME="site" PATH=sitesrc SITEURL="http://siteurl" pelican -s settings.py output_site | |
generate_blog: | |
SITENAME="blog" PATH=blogsrc SITEURL="http://blogurl" pelican -s settings.py output_blog | |
html: generate_blog generate_site | |
@echo "done!" |
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
site: | |
pelican -s site.settings.py output_site | |
blog: | |
pelican -s blog.settings.py output_site | |
html: blog site | |
echo "done!" |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.