Skip to content

Commit ab4f483

Browse files
committed
cronch time
1 parent 80339e0 commit ab4f483

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+30879
-204
lines changed

Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ gem 'pry'
1111
gem 'sinatra'
1212
gem 'shotgun'
1313
gem 'rest-client'
14+
gem 'firebase'
15+
gem 'twilio-ruby'

Gemfile.lock

+37
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,52 @@ GEM
1212
i18n (>= 0.7, < 2)
1313
minitest (~> 5.1)
1414
tzinfo (~> 1.1)
15+
addressable (2.5.2)
16+
public_suffix (>= 2.0.2, < 4.0)
1517
arel (9.0.0)
1618
coderay (1.1.2)
1719
concurrent-ruby (1.0.5)
1820
domain_name (0.5.20180417)
1921
unf (>= 0.0.5, < 1.0.0)
22+
faraday (0.15.3)
23+
multipart-post (>= 1.2, < 3)
24+
firebase (0.2.8)
25+
googleauth
26+
httpclient (>= 2.5.3)
27+
json
28+
googleauth (0.6.6)
29+
faraday (~> 0.12)
30+
jwt (>= 1.4, < 3.0)
31+
memoist (~> 0.12)
32+
multi_json (~> 1.11)
33+
os (>= 0.9, < 2.0)
34+
signet (~> 0.7)
2035
http-cookie (1.0.3)
2136
domain_name (~> 0.5)
37+
httpclient (2.8.3)
2238
i18n (1.1.0)
2339
concurrent-ruby (~> 1.0)
40+
json (2.1.0)
41+
jwt (2.1.0)
42+
memoist (0.16.0)
2443
method_source (0.9.0)
2544
mime-types (3.2.2)
2645
mime-types-data (~> 3.2015)
2746
mime-types-data (3.2018.0812)
47+
mini_portile2 (2.3.0)
2848
minitest (5.11.3)
49+
multi_json (1.13.1)
50+
multipart-post (2.0.0)
2951
mustermann (1.0.3)
3052
netrc (0.11.0)
53+
nokogiri (1.8.5)
54+
mini_portile2 (~> 2.3.0)
55+
os (1.0.0)
3156
pg (1.1.3)
3257
pry (0.11.3)
3358
coderay (~> 1.1.0)
3459
method_source (~> 0.9.0)
60+
public_suffix (3.0.3)
3561
rack (2.0.5)
3662
rack-protection (2.0.4)
3763
rack
@@ -42,6 +68,11 @@ GEM
4268
netrc (~> 0.8)
4369
shotgun (0.9.2)
4470
rack (>= 1.0)
71+
signet (0.11.0)
72+
addressable (~> 2.3)
73+
faraday (~> 0.9)
74+
jwt (>= 1.5, < 3.0)
75+
multi_json (~> 1.10)
4576
sinatra (2.0.4)
4677
mustermann (~> 1.0)
4778
rack (~> 2.0)
@@ -52,6 +83,10 @@ GEM
5283
sinatra (>= 1.0)
5384
thread_safe (0.3.6)
5485
tilt (2.0.8)
86+
twilio-ruby (5.14.1)
87+
faraday (~> 0.9)
88+
jwt (>= 1.5, <= 2.5)
89+
nokogiri (>= 1.6, < 2.0)
5590
tzinfo (1.2.5)
5691
thread_safe (~> 0.1)
5792
unf (0.1.4)
@@ -62,13 +97,15 @@ PLATFORMS
6297
ruby
6398

6499
DEPENDENCIES
100+
firebase
65101
pg
66102
pry
67103
rake
68104
rest-client
69105
shotgun
70106
sinatra
71107
sinatra-activerecord
108+
twilio-ruby
72109

73110
BUNDLED WITH
74111
1.16.6

app.rb

+24-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
11
Bundler.require
22
require "sinatra"
3+
# require 'twilio-ruby'
4+
35

46
class MyApp < Sinatra::Base
57
get '/' do
6-
erb :index
8+
erb :index1
9+
end
10+
11+
get '/landing' do
12+
@message = "Message: "
13+
erb :landing
14+
end
15+
16+
post '/sent' do
17+
@message = params["message"].to_s
18+
@message = @message[8..-1]
19+
puts @message
20+
send(@message)
21+
22+
@reciepient = "(831) 578-7881"
23+
@message = message.sid
24+
erb :sent
25+
end
26+
27+
get '/help' do
28+
erb :help
729
end
8-
end
30+
end

