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 ( | |
"encoding/json" | |
"fmt" | |
"reflect" | |
) | |
type User struct { | |
Username string `json:"user" db:"username"` |
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 ( | |
"fmt" | |
"github.com/bramvdbogaerde/go-scp" | |
"github.com/bramvdbogaerde/go-scp/auth" | |
"golang.org/x/crypto/ssh" | |
"os" | |
) |
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
// Standalone Http to Https redirector | |
// Credit: https://gist.github.com/d-schmidt/587ceec34ce1334a5e60 | |
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
) |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<title>htm Demo</title> | |
<script type="module"> | |
import { html, Component, render } from 'https://unpkg.com/htm/preact/standalone.mjs'; | |
class App extends Component { | |
constructor() { | |
super(); | |
this.Pi = 3.1416; |
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
<html> | |
<head> | |
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.min.js"></script> | |
<script type="text/javascript" src="js/jquery.serialize-object.min.js"></script> | |
<style> | |
* box-sizing {border-box} | |
body {background-color: tan} | |
.module {margin: 2px; padding-bottom: 0.3rem} | |
</style> | |
</head> |
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
// A Concurrency Pattern using Wait Groups and Buffered Channels | |
package main | |
import ( | |
"time" | |
"fmt" | |
"sync" | |
) | |
// Synopsis |
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 ( | |
"os" | |
"fmt" | |
"io/ioutil" | |
"strings" | |
"regexp" | |
"strconv" | |
"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
ackage main | |
import ( | |
"fmt" | |
"strings" | |
) | |
func main() { | |
str := "When not ok\t, val\tis 0" | |
fmt.Printf("%q\n", SplitAndTrim(str)) |
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 xmlparser | |
import ( | |
"os" | |
"golang.org/x/text/encoding/charmap" | |
"log" | |
"bytes" | |
"io" | |
"strings" | |
) |
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
# A Pattern for Custom Exception types | |
module Orders | |
class OrdersError < StandardError; end | |
class OrdersLineItemError < OrdersError | |
def message | |
'There was a line item error.' | |
end | |
end |
NewerOlder