Skip to content

Instantly share code, notes, and snippets.

View msukmanowsky's full-sized avatar
🥳
Building the future of how companies work with elvex!

Mike Sukmanowsky msukmanowsky

🥳
Building the future of how companies work with elvex!
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">
@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
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,
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;
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
@msukmanowsky
msukmanowsky / guess_string_separator.py
Last active July 22, 2019 20:58
Guess a delimiter being used to split a string using term frequencies of non-word characters.
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.