curl-7.57.0-1.aix5.1.ppc.rpm

1.63 MB
Binary file not shown.
7.96 KB
Loading

public/WebGazer_Demo_files/Pizza.png

7.51 KB
Loading

public/WebGazer_Demo_files/Send.png

7.21 KB
Loading

public/WebGazer_Demo_files/Soup.png

7.91 KB
Loading

public/WebGazer_Demo_files/Sushi.png

9.8 KB
Loading

public/WebGazer_Demo_files/Water.png

9.01 KB
Loading

public/WebGazer_Demo_files/bootstrap.min.css

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/WebGazer_Demo_files/bootstrap.min.js

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+153
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
var PointCalibrate = 0;
2+
var CalibrationPoints={};
3+
4+
/**
5+
* Clear the canvas and the calibration button.
6+
*/
7+
function ClearCanvas(){
8+
$(".Calibration").hide();
9+
var canvas = document.getElementById("plotting_canvas");
10+
canvas.getContext('2d').clearRect(0, 0, canvas.width, canvas.height);
11+
}
12+
13+
/**
14+
* Show the instruction of using calibration at the start up screen.
15+
*/
16+
function PopUpInstruction(){
17+
ClearCanvas();
18+
swal({
19+
title:"Calibration",
20+
text: "Please click on each of the 9 points on the screen. You must click on each point 5 times till it goes yellow. This will calibrate your eye movements.",
21+
buttons:{
22+
cancel: false,
23+
confirm: true
24+
}
25+
}).then(isConfirm => {
26+
ShowCalibrationPoint();
27+
});
28+
29+
}
30+
/**
31+
* Show the help instructions right at the start.
32+
*/
33+
function helpModalShow() {
34+
$('#helpModal').modal('show');
35+
}
36+
37+
function fuck() {
38+
document.getElementById("stuff").hidden = false;
39+
document.getElementById("yeet").hidden = true;
40+
console.log("HI LYDIA");
41+
}
42+
/**
43+
* Load this function when the index page starts.
44+
* This function listens for button clicks on the html page
45+
* checks that all buttons have been clicked 5 times each, and then goes on to measuring the precision
46+
*/
47+
$(document).ready(function(){
48+
ClearCanvas();
49+
helpModalShow();
50+
$(".Calibration").click(function(){ // click event on the calibration buttons
51+
52+
var id = $(this).attr('id');
53+
54+
if (!CalibrationPoints[id]){ // initialises if not done
55+
CalibrationPoints[id]=0;
56+
}
57+
CalibrationPoints[id]++; // increments values
58+
59+
if (CalibrationPoints[id]==5){ //only turn to yellow after 5 clicks
60+
$(this).css('background-color','yellow');
61+
$(this).prop('disabled', true); //disables the button
62+
PointCalibrate++;
63+
}else if (CalibrationPoints[id]<5){
64+
//Gradually increase the opacity of calibration points when click to give some indication to user.
65+
var opacity = 0.2*CalibrationPoints[id]+0.2;
66+
$(this).css('opacity',opacity);
67+
}
68+
69+
//Show the middle calibration point after all other points have been clicked.
70+
if (PointCalibrate == 8){
71+
$("#Pt5").show();
72+
}
73+
74+
if (PointCalibrate >= 9){ // last point is calibrated
75+
//using jquery to grab every element in Calibration class and hide them except the middle point.
76+
$(".Calibration").hide();
77+
$("#Pt5").show();
78+
79+
// clears the canvas
80+
var canvas = document.getElementById("plotting_canvas");
81+
canvas.getContext('2d').clearRect(0, 0, canvas.width, canvas.height);
82+
83+
// notification for the measurement process
84+
swal({
85+
title: "Calculating measurement",
86+
text: "Please don't move your mouse & stare at the middle dot for the next 5 seconds. This will allow us to calculate the accuracy of our predictions.",
87+
closeOnEsc: false,
88+
allowOutsideClick: false,
89+
closeModal: true
90+
}).then( isConfirm => {
91+
92+
// makes the variables true for 5 seconds & plots the points
93+
$(document).ready(function(){
94+
95+
store_points_variable(); // start storing the prediction points
96+
97+
sleep(5000).then(() => {
98+
stop_storing_points_variable(); // stop storing the prediction points
99+
var past50 = get_points() // retrieve the stored points
100+
var precision_measurement = calculatePrecision(past50);
101+
var accuracyLabel = "<a>Accuracy | "+precision_measurement+"%</a>";
102+
document.getElementById("Accuracy").innerHTML = accuracyLabel; // Show the accuracy in the nav bar.
103+
swal({
104+
title: "Your accuracy measure is " + precision_measurement + "%",
105+
allowOutsideClick: false,
106+
buttons: {
107+
cancel: "Recalibrate",
108+
confirm: true,
109+
}
110+
}).then(isConfirm => {
111+
if (isConfirm){
112+
//clear the calibration & hide the last middle button
113+
ClearCanvas();
114+
fuck();
115+
} else {
116+
//use restart function to restart the calibration
117+
ClearCalibration();
118+
ClearCanvas();
119+
ShowCalibrationPoint();
120+
}
121+
});
122+
});
123+
});
124+
});
125+
}
126+
});
127+
});
128+
129+
/**
130+
* Show the Calibration Points
131+
*/
132+
function ShowCalibrationPoint() {
133+
$(".Calibration").show();
134+
$("#Pt5").hide(); // initially hides the middle button
135+
}
136+
137+
/**
138+
* This function clears the calibration buttons memory
139+
*/
140+
function ClearCalibration(){
141+
window.localStorage.clear();
142+
$(".Calibration").css('background-color','red');
143+
$(".Calibration").css('opacity',0.2);
144+
$(".Calibration").prop('disabled',false);
145+
146+
CalibrationPoints = {};
147+
PointCalibrate = 0;
148+
}
149+
150+
// sleep function because java doesn't have one, sourced from http://stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep
151+
function sleep (time) {
152+
return new Promise((resolve) => setTimeout(resolve, time));
153+
}
208 KB
Loading

