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" | |
| "reflect" | |
| ) | |
| type Foo struct { | |
| FirstName string `tag_name:"tag 1"` | |
| LastName string `tag_name:"tag 2"` |
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
| var gulp = require('gulp'); | |
| var connect = require('gulp-connect'); | |
| var livereload = require('gulp-livereload'); | |
| var watch = require('gulp-watch'); | |
| gulp.task('connect', function() { | |
| connect.server({ | |
| root : __dirname | |
| }); | |
| }); |
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
| var gulp = require('gulp'); | |
| var livereload = require('gulp-livereload'); | |
| var watch = require('gulp-watch'); | |
| var http = require('http'); | |
| var ecstatic = require('ecstatic'); | |
| gulp.task('default', function() { | |
| http.createServer( | |
| ecstatic({ root: __dirname }) | |
| ).listen(8000); |
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 ( | |
| "bytes" | |
| "fmt" | |
| "log" | |
| "os/exec" | |
| "strconv" | |
| ) |
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
| str := fmt.Sprintf(`{"key": "%s", "message": {"html": "%s", "text": "%s", "subject": "%s", "from_email": "%s", "from_name": "%s", "to": [ { "email": "%s", "name": "%s", "type": "%s" }]}}`, | |
| s.Key, | |
| s.Message.Html, | |
| s.Message.Text, | |
| s.Message.Subject, | |
| s.Message.FromEmail, | |
| s.Message.FromName, | |
| s.Message.To[i].Email, | |
| s.Message.To[i].Name, | |
| s.Message.To[i].RType) |
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
| config(function($httpProvider) { | |
| $httpProvider.interceptors.push('cacheSlayer'); | |
| }) | |
| .factory('cacheSlayer', function($injector, $q) { | |
| return { | |
| request: function(config) { | |
| if (config.method === 'GET' && /^\/api/.test(config.url)) { | |
| var sep = config.url.indexOf('?') === -1 ? '?' : '&'; | |
| config.url = config.url + sep + 'cacheSlayer=' + new Date().getTime(); | |
| } |
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
| // Intercepting HTTP calls with AngularJS. | |
| angular.module('MyApp', []) | |
| .config(function ($provide, $httpProvider) { | |
| // Intercept http calls. | |
| $provide.factory('MyHttpInterceptor', function ($q) { | |
| return { | |
| // On request success | |
| request: function (config) { | |
| // console.log(config); // Contains the data about the request before it is sent. |
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 event | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "net/http/httptest" | |
| "testing" | |
| "github.com/stretchr/testify/suite" |
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 utils | |
| func Slugify(title string) string { | |
| var slug []byte | |
| for _, x := range title { | |
| switch { | |
| case ('a' <= x && x <= 'z') || ('0' <= x && x <= '9'): | |
| slug = append(slug, byte(x)) | |
| case 'A' <= x && x <= 'Z': |
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/xml" | |
| "net/http" | |
| "net/url" | |
| "fmt" | |
| "strings" | |
| "io/ioutil" | |
| "encoding/json" |