A simple example of using CGO in Golang.
- Go
- GCC
- Install mingw-w64:
- https://sourceforge.net/projects/mingw-w64/
A simple example of using CGO in Golang.
dcleanup(){ | |
docker rm -v $(docker ps --filter status=exited -q 2>/dev/null) 2>/dev/null | |
docker rmi $(docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null | |
} | |
dcleanup() |
package main | |
import ( | |
"encoding/base64" | |
"net/http" | |
"strings" | |
) | |
type handler func(w http.ResponseWriter, r *http.Request) |
// Loads all modules in tasks directory. | |
require('fs') | |
.readdirSync(__dirname + '/tasks').forEach(function(file) { | |
if (file.match(/\.js$/) !== null) { | |
var name = file.replace('.js', ''); | |
require('./tasks/' + name)(gulp, config); | |
} | |
}); |
var gulp = require('gulp'); | |
var gutil = require('gulp-util'); | |
var del = require('del'); | |
var rename = require('gulp-rename'); | |
var install = require('gulp-install'); | |
var zip = require('gulp-zip'); | |
var AWS = require('aws-sdk'); | |
var fs = require('fs'); | |
var runSequence = require('run-sequence'); |
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension | |
{ | |
// Settings | |
"passfail" : false, // Stop on first error. | |
"maxerr" : 100, // Maximum error before stopping. | |
// Predefined globals whom JSHint will ignore. | |
"browser" : true, // Standard browser globals e.g. `window`, `document`. |
var NodeCache = require('node-cache'); | |
var myCache = new NodeCache(); | |
var cache = { | |
/** Gets key from cache if exists, else sets the cache and returns data. | |
* @param {string} cacheKey - Key to get or set. | |
* @param {integer} timeout - Timeout (in seconds) for cache to release. | |
* @param {Function} fn - Function to get data if key does not exist. | |
* @param {Function} callback - Callback function to send back data or value. |
;(function($) { | |
// Plugin constructor with options and methods | |
var MainPlugin = function() { | |
var _self = this; | |
var _options = { | |
foo: "bar" | |
}; |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Ping.JS Demo</title> | |
<style> | |
ul span { | |
color: green; | |
} | |
</style> |
<html> | |
<head> | |
<title>Sample Widget Page</title> | |
</head> | |
<body> | |
<h1>Sample Widget Page</h1> | |
<script type="text/javascript" src="http://localhost:81/widget-bootstrap.js"></script> | |
<div id="widget-container"></div> |