public/WebGazer_Demo_files/jquery.min.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/WebGazer_Demo_files/main.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
window.onload = function() {
2+
3+
//start the webgazer tracker
4+
webgazer.setRegression('ridge') /* currently must set regression and tracker */
5+
.setTracker('clmtrackr')
6+
.setGazeListener(function(data, clock) {
7+
// console.log(data); /* data is an object containing an x and y key which are the x and y prediction coordinates (no bounds limiting) */
8+
// console.log(clock); /* elapsed time in milliseconds since webgazer.begin() was called */
9+
})
10+
.begin()
11+
.showPredictionPoints(true); /* shows a square every 100 milliseconds where current prediction is */
12+
13+
14+
//Set up the webgazer video feedback.
15+
var setup = function() {
16+
17+
//Set up the main canvas. The main canvas is used to calibrate the webgazer.
18+
var canvas = document.getElementById("plotting_canvas");
19+
canvas.width = window.innerWidth;
20+
canvas.height = window.innerHeight;
21+
canvas.style.position = 'fixed';
22+
};
23+
24+
function checkIfReady() {
25+
if (webgazer.isReady()) {
26+
setup();
27+
} else {
28+
setTimeout(checkIfReady, 100);
29+
}
30+
}
31+
setTimeout(checkIfReady,100);
32+
};
33+
34+
window.onbeforeunload = function() {
35+
//webgazer.end(); //Uncomment if you want to save the data even if you reload the page.
36+
window.localStorage.clear(); //Comment out if you want to save data across different sessions
37+
}
38+
39+
/**
40+
* Restart the calibration process by clearing the local storage and reseting the calibration point
41+
*/
42+
function Restart(){
43+
document.getElementById("Accuracy").innerHTML = "<a>Not yet Calibrated</a>";
44+
ClearCalibration();
45+
PopUpInstruction();
46+
console.log("cghdhgfg");
47+
}
48+
function fuck() {
49+
document.getElementById("stuff").hidden = false;
50+
console.log("HI LYDIA");
51+
}

0 commit comments

Comments
 (0)