This file contains 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
// _app.tsx | |
import "../styles/globals.css"; | |
import type { AppProps } from "next/app"; | |
import { useEffect } from "react"; | |
import * as Fathom from "fathom-client"; | |
import { useRouter } from "next/router"; | |
function MyApp({ Component, pageProps }: AppProps) { | |
const router = useRouter(); |
This file contains 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
use async_graphql::ID; | |
use serde::Serialize; | |
use server::config::{Configuration, Http, Postgres}; | |
use server::http::App; | |
use sqlx::{Executor, PgPool}; | |
use uuid::Uuid; | |
pub struct TestApp { | |
pub addr: String, | |
pub pool: PgPool, |
This file contains 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
mod common; | |
#[cfg(test)] | |
mod tests { | |
use crate::common::{TestApp, Vars}; | |
use async_graphql::ID; | |
use gql_client::Client; | |
use serde_json::Value; | |
use server::error::AppError; | |
use server::http::project::resolver::Project; |
This file contains 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
#![allow(unused)] // silence unused warnings while exploring (to comment out) | |
use std::{error::Error, time::Duration}; | |
use tokio::time::sleep; | |
use redis::{ | |
from_redis_value, | |
streams::{StreamRangeReply, StreamReadOptions, StreamReadReply}, | |
AsyncCommands, Client, | |
}; |
This file contains 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 clux/muslrust as build | |
WORKDIR /app/ | |
# Deps caching begins | |
COPY Cargo.toml . | |
COPY Cargo.lock . | |
RUN mkdir src | |
RUN echo "fn main() {}" > src/main.rs |
This file contains 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
package main | |
import ( | |
"encoding/csv" | |
"fmt" | |
"log" | |
"os" | |
"path/filepath" | |
"strings" | |
"time" |
This file contains 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
// https://stackoverflow.com/questions/37069186/calculate-working-days-between-two-dates-in-javascript-excepts-holidays | |
$(document).ready(() => { | |
$('#calc').click(() => { | |
var d1 = $('#d1').val(); | |
var d2 = $('#d2').val(); | |
$('#dif').text(workingDaysBetweenDates(d1,d2)); | |
}); | |
}); |
This file contains 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 React from 'react'; | |
import { Provider1, Provider2, Provider3 } from './'; | |
function ProviderComposer({ contexts, children }) { | |
return contexts.reduceRight( | |
// kids = accumulator, parent = currentValue | |
(kids, parent) => | |
React.cloneElement(parent, { | |
children: kids | |
}), |
This file contains 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
func (r *mutationResolver) UpdateUser(ctx context.Context, input UpdateUser) (User, error) { | |
var fields = bson.M{} | |
var user User | |
update := false | |
if input.First != nil && *input.First != "" { | |
fields["first"] = *input.First | |
update = true | |
} |
This file contains 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 React, { useState } from "react"; | |
import ReactDOM from "react-dom"; | |
import "./styles.css"; | |
import { orders } from "./models"; | |
const App = () => { | |
const [currentOrder, setCurrentOrder] = useState(null); // orders[0] | |
const [searchFocused, setSearchFocused] = useState(false); |
NewerOlder