Golang 'range' method returns 2 values (index, value)
package main
import (
"fmt"
)
func main(){
Ref: https://docs.docker.com/opensource/project/set-up-dev-env/#task-3-make-a-code-change | |
Connecting to an existing setup: | |
Start virtual machine | |
docker-machine start dp-vm | |
Check docker machine status | |
docker-machine status dp-vm | |
Change directory to moby |
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'activerecord', '4.2.8' | |
gem 'mysql2', '0.4.5' | |
gem 'byebug' | |
GEMFILE | |
system 'bundle install' | |
end |
function makeRequest (opts) { | |
return new Promise(function (resolve, reject) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open(opts.method, opts.url); | |
xhr.onload = function () { | |
if (this.status >= 200 && this.status < 300) { | |
resolve(xhr.response); | |
} else { | |
reject({ | |
status: this.status, |
Golang 'range' method returns 2 values (index, value)
package main
import (
"fmt"
)
func main(){
version: '2' | |
services: | |
db: | |
image: mysql:5.7 | |
restart: always | |
environment: | |
MYSQL_USER: root | |
MYSQL_PASSWORD: '' | |
MYSQL_DATABASE: 'noteapp_development' | |
ports: |
SSH to docker-machine with 'docker-machine ssh <machine-name>' | |
Run below commands for installing docker-compose. | |
curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > ./docker-compose | |
sudo mv ./docker-compose /usr/bin/docker-compose | |
sudo chmod +x /usr/bin/docker-compose |
Downloading and installing. | |
curl -L https://github.com/docker/machine/releases/download/v0.10.0/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine && chmod +x /usr/local/bin/docker-machine | |
Adding VBox dependency | |
brew cask install virtualbox | |
Creating a new machine. 'default' would be the name of the machine. | |
docker-machine create --driver default | |
Listing the machines. |
1) add gem | |
2) create vendor directory, and download script | |
3) configure application.rb | |
4) write js that points the trigger to the displayer | |
5) ensure the trigger has the correct jquery selector | |
6) ensure the displayer has the correct jquery selector | |
1) add gem | |
gem 'rack-pjax' |
require 'oauth2' | |
# on the initial action. | |
# Get the client_id and client_secret for your app from | |
# from the developer console of the app to be authenticated. | |
client = OAuth2::Client.new('client_id', 'client_secret', :authorize_url => '/o/oauth2/auth' ,:site =>'https://accounts.google.com') | |
# The redirect uri is the endpoint on our app which can | |
# take the code/access_token sent for further access. | |
a_url = client.auth_code.authorize_url(:redirect_uri => 'http://localhost:8080/oauth2/callback') |