Skip to content

Instantly share code, notes, and snippets.

def is_prime(n):
prime = False
for divisor in range(2, n):
if n % divisor == 0:
return prime
else:
continue
prime = True
return prime
big_num = '7316717653133062491922511542828064444866452387493035890'
big_num_len = len(big_num)
list_of_products = []
def multiply_adjacents(adj_num):
product = 0
first_pos = True
for element in adj_num:
def find_anagrams(list_of_words, word):
sliced_word = []
sliced_word += word
list_of_anagrams = []
for element in list_of_words:
sliced_element = []
sliced_element += element
if sorted(sliced_element) == sorted(sliced_word):
list_of_anagrams.append(element)
return list_of_anagrams
@alexxxmf
alexxxmf / genesis_public_key
Last active March 3, 2018 22:49
Genesis Airdrop
04cd29cfde9d461c722d1b0f482c054367972037dc1982d7b5e7ec46bdb4864679a240f616b9cafbe2a99a389a0f7d76daf5132e27546ea071a80e6d1e35b62955;nortss
const { ApolloServer, gql } = require("apollo-server-lambda");
const AWS = require("aws-sdk");
const dynamoDb = new AWS.DynamoDB.DocumentClient();
const typeDefs = gql`
type Recipe {
recipeId: Int
recipeName: String
description: String
# Welcome to Serverless!
#
# This file is the main config file for your service.
# It's very minimal at this point and uses default values.
# You can always add more config options for more control.
# We've included some commented out config examples here.
# Just uncomment any of them to get that config option.
#
# For full config options, check the docs:
# docs.serverless.com
import React, { Component } from "react";
import {
StyleSheet,
View,
Text,
Image,
ImageBackground,
TouchableHighlight,
StyleProp,
TextStyle,
@alexxxmf
alexxxmf / gist:258e7893c08a9fffee8d15efcebabd38
Last active May 28, 2019 18:48
RecipeListScreen.test.js
import React from 'react';
import { mount, shallow } from 'enzyme';
import { View, TextInput, Image, Text } from 'react-native';
import toJSON from 'enzyme-to-json';
import { MockedProvider } from 'react-apollo/test-utils';
import renderer from 'react-test-renderer';
import wait from 'waait';
import { GET_RECIPIES_QUERY } from '../src/graphql/queries';
import RecipeListScreen, {RecipeListScreenWithoutHocs} from '../src/screens/RecipeListScreen';
import "react-app-polyfill/ie9"; // For IE 9-11 support
import "react-app-polyfill/ie11"; // For IE 11 support
import "./polyfill";
import React, { Component } from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import * as serviceWorker from "./serviceWorker";
import Amplify, { Auth } from "aws-amplify";
import { Authenticator, Greetings, SignUp, SignIn } from "aws-amplify-react";
@alexxxmf
alexxxmf / answers.js
Last active June 25, 2019 17:16
Answers
//ANSWER ======== A
/* Notes:
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
Here we can find in which cases we should expect a catch to be raised in the promise and when not. Seems like unless
there is a problem with the connection or bad formed url, we should expect an error to not be raised. Just an status code that reflects that
/*
const urls = [
"http://randomurl.com/subpath1",