First, let's try just iterating through the list as we delete:
Here we're trying to remove all the numbers in our list under 3.
mylist = [1, 2, 3, 4, 5]
for item in mylist:
if item < 3:
mylist.remove(item)
First, let's try just iterating through the list as we delete:
Here we're trying to remove all the numbers in our list under 3.
mylist = [1, 2, 3, 4, 5]
for item in mylist:
if item < 3:
mylist.remove(item)
class PollingBase { | |
poll = async ({ fn, validate, interval, maxAttempts = 10 }) => { | |
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) | |
for (let attempts = 0; attempts < maxAttempts; attempts++) { | |
try { | |
const result = await fn() | |
if (validate(result)) { | |
return result |
#!/usr/bin/env python3 | |
import sys | |
import json | |
import requests | |
slack_url = "https://hooks.slack.com/services/<webhook URL>" | |
def get_subject(lines): | |
try: |
cmake_minimum_required(VERSION 3.5) | |
project(Test) | |
set(the_target "Test") | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | |
# CUDA | |
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake/cuda" ${CMAKE_MODULE_PATH}) | |
FIND_PACKAGE(CUDA) | |
LIST(APPEND CUDA_NVCC_FLAGS "-arch=compute_30") |
import React from 'react' | |
import useCustomScrollbars, { scrollbarWidth } from './useCustomScrollbars' | |
const Container = React.forwardRef(({ bg, children, ...props }, ref) => { | |
const [localRef, scrollbarsShown, scrollbarStyles] = useCustomScrollbars( | |
children, | |
ref, | |
bg | |
) |
from gensim.models import Phrases | |
from nltk.tokenize import word_tokenize | |
creed = """This is my rifle. There are many like it, but this one is mine. | |
My rifle is my best friend. It is my life. I must master it as I must master my life. | |
My rifle, without me, is useless. Without my rifle, I am useless. I must fire my rifle true. I must shoot straighter than my enemy who is trying to kill me. I must shoot him before he shoots me. I will... | |
My rifle and I know that what counts in war is not the rounds we fire, the noise of our burst, nor the smoke we make. We know that it is the hits that count. We will hit... | |
My rifle is human, even as I, because it is my life. Thus, I will learn it as a brother. I will learn its weaknesses, its strength, its parts, its accessories, its sights and its barrel. I will keep my rifle clean and ready, even as I am clean and ready. We will become part of each other. We will... | |
Before God, I swear this creed. My rifle and I are the defenders of my country. We are the masters of our ene |
version: 2 | |
jobs: | |
build: | |
working_directory: ~/repo | |
docker: | |
- image: circleci/node:10 | |
steps: | |
- checkout | |
- run: |
d3.select('#path4').node().getTotalLength() |