Skip to content

Instantly share code, notes, and snippets.

@cespare
cespare / main.go
Created February 20, 2013 03:05
Example of testing Go HTTP servers using httptest.Server.
package main
import (
"log"
"myserver"
"net/http"
)
const addr = "localhost:12345"
@Ulv
Ulv / pre-commit
Created February 25, 2014 09:33
git pre-commit hook - backup mysql database on every commit
#!/usr/bin/bash
# бэкап mysql базы при каждом коммите
FILENAME=/home/www/intinity/klumbariy/db/`date +%d-%m-%Y-%H-%I-%S`.mysql
mysqldump intinity_klumba -u klumba \
-p2UDRyHqedqnSfFfW > ${FILENAME}
git add $FILENAME
@sourcec0de
sourcec0de / init-dl-js.md
Last active August 30, 2018 15:12
Initiating downloads in javascript

Downloads in javascript

Method 1

Use this method when viewing images or textual data. It allows you to open it in a seperate window. This will cause a popup blocker to react.

window.open(url,'_blank');
@mikeatlas
mikeatlas / .golang-example-gitlab-ci.yml
Last active February 2, 2024 08:08
Example Go GitLab CI setup (no root/sudo required)
# See docs/examples
# http://doc.gitlab.com/ce/ci/quick_start/README.html
# http://doc.gitlab.com/ce/ci/yaml/README.html
# GitLab CI template for Go tests. Note this installs
# a new working copy of Go in a non-standard path such
# that sudo/root is not needed for the install stage.
# note that this particular install-environment stage
# is overly verbose in order to debug anything tricky