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/json" | |
"fmt" | |
"net/http" | |
"io" | |
"io/ioutil" | |
"strconv" | |
"time" |
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 ( | |
mux "github.com/julienschmidt/httprouter" | |
) | |
type Route struct { | |
Method string | |
Path string | |
Handle mux.Handle // httprouter package as mux |
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 "time" | |
// User | |
type User struct { | |
Id int `json:"id"` | |
Username string `json:"username"` | |
Email string `json:"email"` | |
} |
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/json" | |
"fmt" | |
) | |
type Person struct { | |
Name string | |
Age int |
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
class Circle { | |
var radius: Double | |
init(radius: Double) { | |
self.radius = radius | |
} | |
} | |
class Square { | |
var sideLength: Double |
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
import Darwin | |
class Circle { | |
var radius: Double | |
// contructor | |
init(radius: Double) { | |
self.radius = radius | |
} | |
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
// Register firebase module | |
var app = angular.module("app", ["firebase"]); | |
// Set up controller function | |
app.controller("Ctrl", function($scope, $firebase) { | |
var firebaseRef = new Firebase( | |
// Replace this fictional URL with your own | |
"https://burning-limbo-6666.firebaseio.com/colors" | |
); | |
// create an AngularFire ref to the data |
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
<!DOCTYPE html> | |
<!--Directive--> | |
<html ng-app="app"> | |
<head> | |
</head> | |
<!--Controller--> | |
<body ng-controller="Ctrl"> | |
<div class="header"> | |
<!--Style--> | |
<h1 ng-style="{'background-color': 'rgb(' + data.r + ',' + data.g + ',' + data.b +')'}"> |
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 Firebase = require("firebase"); | |
var express = require("express"); | |
// Create HTTP Server | |
var app = express(); | |
var server = require("http").createServer(app); | |
// Attach Socket.io server | |
var io = require("socket.io")(server); | |
// Indicate port 3000 as host | |
var port = process.env.PORT || 3000; |
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 Firebase = require("firebase"); | |
var five = require("johnny-five"); | |
// Create a new reference of Firebase db | |
var firebaseRef = new Firebase( | |
// fictional URL, replace it with your own from Firebase | |
"https://burning-limbo-6666.firebaseio.com/colors" | |
); | |
five.Board().on("ready", function() { |