query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Explicitly disallow phi access in a specific area of code. This does not play nicely with the mutating versions of `allow_phi!` and `disallow_phi!` At the moment, this doesn't work at all, as the instance won't necessarily look at the classlevel stack when determining if PHI is allowed. &block [block] The block in which PHI access is explicitly disallowed.
def disallow_phi raise ArgumentError, 'block required. use disallow_phi! without block' unless block_given? __phi_stack.push({ phi_access_allowed: false }) yield if block_given? __phi_stack.pop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disallow_phi!\n raise ArgumentError, 'block not allowed. use disallow_phi with block' if block_given?\n\n message = __phi_stack.present? ? \"PHI access disabled for #{__user_id_string(__phi_stack)}\" : 'PHI access disabled. No class level access was granted.'\n\n __reset_phi_stack\n\n ...
[ "0.81640065", "0.803826", "0.72729397", "0.717562", "0.69629085", "0.67516845", "0.655199", "0.6528707", "0.6485129", "0.63645905", "0.616724", "0.5976554", "0.59646726", "0.5765009", "0.5614054", "0.555833", "0.53671205", "0.53032136", "0.5277344", "0.5171617", "0.51664096",...
0.8087484
1
Revoke all PHI access for this class, if enabled by PhiRecordallow_phi!
def disallow_phi! raise ArgumentError, 'block not allowed. use disallow_phi with block' if block_given? message = __phi_stack.present? ? "PHI access disabled for #{__user_id_string(__phi_stack)}" : 'PHI access disabled. No class level access was granted.' __reset_phi_stack PhiAttrs::Logger.tagged(PHI_ACCESS_LOG_TAG, name) do PhiAttrs::Logger.info(message) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disallow_phi!\n raise ArgumentError, 'block not allowed. use disallow_phi with block' if block_given?\n\n PhiAttrs::Logger.tagged(*phi_log_keys) do\n removed_access_for = self.class.__user_id_string(@__phi_access_stack)\n\n revoke_extended_phi!\n @__phi_access_stack = []\n\n ...
[ "0.68374854", "0.6675628", "0.63887876", "0.6320637", "0.6007623", "0.5952524", "0.5840026", "0.5692666", "0.5643324", "0.5577794", "0.5522264", "0.55016327", "0.5488599", "0.5460995", "0.54551697", "0.5425435", "0.53944206", "0.53864354", "0.5351043", "0.5305578", "0.5303501...
0.65287447
2
Revoke last PHI access for this class, if enabled by PhiRecordallow_phi!
def disallow_last_phi! raise ArgumentError, 'block not allowed' if block_given? removed_access = __phi_stack.pop message = removed_access.present? ? "PHI access disabled for #{removed_access[:user_id]}" : 'PHI access disabled. No class level access was granted.' PhiAttrs::Logger.tagged(PHI_ACCESS_LOG_TAG, name) do PhiAttrs::Logger.info(message) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disallow_last_phi!(preserve_extensions: false)\n raise ArgumentError, 'block not allowed' if block_given?\n\n PhiAttrs::Logger.tagged(*phi_log_keys) do\n removed_access = @__phi_access_stack.pop\n\n revoke_extended_phi! unless preserve_extensions\n message = removed_access.presen...
[ "0.6518896", "0.6509298", "0.6353209", "0.62505233", "0.610909", "0.6018111", "0.5942799", "0.59380364", "0.5820699", "0.57750565", "0.569153", "0.5575222", "0.5550095", "0.5430204", "0.54136413", "0.541358", "0.54036754", "0.5397172", "0.53721356", "0.5371745", "0.5363132", ...
0.6793201
0
Whether PHI access is allowed for this class
def phi_allowed? __phi_stack.present? && __phi_stack[-1][:phi_access_allowed] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phi_allowed?\n !phi_context.nil? && phi_context[:phi_access_allowed]\n end", "def has_access?\n true\n end", "def has_access?\n true\n end", "def has_privilege?\n has_all? || has_direct?\n end", "def require_phi!\n raise PhiAccessException, 'PHI Access required, please call...
[ "0.7995173", "0.6944365", "0.6944365", "0.6652554", "0.6504829", "0.6499465", "0.64774835", "0.638429", "0.63752407", "0.63752407", "0.63291174", "0.6298908", "0.62653935", "0.6237007", "0.62039125", "0.6203814", "0.6179676", "0.6158496", "0.6155603", "0.61355007", "0.6132566...
0.7715687
1
Get all method names to be wrapped with PHI access logging
def __phi_wrapped_methods excluded_methods = self.class.__phi_exclude_methods.to_a included_methods = self.class.__phi_include_methods.to_a attribute_names - excluded_methods + included_methods - [self.class.primary_key] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_names\n bindings.collect( &:inbound_name )\n end", "def inspect_methods\n return [] unless constant.respond_to?(:methods)\n\n methods = get_methods.map do |name|\n method_information(:method, name)\n end\n\n return methods.sort_by(&:name)\n end", "def inspect_me...
[ "0.65767586", "0.63391435", "0.63391435", "0.6330648", "0.6320547", "0.597802", "0.5966139", "0.5962135", "0.59499836", "0.59407777", "0.5924651", "0.5915819", "0.58986896", "0.5837323", "0.5833981", "0.5820685", "0.5820685", "0.57955", "0.5788368", "0.57745004", "0.573405", ...
0.53662825
89
Get all method names to be wrapped with PHI access extension
def __phi_extended_methods self.class.__phi_extend_methods.to_a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_names\n bindings.collect( &:inbound_name )\n end", "def interesting_methods\n em = extension_modules\n methods-[em.last ? em.last.methods : nil]-self.class.instance_methods\n end", "def inspect_methods\n return [] unless constant.respond_to?(:methods)\n\n methods...
[ "0.685645", "0.66179276", "0.64682573", "0.64682573", "0.64449006", "0.64125663", "0.63714683", "0.62222874", "0.6220768", "0.6179154", "0.61584693", "0.6147961", "0.6143348", "0.6143348", "0.6115024", "0.6104664", "0.61005366", "0.6097147", "0.6096961", "0.6070741", "0.60505...
0.6473883
2
Enable PHI access for a single instance of this class.
def allow_phi!(user_id = nil, reason = nil) raise ArgumentError, 'block not allowed. use allow_phi with block' if block_given? user_id ||= self.class.current_user reason ||= self.class.i18n_reason raise ArgumentError, 'user_id and reason cannot be blank' if user_id.blank? || reason.blank? PhiAttrs::Logger.tagged(*phi_log_keys) do @__phi_access_stack.push({ phi_access_allowed: true, user_id: user_id, reason: reason }) PhiAttrs::Logger.info("PHI Access Enabled for '#{user_id}': #{reason}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_phi\n # Disable PHI access by default\n @__phi_access_stack = []\n @__phi_methods_extended = Set.new\n @__phi_relations_extended = Set.new\n\n # Wrap attributes with PHI Logger and Access Control\n __phi_wrapped_methods.each { |m| phi_wrap_method(m) }\n __phi_extended_me...
[ "0.6503711", "0.60157526", "0.5888412", "0.56705296", "0.5275839", "0.5272819", "0.523849", "0.5006671", "0.49850884", "0.4902998", "0.48814306", "0.48665932", "0.4845151", "0.4806198", "0.47895586", "0.47890317", "0.47821018", "0.47678176", "0.47272968", "0.4694331", "0.4666...
0.52162623
7
Enable PHI access for a single instance of this class inside the block. Nested calls to allow_phi will log once per nested call
def allow_phi(user_id = nil, reason = nil, &block) get_phi(user_id, reason, &block) return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disallow_phi!\n raise ArgumentError, 'block not allowed. use disallow_phi with block' if block_given?\n\n message = __phi_stack.present? ? \"PHI access disabled for #{__user_id_string(__phi_stack)}\" : 'PHI access disabled. No class level access was granted.'\n\n __reset_phi_stack\n\n ...
[ "0.7399726", "0.7300517", "0.7009457", "0.6902059", "0.68666077", "0.6774093", "0.6770297", "0.6558845", "0.64915097", "0.6104912", "0.59926045", "0.5949733", "0.58070046", "0.5631842", "0.56299686", "0.5263379", "0.52136946", "0.50212485", "0.49686205", "0.48723674", "0.4833...
0.59859735
11
Enable PHI access for a single instance of this class inside the block. Returns whatever is returned from the block. Nested calls to get_phi will log once per nested call s
def get_phi(user_id = nil, reason = nil) raise ArgumentError, 'block required' unless block_given? extended_instances = @__phi_relations_extended.clone allow_phi!(user_id, reason) result = yield if block_given? new_extensions = @__phi_relations_extended - extended_instances disallow_last_phi!(preserve_extensions: true) revoke_extended_phi!(new_extensions) if new_extensions.any? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_phi\n # Disable PHI access by default\n @__phi_access_stack = []\n @__phi_methods_extended = Set.new\n @__phi_relations_extended = Set.new\n\n # Wrap attributes with PHI Logger and Access Control\n __phi_wrapped_methods.each { |m| phi_wrap_method(m) }\n __phi_extended_me...
[ "0.6707992", "0.6136941", "0.6083942", "0.60373497", "0.6015877", "0.59142756", "0.5908398", "0.55991167", "0.5379087", "0.53283715", "0.52458555", "0.5107322", "0.50837344", "0.5052187", "0.5049224", "0.5018223", "0.5003113", "0.48136827", "0.47590837", "0.47560441", "0.4726...
0.56929445
7
Revoke all PHI access for a single instance of this class.
def disallow_phi! raise ArgumentError, 'block not allowed. use disallow_phi with block' if block_given? PhiAttrs::Logger.tagged(*phi_log_keys) do removed_access_for = self.class.__user_id_string(@__phi_access_stack) revoke_extended_phi! @__phi_access_stack = [] message = removed_access_for.present? ? "PHI access disabled for #{removed_access_for}" : 'PHI access disabled. No instance level access was granted.' PhiAttrs::Logger.info(message) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revoke\n @session.do_rpc_endpoint('/revoke')\n nil\n end", "def destroy\n __log_activity(\"LOGOUT #{current_user}\")\n __debug_route\n __debug_request\n user = current_user&.account&.dup\n opt = BS_AUTH ? { no_revoke: true?(params[:no_revoke]) } : {}\n delete_auth_...
[ "0.5888611", "0.579848", "0.5727517", "0.5698714", "0.5692734", "0.5665577", "0.56068414", "0.56044024", "0.5526789", "0.552085", "0.5512875", "0.5509194", "0.5509194", "0.5503925", "0.549266", "0.5480225", "0.5466496", "0.54552156", "0.5449698", "0.5447445", "0.5439153", "...
0.5926773
0
Dissables PHI access for a single instance of this class inside the block. Nested calls to allow_phi will log once per nested call
def disallow_phi raise ArgumentError, 'block required. use disallow_phi! without block' unless block_given? add_disallow_flag! add_disallow_flag_to_extended_phi! yield if block_given? remove_disallow_flag_from_extended_phi! remove_disallow_flag! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disallow_phi!\n raise ArgumentError, 'block not allowed. use disallow_phi with block' if block_given?\n\n PhiAttrs::Logger.tagged(*phi_log_keys) do\n removed_access_for = self.class.__user_id_string(@__phi_access_stack)\n\n revoke_extended_phi!\n @__phi_access_stack = []\n\n ...
[ "0.80872554", "0.8009705", "0.78500485", "0.769474", "0.7293979", "0.6542915", "0.64734524", "0.6473243", "0.6387794", "0.63632447", "0.6163342", "0.59541714", "0.5947118", "0.5931487", "0.59151083", "0.55448174", "0.5350029", "0.5335636", "0.52979505", "0.5280221", "0.522707...
0.6560936
5
Revoke last PHI access for a single instance of this class.
def disallow_last_phi!(preserve_extensions: false) raise ArgumentError, 'block not allowed' if block_given? PhiAttrs::Logger.tagged(*phi_log_keys) do removed_access = @__phi_access_stack.pop revoke_extended_phi! unless preserve_extensions message = removed_access.present? ? "PHI access disabled for #{removed_access[:user_id]}" : 'PHI access disabled. No instance level access was granted.' PhiAttrs::Logger.info(message) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revoke\n @session.do_rpc_endpoint('/revoke')\n nil\n end", "def revoke!\n self.class.transaction do\n update_attribute :revoked, Time.now\n client.increment! :tokens_revoked\n end\n end", "def revoke\n raise \"Implement me!\"\n ...
[ "0.63997555", "0.6282532", "0.6145793", "0.60280687", "0.59928036", "0.5900275", "0.5863169", "0.5805928", "0.572812", "0.5722388", "0.56471425", "0.56471425", "0.56428397", "0.56211054", "0.5605139", "0.55996305", "0.5579732", "0.5543967", "0.5538277", "0.553653", "0.550807"...
0.5733393
8
The unique identifier for whom access has been allowed on this instance. This is what was passed in when PhiRecordallow_phi! was called.
def phi_allowed_by phi_context[:user_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def privacy_object_id\r\n\t\t\treturn self.id\r\n\t\tend", "def owner_access_control_key # :nodoc:\n 'id'\n end", "def all_phi_allowed_by\n self.class.__user_id_string(all_phi_context)\n end", "def recip\n\t\tself.identity\n\tend", "def identifier_value\n user.icn\n end", ...
[ "0.6373371", "0.6309853", "0.6225201", "0.61484224", "0.6069459", "0.604486", "0.60344976", "0.59835744", "0.5960108", "0.5914712", "0.5882732", "0.58694553", "0.58062017", "0.5802811", "0.57836604", "0.5775802", "0.5775802", "0.5764635", "0.5746757", "0.5737906", "0.5735067"...
0.69745827
0
The access reason for allowing access to this instance. This is what was passed in when PhiRecordallow_phi! was called.
def phi_access_reason phi_context[:reason] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def protection\n return @protection\n end", "def phi_allowed?\n !phi_context.nil? && phi_context[:phi_access_allowed]\n end", "def add_disallow_flag!\n @__phi_access_stack.push({\n phi_access_allowed: false\n }...
[ "0.5963926", "0.5895669", "0.5812808", "0.57298714", "0.5704143", "0.5694744", "0.5694744", "0.55676234", "0.55323106", "0.55318356", "0.5512706", "0.5511024", "0.55098116", "0.5497229", "0.5486193", "0.5486193", "0.54677814", "0.54613286", "0.54613286", "0.5443621", "0.54415...
0.7814361
0
Whether PHI access is allowed for a single instance of this class
def phi_allowed? !phi_context.nil? && phi_context[:phi_access_allowed] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phi_allowed?\n __phi_stack.present? && __phi_stack[-1][:phi_access_allowed]\n end", "def has_access?\n true\n end", "def has_access?\n true\n end", "def has_privilege?\n has_all? || has_direct?\n end", "def allow_member?\n true\n end", "def priv?\n !org?\n end"...
[ "0.73977035", "0.67593193", "0.67593193", "0.63658214", "0.62343985", "0.62260216", "0.62142146", "0.6196914", "0.6186885", "0.61813635", "0.6175818", "0.6162348", "0.61538994", "0.61538994", "0.6144762", "0.6131584", "0.6103974", "0.6090221", "0.607106", "0.60670555", "0.604...
0.75445
0
Require phi access. Raises an error preemptively if it has not been granted.
def require_phi! raise PhiAccessException, 'PHI Access required, please call allow_phi or allow_phi! first' unless phi_allowed? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phi_allowed?\n !phi_context.nil? && phi_context[:phi_access_allowed]\n end", "def phi_allowed?\n __phi_stack.present? && __phi_stack[-1][:phi_access_allowed]\n end", "def disallow_phi!\n raise ArgumentError, 'block not allowed. use disallow_phi with block' if block_given?\n\n ...
[ "0.6594145", "0.6286611", "0.6176078", "0.61688894", "0.61167896", "0.6050106", "0.5954506", "0.57413477", "0.5591355", "0.5549433", "0.55245435", "0.5471536", "0.5464704", "0.54590005", "0.5451551", "0.54365927", "0.5400033", "0.5400033", "0.5400033", "0.5392729", "0.5363203...
0.79007185
0
Adds a disallow phi flag to instance internal stack.
def add_disallow_flag! @__phi_access_stack.push({ phi_access_allowed: false }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disallow_phi\n raise ArgumentError, 'block required. use disallow_phi! without block' unless block_given?\n\n __phi_stack.push({\n phi_access_allowed: false\n })\n\n yield if block_given?\n\n __phi_stack.pop\n end", "def remov...
[ "0.7317745", "0.7183306", "0.7161934", "0.7147925", "0.6678703", "0.6617949", "0.64365196", "0.63379455", "0.62022114", "0.586159", "0.5701248", "0.5616867", "0.52915275", "0.50800544", "0.49696803", "0.49367988", "0.4933882", "0.4873057", "0.4796245", "0.47469485", "0.474521...
0.81658965
0
removes the last item in instance internal stack.
def remove_disallow_flag! @__phi_access_stack.pop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop\n if @count > 0\n last_item_index = @count - 1\n\n # stores last element\n last_item = @items[last_item_index]\n\n # remove last item from array\n @items[last_item_index] = nil\n\n # reduces size by 1\n @count -= 1\n\n last_item\n else\n raise \"There are ...
[ "0.7876991", "0.7710947", "0.76845044", "0.7684091", "0.7682939", "0.76709926", "0.76461333", "0.7643227", "0.7643227", "0.7581042", "0.7581042", "0.75685394", "0.7547953", "0.7541613", "0.7536002", "0.75192344", "0.7518482", "0.7458838", "0.7430498", "0.74167466", "0.7416746...
0.0
-1
Entry point for wrapping methods with PHI access logging. This is called by an `after_initialize` hook from ActiveRecord.
def wrap_phi # Disable PHI access by default @__phi_access_stack = [] @__phi_methods_extended = Set.new @__phi_relations_extended = Set.new # Wrap attributes with PHI Logger and Access Control __phi_wrapped_methods.each { |m| phi_wrap_method(m) } __phi_extended_methods.each { |m| phi_wrap_extension(m) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_init\n # puts 'Syslogger initialized'\n end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def initialize\n\t\t@@logger = OMLogger.getLogger(DataHelper.name)\n\tend", "def initialize\n ...
[ "0.56423086", "0.5560896", "0.5560896", "0.5560896", "0.5560896", "0.5560896", "0.5560896", "0.5560896", "0.5560896", "0.5557878", "0.5507924", "0.5496038", "0.5496038", "0.5496038", "0.5496038", "0.5496038", "0.5496038", "0.5496038", "0.5496038", "0.5496038", "0.5496038", ...
0.6144088
0
Log Key for an instance of this class. If the instance is persisted in the database, then it is the primary key; otherwise it is the Ruby object_id in memory. This is used by the tagged logger for tagging all log entries to find the underlying model.
def phi_log_keys @__phi_log_id = persisted? ? "Key: #{attributes[self.class.primary_key]}" : "Object: #{object_id}" @__phi_log_keys = [PHI_ACCESS_LOG_TAG, self.class.name, @__phi_log_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key\n self.class._key\n end", "def self_key # :nodoc:\n klass = self.class\n if klass.superclass != ActiveRecord::Base\n if klass.superclass.eav_class == klass.eav_class\n klass = klass.superclass\n end\n end\n\n \"#{klass.nam...
[ "0.7309724", "0.72346777", "0.68675977", "0.6821761", "0.6821761", "0.67555493", "0.67555493", "0.67555493", "0.67555493", "0.6739975", "0.6739975", "0.6739975", "0.6728207", "0.6683211", "0.6647677", "0.6647677", "0.6647677", "0.6625163", "0.6593296", "0.6561271", "0.6531389...
0.626636
50
The unique identifiers for everything with access allowed on this instance.
def all_phi_allowed_by self.class.__user_id_string(all_phi_context) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_identifiers\n [:name, :path]\n end", "def unique_identifiers\n return super if defined?(super)\n\n raise NotImplementedError\n end", "def known_identities; end", "def globally_unique_identifier\n super\n end", "def owner_access_control_key # :nodoc:\n ...
[ "0.79578733", "0.6908273", "0.67682344", "0.6647124", "0.65532345", "0.6408829", "0.63862103", "0.6301023", "0.62380296", "0.6198671", "0.6160228", "0.6146002", "0.61426187", "0.6138904", "0.6103008", "0.6103008", "0.6101796", "0.60802203", "0.60802203", "0.60742325", "0.6073...
0.0
-1
Core logic for wrapping methods in PHI access logging and access restriction. This method takes a single method name, and creates a new method using define_method; once this method is defined, the original method name is aliased to the new method, and the original method is renamed to a known key.
def phi_wrap_method(method_name) unless respond_to?(method_name) PhiAttrs::Logger.warn("#{self.class.name} tried to wrap non-existant method (#{method_name})") return end return if self.class.__phi_methods_wrapped.include? method_name wrapped_method = :"__#{method_name}_phi_wrapped" unwrapped_method = :"__#{method_name}_phi_unwrapped" self.class.send(:define_method, wrapped_method) do |*args, **kwargs, &block| PhiAttrs::Logger.tagged(*phi_log_keys) do unless phi_allowed? raise PhiAttrs::Exceptions::PhiAccessException, "Attempted PHI access for #{self.class.name} #{@__phi_user_id}" end unless all_phi_context_logged? PhiAttrs::Logger.info("#{self.class.name} access by [#{all_phi_allowed_by}]. Triggered by method: #{method_name}") set_all_phi_context_logged end send(unwrapped_method, *args, **kwargs, &block) end end # method_name => wrapped_method => unwrapped_method self.class.send(:alias_method, unwrapped_method, method_name) self.class.send(:alias_method, method_name, wrapped_method) self.class.__phi_methods_wrapped << method_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_alias_for_existing_method(method_name)\n new_alias = new_name(method_name)\n unless @obj.respond_to?(new_alias)\n safe_alias_method(new_alias, method_name)\n end\n new_alias\n end", "def create_alias_for_existing_method(method_name)\n begin\n new_alias = new_n...
[ "0.71978664", "0.7069993", "0.6886632", "0.68152463", "0.668163", "0.6671713", "0.6611153", "0.6611153", "0.651443", "0.64577705", "0.6443086", "0.64276093", "0.64140046", "0.64104855", "0.6367846", "0.63619065", "0.6343728", "0.6333576", "0.63164103", "0.63136435", "0.628572...
0.74538535
0
Core logic for wrapping methods in PHI access extensions. Almost functionally equivalent to the phi_wrap_method call above, this method doesn't add any logging or access restriction, but simply proxies the PhiRecordallow_phi! call.
def phi_wrap_extension(method_name) raise NameError, "Undefined relationship in `extend_phi_access`: #{method_name}" unless respond_to?(method_name) return if self.class.__phi_methods_to_extend.include? method_name wrapped_method = wrapped_extended_name(method_name) unwrapped_method = unwrapped_extended_name(method_name) self.class.send(:define_method, wrapped_method) do |*args, **kwargs, &block| relation = send(unwrapped_method, *args, **kwargs, &block) if phi_allowed? && (relation.present? && relation_klass(relation).included_modules.include?(PhiRecord)) relations = relation.is_a?(Enumerable) ? relation : [relation] relations.each do |r| r.allow_phi!(phi_allowed_by, phi_access_reason) unless @__phi_relations_extended.include?(r) end @__phi_relations_extended.merge(relations) self.class.__instances_with_extended_phi.add(self) end relation end # method_name => wrapped_method => unwrapped_method self.class.send(:alias_method, unwrapped_method, method_name) self.class.send(:alias_method, method_name, wrapped_method) self.class.__phi_methods_to_extend << method_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_phi\n # Disable PHI access by default\n @__phi_access_stack = []\n @__phi_methods_extended = Set.new\n @__phi_relations_extended = Set.new\n\n # Wrap attributes with PHI Logger and Access Control\n __phi_wrapped_methods.each { |m| phi_wrap_method(m) }\n __phi_extended_me...
[ "0.78887254", "0.743288", "0.62238234", "0.5871042", "0.57715297", "0.57334656", "0.56094", "0.5606861", "0.55788046", "0.5531436", "0.5531436", "0.54988474", "0.5495265", "0.5470079", "0.5404526", "0.53701097", "0.53644806", "0.5364063", "0.53249943", "0.5303578", "0.5273308...
0.71682954
2
Revoke PHI access for all `extend`ed relations (or only those given)
def revoke_extended_phi!(relations = nil) relations ||= @__phi_relations_extended relations.each do |relation| relation.disallow_last_phi! if relation.present? && relation_klass(relation).included_modules.include?(PhiRecord) end @__phi_relations_extended.subtract(relations) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_disallow_flag_from_extended_phi!(relations = nil)\n relations ||= @__phi_relations_extended\n relations.each do |relation|\n relation.remove_disallow_flag! if relation.present? && relation_klass(relation).included_modules.include?(PhiRecord)\n end\n end", "def add_disallow_fla...
[ "0.6587906", "0.5902585", "0.5766153", "0.5674617", "0.56393856", "0.5618511", "0.5616106", "0.5580106", "0.5519277", "0.5462062", "0.5420075", "0.53760546", "0.53100514", "0.52718127", "0.52424747", "0.52184767", "0.515431", "0.515431", "0.5129898", "0.5124908", "0.5096734",...
0.79246837
0
Adds a disallow PHI access to the stack for block syntax for all `extend`ed relations (or only those given)
def add_disallow_flag_to_extended_phi!(relations = nil) relations ||= @__phi_relations_extended relations.each do |relation| relation.add_disallow_flag! if relation.present? && relation_klass(relation).included_modules.include?(PhiRecord) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disallow_last_phi!(preserve_extensions: false)\n raise ArgumentError, 'block not allowed' if block_given?\n\n PhiAttrs::Logger.tagged(*phi_log_keys) do\n removed_access = @__phi_access_stack.pop\n\n revoke_extended_phi! unless preserve_extensions\n message = removed_access.presen...
[ "0.6783726", "0.6664244", "0.65746266", "0.6541955", "0.65250677", "0.6465221", "0.6357006", "0.62972945", "0.5802014", "0.54192305", "0.51315415", "0.5066757", "0.500448", "0.5000395", "0.49190742", "0.4910319", "0.48812017", "0.48757094", "0.48726538", "0.48613065", "0.4849...
0.690083
0
Adds a disallow PHI access to the stack for all for all `extend`ed relations (or only those given)
def remove_disallow_flag_from_extended_phi!(relations = nil) relations ||= @__phi_relations_extended relations.each do |relation| relation.remove_disallow_flag! if relation.present? && relation_klass(relation).included_modules.include?(PhiRecord) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_disallow_flag_to_extended_phi!(relations = nil)\n relations ||= @__phi_relations_extended\n relations.each do |relation|\n relation.add_disallow_flag! if relation.present? && relation_klass(relation).included_modules.include?(PhiRecord)\n end\n end", "def add_disallow_flag!\n ...
[ "0.72142094", "0.6821675", "0.64514476", "0.6331677", "0.61960024", "0.61160535", "0.60905063", "0.5913089", "0.56113464", "0.5440329", "0.5310232", "0.52933234", "0.5142014", "0.50853455", "0.5069504", "0.5058424", "0.50462246", "0.50398934", "0.50364983", "0.50317436", "0.4...
0.6651693
2
=> instance method to add up the mass of all bodies in bodies and return it
def total_mass mass = 0 @bodies.each do |body| mass += body.mass end return mass end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_mass\n sum = 0\n @bodies.each{ |body| body[:mass] += sum}\n sum\n end", "def update_masses\n self.total = 0\n masses.clear\n self.hashes.each do |hash, nodes|\n masses[hash] = nodes.first.mass * nodes.size\n masses[hash] *= (nodes.size) if identical[hash]\n self.total ...
[ "0.8550619", "0.6276286", "0.6268563", "0.620096", "0.6143025", "0.5981379", "0.59792024", "0.5934948", "0.58977157", "0.58898675", "0.58727676", "0.5868477", "0.58483446", "0.58176804", "0.57921505", "0.5773891", "0.57133293", "0.57116896", "0.5710129", "0.5703177", "0.57017...
0.8603155
0
Create a method that takes a string, and returns the amount of vowels in that string. E.g. number_of_vowels("How many vowels") > "There are 4 vowels in this word" E.g. number_of_vowels("I fly") > "There is 1 vowel in this word" E.g. number_of_vowels("Fly") > "There are no vowels in this word" NOTE THE GRAMMAR!! Advanced: Try doing this using our good, old friend REGEX
def number_of_vowels(string) count = string.downcase.scan(/[aeiou]/).size case count when 1 "There is 1 vowel in this word" when 0 "There are no vowels in this word" else "There are #{count} number of vowels" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_vowels(str)\n str.count(VOWELS)\nend", "def VowelCount(str)\n str.count \"aeiou\" \nend", "def count_vowels(string)\n string.downcase.count('aeiou')\nend", "def count_vowels(str)\n str.count(\"aeoui\")\nend", "def vowel_count(str)\n str.downcase.count('aeiou')\nend", "def num_vowels(s...
[ "0.8722585", "0.853723", "0.85061866", "0.848667", "0.8465922", "0.845591", "0.8411559", "0.8288832", "0.8266928", "0.8234893", "0.82280535", "0.82161695", "0.8205364", "0.819957", "0.8189489", "0.81841403", "0.81809205", "0.81790066", "0.81785643", "0.8169062", "0.81365556",...
0.8356589
7
GET /matter_products GET /matter_products.json
def index @matter_products = MatterProduct.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def products\n request :public, :get, :products\n end", "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend", "def index\n @products = Product.all\n render json: @products\n end", "def product(name)\n get(...
[ "0.7236215", "0.71494395", "0.6859548", "0.68407476", "0.6784778", "0.67501616", "0.6712368", "0.670876", "0.6702911", "0.6684415", "0.66695225", "0.6669509", "0.6669509", "0.6669509", "0.6654767", "0.66505194", "0.66505194", "0.66505194", "0.66505194", "0.66339433", "0.66322...
0.7440614
0
GET /matter_products/1 GET /matter_products/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @matter_products = MatterProduct.all\n end", "def product(name)\n get(\"/apiproducts/#{name}\")\n end", "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend", "def index\n @api_v1_products = Product.all\n jso...
[ "0.72307265", "0.69784683", "0.6938911", "0.68713427", "0.6749252", "0.6677378", "0.6645124", "0.6611586", "0.6569042", "0.656885", "0.6568503", "0.6559013", "0.6559013", "0.6559013", "0.6559", "0.6553484", "0.65456617", "0.6541143", "0.6541143", "0.6541143", "0.6541143", "...
0.0
-1
POST /matter_products POST /matter_products.json
def create @matter_product = MatterProduct.new(matter_product_params) respond_to do |format| if @matter_product.save format.html { redirect_to @matter_product, notice: 'Matter product was successfully created.' } format.json { render :show, status: :created, location: @matter_product } else format.html { render :new } format.json { render json: @matter_product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if params[:products]\n params[:products].each do |product|\n @product = Product.new(name: product[:name],\n brand: product[:brand],\n model: product[:model],\n sku: product[:sku],\n ...
[ "0.6928276", "0.67488784", "0.669899", "0.659528", "0.6541616", "0.6527496", "0.6520057", "0.65105236", "0.6391199", "0.63861233", "0.63775826", "0.63674825", "0.6341455", "0.63356346", "0.6334726", "0.6328034", "0.62777823", "0.6272497", "0.6265461", "0.6213499", "0.618649",...
0.72924066
0
PATCH/PUT /matter_products/1 PATCH/PUT /matter_products/1.json
def update respond_to do |format| if @matter_product.update(matter_product_params) format.html { redirect_to @matter_product, notice: 'Matter product was successfully updated.' } format.json { render :show, status: :ok, location: @matter_product } else format.html { render :edit } format.json { render json: @matter_product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "def update\n updateProduct = Product.find_by_id(params[:id])\n updateProduct.update(products_params)\n ...
[ "0.71118176", "0.66956574", "0.6663161", "0.6614635", "0.65725356", "0.6500799", "0.64642054", "0.6460646", "0.6456365", "0.64500326", "0.64329946", "0.63851064", "0.6381777", "0.6376986", "0.6369513", "0.6357122", "0.6354364", "0.6345106", "0.6342484", "0.6324882", "0.632293...
0.69816375
1
DELETE /matter_products/1 DELETE /matter_products/1.json
def destroy @matter_product.destroy respond_to do |format| format.html { redirect_to matter_products_url, notice: 'Matter product was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end", "def destroy\n unread\n\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def...
[ "0.707563", "0.70666003", "0.7061442", "0.7031911", "0.7030968", "0.70221364", "0.70145065", "0.6994228", "0.6991333", "0.6986497", "0.69643533", "0.6909867", "0.690956", "0.6903224", "0.6893754", "0.6865364", "0.6857286", "0.6857286", "0.6857286", "0.6857286", "0.6857286", ...
0.74430215
0
Use callbacks to share common setup or constraints between actions.
def set_matter_product @matter_product = MatterProduct.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def matter_product_params params.require(:matter_product).permit(:nombre, :fecha, :materia, :cantidad, :medida, :Matter_id, :Product_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
launch: Pass either params or hardcoded server and client data to the auth_url via redirection
def launch # Get a completely fresh session for each launch. This is a rails method. reset_session cookies.clear redirect_to home_path, alert: "Please provide the server_url, client_id, and client_secret." and return if !all_credentials_provided? # Set auth sessions with params values session[:launch] = params[:launch].present? ? params[:launch].strip : "launch" session[:iss_url] = cookies[:iss_url] = params[:iss_url].strip.delete_suffix("/").delete_suffix("/metadata") session[:client_id] = params[:client_id].strip session[:client_secret] = params[:client_secret].strip session[:scope] = params[:scope]&.strip # Get the server metadata rcResult = get_server_metadata(session[:iss_url]) redirect_to home_path, alert: rcResult and return if rcResult.class == String # Logic for authenticated access server if session[:is_auth_server?] begin server_auth_url = set_server_auth_url() redirect_to server_auth_url rescue StandardError => exception redirect_back fallback_location: home_path, alert: "Failed to connect: #{exception.message}" and return end # Logic for unauthenticated server access: the user will provide the patient ID in the client_id & client_secret fields. else session[:patient_id] = session[:client_secret] redirect_to dashboard_url, notice: "Signed in with Patient ID: #{session[:patient_id]}" end cookies.clear end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate!\n @client = Octokit::Client.new\n url = @client.authorize_url(CLIENT_ID)\n redirect url\nend", "def signin\n embed_screen api_args.select_keys(\"redirect_uri\", \"client_id\", \"response_type\")\n end", "def index\n res = create_request2(root_url + '/login/auth', 'tequila.epfl.ch')\...
[ "0.6678311", "0.6362986", "0.6335776", "0.62370044", "0.6176067", "0.61650795", "0.6118643", "0.60888183", "0.60588706", "0.60541135", "0.60386896", "0.6026132", "0.5991819", "0.59854573", "0.59653205", "0.59389", "0.59188396", "0.5917868", "0.59024245", "0.59006095", "0.5899...
0.6880365
0
login: Once authorization has happened, auth server redirects to here. Use the returned info to get a token Use the returned token and patientID to get the patient info
def login if params[:error].present? # Authentication Failure err = "Authentication Failure: #{params[:error]} - #{params[:error_description]}" redirect_to home_path, alert: err else session[:wakeupsession] = "ok" # using session hash prompts rails session to load session[:client_id] = params[:client_id] || session[:client_id] #).gsub! /\t/, '' session[:client_secret] = params[:client_secret] || session[:client_secret] #).gsub! /\t/, '' code = params[:code] @client = connect_to_server(code) return if @client.nil? redirect_to eobs_url, notice: "Signed in with Patient ID: #{session[:patient_id]} " end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login\n if params[:error].present? # Authentication Failure\n ## binding.pry \n err = \"Authentication Failure: \" + params[:error] + \" - \" + params[:error_description]\n redirect_to patients_path, alert: err\n else\n session[:wakeupsession] = \"ok\" # using session hash prompts r...
[ "0.7503731", "0.7146259", "0.70191336", "0.6874317", "0.6768715", "0.66923356", "0.6683419", "0.65960443", "0.6595334", "0.653794", "0.6534046", "0.65182364", "0.6511301", "0.65111464", "0.64960945", "0.64690644", "0.6464938", "0.6450722", "0.64376193", "0.6430358", "0.642685...
0.6986119
3
Removes the given object from the dispatcher queue of the message +msgName+.
def del_msg_listener( msgName, object ) @msgNames[msgName].delete object if defined? @msgNames end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_msg_name( msgName )\n @msgNames.delete msgName if defined? @msgNames\n end", "def remove_message(name)\n\t\tend", "def remove_message(id)\n with_queue_control do |control|\n control.remove_message(id)\n end\n end", "def unsubscribe(message_name)\n @transport.unb...
[ "0.7025907", "0.65422636", "0.6183906", "0.61722475", "0.6163905", "0.60788625", "0.5942539", "0.58861667", "0.58853036", "0.5862394", "0.58507943", "0.58303237", "0.5804372", "0.5757792", "0.5730907", "0.5727485", "0.5708007", "0.5686499", "0.5677829", "0.56621295", "0.56615...
0.75973785
0
Adds a new message target called +msgName+
def add_msg_name( msgName ) @msgNames = {} unless defined? @msgNames @msgNames[msgName] = [] unless @msgNames.has_key? msgName end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_message(name, message)\n\t\tend", "def addTarget(name=nil, note=nil)\n @addTargetBtn.click\n return EditTarget.new.enterTargetInformation(name)\n end", "def setup_log_message\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n text = @acts[1].gsub(/<name>/i) { self.name }\...
[ "0.6601231", "0.6339349", "0.6111804", "0.5882971", "0.57765985", "0.5632621", "0.5603092", "0.55837256", "0.55542886", "0.5527673", "0.55179965", "0.5507411", "0.54249394", "0.5408368", "0.53592014", "0.52734494", "0.5268719", "0.5240212", "0.5216382", "0.51726377", "0.51214...
0.6440258
1
Deletes the message target +msgName+.
def del_msg_name( msgName ) @msgNames.delete msgName if defined? @msgNames end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end", "def remove_message(name)\n\t\tend", "def del_msg_listener( msgName, object )\n @msgNames[msgName].delete object if defined? @msgNames\n end", "def delete_msg()\n MsgUtil.delete_msg(params[:ch])\n end", "d...
[ "0.76744175", "0.73386955", "0.7197245", "0.7181386", "0.6937953", "0.6749326", "0.66964567", "0.6694406", "0.66046596", "0.6551827", "0.65110856", "0.6469001", "0.6410771", "0.63640195", "0.6360717", "0.6360717", "0.63413745", "0.6288525", "0.6240895", "0.62289816", "0.62200...
0.82614136
0
Dispatches the message +msgName+ to all listeners for this message, providing the given arguments
def dispatch_msg( msgName, *args ) if defined? @msgNames and @msgNames.has_key? msgName @msgNames[msgName].each do |obj| obj.call( *args ) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_event(event_name, args)\n @event_message_channels[event_name].each do |message_channel|\n message_channel.send [:event, event_name, args]\n end\n end", "def notify_listeners(event_name, *args)\n listeners.each_value { |listener|\n if listener.respo...
[ "0.68110913", "0.6788161", "0.62809247", "0.6202623", "0.6138758", "0.6074418", "0.60267806", "0.58162886", "0.55855316", "0.5562728", "0.5497522", "0.549229", "0.54807943", "0.5463088", "0.5438406", "0.5430428", "0.5416576", "0.5369889", "0.53564143", "0.5346126", "0.5345655...
0.75376266
0
Use callbacks to share common setup or constraints between actions.
def set_entity @entity = Entity.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def entity_params params.require(:entity).permit(:name, :database, :domain) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
List available SLES ISOs
def list_ay_isos(options) options['method'] = "ay" if not options['search'].to_s.match(/[a-z]|[A-Z]|all/) options['search'] = "SLE|SuSE" end list_linux_isos(options) return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_ps_isos()\n search_string = \"ubuntu\"\n list_linux_isos(search_string)\n return\nend", "def list_sol_isos(search_string)\n handle_output(options,\"\") \n list_js_isos()\n list_ai_isos()\n return\nend", "def index\n @ssystems = Ssystem.all\n end", "def list_vs_services(options)\n options...
[ "0.6754239", "0.63414836", "0.61719334", "0.60316044", "0.5980143", "0.59203595", "0.5901304", "0.5883644", "0.5883418", "0.58351094", "0.5702179", "0.5665062", "0.5653075", "0.5609627", "0.5601981", "0.5598723", "0.5592912", "0.559083", "0.5585826", "0.5580851", "0.5551745",...
0.6058915
3
get longitude and latitude
def getLocation loc = Addressable::URI.new( :scheme => "https", :host => "maps.googleapis.com", :path => "maps/api/geocode/json", :query_values => {:address => "160+Folsom,+San+Francisco,+CA", :sensor => "false"}).to_s location_request = RestClient.get(loc) parsed_location_request = JSON.parse(location_request) lat = parsed_location_request["results"][0]["geometry"]["location"]["lat"].to_s lng = parsed_location_request["results"][0]["geometry"]["location"]["lng"].to_s [lat,lng] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lonlat\r\n [longitude,latitude]\r\n end", "def lonlat\r\n [longitude,latitude]\r\n end", "def latlon\r\n [latitude,longitude]\r\n end", "def latlon\r\n [latitude,longitude]\r\n end", "def latlon\r\n [latitude,lon...
[ "0.80233806", "0.80233806", "0.7887345", "0.7887345", "0.7887345", "0.773535", "0.77127934", "0.7624637", "0.7604247", "0.75956655", "0.7540942", "0.7513901", "0.74579734", "0.74460065", "0.7433143", "0.7429592", "0.7399381", "0.7385778", "0.7340706", "0.732971", "0.7254345",...
0.6990847
40
This will remove playlists from the specified plan
def remove_playlists(id:, params:) client.execute(method: :put, path: "/#{path}/#{id}/remove_playlists", params: params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_plans\n cb_plan_ids = cb_plans.flat_map(&:id)\n Plan.all.reject { |plan| cb_plan_ids.include?(plan.plan_id) }\n .each { |plan| puts \"Deleting Plan - #{plan.plan_id}\"; plan.destroy }\n end", "def remove_plan(plan)\n raise Reji::SubscriptionUpdateFailureError.cannot_delete_las...
[ "0.6895293", "0.6442852", "0.5920691", "0.5830297", "0.57509166", "0.5722448", "0.5653833", "0.56149447", "0.55953854", "0.55876976", "0.5534236", "0.5530545", "0.5530545", "0.5530545", "0.55288655", "0.5493256", "0.54819226", "0.54787475", "0.5476788", "0.5471617", "0.546495...
0.6273663
2
Subscribe to a path and make some magic happen, mmkmay?
def on_open(env) @subscription = @config.consumer(env).subscription(@config.channel(env)) @subscription.on_message {|message, consumer| send_data message } @subscription.subscribe end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_path(path)\n @blk.call(:path, path, self.class::EXT)\n @path_notified = true\n end", "def run_on_additions(paths)\n @builder.notify\n end", "def event_callback(path, event)\n\t\t\t\tpublish(\"zk_event_#{path}\", event)\n\t\t\tend", "def update(path, event_type = nil)\n pa...
[ "0.6656234", "0.59339464", "0.57470834", "0.5701881", "0.56308806", "0.5566248", "0.554136", "0.55194503", "0.55087453", "0.54982114", "0.549094", "0.5472926", "0.545923", "0.54128057", "0.54033285", "0.53961504", "0.5368937", "0.536349", "0.53574216", "0.534966", "0.533288",...
0.0
-1
Delete the subscription if the thing even happened.
def on_close(env) @subscription.delete if @subscription logger.debug "WebSocket closing connection" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy!\n Dropio::Resource.client.delete_subscription(self)\n nil\n end", "def destroy!(this_is_not_accidental:)\n @topic.delete\n @subscription.delete\n end", "def delete_subscription subscription\n subscriber.delete_subscription subscription: subscription_path(subscription)\...
[ "0.7181977", "0.7155097", "0.71144766", "0.7073991", "0.7033101", "0.69934714", "0.6929764", "0.6929764", "0.692375", "0.6861958", "0.68394095", "0.6747895", "0.6730669", "0.67278045", "0.6719343", "0.6715799", "0.6696177", "0.6688035", "0.6638654", "0.65838784", "0.6536387",...
0.0
-1
Log websocket level errors
def on_error(env, error) logger.debug "Websocket error: #{error.message}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inject_error(e)\n websocket_error(e)\n end", "def error(event)\n Firehose.logger.error \"WS connection `#{@req.path}` error. Message: `#{event.message.inspect}`\"\n end", "def on_error(env, error)\n Firehose.logger.error \"WS connection `#{cid}@#{path}` error `#{error}`: ...
[ "0.7010622", "0.6873135", "0.670333", "0.64622253", "0.61725646", "0.6074077", "0.60400975", "0.594101", "0.59091365", "0.59008425", "0.5869451", "0.5869451", "0.5869451", "0.5821708", "0.5821708", "0.5798314", "0.5760141", "0.57395995", "0.57081443", "0.56787705", "0.5677368...
0.7805862
0
file loaded. Make changes to this file and then run 'ruby part1.rb' at the command line, this will run your program. Once you're satisfied with your work, save your file and upload it to the checker.
def palindrome?(str) s = str.gsub(/[^a-zA-Z]*/, '').to_s.downcase s.reverse == s # YOUR CODE HERE end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_sketch\n ensure_exists(filename)\n spin_up('run.rb', filename, argc)\n end", "def run_sketch\n ensure_exists(filename)\n spin_up('run.rb', filename, argc)\n end", "def start()\n source_in = File.new(@file, \"r\")\n read_source(source_in)\n\n # Pad with spa...
[ "0.6306849", "0.6306849", "0.58674127", "0.5814108", "0.58088046", "0.58068913", "0.5780768", "0.5774481", "0.5773407", "0.5755512", "0.5743653", "0.57343984", "0.5733372", "0.5718698", "0.5717825", "0.5696378", "0.5696378", "0.5696334", "0.5679648", "0.5665895", "0.56173396"...
0.0
-1
TODO: more than one bullet?
def bullet @bullet ||= load_data.first.bullet end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_bullet(bullet)\n @bullets << bullet\n end", "def bullet(name, options={}, &block)\n cur_page.bullet(name, options, &block)\n end", "def prepare_bullet_data\n [\"*\", self]\n end", "def bullet(str)\n [*str].each { |s| @parts.push(bullet: s) }\n end", "def player_fire_bullet()...
[ "0.75124717", "0.7439275", "0.6829142", "0.6815622", "0.6788822", "0.66167885", "0.6506522", "0.641715", "0.63753724", "0.6371628", "0.6364791", "0.63384837", "0.6282106", "0.6262739", "0.6236886", "0.6218436", "0.62153554", "0.6179613", "0.6142401", "0.6119371", "0.59584105"...
0.7533692
0
TODO: more than one manufacturer?
def manufacturer @manufacturer ||= load_data.first.manufacturer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manufacturer; end", "def manufacturer\n data['manufacturer']\n end", "def manufacturer\n return @manufacturer\n end", "def manufacturer\n return @manufacturer\n end", "def manufacturer\n return @manufacturer\n ...
[ "0.8392272", "0.7773725", "0.77446896", "0.75690955", "0.75690955", "0.7545642", "0.7530389", "0.73476315", "0.73476315", "0.71125907", "0.7089924", "0.7089924", "0.70471066", "0.6959486", "0.6959486", "0.6944611", "0.6869181", "0.6869181", "0.68289244", "0.68061453", "0.6757...
0.7760405
2
Hack to fix up the :input path allowing us to use Omnibus packaging for a new purpose. eg. Installing both rust and cargo to the same prefix and packaging them up in a single package.
def input(config) config.delete(:input) super config end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input(vnd_pkg_path)\n\n # general params\n in_bundle = vnd_pkg_path.gsub(/^(.+\\/+)*vendor\\/+|\\/(?=\\/)|\\/+$/, \"\")\n @name = in_bundle.gsub(/[\\W]+/, \"-\")\n json = {}\n if @once\n @once = true\n raise FPM::InvalidPackageConfiguration, \"You can't input multiple bundle names. Onl...
[ "0.6390976", "0.61305445", "0.6080514", "0.57882375", "0.5706573", "0.5666347", "0.55662334", "0.5544388", "0.54973555", "0.5487566", "0.5483074", "0.54114586", "0.53654104", "0.5324341", "0.5318689", "0.53143626", "0.5229491", "0.52245295", "0.52205014", "0.5216575", "0.5201...
0.0
-1
GET /budgets GET /budgets.json
def index @budgets = Budget.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def budgets\n # https://developer.xero.com/documentation/api/budgets\n # if you are having issues in adding the accounting.budgets.read scope, get in touch => api@xero.com\n @budgets = xero_client.accounting_api.get_budgets(current_user.active_tenant_id).budgets\n @budget = xero_client.accounting_api.g...
[ "0.7769996", "0.77680784", "0.739718", "0.7325283", "0.71915555", "0.7146855", "0.71041167", "0.70492715", "0.692903", "0.6864969", "0.6825186", "0.6761401", "0.6596338", "0.65764004", "0.6477175", "0.6459417", "0.6458338", "0.6431454", "0.6426355", "0.6417248", "0.6417248", ...
0.76790833
2
GET /budgets/1 GET /budgets/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n get_budgets\n end", "def index\n @budgets = Budget.all\n end", "def show\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @budget }\n end\n end", "def index\n @items = Item.all\n @budget ...
[ "0.76160544", "0.7537587", "0.75305104", "0.74275905", "0.7298344", "0.7276626", "0.7270971", "0.7212236", "0.7089043", "0.7083458", "0.70186245", "0.7007369", "0.7007369", "0.7007369", "0.7007369", "0.69924563", "0.69297826", "0.68525136", "0.6842345", "0.68049353", "0.67634...
0.0
-1
POST /budgets POST /budgets.json
def create @budget = Budget.new(budget_params) @budget1 = @budget respond_to do |format| if @budget.save BudgetMailer.budget_email(@budget1).deliver_now format.html { redirect_to reservation_requests_path, notice: 'Presupuesto creado exitosamente.' } else @my_reservation_requests = ReservationRequest.find(budget_params[:reservation_request_id]) Rails.logger.debug " conteo: #{1}" @budget.budget_service_details.build @budget.budget_room_details.build format.html { render :new } format.json { render json: @budget.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to budgets_path }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format...
[ "0.7553818", "0.754795", "0.74010944", "0.73762596", "0.7287223", "0.7262481", "0.7262257", "0.68913096", "0.67946094", "0.67769855", "0.6749393", "0.67413753", "0.66027814", "0.65826136", "0.655764", "0.6494124", "0.64795405", "0.6478955", "0.64398104", "0.64251715", "0.6425...
0.61965144
29
PATCH/PUT /budgets/1 PATCH/PUT /budgets/1.json
def update @budget = Budget.find(params[:id]) @budget1 = @budget respond_to do |format| if @budget.update(budget_params) BudgetMailer.budget_email(@budget1).deliver_now format.html { redirect_to reservation_requests_path, notice: 'Presupuesto modificado exitosamente.' } else @my_reservation_requests = ReservationRequest.find(budget_params[:reservation_request_id]) @my_budget = Budget.find(params[:id]) @services_details=@my_budget.budget_service_details @budget.budget_service_details.build @budget.budget_room_details.build format.html { render :edit } format.json { render json: @budget.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was succe...
[ "0.802662", "0.73978305", "0.73978305", "0.73627716", "0.72459084", "0.7210995", "0.7210995", "0.68629795", "0.6746625", "0.66160095", "0.65061015", "0.64733225", "0.6431927", "0.64094025", "0.6406315", "0.63802946", "0.63388276", "0.63388276", "0.63388276", "0.63388276", "0....
0.6652714
9
DELETE /budgets/1 DELETE /budgets/1.json
def destroy @budget.destroy respond_to do |format| format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n ...
[ "0.80596507", "0.8052162", "0.7745417", "0.76833415", "0.7648094", "0.748794", "0.73072225", "0.72522795", "0.72057337", "0.72005427", "0.70806473", "0.6962823", "0.69600993", "0.69600993", "0.6938634", "0.69297326", "0.69276094", "0.6921499", "0.6921499", "0.68874925", "0.68...
0.7660224
6
Use callbacks to share common setup or constraints between actions.
def set_budget @budget = Budget.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def budget_params params.require(:budget).permit(:id,:reservation_request_id,:comfort_id,:check_in, :check_out,:comentario, :descuento, :total,:budget_room_details_attributes => [:id, :cantidad, :type_of_room_id, :subtotal, :_destroy], :budget_service_details_attributes => [:id, :cantidad, :service_id, :subtotal, :_destroy]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_sixth_economic_census1 @sixth_economic_census1 = SixthEconomicCensus1.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def sixth_economic_census1_params params.require(:sixth_economic_census1).permit(:Variable1, :Variable2, :Number_2005, :Number_2013, :Percentage_Increase) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted:
def store_dir "uploads/#{model.class.to_s.underscore}/#{model.id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_dir\n 'file_uploads'\n end", "def store_dir\n 'uploads'\n end", "def store_dir\n \"uploads\"\n end", "def store_dir\n if Rails.env == \"production\"\n ENV['CONFIG_FILE_UPLOAD_PATH']\n else\n \"uploads\"\n end\n end", "def store_dir\n '%suploads/peopl...
[ "0.78669196", "0.76282656", "0.7622718", "0.7618806", "0.7575838", "0.7489612", "0.74863446", "0.7454662", "0.7454662", "0.7454662", "0.7400173", "0.7400173", "0.7400173", "0.7400173", "0.7400173", "0.73844165", "0.73647976", "0.7358027", "0.735749", "0.7348965", "0.7341311",...
0.0
-1
Allow image file extensions
def extension_white_list %w(jpg jpeg gif png) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extension_whitelist\n %w[jpg jpeg png]\n end", "def extension_whitelist\n %w[jpg jpeg gif png]\n end", "def extension_whitelist\n %w[jpg jpeg gif png]\n end", "def extension_whitelist\n %w[jpg jpeg gif png]\n end", "def extension_whitelist\n %w(jpg jpeg png)\n end", "def extension...
[ "0.796211", "0.79483515", "0.79483515", "0.79483515", "0.7898088", "0.7898088", "0.7898088", "0.78753823", "0.78753823", "0.78753823", "0.78753823", "0.78753823", "0.78753823", "0.78753823", "0.78753823", "0.78753823", "0.78753823", "0.78753823", "0.78753823", "0.78753823", "...
0.74029404
84
Override the filename of the uploaded files:
def filename "wallpaper.#{file.extension}" if file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filename\n if super.present?\n @name ||=\"#{SecureRandom.hex}.#{file.extension.downcase}\" if original_filename\n Rails.logger.debug(\"(BaseUploader.filename) #{@name}\")\n @name\n end\n end", "def file_name\n uploaded_file_file_name\n end", "def original_filename\n fake_file_n...
[ "0.77587795", "0.77092165", "0.7650253", "0.76119834", "0.76119834", "0.7511504", "0.7509861", "0.7469618", "0.7408529", "0.7325303", "0.7303221", "0.7293142", "0.72422063", "0.7219045", "0.717902", "0.7177287", "0.71570605", "0.71570605", "0.7156595", "0.7156595", "0.7119968...
0.0
-1
Returns the full title on per page basis.
def full_title(page_title) base_title = "ARealtor" if page_title.empty? base_title else "#{base_title} | #{page_title}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title\n @title_pages.each { |tp| tp.title and return tp.title }\n nil\n end", "def page_title\n page.title\n end", "def full_title(page_title)\n if page_title.empty?\n @@base_title\n else\n \"#{@@base_title} | #{page_title}\"\n end\n end", "def full_title(page...
[ "0.83595914", "0.7992085", "0.78369653", "0.78206384", "0.77611417", "0.77517354", "0.7746882", "0.77463675", "0.7694665", "0.76935065", "0.7685117", "0.7685059", "0.7682162", "0.7677138", "0.7677138", "0.7677138", "0.7677138", "0.7677138", "0.7677138", "0.7677138", "0.767191...
0.75842434
34
Returns joke from ICNDB
def icndb_joke url = "http://api.icndb.com/jokes/random" begin joke = open(url).read() hash = JSON.parse joke joke_string = hash['value']['joke'] rescue joke_string='' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def joke(id)\n path = id.nil? ? \"/\" : \"/j/#{id}\"\n resp = http.get(path).tap do |resp|\n if resp.body.status == 404\n raise FunnyGuy::HTTPError::NotFound, error_handler.response_values(resp.env)\n end\n end\n FunnyGuy::DataSource::ICanHasDadJoke::Joke.new resp.body\n end", "def ...
[ "0.6224704", "0.59733707", "0.5640795", "0.5559783", "0.55182016", "0.54919726", "0.5325014", "0.52230704", "0.52155465", "0.5209845", "0.5145834", "0.5134466", "0.51216155", "0.5080215", "0.50569725", "0.50364983", "0.50310045", "0.501427", "0.5013942", "0.50120306", "0.5005...
0.69345134
0
Construtor Cria um programa de shaders
def initialize @id = glCreateProgram @shaders = [] @linked = false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_shaders(widget)\n context = widget.context\n\n if context.use_es?\n vertex_path = \"/glarea/glarea-gles.vs.glsl\"\n fragment_path = \"/glarea/glarea-gles.fs.glsl\"\n else\n vertex_path = \"/glarea/glarea-gl.vs.glsl\"\n fragment_path = \"/glarea/glarea-gl.fs.glsl\"\n end\n ...
[ "0.78125066", "0.6928768", "0.67964166", "0.6714616", "0.64758843", "0.6113041", "0.58382887", "0.5825165", "0.58169854", "0.57286125", "0.5671796", "0.56446886", "0.5626977", "0.550136", "0.5473906", "0.538306", "0.53658396", "0.5308355", "0.52918667", "0.5257406", "0.521044...
0.79877937
0
Adiciona um shader de fragmento ao programa a partir de um arquivo
def add_fragment_shader name raise 'O programa já está linkado, não é possível adicionar mais shaders' if @linked file = File.open "shaders/#{name}.frag" source = file.read file.close shader = glCreateShader GL_FRAGMENT_SHADER glShaderSource shader, 1, [source.cptr].pack("L").cptr, 0 glCompileShader shader info_log_length = [0].pack("L") glGetShaderiv shader, GL_INFO_LOG_LENGTH, info_log_length.cptr info_log_length = info_log_length.unpack("L")[0] if info_log_length > 0 err = "\0" * (info_log_length + 1) glGetShaderInfoLog shader, info_log_length, 0, err.cptr unless err.include? "No errors" raise "Falha ao compilar shader de fragmento `#{name}`: #{err}" end end glAttachShader @id, shader @shaders << shader end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_shaders(widget)\n context = widget.context\n\n if context.use_es?\n vertex_path = \"/glarea/glarea-gles.vs.glsl\"\n fragment_path = \"/glarea/glarea-gles.fs.glsl\"\n else\n vertex_path = \"/glarea/glarea-gl.vs.glsl\"\n fragment_path = \"/glarea/glarea-gl.fs.glsl\"\n end\n ...
[ "0.6816895", "0.65912825", "0.6151664", "0.60401577", "0.59396833", "0.5902404", "0.5325893", "0.52054155", "0.511485", "0.49794608", "0.49179956", "0.49107358", "0.47824085", "0.47394258", "0.4709167", "0.4672516", "0.46669614", "0.4666518", "0.46074077", "0.4606476", "0.460...
0.79679126
0
Ativa o programa de shaders
def use glUseProgram @id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_shaders(widget)\n context = widget.context\n\n if context.use_es?\n vertex_path = \"/glarea/glarea-gles.vs.glsl\"\n fragment_path = \"/glarea/glarea-gles.fs.glsl\"\n else\n vertex_path = \"/glarea/glarea-gl.vs.glsl\"\n fragment_path = \"/glarea/glarea-gl.fs.glsl\"\n end\n ...
[ "0.73791856", "0.6774999", "0.661522", "0.65457886", "0.629392", "0.5975027", "0.56829584", "0.5635223", "0.5614747", "0.53920424", "0.538263", "0.53819466", "0.53347224", "0.53287166", "0.5316994", "0.52631116", "0.52107185", "0.5139761", "0.51067775", "0.5094172", "0.507926...
0.64287764
4
divmod returns an array of the quotient and remainder if the quotient is divisible by 60 divmod is used again providing hours and minutes, and seconds are pushed onto the back of array single digit numbers are padded with 0 words are converted into string with the separator
def time_string clock = @seconds.divmod(60) if clock[0] > 59 b = clock[1] a = clock[0].divmod(60) clock = a.push(b) else clock.unshift(0) end clock.map! do |final| if final < 10 "0" + final.to_s else final end end clock.join(":") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_playtime(start)\r\r\n number = []\r\r\n number[0] = start / 60 / 60\r\r\n number[1] = start / 60 % 60\r\r\n number[2] = start % 60\r\r\n return number\r\r\n end", "def split_playtime(start)\n number = []\n number[0] = start / 60 / 60\n number[1] = start / 60 % 60\n number[2]...
[ "0.62744635", "0.6194322", "0.61703575", "0.60900307", "0.6050997", "0.602515", "0.60038316", "0.59600335", "0.5889224", "0.5863171", "0.58164614", "0.58023393", "0.5782319", "0.5772425", "0.5770685", "0.5768418", "0.5730348", "0.5723905", "0.5691104", "0.56821966", "0.567208...
0.61486465
3
To not break prod (WebKite) ~Jon
def liquid_line_number @line_number end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_production; end", "def allow_production=(_arg0); end", "def prod?\n !(Rails.env.development? || Rails.env.test?)\nend", "def request_debug_assets?; end", "def request_debug_assets?; end", "def production?\n ENV[\"JEKYLL_ENV\"] == \"production\"\nend", "def keg_only?; false end", "def prod...
[ "0.7174081", "0.68001735", "0.61823434", "0.60857356", "0.60857356", "0.6056256", "0.6000531", "0.5991989", "0.59841806", "0.5941582", "0.59167844", "0.5895661", "0.5851723", "0.5830881", "0.58148843", "0.5782016", "0.5773634", "0.5771044", "0.5765948", "0.5738071", "0.572959...
0.0
-1
this testcase has no tests of its own:
def default_test info "self: #{self}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec; end", "def spec; end", "def __dummy_test__\n end", "def private; end", "def running_test_case; end", "def self_test; end", "def self_test; end", "def testing\n # ...\n end", "def test_0_dummy\n\t\tend", "def specie; end", "def specie; end", "def specie; end", "def s...
[ "0.7112998", "0.7112998", "0.70541435", "0.6955685", "0.69552517", "0.6940652", "0.6940652", "0.692186", "0.6813294", "0.6772844", "0.6772844", "0.6772844", "0.6772844", "0.67088455", "0.66806275", "0.6677824", "0.6677824", "0.64796865", "0.64796865", "0.6450797", "0.64417815...
0.0
-1
Register plugin with name in internal array
def register(name, plugin = false) return unless plugin && !loaded?(name) @plugins << plugin end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(plugin, id); end", "def plugin(name)\n @plugins[name]\n end", "def register!\n # Register the plugin.\n @manager.register_plugin! self\n end", "def plugin(name); end", "def << plugin\n @plugins[plugin.to_s] = plugin\n end", "def load_plugin(name); end", "def ad...
[ "0.7747027", "0.7406852", "0.73945683", "0.73907757", "0.73562616", "0.72290117", "0.72211283", "0.72204417", "0.72193795", "0.7164622", "0.70767844", "0.70114243", "0.69876015", "0.6931228", "0.68947953", "0.6870711", "0.68464464", "0.68297637", "0.67886204", "0.6771686", "0...
0.78041494
0
Loads gemspec from a file and registers gems matching pattern.
def load_from(gemspec_path, pattern) Gem.refresh spec = Gem::Specification.load(gemspec_path) dependencies = spec.runtime_dependencies.concat(spec.development_dependencies) dependencies.each do |gem| gem_name = gem.name[pattern] next if gem_name.to_s.empty? register(gem_name, Plugin.new(gem_name, gem)) end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_gemspec!\n @gemspec = eval(File.read(@gemspec_file))\n end", "def load_gemspec\n\n text = File.read(gemspec_file)\n if text =~ /\\A---/ \n require 'yaml'\n spec = YAML.load(text)\n else\n #spec = eval(text) #, gemspec_file)\n spec = ::Gem...
[ "0.7242673", "0.69334483", "0.6797337", "0.65715325", "0.65404963", "0.6473995", "0.6406423", "0.6385486", "0.6342654", "0.62927926", "0.6113445", "0.6079612", "0.6001457", "0.5971521", "0.59482914", "0.59412575", "0.5929736", "0.591711", "0.591711", "0.5914992", "0.5895672",...
0.7375221
0
Activate all registered plugins that are not already enabled and add lib paths to $LOAD_PATH.
def activate plugins.each do |plugin| plugin.load! unless plugin.enabled? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_plugins\n @plugins.each do |plugin|\n plugin.activate! if plugin.enabled?\n end\n end", "def add_plugin_load_paths\r\n plugins.each do |plugin|\r\n plugin.load_paths.each do |path|\r\n $LOAD_PATH.insert(application_lib_index + 1, path)\r\n\r\n Ac...
[ "0.7820285", "0.76491386", "0.74310327", "0.7254151", "0.70070267", "0.6894411", "0.68405294", "0.6815507", "0.68147653", "0.6794474", "0.6785123", "0.6782352", "0.6743389", "0.67027247", "0.6670235", "0.6657703", "0.66402704", "0.6599149", "0.6587906", "0.65846115", "0.65473...
0.7455547
2
Return a list of all plugin names as strings
def names plugins.reduce({}) do |hash, plugin| hash[plugin.name] = plugin hash end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plugin_names\n @plugin_names ||= []\n end", "def registered_plugin_names\r\n configuration.plugins ? configuration.plugins.map(&:to_s) : nil\r\n end", "def find_all_plugin_names(*pattern)\n find_all_plugin_specs(*pattern).map do |spec|\n spec.plugin_name\n ...
[ "0.8035311", "0.7955958", "0.734698", "0.70959586", "0.70475185", "0.70257276", "0.69222426", "0.680727", "0.6747513", "0.66487414", "0.6607537", "0.6499434", "0.64321476", "0.64296806", "0.6425936", "0.63353133", "0.63311315", "0.63207763", "0.63129514", "0.63000154", "0.629...
0.7536673
2
Check if plugin is already loaded
def loaded?(name) plugins.any? { |plugin| plugin.name == name } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_plugin?(name)\n true\n end", "def plugin_loaded(name)\n\n\t\tif @plugins.length == 0\n\t\t\treturn false\n\t\tend\n\n\t\t@plugins.each do |a|\n\t\t\tif a.name == name\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\n\t\treturn false\n\tend", "def reload_plugins?\n !!@reload_plugins\n e...
[ "0.7530419", "0.74958473", "0.72060055", "0.6964545", "0.6776728", "0.67538995", "0.6713307", "0.66962284", "0.66883403", "0.6598972", "0.6598972", "0.6587917", "0.6561075", "0.64950204", "0.64334995", "0.63454765", "0.6328808", "0.63177216", "0.6293933", "0.6289538", "0.6280...
0.746727
2
Include an Octicon! (see
def octicon(name) %(<span class="octicon octicon-#{name}"></span>) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def octicon(name, options)\n content_tag :svg, options do\n content_tag :use, '', 'xlink:href' => \"#icon-#{name}\"\n end\n end", "def rocticon_css(symbol, parameters = {})\n octicon = ::Octicons::Octicon.new(symbol, parameters.merge({xmlns: 'http://www.w3.org/2000/svg'}))\n [:width...
[ "0.7008846", "0.6281313", "0.6156053", "0.6120124", "0.60483295", "0.6034941", "0.58948696", "0.58718336", "0.58489734", "0.58489734", "0.5822725", "0.5807627", "0.5795426", "0.57802445", "0.5754399", "0.5754399", "0.5724942", "0.57214034", "0.5697736", "0.56935656", "0.56890...
0.75193274
0
Get the directoryTree from the root of the repo
def tree_root repo.tree end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repository_root\n return unless available?\n root = Licensed::Shell.execute(\"git\", \"rev-parse\", \"--show-toplevel\", allow_failure: true)\n return nil if root.empty?\n root\n end", "def get_svn_repo_root( dir='.' )\n\tinfo = get_svn_info( dir )\n\treturn info['Repository ...
[ "0.72790486", "0.6908844", "0.6906041", "0.67978346", "0.6332378", "0.63251656", "0.63149714", "0.6272349", "0.6106052", "0.60321736", "0.6029437", "0.60287106", "0.5997431", "0.5995607", "0.5966819", "0.59331894", "0.5915845", "0.5880715", "0.5866433", "0.58440495", "0.58265...
0.76856315
0
URL helper for the History page of a document
def history_path(path) url('/h/' + path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_url(first, hsh)\n hsh = hsh.merge item_type: model.class.to_s,\n item_id: model.id.to_i\n api_history_path(first, hsh)\n end", "def redirection_history; end", "def history\r\n\r\n end", "def add_to_history(page); end", "def history\n # blank\n end", "def document_...
[ "0.6869474", "0.65658134", "0.6473387", "0.6469171", "0.6433061", "0.642693", "0.64180875", "0.64180875", "0.64180875", "0.6360034", "0.6259342", "0.6259342", "0.62400496", "0.620006", "0.619646", "0.6159481", "0.6153468", "0.61135805", "0.61122423", "0.6109527", "0.6074837",...
0.70901227
0
URL helper for the Edit page of a document
def edit_path(path) url('/e/' + path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_edit\n cname = self.class.classname.to_s.downcase\n return \"?show=#{cname}_edit&#{cname}_id=#{self.id}\"\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", ...
[ "0.7392644", "0.7212802", "0.7170562", "0.7170562", "0.7170562", "0.7170562", "0.7170562", "0.7170562", "0.7170562", "0.7170562", "0.7170562", "0.7170562", "0.7170562", "0.7170562", "0.7170562", "0.7170562", "0.71617776", "0.71538025", "0.7147042", "0.7146872", "0.7144504", ...
0.73278123
1
CSS class for a diff line
def class_for_diff(line) case line[0] when '+' 'addition' when '-' 'removal' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diff_line_class(line)\n case line[0, 1]\n when '+' then 'added'\n when '-' then 'deleted'\n end\n end", "def colorized_diff\n diff.lines.map do |line|\n self.class.colorize_line(line)\n end.join\n end", "def colorized_diff\n return unless diff\n\n diff.lines.map(&...
[ "0.74846035", "0.675893", "0.6689632", "0.6309649", "0.6116834", "0.60038835", "0.5964602", "0.586575", "0.58221835", "0.5816642", "0.56416863", "0.56178", "0.5612193", "0.5609927", "0.5604306", "0.5591892", "0.55917454", "0.5588305", "0.55746365", "0.55416924", "0.55124146",...
0.737318
1
Render Markdown to HTML
def render_markdown(markdown) settings.markdown_renderer.render(markdown) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_html\n determine_markdown_renderer\n @markdown.to_html\n end", "def html\n Markdown.render(self.content)\n end", "def html\n Markdown.render(self.content)\n end", "def render_markdown\n return @render if @render\n @render = Markdown.new(:content => content, :indent => se...
[ "0.8409079", "0.8137766", "0.8137766", "0.8056751", "0.80021566", "0.78712976", "0.78600425", "0.7854223", "0.78368473", "0.77851504", "0.77647424", "0.7758357", "0.7707314", "0.76822865", "0.76787823", "0.76440126", "0.7620145", "0.7612946", "0.7612946", "0.76050615", "0.759...
0.80286545
4
create or return Repository
def repo settings.repo end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repository!\n Repository.find_or_create_by!(url: repository_url) do |repo|\n repo.organization_id = org_id\n repo.name = repository_name\n end\n end", "def repository\n repo = RepositoryManager.for(repository_key)\n return repo unless repo.nil?\n # w...
[ "0.77289057", "0.7469509", "0.6973556", "0.693031", "0.6873853", "0.67995", "0.6779496", "0.67769986", "0.6755466", "0.6752897", "0.6696692", "0.6696683", "0.66817087", "0.66760975", "0.6635438", "0.6609682", "0.6606863", "0.66008943", "0.65804327", "0.65699387", "0.65699387"...
0.0
-1
create or return the Search Index
def files_set if settings.fs_created + 12 < Time.now settings.fs = FuzzySet.new(repo.files) settings.fs_created = Time.now end settings.fs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_search_index\n Tire.index self.index_name\n end", "def build_index\n @search = RSemantic::Search.new(@documents.map(&:text), @options)\n end", "def construct_index\n end", "def index\r\n build_index unless @index\r\n @index\r\n end", "def create_search_index(name, schem...
[ "0.86561006", "0.80279", "0.7732848", "0.7458167", "0.7252066", "0.72442234", "0.7135191", "0.7017779", "0.69923246", "0.69323915", "0.69263905", "0.6917118", "0.6917118", "0.69138503", "0.689705", "0.68556327", "0.6846981", "0.67983127", "0.6721871", "0.67210317", "0.669515"...
0.0
-1
Hook the Nexus into the register API, any register read requests will use the Nexus by default
def read_register(reg, options = {}) # nexus.read_register(reg, options) cc 'Needs to be enabled when a register protocol is available' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register\n end", "def register\n end", "def register\n end", "def register\n end", "def register\n \n end", "def register\r\n \r\n end", "def register\n\n\tend", "def nexus\n return @nexus unless @nexus.nil?\n @nexus = Chef::Nexus.new(new_resource.url, new_resource.username, new...
[ "0.6889513", "0.6889513", "0.6889513", "0.68345374", "0.68161243", "0.67570263", "0.67251754", "0.64401734", "0.6420024", "0.6020427", "0.59838766", "0.59501445", "0.59399873", "0.59350973", "0.5931362", "0.591868", "0.591868", "0.5901147", "0.5849574", "0.5836683", "0.582970...
0.51978475
44
As above for write requests
def write_register(reg, options = {}) # nexus.write_register(reg, options) cc 'Needs to be enabled when a register protocol is available' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(_request, _response)\n raise NotImplementedError, 'Implement this method in your strategy'\n end", "def pending_write?; end", "def write\n write_data\n end", "def write; end", "def write; end", "def on_writable\n @being_written = nil\n return unless res = responses....
[ "0.7191813", "0.69296527", "0.67635834", "0.6695295", "0.6695295", "0.66216135", "0.66215885", "0.65902555", "0.6546661", "0.6240716", "0.6226093", "0.6226093", "0.6226093", "0.6066174", "0.6064423", "0.6062388", "0.6062388", "0.6062388", "0.6062388", "0.6056641", "0.6056641"...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_media_type @media_type = MediaType.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def media_type_params params.require(:media_type).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
helper method that converts object to open struct recursively
def hashes2ostruct(object) return case object when Hash object = object.clone object.each do |key, value| object[key] = hashes2ostruct(value) end OpenStruct.new(object) when Array object = object.clone object.map! { |i| hashes2ostruct(i) } else object end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_ostruct(obj)\n return OpenStruct.new(Hash[obj.map { |k, v| [k, _convert_ostruct(v)] }]).freeze if obj.is_a?(Hash)\n return obj.map { |v| _convert_ostruct(v) }.freeze if obj.is_a?(Array)\n obj\n end", "def _struct(obj)\n obj.class.new(*_renc(obj.to_h).values)\n end", "def nested_struc...
[ "0.6278626", "0.61189574", "0.5995268", "0.5810311", "0.5792834", "0.5704883", "0.57033473", "0.5678983", "0.5612167", "0.5592857", "0.5508088", "0.55053204", "0.5481234", "0.5477341", "0.5462412", "0.54365253", "0.5432352", "0.5421812", "0.53694427", "0.5361314", "0.5349662"...
0.5938934
4
GET /commands GET /commands.json
def index @commands = Command.all render :json => @commands end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commands(params = {})\n res = @client.get(\"#{path}/commands\", params)\n\n res.json[\"commands\"].map { |atts| M2X::Client::Command.new(@client, atts) } if res.success?\n end", "def index\n @commands = Command.all\n end", "def index\n @commands = Command.all\n end", "def index\n @comma...
[ "0.78649783", "0.7111867", "0.7111867", "0.6937871", "0.69377637", "0.67611986", "0.6751875", "0.6694443", "0.6670576", "0.664987", "0.6609053", "0.65806025", "0.65446085", "0.6470076", "0.64382315", "0.63795847", "0.6256752", "0.61963713", "0.61805284", "0.6176437", "0.61572...
0.7855072
1
GET /commands/1 GET /commands/1.json
def show respond_to do |format| if @command.present? format.json { render json: @command } else msg = { :status => 'error', message: 'Records Not Found'} format.json { render json: msg } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @commands = Command.all\n render :json => @commands\n end", "def command(id)\n res = @client.get(\"#{path}/commands/#{id}\")\n\n M2X::Client::Command.new(@client, res.json) if res.success?\n end", "def commands(params = {})\n res = @client.get(\"#{path}/commands\", params)\n\n r...
[ "0.73789227", "0.72582626", "0.71749294", "0.6883389", "0.6883389", "0.66961443", "0.647931", "0.6421412", "0.6288571", "0.6256665", "0.6251238", "0.623424", "0.6193243", "0.615816", "0.6076257", "0.6066263", "0.6066263", "0.6066263", "0.6053511", "0.6050643", "0.60484695", ...
0.62910324
8
POST /commands POST /commands.json
def create @command = Command.new(command_params) respond_to do |format| if @command.save format.json { render json: @command } else format.json { render json: @command.errors, status: 401 } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_params\n params.require(:command).permit(:name, :json)\n end", "def create\n @command = current_user.commands.build(command_params)\n\n respond_to do |format|\n if @command.save\n format.html { redirect_to @command, notice: \"Command is queued to run...\" }\n format.json ...
[ "0.7092538", "0.6900521", "0.6764133", "0.67391413", "0.64927304", "0.6273162", "0.6253894", "0.62021655", "0.6165331", "0.6063389", "0.6036017", "0.6025217", "0.6019788", "0.5955273", "0.59393644", "0.59293926", "0.59288085", "0.5922161", "0.58942914", "0.58630234", "0.58289...
0.7124352
0
PATCH/PUT /commands/1 PATCH/PUT /commands/1.json
def update respond_to do |format| if @command.update(command_params) format.json { render :json => @command } else format.json { render json: @command.errors, status: 401 } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @command.update(command_params)\n format.html { redirect_to @command, notice: 'Command was successfully updated.' }\n format.json { render :show, status: :ok, location: @command }\n else\n format.html { render :edit }\n format.json {...
[ "0.64716566", "0.62544644", "0.6223385", "0.6166207", "0.5989352", "0.59023935", "0.5902321", "0.59014827", "0.58701193", "0.58631754", "0.585324", "0.5769708", "0.56984615", "0.5689745", "0.56885976", "0.56885976", "0.56767225", "0.5673897", "0.5664423", "0.56581366", "0.565...
0.70265263
0
DELETE /commands/1 DELETE /commands/1.json
def destroy @command.destroy respond_to do |format| msg = { :status => 'ok', message: 'Deleted Successfully'} format.json { render json: msg } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @command.destroy\n respond_to do |format|\n format.html { redirect_to commands_url, notice: 'Command was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @command.destroy\n respond_to do |format|\n format.html { redirect_to co...
[ "0.72264004", "0.7218138", "0.7183386", "0.7077406", "0.6934684", "0.6799898", "0.6723346", "0.67077225", "0.6700849", "0.6689655", "0.6689467", "0.6684283", "0.6684283", "0.6684283", "0.6684283", "0.6642257", "0.6591556", "0.6577685", "0.65410274", "0.65145236", "0.6500549",...
0.73457795
0
Use callbacks to share common setup or constraints between actions.
def set_command @command = Command.find_by(id: params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def command_params params.permit(:command_name, :post_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /stories GET /stories.json
def index @page_title = 'Stories' if params[:tag_id] @obj = Tag.find_by_name(params[:tag_id]) elsif params[:character_id] @obj = Character.find(params[:character_id]) elsif params[:source_id] @obj = Source.find(params[:source_id]) else @base_stories = Story.all unless can_see_adult? @base_stories = Story.non_adult(@base_stories) .or(stories.where(user: current_user_or_guest)) end end if @obj.present? @base_stories = @obj.visible_stories(current_user_or_guest) # @page_title.prepend(@obj.name + ' ') @page_title += " in \"#{@obj.name}\"" end @base_stories = do_filtering(@base_stories) # exact_filters = {} # fuzzy_filters = {} # # %i[tags sources characters].each do |tp| # exact_filters[tp] = params["filter_#{tp}".to_sym] # fuzzy_filters[tp] = params["other_#{tp}".to_sym] # end # @base_stories = Story.tsc_wrapper(@base_stories, exact_filters, true) # @base_stories = Story.tsc_wrapper(@base_stories, fuzzy_filters, false) # query_params = { # tags: params[:other_tags], # sources: params[:other_sources], # characters: params[:other_characters] # } # @base_stories = Story.tsc_search(@base_stories, query_params) # @base_stories = Story.tsc_search(@base_stories, params) # sort_by = params[:sort_by] ? params[:sort_by].to_sym : :updated_at # sort_dir = params[:sort_direction] ? params[:sort_direction].to_sym : :desc # if sort_by == :num_comments # @stories = @base_stories.left_outer_joins(:comments) # .select('stories.*, COUNT(comments.*)') # .group('stories.id') # .order("COUNT(comments.*) #{sort_dir}") # else # @stories = @base_stories.order(sort_by => sort_dir) # end # unless can_see_adult? # # @base_stories = @base_stories.reject(&:is_adult?) # @base_stories = Story.non_adult(@base_stories) # end @stories = Story.s_sort(@base_stories, params[:sort_by], params[:sort_direction]) @stories = @stories.paginate(page: params[:page], per_page: 10) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @stories = Story.all\n render json: @stories, root: false\n end", "def index\n @stories = Story.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @stories }\n end\n end", "def get_stories\n api_url ...
[ "0.7912268", "0.7652356", "0.7617811", "0.749546", "0.74498045", "0.74498045", "0.74498045", "0.74498045", "0.74498045", "0.74498045", "0.7448078", "0.7423067", "0.74189985", "0.74189985", "0.73998713", "0.73920465", "0.7388038", "0.7382927", "0.73384607", "0.73384607", "0.73...
0.0
-1
GET /stories/1 GET /stories/1.json
def show redirect_to @story.first_chapter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n story = Story.find(params[:id])\n render json: story\n end", "def index\n @stories = Story.all\n render json: @stories, root: false\n end", "def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:...
[ "0.77512723", "0.77086306", "0.7524696", "0.75152636", "0.74868363", "0.7486413", "0.7486413", "0.7464921", "0.74565643", "0.74565643", "0.7368119", "0.7368119", "0.7368119", "0.7368119", "0.7368119", "0.7368119", "0.73667985", "0.732709", "0.7308125", "0.7269857", "0.7202481...
0.0
-1