start new:
tmux
start new with session name:
tmux new -s myname
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
var jsonStr = []byte(` | |
{ | |
"things": [ |
package main | |
import "fmt" | |
// Generate the input values passing through the go channel pipe | |
func generate(ch chan int) { | |
go func() { | |
for i := 2; ; i++ { | |
ch <- i | |
} |
http://angular.github.io/protractor/#/api
Note: Most commands return promises, so you only resolve their values through using jasmine expect API or using .then(function()) structure
Based on this post: https://spagettikoodi.wordpress.com/2015/01/14/angular-testing-cheat-sheet/ by @crystoll
browser.get('yoururl'); // Load address, can also use '#yourpage'
function extractPatterns(sample){ | |
var markers = {}; | |
sample.forEach(function(element, i){ | |
if(isNaN( Number(element) )){ | |
var parts = element.split(/(?=[A-Z])/); | |
parts.forEach(function(part){ | |
if(!markers[part]){ | |
markers[part] = []; | |
} | |
markers[part].push(i+1); |
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.
This is how the demonstration will load data:
a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';
b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.
This guide has moved to a GitHub repository to enable collaboration and community input via pull-requests.
https://github.com/alexellis/k8s-on-raspbian
Alex
We Gophers, love table-driven-tests, it makes our unittesting structured, and makes it easy to add different test cases with ease.
Let’s create our table driven test, for convenience, I chose to use t.Log
as the test function.
Notice that we don't have any assertion in this test, it is not needed to for the demonstration.
func TestTLog(t *testing.T) {
t.Parallel()
package main | |
import ( | |
"image/color" | |
"math/rand" | |
"time" | |
"github.com/faiface/pixel" | |
"github.com/faiface/pixel/imdraw" | |
"github.com/faiface/pixel/pixelgl" |