Last active
          December 17, 2024 21:46 
        
      - 
      
 - 
        
Save VojtechVitek/00f8f22b0ab3ec221815fcd78f244edd to your computer and use it in GitHub Desktop.  
Revisions
- 
        
VojtechVitek revised this gist
Mar 26, 2019 . No changes.There are no files selected for viewing
 - 
        
VojtechVitek revised this gist
Mar 26, 2019 . 1 changed file with 10 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,17 +2,19 @@ package main import "fmt" func main() { slice := make([]int, 159) // Split the slice into batches of 20 items. batch := 20 for i := 0; i < len(slice); i += batch { j := i + batch if j > len(slice) { j = len(slice) } fmt.Println(slice[i:j]) // Process the batch. } // Try it at https://play.golang.org/p/mgd814w8xx6 }  - 
        
VojtechVitek created this gist
Apr 12, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ package main import "fmt" func main() { recipients := make([]int, 159) // Send 20 emails in parallel. batch := 20 for i := 0; i < len(recipients); i += batch { j := i + batch if j > len(recipients) { j = len(recipients) } fmt.Printf("recipients[%v:%v]\n", i, j) } }