Follow Go community standards:
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 characters
import "bytes" | |
// "Quote" a string in backticks so it can be safely used in a dynamic | |
// query as a field or table name. The returned string will be | |
// surrounded by backticks, and any backticks inside the string will | |
// escaped (by another backtick). | |
// | |
// For example, this won't work: | |
// db.Query("SELECT * FROM ?", "mytable") | |
// |
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 characters
// https://github.com/brnstz/algo | |
package fund | |
// Create an interface, steal ideas from part of core sort package. | |
type SearchSlice interface { | |
// Return true if val is less than value stored at index i | |
Less(val interface{}, i int) bool | |
// Return true if val is equal to value at index i | |
Equals(val interface{}, i int) bool |
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 characters
// https://github.com/brnstz/algo | |
package sorting | |
import ( | |
// Import the core sort package to use its interface, which declares | |
// Len(), Less(), and Swap() | |
"sort" | |
) | |
func InsertionSort(a sort.Interface) { |
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 characters
// https://github.com/brnstz/algo | |
package sorting_test | |
import ( | |
"algo/sorting" | |
"fmt" | |
"io" | |
"os" | |
"sort" |
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 characters
// https://github.com/brnstz/algo | |
package sorting | |
import ( | |
"sort" | |
) | |
// Expand sort.Interface to include the ability to swap via aux | |
type Interface interface { | |
// Set self[i] = other[j] |
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 characters
// https://github.com/brnstz/algo | |
package sorting_test | |
import ( | |
"algo/sorting" | |
"fmt" | |
"io" | |
"os" | |
"testing" |
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 characters
package sorting | |
import ( | |
"math/rand" | |
"sort" | |
"time" | |
) | |
// Run a simple implementation of Quicksort on an incoming | |
// sort.Interface value |
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 characters
package main | |
import ( | |
"errors" | |
"fmt" | |
"net/http" | |
) | |
var noRedirect = errors.New("no redirect") |
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 characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"log" | |
"github.com/brnstz/routine/wikimg" | |
) |
OlderNewer