Skip to content

Instantly share code, notes, and snippets.

View indatawetrust's full-sized avatar
🏠
Working from home

indatawetrust

🏠
Working from home
View GitHub Profile
android update sdk --no-ui --all --filter build-tools-28.0.3,android-28,extra-android-m2repository
import React from 'react';
import { useFormik } from 'formik';
import styled from 'styled-components';
import * as yup from 'yup';
let validationSchema = yup.object().shape({
email: yup.string().email().required(),
password: yup.string().min(5).max(25).required(),
});
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
DECLARE _N INT;
SET _N = N - 1;
RETURN (
# Write your MySQL query statement below.
select (
select distinct Salary from Employee order by Salary desc limit 1 offset _N
) as getNthSalary
);
@indatawetrust
indatawetrust / test.js
Last active May 16, 2020 13:56
expressjs endpoint testing with ava + supertest + @hapi/joi
const test = require('ava')
const request = require('supertest')
const app = require('../lib/infra')
const Joi = require('@hapi/joi')
const agent = request.agent(app)
test('main', async (t) => {
const { body } = await agent.get('/')
import React, {useContext, useState} from "react";
export default null;
const FeathersContext = React.createContext(null);
export const useFeathers = () => useContext(FeathersContext);
export const FeathersProvider = ({ children, client: feathersClient }) => {
const [isLoggedIn, setIsLoggedIn] = useState(false);
version: '3.1'
services:
reverse-proxy:
image: traefik # The official Traefik docker image
command: --api --docker # Enables the web UI and tells Traefik to listen to docker
ports:
- "3000:3000" # The HTTP port
- "8080:8080" # The Web UI (enabled by --api)
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
@indatawetrust
indatawetrust / plink-plonk.js
Created February 18, 2020 10:37 — forked from tomhicks/plink-plonk.js
Listen to your web pages
const children = [];
const getChildren = el => [...el.children].map(child => {
getChildren(child);
child.style.transition = 'all ease 0.5s'
children.push(child);
});
getChildren(document.body);
@indatawetrust
indatawetrust / storage.ts
Created December 15, 2019 16:12
capacitor auth storage for featherjs
import { Plugins } from "@capacitor/core";
const { Storage } = Plugins;
export default class CapacitorStorage {
static async getItem(key: string) {
const { value } = (await Storage.get({ key })) || { value: null };
return value;
}
@indatawetrust
indatawetrust / cps.js
Created December 15, 2019 12:16
redux-saga cps effect
const response = yield cps(cb =>
new Promise((resolve, reject) => {
setTimeout(() => {
resolve(true);
}, 1000);
}).then(data => cb(null, data))
.catch(error => cb(error))
);