Python syntax here : 2.7 - online REPL
Javascript ES6 via Babel transpilation - online REPL
import math
/** | |
* Save file splitting it by chunks of 9M | |
* @param {Blob} FileBlob blob data to save | |
* @param {Folder} folder destination folder | |
* @param {Number} chunkSize | |
* @return {String} | |
*/ | |
function saveFileByChunks(fileBlob, folder, chunkSize) { | |
var | |
fileName = new Date().getTime(), |
Python syntax here : 2.7 - online REPL
Javascript ES6 via Babel transpilation - online REPL
import math
function START() { | |
var url = "https://hooks.slack.com/services/xxxxxx/xxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxx"; | |
var payload = { | |
"channel" : "#test", // <-- optional parameter, use if you want to override default channel | |
"username" : "robot", // <-- optional parameter, use if you want to override default "robot" name | |
"text" : "It's working", // <-- required parameter | |
"icon_emoji": ":robot_face:", // <-- optional parameter, use if you want to override default icon, | |
//"icon_url" : "http://image" // <-- optional parameter, use if you want to override default icon |
import json | |
import requests | |
import logging as log | |
log.basicConfig(level=log.DEBUG) | |
class FollowerExtractor(): | |
""" | |
Extracts followers for a given profile | |
""" |
import asyncio | |
loop = asyncio.get_event_loop() | |
async def hello(): | |
await asyncio.sleep(3) | |
print('Hello!') | |
if __name__ == '__main__': | |
loop.run_until_complete(hello()) | |
Converting an SVG animation to a video with the MediaRecorder API and a hidden canvas.
Drawing frames from img
elements can introduce an extra delay, so this version generates all the frames upfront and then renders them in a loop with requestAnimationFrame()
.
See also: Canvas animation to video
/* | |
* script to export data of the named sheet as an individual csv files | |
* sheet downloaded to Google Drive and then downloaded as a CSV file | |
* file named according to the name of the sheet | |
* original author: Michael Derazon (https://gist.github.com/mderazon/9655893) | |
*/ | |
function onOpen() { | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var csvMenuEntries = [{name: "Download Primary Time File", functionName: "saveAsCSV"}]; |
# *-* coding: UTF-8 *-* | |
import hashlib | |
import requests | |
from urllib.parse import urlencode, unquote_plus | |
def ksort(d): | |
return [(k, d[k]) for k in sorted(d.keys())] |
/** | |
* Pretends to take a long time to return two rows of data | |
* | |
* @param {string} endpoint | |
* @return {ResponseObject} | |
*/ | |
function doSomething (endpoint) { | |
Utilities.sleep(5 * 1000); // sleep for 5 seconds | |
return { | |
numberOfRows: 2, |
from bs4 import BeautifulSoup as BS | |
import requests | |
class BaseCrawler(object): | |
api_url = None | |
default_headers = { | |
'Accept-Language' :'en-US,en,q=0.9,vi;q=0.8', |