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 ( | |
"errors" | |
"fmt" | |
"go/parser" | |
"go/token" | |
"log" | |
"os" | |
"path/filepath" |
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
{ | |
"require": { | |
"guzzlehttp/guzzle": "~6.0" | |
} | |
} |
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 ( | |
"strings" | |
"testing" | |
) | |
func BenchmarkStringReverseBad(b *testing.B) { | |
b.ReportAllocs() |
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 | |
if [ -z "$1" ]; then | |
echo "Usage: $0 [start/stop]" | |
exit 1 | |
fi | |
function setup_database { | |
NAME="$1" | |
DOCKERFILE="titpetric/percona-xtrabackup" | |
docker run -d -h $NAME --name $NAME --net=party -e MYSQL_ROOT_PASSWORD="testing" $DOCKERFILE |
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
func parse(input io.Reader) (p *point, err error) { | |
// handle read errors | |
read := func(data interface{}) { | |
if err == nil { | |
err = binary.Read(input, binary.BigEndian, data) | |
} | |
} | |
p := &point{} | |
read(&p.Longitude) |
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
<blockquote class="tweet-this"> | |
<p><a href="http://twitter.com/intent/tweet?url={{ .Page.Permalink }}&text="{{ .Get 0 }}"&via=TitPetric" target="_blank">"{{ .Get 0 }}" via @TitPetric</a></p> | |
<a href="http://twitter.com/intent/tweet?url={{ .Page.Permalink }}&text="{{ .Get 0 }}"&via=TitPetric" target="_blank"><i class="fa fa-twitter"></i>Click to Tweet</a> | |
</blockquote> |
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
{{< tweet "Adding a \"Tweet this\" shortcode to Hugo, step-by-step tutorial" >}} |
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 | |
# | |
# You can set up sSMTP by setting the following ENV variables: | |
# | |
# SSMTP_TO - This is the address alarms will be delivered to. | |
# SSMTP_SERVER - This is your SMTP server. Defaults to smtp.gmail.com. | |
# SSMTP_PORT - This is the SMTP server port. Defaults to 587. | |
# SSMTP_USER - This is your username for the SMTP server. | |
# SSMTP_PASS - This is your password for the SMTP server. Use an app password if using Gmail. | |
# SSMTP_TLS - Use TLS for the connection. Defaults to YES. |
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
<?php | |
/** A poor mans GraphQL fields parser | |
* | |
* Try to convert graphQL fields to JSON and then just use json_decode to produce an array. | |
*/ | |
class Fields | |
{ | |
/** Parse GraphQL fields into an array */ | |
public static function parse($query) |
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
local ffi = require("ffi") | |
local awesome = ffi.load("./awesome.so") | |
ffi.cdef([[ | |
typedef long long GoInt64; | |
typedef unsigned long long GoUint64; | |
typedef GoInt64 GoInt; | |
typedef GoUint64 GoUint; | |
typedef double GoFloat64; |
NewerOlder