Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
export function ApolloMockedProvider(props: any) {
let { mocks, ...otherProps } = props;
let mockLink = new MockLink(mocks);
let errorLoggingLink = onError(({ networkError }) => {
if (networkError) {
/No more mocked responses for the query/.test(networkError.message);
console.warn(`[Network error]: ${networkError}`);
}
@rcdexta
rcdexta / pytorch_simple_nn.py
Created August 4, 2021 05:22
PyTorch Simple Neural Network
# Hyperparameters for our network
input_size = 784
hidden_sizes = [128, 64]
output_size = 10
# Build a feed-forward network
model = nn.Sequential(nn.Linear(input_size, hidden_sizes[0]),
nn.ReLU(),
nn.Linear(hidden_sizes[0], hidden_sizes[1]),
nn.ReLU(),
@rcdexta
rcdexta / kitty.conf
Created May 26, 2021 19:11
My configuration for Kitty terminal. Copy to ~/.config/kitty
# vim:fileencoding=utf-8:ft=conf:foldmethod=marker
#: Fonts {{{
#: kitty has very powerful font management. You can configure
#: individual font faces and even specify special fonts for particular
#: characters.
font_family Inconsolata Nerd Font
# bold_font auto
import React from "react";
import "./styles.css";
import axios from "axios";
import { useDebouncedCallback } from "use-debounce";
const App = () => {
const [results, setResults] = React.useState([]);
const debounced = useDebouncedCallback((term) => {
axios.get(`https://ticker-2e1ica8b9.now.sh/keyword/${term}`).then((res) => {
const App = () => {
const [results, setResults] = React.useState([]);
const debouncedHandler = debounce((term) => {
if (term) {
axios
.get(`https://ticker-2e1ica8b9.now.sh/keyword/${term}`)
.then((res) => {
setResults(res.data);
});
import debounce from "lodash.debounce";
class App extends React.Component {
constructor(props) {
super(props);
this.state = { results: [] };
this.onInput = debounce(this.onInput.bind(this), 500);
}
onInput = (e) => {
class App extends React.Component {
state = { results: [] };
onInput = (e) => {
const term = e.target.value;
if (term) {
axios
.get(`https://ticker-2e1ica8b9.now.sh/keyword/${term}`)
.then((res) => {
this.setState({ results: res.data });
shoryuken sqs create User_Events.fifo
event1 = {id: 'evt7', user_id: 'usr1', details: {...}}
UserEventsProcessor.perform_async event1,
message_group_id: event1.user_id,
message_deduplication_id: event1.id
event1 = {id: 'evt2', user_id: 'usr1', details: {...}}
UserEventsProcessor.perform_async event1,
message_group_id: event1.user_id,
message_deduplication_id: event1.id