Say we're working with clickstream data:
CREATE TABLE pageviews (
"timestamp" timestamp,
url text,
referrer text,
user_agent text,
const admin = require('firebase-admin'); | |
function getIdToken(req) { | |
const authHeader = req.header('Authorization') || ''; | |
const parts = authHeader.split('Bearer '); | |
if (parts.length === 1) return null; | |
return parts[1]; | |
} |
// middleware.js | |
exports.filesUpload = function(req, res, next) { | |
// See https://cloud.google.com/functions/docs/writing/http#multipart_data | |
const busboy = new Busboy({ | |
headers: req.headers, | |
limits: { | |
// Cloud functions impose this restriction anyway | |
fileSize: 10 * 1024 * 1024, | |
} |
const express = require('express'); | |
const { filesUpload } = require('./middleware'); | |
app = express(); | |
app.post('/upload', filesUpload, function(req, res) { | |
// will contain all text fields | |
req.body |
import re | |
from collections import Counter | |
def guess_string_separator( | |
string: str, | |
to_ignore: Iterable[str] = tuple(), | |
ignore_empty_strings: bool = True, | |
) -> Optional[str]: | |
"""Guess a delimiter being used to split a string using term frequencies. |
import fileinput | |
for line in fileinput.input(): | |
print(line) | |
""" | |
Usages | |
- Read from stdin: cat somefile | python script.py | |
- read from multiple files: python script.py file1.txt file2.txt file3.txt |
import { useState, useEffect } from "react"; | |
import { AsyncStorage } from "react-native"; | |
function useAsyncStorage(key, initialValue) { | |
const [storedValue, setStoredValue] = useState(initialValue); | |
useEffect(() => { | |
AsyncStorage.getItem(key) | |
.then(value => { | |
if (value === null) return initialValue; |
A collection of articles and tools I've found really helpful, organized by subject.
Your requirements could not be resolved to an installable set of packages. | |
Problem 1 | |
- Conclusion: don't install magento/magento-cloud-docker 1.1.1 | |
- Conclusion: remove symfony/console v4.4.11 | |
- Conclusion: don't install symfony/console v4.4.11 | |
- symfony/dependency-injection v3.3.0 conflicts with symfony/console[v4.4.11]. | |
- symfony/dependency-injection v3.3.1 conflicts with symfony/console[v4.4.11]. | |
- symfony/dependency-injection v3.3.10 conflicts with symfony/console[v4.4.11]. | |
- symfony/dependency-injection v3.3.11 conflicts with symfony/console[v4.4.11]. |
from rest_framework.authentication import BasicAuthentication | |
class CustomBasicAuthentication(BasicAuthentication): | |
def authenticate_header(self, request): | |
# Important see https://stackoverflow.com/questions/9859627/how-to-prevent-browser-to-invoke-basic-auth-popup-and-handle-401-error-using-jqu?lq=1 | |
return None |