Skip to content

Instantly share code, notes, and snippets.

@msmfsd
msmfsd / es7-async-await.js
Last active February 4, 2024 17:38
Javascript fetch JSON with ES7 Async Await
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
@mouuff
mouuff / gtranslate.py
Created August 21, 2012 09:33
android fast translator
#!/usr/bin/env python
# -*- coding: latin-1 -*-
import android
import urllib2
droid = android.Android()
def translate(to_translate, to_langage="auto", langage="auto"):
'''Return the translation using google translate