-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Scott Miller <[email protected]>
- Loading branch information
Showing
11 changed files
with
65 additions
and
81 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,4 @@ | |
<div class="flex w-full justify-center pt-5"> | ||
<%== pagy_nav(@pagy) if @pagy.count > 10 %> | ||
</div> | ||
</div> | ||
|
||
|
||
|
||
|
||
|
||
</div> |
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,18 @@ | ||
|
||
user = User.create!(email: '[email protected]', password: '12345678', uuid: SecureRandom.uuid, role: 'admin') | ||
snippet_uuid = SecureRandom.uuid | ||
snippet = Snippet.create!(name: 'Ruby sample', description: 'demo of Ruby highlighting', content: "# | ||
# Function to evaluate a polynomial at x. The polynomial is given | ||
# as a list of coefficients, from the greatest to the least. | ||
def polyval(x, coef) | ||
sum = 0 | ||
coef = coef.clone # Don't want to destroy the original | ||
while true | ||
sum += coef.shift # Add and remove the next coef | ||
break if coef.empty? # If no more, done entirely. | ||
sum *= x # This happens the right number of times. | ||
end | ||
return sum | ||
end", uuid: snippet_uuid, parent_uuid: snippet_uuid, user_id: user.id, visibility: 'org', language: 'ruby') | ||
snippet = Snippet.create!(name: 'Ruby sample', description: 'demo of Ruby highlighting', content: "# VERSION 2 | ||
# Function to evaluate a polynomial at x. The polynomial is given | ||
# as a list of coefficients, from the greatest to the least. | ||
def polyval(x, coef) | ||
sum = 0 | ||
coef = coef.clone # Don't want to destroy the original | ||
while true | ||
sum += coef.shift # Add and remove the next coef | ||
break if coef.empty? # If no more, done entirely. | ||
sum *= x # This happens the right number of times. | ||
end | ||
return sum | ||
end", uuid: SecureRandom.uuid, parent_uuid: snippet_uuid, user_id: user.id, visibility: 'org', language: 'ruby', version: 2) | ||
snippet = Snippet.create!(name: 'Hello World in Ruby', description: 'demo of Ruby highlighting', content: "# Hello World in Ruby | ||
puts \"Hello World!\"", uuid: snippet_uuid, parent_uuid: snippet_uuid, user_id: user.id, visibility: 'org', language: 'ruby') | ||
snippet = Snippet.create!(name: 'Hello World in Ruby 2', description: 'demo of Ruby highlighting', content: "# VERSION 2 | ||
# Hello World in Ruby | ||
puts \"Hello World!\"", uuid: SecureRandom.uuid, parent_uuid: snippet_uuid, user_id: user.id, visibility: 'org', language: 'ruby', version: 2) | ||
snippet_uuid = SecureRandom.uuid | ||
snippet = Snippet.create!(name: 'Golang code', description: 'A sample of Go code', content: "// Prime Sieve in Go. | ||
// Taken from the Go specification. | ||
// Copyright © The Go Authors. | ||
snippet = Snippet.create!(name: 'Hello World in Go', description: 'A sample of Go code', content: "// Hello world in Go | ||
package main | ||
import \"fmt\" | ||
// Send the sequence 2, 3, 4, ... to channel 'ch'. | ||
func generate(ch chan<- int) { | ||
for i := 2; ; i++ { | ||
ch <- i // Send 'i' to channel 'ch' | ||
} | ||
} | ||
// Copy the values from channel 'src' to channel 'dst', | ||
// removing those divisible by 'prime'. | ||
func filter(src <-chan int, dst chan<- int, prime int) { | ||
for i := range src { // Loop over values received from 'src'. | ||
if i%prime != 0 { | ||
dst <- i // Send 'i' to channel 'dst'. | ||
} | ||
} | ||
} | ||
// The prime sieve: Daisy-chain filter processes together. | ||
func sieve() { | ||
ch := make(chan int) // Create a new channel. | ||
go generate(ch) // Start generate() as a subprocess. | ||
for { | ||
prime := <-ch | ||
fmt.Print(prime, \"\n\") | ||
ch1 := make(chan int) | ||
go filter(ch, ch1, prime) | ||
ch = ch1 | ||
} | ||
} | ||
func main() { | ||
sieve() | ||
fmt.Printf(\"Hello World\n\") | ||
} | ||
", uuid: snippet_uuid, parent_uuid: snippet_uuid, user_id: user.id, visibility: 'org', language: 'go') |