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
package util | |
import ( | |
"bytes" | |
"text/template" | |
) | |
// Example: | |
// str := Tprintf("{{ .Thing }} a thing a do foo, bar", data) |
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
package foo | |
type Foo struct { | |
Field string `json:"field"` | |
} | |
// UnmarshalJSON is the implementation of the json.Unmarshaler interface. | |
func (t *Foo) UnmarshalJSON(data []byte) error { | |
type innerFoo Foo | |
inner := &innerFoo{ |
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
package main | |
import ( | |
"github.com/dwburke/xxxx/cmd" | |
) | |
func main() { | |
cmd.Execute() | |
} |
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
import "github.com/gin-gonic/gin" | |
func AllGinParams(c *gin.Context) gin.Params { | |
var params gin.Params | |
for _, p := range c.Params { | |
params = append(params, gin.Param{Key: p.Key, Value: p.Value}) | |
} | |
req := c.Request |
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
package api | |
import ( | |
"github.com/gin-gonic/gin" | |
endpoint_player "github.com/dwburke/addict-service/api/player" | |
) | |
func SetupRoutes(r *gin.Engine) { | |
endpoint_player.SetupRoutes(r) |
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
#include <string> | |
#include <sstream> | |
#include <vector> | |
#include <iterator> | |
template<typename Out> | |
void split(const std::string &s, char delim, Out result) { | |
std::stringstream ss(s); | |
std::string item; | |
while (std::getline(ss, item, delim)) { |
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
apiVersion: v1 | |
kind: PersistentVolume | |
metadata: | |
name: pv0001 | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
capacity: | |
storage: 8Gi | |
hostPath: |
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
class Pipe { | |
public: | |
Pipe() {}; | |
Pipe(char *command, char *mode) { | |
open(command, mode); | |
}; | |
~Pipe() { | |
if (pfp) | |
pclose(pfp); |
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
#pragma once | |
template <typename T, typename KEYT, typename... Args> | |
class Factory | |
{ | |
public: | |
template <typename TDerived> | |
void registerType(KEYT key) | |
{ | |
static_assert(std::is_base_of<T, TDerived>::value, "Factory::registerType doesn't accept this type because doesn't derive from base class"); |
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
#!/bin/bash | |
set -eu | |
die () { | |
echo >&2 "$@" | |
exit 1 | |
} | |
[ "$#" -eq 1 ] || die "Usage: $0 <username>" |
NewerOlder