Skip to content

Instantly share code, notes, and snippets.

:root {
--fg: #d5ced9;
--bg: #23262e;
--red: #ee5d43;
--purple: #c74ded;
--yellow: #ffe66d;
--font: Arial, sans;
}
use std::fmt::Display;
use actix_web::{http::StatusCode, HttpResponse};
use serde_json::{json, to_string};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ErrorMime {
Json,
Html,
JavaScript,
const Foo = () => {
const foo = useSelector(selectFoo);
const [initial] = useState(foo);
useEffect(() => {
if (foo !== initial) {
console.log('foo');
}
}, [foo]);
fn greet(name: &str) -> String {
if name.is_empty() {
// ..snip..
}
format!("Hello, {}", name)
}
fn greet(name: &str) -> String {
if name.is_empty() {
format!("Hello, {}", "whoever")
} else {
format!("Hello, {}", name)
}
}
const create = sessionUser => data => Promise.try(() => transaction(model, async (modelTransaction) => {
const { CAN_CREATE_ORGANIZATIONS } = getPermissions(sessionUser.permissions);
const { userId } = sessionUser;
const { avatar, ...orgData } = data;
if (!CAN_CREATE_ORGANIZATIONS) {
throw Unauthorized({ message: 'Sie haben nicht das Recht Organisationen zu erstellen' });
}
const insert = params => modelTransaction.query()
let estate;
let signed;
let watches;
function getImagesAndServePages() {
estate = require('fs').readdirSync('./public/imgs/estate');
signed = require('fs').readdirSync('./public/imgs/signed');
watches = require('fs').readdirSync('./public/imgs/watches');
import React, { Component } from 'react';
import styled from 'styled-components';
const Figure = styled.figure`
height: 0;
margin: 0;
background-color: #efefef;
position: relative;
padding-bottom: ${props => props.ratio}%;
`;
const get = (array, currentKey, direction) => {
const k = currentKey ? currentKey : array[0];
const delta = direction == 'inc' ? 1 : -1
const index = array.indexOf(k);
const nextIndex = (index + delta + array.length) % array.length;
console.log(array[nextIndex]);
};
import React, { useState } from 'react';
import styled from '@emotion/styled';
import { Col, Row } from './Flex';
const splitBasis = (percent) => {
const SCALE = 10000;
const p = Math.floor(percent * SCALE);
const shared = { flexShrink: 1 };
return {
a: { flexGrow: String(p), ...shared },