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 characters
import pytest | |
from unittest.mock import AsyncMock, MagicMock | |
from motor.motor_asyncio import AsyncIOMotorClient | |
# Example function to test | |
async def get_data_from_collection(db_client, collection_name, query): | |
collection = db_client["test_database"][collection_name] | |
result = await collection.find_one(query) | |
return result |
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 characters
function getId() { | |
/** | |
* Imported from https://github.com/kyo-ago/UUID | |
* Robbie Mitchell, @superstrong | |
*/ | |
/** | |
* UUID.core.js: The minimal subset of the RFC-compliant UUID generator UUID.js. | |
* | |
* @fileOverview |
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 characters
<div class="menu-btn"> | |
<i class="fas fa-bars fa-2x"></i> | |
</div> | |
<div class="container"> | |
<!-- Nav --> | |
<nav class="main-nav"> | |
<img src="https://i.ibb.co/wwLhz98/logo.png" alt="Microsoft" class="logo"> | |
<ul class="main-menu"> |
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 characters
moment.min.js | |
moment-timezone-with-data-2010-2020.min.js |
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 characters
from datetime import timedelta, date | |
def daterange(date1, date2): | |
for n in range(int ((date2 - date1).days)+1): | |
yield date1 + timedelta(n) | |
start_dt = date(2015, 12, 20) | |
end_dt = date(2016, 1, 11) | |
for dt in daterange(start_dt, end_dt): | |
print(dt.strftime("%Y-%m-%d")) |
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 characters
from pymongo import Connection | |
from bson import ObjectId | |
from itertools import imap | |
class Model(dict): | |
""" | |
A simple model that wraps mongodb document | |
""" | |
__getattr__ = dict.get |
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 characters
function myFunction() { | |
var ss = SpreadsheetApp.getActive(); | |
var sheet = ss.getSheetByName("orange"); | |
var range = sheet.getRange("1:1").getValues(); | |
var titles = range[0]; | |
var a1range = "A1:A"; | |
var a1array = []; | |
a1range = a1range +titles.length*titles.length; | |
var b1range = "B1:B"; |
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 characters
// http://stackoverflow.com/questions/11273268/script-import-local-csv-in-google-spreadsheet | |
function onOpen() { | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var csvMenuEntries = [{name: "Upload CSV file", functionName: "doGet"}]; | |
ss.addMenu("CSV", csvMenuEntries); | |
} | |
function doGet(e) { | |
var app = UiApp.createApplication().setTitle("Upload CSV to Sheet"); |
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 characters
import org.json.JSONObject | |
import org.json.JSONArray | |
class Task(val title:String, val email:String, val description:String) { | |
fun convertToJSON(): JSONObject { | |
val json = JSONObject() | |
json.put("title", title) | |
json.put("email", email) | |
json.put("description", description) | |
return json |
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 characters
/** | |
* immersiveMode | |
* set onPostResume, onSystemUiVisibilityChange | |
*/ | |
fun immersiveMode(activity: Activity) { | |
activity.window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN) | |
activity.window | |
.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN) | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
NewerOlder