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
this is just my code |
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
# Call scopes directly from your URL params: | |
# | |
# @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
module Filterable | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# Call the class methods with the same name as the keys in <tt>filtering_params</tt> | |
# with their associated values. Most useful for calling named scopes from |
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 apiKey = '45173502'; | |
var sessionId = "#{@room.session_id}" | |
var token = '#{@opentTok_token}'; | |
// Create a session object | |
var session = OT.initSession(apiKey, sessionId); | |
// connect to the session | |
session.connect(token, function(error) { | |
if (error) { |
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
#rooms_controller.rb | |
def show | |
@room = Room.find(params[:id]) | |
@opentTok_token = @opentok.generate_token @room.session_id | |
end |
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
//To send messages | |
var txtMsg = document.querySelector("#txtMsg") | |
$("#txtMsg").keydown(function(event){ | |
if(event.keyCode == 13){ | |
session.signal({ | |
type: "chat", | |
data: txtMsg.value | |
}, function(error){ | |
if(error){ |
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
//To make this work include the RTCMulticonnection.js file | |
//create a connection object to handle the sending procress of a file. | |
var connection = new RTCMultiConnection(); | |
document.getElementById('files').onchange = function() { | |
var file = this.files[0]; | |
connection.send(file); | |
}; |
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
<script src="~/lib/swagger-client.js" type='text/javascript'></script> | |
<script type="text/javascript"> | |
$(document).ready(function () { | |
// initialize swagger, point to a resource listing | |
window.swagger = new SwaggerClient({ | |
url: "http://api.wordnik.com/v4/resources.json", | |
success: function () { | |
swagger.apis.account.getLoggedInUser({username: 'myusername', password: 'mypass'}, function(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
var BitcoinPrices = []; | |
function countdown() { | |
var count = 10; | |
setInterval(function() { | |
count--; | |
//display the countdown timer to UI | |
$('#cdDiv').html(count); |
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 BitcoinPrices = []; | |
$(document).ready(function() { | |
var priceIntervalStream = Rx.Observable.interval(1000).flatMap(function (param){ | |
$('#cdDiv').html(param); | |
return getPriceStream(); | |
}); | |
priceIntervalStream.subscribe(function(x){ | |
$('#lbl-price').html(x.data.total.amount); | |
BitcoinPrices.push(x.data.total.amount); |
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
let BitcoinPrices = []; | |
$(document).ready(function() { | |
let priceIntervalStream = Rx.Observable.interval(1000).flatMap( param => { | |
$('#cdDiv').html(param); | |
return getPriceStream(); | |
}); | |
priceIntervalStream.subscribe( x => { | |
$('#lbl-price').html(x.data.total.amount); | |
BitcoinPrices.push(x.data.total.amount); |
OlderNewer