Skip to content

Instantly share code, notes, and snippets.

View msukmanowsky's full-sized avatar

Mike Sukmanowsky msukmanowsky

View GitHub Profile
type Props = {
color: string;
};
export default function CrescentSpinner({
color = "gray",
}: Props) {
return (
<div aria-label="Loading..." role="status">
<svg className="h-6 w-6 animate-spin" viewBox="3 3 18 18">
// 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,
}
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;
@msukmanowsky
msukmanowsky / Game.ts
Created October 18, 2022 02:09
TicTacToe using boardgame.io
import type { Game, Move } from "boardgame.io";
import { INVALID_MOVE } from "boardgame.io/core";
export interface TicTacToeState {
cells: (null | string)[];
}
function isVictory(cells: (null | string)[]): boolean {
const positions = [
// Horizontal
@msukmanowsky
msukmanowsky / spark_gzip.py
Created November 14, 2014 01:32
Example of how to save Spark RDDs to disk using GZip compression in response to https://twitter.com/rjurney/status/533061960128929793.
from pyspark import SparkContext
def main():
sc = SparkContext(appName="Test Compression")
# RDD has to be key, value pairs
data = sc.parallelize([
("key1", "value1"),
("key2", "value2"),
("key3", "value3"),
from django.contrib.auth import login as django_login, logout as django_logout
from rest_framework.request import Request
from rest_framework.response import Response
from rest_framework.decorators import (
api_view,
authentication_classes,
permission_classes,
)
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAuthenticated
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
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].

LookML vs Materialized Views

Say we're working with clickstream data:

CREATE TABLE pageviews (
  "timestamp"   timestamp,
  url           text,
  referrer      text,
 user_agent text,