Skip to content

Instantly share code, notes, and snippets.

//As you can see in the video, the issue happens because this.answer returns from an if condition in here:
// callManager.js
this.answer = function(callid, onSuccess, onFailure, isVideoEnabled, videoQuality){
var internalCall = calls[callid],
videoNegotationAvailable = this.isVideoNegotationAvailable(callid);
if(internalCall) {
// check if term side tries to answer an audio only call with video
if (videoNegotationAvailable === false && isVideoEnabled === true) {
@primableatom
primableatom / acts_as_aspector_on.rb
Last active August 29, 2015 14:08
Aspect Oriented Progamming for Ruby
# gives the ability to execute code before and after instance method,
# the methods on which to attach code can be passed declaritive using
# this marco
# class Foo
# acts_as_aspector_on :bar
#
# def bar
# puts "bar"
# end
#
@primableatom
primableatom / serialize_attr.rb
Created October 13, 2014 13:27
Serialize a field to use Postgres Hstore
# put this somewhere in the initializer
#ActiveSupport.on_load(:active_record) do
# include Extensions::ActiveRecord::SerializeAttr
#end
# usage
# class User < ActiveRecord::Base
# serialize_attr :settings # serialize this field to use hstore, defaults to JSON if pg isn't there
#end
@primableatom
primableatom / imageuploadfield.js
Last active August 2, 2020 11:30
Image upload field component for Extjs
/**
* This componet handles icon upload along with preview and drag drop.
* Usage: include it as xtype: 'imageuploadfield', including this field in a form requires us to submit it via a method submitWithImage instead of submit.
*/
Ext.define('SomeNameSpace.ImageUploadField', {
alias: 'widget.imageuploadfield',
extend: 'Ext.form.FieldContainer',
/**
class DynamicForm < ActiveRecord::Base
....
has_many :field_definitions, :dependent => :destroy
def build_field_definitions(definitions)
JSON.parse(definitions).each do |definition|
puts definition.class
self.field_definitions << FieldDefinition.new(extract_field_definition(definition))
end
end