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
Use callbacks to share common setup or constraints between actions.
def set_event @event = Event.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
an alternative way to create hashes
def artax a = [:punch, 0] b = [:kick, 72] c = [:stops_bullets_with_hands, false] key_value_pairs = [a, b, c] Hash[key_value_pairs] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash(*) end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def to_hash() end", "def create_hash(&blo...
[ "0.77497303", "0.77497303", "0.77497303", "0.77497303", "0.77497303", "0.77497303", "0.77497303", "0.7538488", "0.73652756", "0.7352551", "0.72668123", "0.72668123", "0.71752876", "0.71634734", "0.71634734", "0.71634734", "0.71634734", "0.71634734", "0.71634734", "0.71634734", ...
0.0
-1
Send points in batches of a hundred. I'm not sure exactly how much the API can cope with in a single call, so this might change.
def _send_point(body) body.each_slice(100) do |p| conn.post('/?f=wavefront', p.join("\n"), 'application/octet-stream') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_batch\n batch = @batch.map(&:first) # get the requests\n response = send_batch_request(batch)\n\n begin\n responses = JSON.parse(response)\n rescue\n raise Jimson::ClientError::InvalidJSON.new(json)\n end\n\n process_batch_response(responses)\n responses = ...
[ "0.61290437", "0.60472465", "0.5712649", "0.56227756", "0.56149447", "0.55629003", "0.5535943", "0.5477959", "0.5416563", "0.5410397", "0.5389276", "0.5386063", "0.53725266", "0.5363811", "0.53573585", "0.53545845", "0.5338584", "0.5328771", "0.5321805", "0.53210855", "0.5277...
0.6768508
0
Create a new task, assigned to run on the given thread.
def initialize(thread, &block) @thread = thread @block = block @value_mutex = Mutex.new @value_cond = Turbine::ConditionVariable.new @called = false @value = nil @value_type = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_create(task, data=nil)\n if task_present? task\n task = task_get task\n elsif task.is_a? Deployment::Task\n task = task_add task\n else\n task = Deployment::Task.new task, node, data\n task = task_add task\n end\n task.data = data if data\n task\n ...
[ "0.658307", "0.6420867", "0.6420259", "0.63941556", "0.6373084", "0.621616", "0.61685836", "0.6144548", "0.6128336", "0.611508", "0.61070234", "0.61070234", "0.60641783", "0.59942997", "0.5931701", "0.5905548", "0.59002954", "0.58705866", "0.5866429", "0.58647406", "0.5864671...
0.0
-1
Instantiates a new instance of self.
def initialize(file_specs, options) @file_specs = file_specs @options = options @options['log_level'] ||= 'info' @logger = initialize_logger(@options['logger']) @reporter = initialize_reporter(@options['validation-reporter']) @options['run_options'] ||= [] # make sure this is always ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n \n end", "def new()\n #This is a stub, used for indexing\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize...
[ "0.77194566", "0.7662317", "0.75612843", "0.75612843", "0.75612843", "0.75612843", "0.75612843", "0.75612843", "0.74761206", "0.74014324", "0.74014324", "0.7391811", "0.73667973", "0.732348", "0.732348", "0.732348", "0.732348", "0.732348", "0.732348", "0.732348", "0.73195356"...
0.0
-1
Returns the primary file spec for self. This is used for reporting where we want a single file spec only. Uses the one with key :primary if present, otherwise a random one.
def primary_file_spec @file_specs[:primary] || @file_specs[@file_specs.keys.first] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corresponding_primary_file\n return self if is_primary?\n\n cpct = corresponding_primary_content_type\n self.class.new(\n File.read(corresponding_primary_filename),\n cpct.language,\n corresponding_primary_filename,\n cpct\n )\n end", "def...
[ "0.7044957", "0.6303264", "0.61474293", "0.58819026", "0.5824097", "0.5817692", "0.5817692", "0.58163816", "0.5797509", "0.5704231", "0.56131697", "0.559982", "0.55916196", "0.556773", "0.5563159", "0.55624014", "0.55624014", "0.5524466", "0.55004084", "0.54994243", "0.549449...
0.88662577
1
Devise security improvements, used to invalidate old sessions on logout Taken from
def authenticatable_salt "#{super}#{session_token}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_out_expired_session\n return unless current_user.present?\n return if current_user.last_sign_in_check.present? && current_user.last_sign_in_check <= 5.minutes.ago\n\n current_user.update last_sign_in_check: Time.now\n\n if UniversumSsoClient.signed_out?(current_user.uid)\n session[:user_i...
[ "0.7106749", "0.6990926", "0.6984968", "0.69813484", "0.69718224", "0.6954962", "0.69285214", "0.69272554", "0.689483", "0.68845135", "0.6874036", "0.6873158", "0.685214", "0.6844198", "0.68310356", "0.68121976", "0.68048054", "0.6768563", "0.6768341", "0.67549807", "0.675091...
0.0
-1
Read browsers requirements from application config
def browsers(app) file = app.root.join('config/autoprefixer.yml') config = file.exist? ? YAML.load_file(file) : { 'browsers' => nil } config['browsers'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def browser_version\n ENV['BROWSER_VERSION']\n end", "def env_browser_name\n (ENV['BROWSER'] ||= 'firefox')\nend", "def browsers\n @browsers ||= @data[\"agents\"].keys.map{|b| PUBLIC_BROWSER_NAMES[b] }.sort\n end", "def browser_cmdline\n browser_env.each do |p|\n Launchy.log \"#{self.cla...
[ "0.60073966", "0.59629333", "0.59535635", "0.58589315", "0.57369584", "0.5692717", "0.56453407", "0.56441313", "0.5617939", "0.55933774", "0.55855405", "0.55812037", "0.5573661", "0.55695426", "0.5565853", "0.5520386", "0.55108476", "0.54708165", "0.53766215", "0.53762597", "...
0.6776741
0
vertical is the easy case, we know that the width will always be 1 and there has to be a solid brick below it
def is_solid_piece_at_bottom?( piece, position ) return position.layout[0] == 1 || position.layout[0] == 'K' || position.layout[0] == 'P' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertical?\n height > width\n end", "def outer_height; rect.height + @border_thickness * 2; end", "def vertical?\n height > width if !(width.blank? && height.blank?)\n end", "def base_height; 24; end", "def base_height; 24; end", "def draw\n\t\tputs \"\\n\"\n\t\tmid = (@height/2.0).ceil\n\...
[ "0.6645652", "0.6286024", "0.62096035", "0.61756593", "0.61756593", "0.60523385", "0.6044686", "0.6037355", "0.6013931", "0.5995753", "0.59512687", "0.5858737", "0.5833532", "0.577654", "0.577654", "0.5773684", "0.5756636", "0.5754191", "0.5733624", "0.5733624", "0.57094544",...
0.0
-1
Check if this block is valid, and appears after prev block
def after?(prev_block) (index - prev_block.index) == 1 && prev_block.time <= time && prev_block.hash == prev_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_valid?(args = {})\n block = Block.find_by(id: args[:block_id])\n previous_block = block.previous_block\n neighbor_blocks_valid?(block, previous_block)\n end", "def valid_new_block?(new_block, previous_block)\n conditions = {\n (new_block.block_index != (previous_block.block_index + 1)...
[ "0.6610355", "0.64600044", "0.63057286", "0.62794924", "0.601952", "0.59391516", "0.59188473", "0.587369", "0.5873529", "0.58649486", "0.5832942", "0.5811153", "0.5779361", "0.5750054", "0.5728072", "0.5666664", "0.563097", "0.5600104", "0.5593506", "0.55910987", "0.556176", ...
0.70807743
0
Return hash representation of block
def to_h { data: data, nonce: nonce, time: time, hash: hash, index: index, prev_hash: prev_hash } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash(block)\n Digest::SHA256.hexdigest(block.to_s.encode)\n end", "def calculate_block_hash(block)\n Digest::SHA256.hexdigest(block.block_index.to_s + block.previous_block_hash + block.timestamp + block.data)\n end", "def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.inde...
[ "0.8520505", "0.8312244", "0.81396824", "0.7151379", "0.6863372", "0.68395275", "0.68395275", "0.68395275", "0.68395275", "0.68395275", "0.68395275", "0.68395275", "0.6690625", "0.65731084", "0.65619695", "0.6482824", "0.64780384", "0.6453022", "0.6453022", "0.6453022", "0.64...
0.0
-1
Serialized representation of block
def to_bson to_h.to_bson end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blocks\n object.blocks.map{ |x|\n ShallowBlockSerializer.new(x)\n }\n end", "def serialize\n @raw_data\n end", "def to_s; \"<Block #{length}>\"; end", "def serialize(*args, &block); end", "def serialize(*args, &block); end", "def encode_block(state, buf)\n\t\tbuf\n\tend", "def a...
[ "0.6898893", "0.67395276", "0.6524439", "0.64502716", "0.64502716", "0.6413992", "0.63004255", "0.62966585", "0.6251218", "0.6251218", "0.6153699", "0.61495566", "0.61055", "0.6081842", "0.5997257", "0.59743136", "0.59533584", "0.5950048", "0.5943738", "0.5933947", "0.590153"...
0.0
-1
These methods are part of the code to make the tree editable
def startEdit super create_text_field unless @text_field set_text nil set_graphic @text_field @text_field.select_all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_tree\n\tend", "def update_tree(element); end", "def render\n return ro_standard if @readonly \n set_initial_value('html','value')\n require 'sort_alphabetical' \n \n record = record_text_for(@yaml['name'])\n p '******', \"<div id=\\\"#{@yaml['name']}\\\" class=\\\"tree-select\\\" #{set_style()...
[ "0.6467389", "0.640778", "0.63123137", "0.6152099", "0.61062366", "0.6084185", "0.5999627", "0.5947091", "0.5945303", "0.5898976", "0.5896479", "0.5876703", "0.58739364", "0.5815046", "0.5811449", "0.58060795", "0.5801345", "0.5801345", "0.5801345", "0.58005214", "0.5796903",...
0.0
-1
ID of the object
def id object["id"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_id() end", "def __id; @id || @obj.id; end", "def id\n object.object_id\n end", "def id\n object.id\n end", "def id\n object.id\n end", "def id\n object_id\n end", "def getId()\n @obj.getId()\n end", "def id\n object.id.to_i\n end", "def id\n o...
[ "0.87322426", "0.8651325", "0.86476535", "0.8606129", "0.8606129", "0.8600797", "0.85745674", "0.85698", "0.8560696", "0.8421016", "0.827813", "0.8238045", "0.82376343", "0.81944907", "0.81944907", "0.8168917", "0.80596024", "0.8044447", "0.80291855", "0.79699576", "0.7947691...
0.84046805
10
Info about the user who uploaded the file.
def from Skydrive::User.new(client, object["from"]) if object["from"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getUploadedBy\r\n\t\t\t\t\treturn @uploadedBy\r\n\t\t\t\tend", "def updatedb_file_user(file)\n meta = updatedb_file_ls(file)\n if meta\n user = meta.split(\" \")[2]\n user\n else\n nil\n end\n end", "def user_info\n auth_hash['user_info']...
[ "0.70834726", "0.7069", "0.64142984", "0.64035803", "0.6263915", "0.6227187", "0.6179323", "0.61696976", "0.6162234", "0.61425", "0.6140512", "0.610057", "0.6081751", "0.60651326", "0.60464936", "0.6022486", "0.59876144", "0.5950826", "0.59398514", "0.59292054", "0.592261", ...
0.0
-1
Name of the object
def name object["name"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n @object.to_s\n end", "def getName()\n return @obj_name\n end", "def object_name; end", "def object_name; end", "def object_name; end", "def name\n object.name\n end", "def object_name\n @object.name.split('::').last.downcase + 's'\n end", "def name\n @name || ...
[ "0.8806093", "0.8698997", "0.8656774", "0.8656774", "0.8656774", "0.85568655", "0.8288197", "0.80444765", "0.8032044", "0.7838107", "0.7821775", "0.7745129", "0.77391887", "0.77360207", "0.7734133", "0.77287096", "0.77060217", "0.7695555", "0.76945007", "0.7678177", "0.767817...
0.8473474
6
Desciption of the object
def description object["description"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description\n end", "def description\n ...
[ "0.76494783", "0.76494783", "0.76494783", "0.76494783", "0.76494783", "0.76494783", "0.76494783", "0.76494783", "0.76494783", "0.76494783", "0.7505113", "0.7505113", "0.7484476", "0.74414086", "0.7341819", "0.72894454", "0.72267747", "0.72105485", "0.71960086", "0.71960086", ...
0.7436203
14
A URL to view the item on SkyDrive
def link object["link"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url\n item_path(object)\n end", "def url\n @client.get_download_link(@path)\n end", "def api_path\n if remote?\n \"drives/#{@remote_drive_id}/items/#{@remote_id}\"\n else\n \"drive/items/#{@id}\"\n end\n end", "def url\n item_hash.deep_find([:listi...
[ "0.67196393", "0.66885513", "0.6543145", "0.6463081", "0.64435536", "0.6379455", "0.6126578", "0.6126578", "0.6089154", "0.60585874", "0.6051191", "0.60097694", "0.5990355", "0.5936023", "0.5936023", "0.59306943", "0.59127355", "0.5908992", "0.590569", "0.589995", "0.58989954...
0.0
-1
The time at which the object was created.
def created_time Time.parse(object["created_time"]) if object["created_time"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def created_time\n ctime\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def create...
[ "0.78912467", "0.7881457", "0.78809214", "0.78809214", "0.78809214", "0.78809214", "0.78809214", "0.78809214", "0.78809214", "0.78809214", "0.78809214", "0.78809214", "0.78809214", "0.78809214", "0.78809214", "0.78809214", "0.78809214", "0.78809214", "0.78809214", "0.78809214",...
0.72036725
52
The time at which the object was updated.
def updated_time Time.parse(object["updated_time"]) if object["updated_time"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_updated_date_time\n return @last_updated_date_time\n end", "def last_updated_date_time\n return @last_updated_date_time\n end", "def last_updated_date_time\n return @last_updated_date_time\n end", "def last_updated_date_ti...
[ "0.80376065", "0.80376065", "0.80376065", "0.80376065", "0.790909", "0.790909", "0.790909", "0.790909", "0.77683574", "0.7724907", "0.772238", "0.77032787", "0.76314574", "0.76153654", "0.76153654", "0.76153654", "0.7604436", "0.7572333", "0.7554839", "0.75513995", "0.7551399...
0.788072
8
The URL to upload file content hosted in SkyDrive.
def upload_location object["upload_location"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_url\n _get(\"/files/upload_url\") { |json| json }\n end", "def upload_file_url\n \"file://#{upload_full_path}\"\n end", "def upload_url\n return @upload_url\n end", "def url(options = {})\n file.path\n end", "def url\n # HACK: Revisi...
[ "0.7733416", "0.7473084", "0.6985415", "0.6868772", "0.68108034", "0.6632666", "0.6608102", "0.65956056", "0.656736", "0.6517776", "0.651212", "0.65063006", "0.64031494", "0.6385629", "0.6367889", "0.6348614", "0.634589", "0.63363487", "0.6320607", "0.6316237", "0.6272327", ...
0.56547415
74
The ID of the parent object
def parent_id object["parent_id"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_id\r\n return nil unless ar_object\r\n ar_object[ar_p]\r\n end", "def parent_id\n self.parent._id.to_s\n end", "def _parent_id\n send parent_column_name\n end", "def parent_id\n data[:parent_id]\n end", "def parent_id\n parent_ids.last\n ...
[ "0.8498718", "0.8495141", "0.8245423", "0.8177195", "0.8089715", "0.80414903", "0.79242724", "0.78445953", "0.78422195", "0.77200943", "0.76173955", "0.7470717", "0.7443227", "0.7436425", "0.74091744", "0.73936594", "0.73936594", "0.73936594", "0.73936594", "0.73807096", "0.7...
0.86632013
0
The object that contains permission info.
def shared_with object["shared_with"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permissions = {}", "def permission\n Ricer::Irc::Permission.by_permission(self.permissions, authenticated?)\n end", "def permission\n return @children['permission'][:value]\n end", "def one_object_perm privilege, obj\n Permission.new( :privilege => privilege,\n ...
[ "0.7202397", "0.6895051", "0.68911666", "0.6851432", "0.68210363", "0.6735153", "0.6673834", "0.6673834", "0.65915704", "0.656746", "0.64694524", "0.6457866", "0.6440819", "0.6438231", "0.640842", "0.6403268", "0.63670594", "0.63257146", "0.6319965", "0.63123775", "0.62699425...
0.0
-1
Get json format object
def to_json object.to_json end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_json\n @json ||= get_json\n end", "def to_json_raw_object()\n #This is a stub, used for indexing\n end", "def json\n {}\n end", "def tojson\n\t\tend", "def to_json\n\t\tto_h.to_json\n\tend", "def to_json\n\t\tto_h.to_json\n\tend", ...
[ "0.7650927", "0.75633585", "0.7562201", "0.7469389", "0.7454028", "0.7454028", "0.7425858", "0.7340431", "0.73328584", "0.73174286", "0.73174286", "0.73012275", "0.7287307", "0.7287122", "0.7271262", "0.7252237", "0.72411376", "0.72384715", "0.72356147", "0.72283417", "0.7208...
0.7308049
11
Get the hash equivalent of the data
def to_hash object end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n data.hash\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash\n bytes.hash\n end", "def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n...
[ "0.79371935", "0.7855994", "0.7855994", "0.7855994", "0.7855994", "0.7855994", "0.7855994", "0.7855994", "0.7754497", "0.7664794", "0.755855", "0.7490035", "0.73760355", "0.73760355", "0.73760355", "0.7362371", "0.73366135", "0.72881097", "0.7285503", "0.7270733", "0.726795",...
0.0
-1
Delete the object from Skydrive
def delete client.delete("/#{id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(object); end", "def delete\n object.destroy rescue nil\n end", "def delete(obj) ; end", "def delete(object)\n full_name = extract_full_name object\n post 'api/del', :id => full_name\n end", "def delete(o); removeObject o end", "def destroy; delete end", "de...
[ "0.73198676", "0.7152543", "0.7133676", "0.7117471", "0.6916132", "0.690742", "0.6889391", "0.68184817", "0.68184817", "0.68184817", "0.68184817", "0.6805604", "0.6693671", "0.6682183", "0.66669637", "0.6666567", "0.6660003", "0.6654303", "0.6654303", "0.66408736", "0.6631474...
0.0
-1
A value that indicates whether this object can be embedded
def is_embeddable? object["is_embeddable"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embedded?\n @embedded == true\n end", "def embedded?\n false\n end", "def embedded?\n self.class.embedded?\n end", "def embedded?\n false\n end", "def allowed?\n true\n end", "def embedded?\n true\n en...
[ "0.70913744", "0.70547324", "0.70313805", "0.7007512", "0.6998188", "0.6970036", "0.69360363", "0.69360363", "0.6758669", "0.67512167", "0.66850674", "0.662582", "0.65062636", "0.65062636", "0.64918816", "0.64778477", "0.6449", "0.63562036", "0.62874985", "0.62709963", "0.626...
0.74746305
0
Comments associated with the object
def comments client.get("/#{id}/comments") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comments; end", "def comments; end", "def comments; end", "def comments; end", "def comments; end", "def comments; end", "def comment\n @ole.Comment\n end", "def comment\n @comment\n end", "def comments\n @comments\n end", "def comments\n @comments\n end", "d...
[ "0.73357904", "0.73357904", "0.73357904", "0.73357904", "0.73357904", "0.73357904", "0.72653246", "0.7259999", "0.7080065", "0.7036302", "0.6994462", "0.6994462", "0.6994462", "0.6994462", "0.6994462", "0.6994462", "0.6994462", "0.6994462", "0.6994462", "0.6994462", "0.699446...
0.63525516
71
Make a comment about the object
def comment options={} client.post("/#{id}/comments", options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def com...
[ "0.73253113", "0.73253113", "0.73253113", "0.73253113", "0.73253113", "0.73253113", "0.73253113", "0.73253113", "0.73253113", "0.73253113", "0.73253113", "0.73253113", "0.73253113", "0.73253113", "0.73253113", "0.73253113", "0.73253113", "0.72900385", "0.7229316", "0.7059593", ...
0.0
-1
GET /dialogs GET /dialogs.json
def index if params[:dialog].present? @dialog = Dialog.find(params[:dialog]) @dialog.update_attributes(no_read: '0') @area = Area.where(id: @dialog.url_start.split('/')[1]).first if @dialog.url_start.present? @messages = @dialog.messages.desc(:created_at) @geo = Geocoder.search @dialog...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dialogs = Dialog.all\n end", "def index\n @dialogues = Dialogue.all\n end", "def show\n render json: @conversation\n end", "def show\n render json: @conversation, status: 200\n end", "def show\n @dialog_turn = DialogTurn.find(params[:id])\n\n respond_to do |format|\n ...
[ "0.67946345", "0.62684995", "0.60077953", "0.5936814", "0.59161526", "0.5905902", "0.58473885", "0.5836628", "0.5834727", "0.582335", "0.58112067", "0.57890296", "0.57714987", "0.5725308", "0.5725308", "0.56915593", "0.56791794", "0.55985063", "0.556427", "0.556427", "0.55427...
0.61835366
2
GET /dialogs/1 GET /dialogs/1.json
def show @messages = @dialog.messages end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dialogs = Dialog.all\n end", "def show\n render json: @conversation\n end", "def show\n render json: @conversation, status: 200\n end", "def index\n @dialogues = Dialogue.all\n end", "def show\n @dialog_turn = DialogTurn.find(params[:id])\n\n respond_to do |format|\n ...
[ "0.66501844", "0.61568856", "0.6150922", "0.6146419", "0.6136457", "0.6100177", "0.60822153", "0.6065243", "0.6065243", "0.6010787", "0.59974355", "0.59452933", "0.59452933", "0.5881847", "0.58253556", "0.58125025", "0.5808339", "0.58059293", "0.58059293", "0.5789136", "0.578...
0.56716377
32
POST /dialogs POST /dialogs.json
def create @dialog = Dialog.new(dialog_params) respond_to do |format| if @dialog.save format.html { redirect_to @dialog, notice: 'Dialog was successfully created.' } format.json { render action: 'show', status: :created, location: @dialog } else format.html { render action: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @dialog = Dialog.new(dialog_params)\n\n respond_to do |format|\n if @dialog.save\n format.html { redirect_to @dialog, notice: 'Dialog was successfully created.' }\n format.json { render :show, status: :created, location: @dialog }\n else\n format.html { render :new...
[ "0.70405114", "0.64268047", "0.6369841", "0.6200411", "0.5840489", "0.57129604", "0.56838524", "0.5583967", "0.5543598", "0.55165863", "0.53946835", "0.5386971", "0.5373209", "0.5367648", "0.5350076", "0.5350076", "0.5350076", "0.5350076", "0.53438485", "0.534275", "0.5337176...
0.6973855
1
PATCH/PUT /dialogs/1 PATCH/PUT /dialogs/1.json
def update respond_to do |format| if @dialog.update(dialog_params) format.html { redirect_to @dialog, notice: 'Dialog was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @dialog.errors, status...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @dialog.update(dialog_params)\n format.html { redirect_to @dialog, notice: 'Dialog was successfully updated.' }\n format.json { render :show, status: :ok, location: @dialog }\n else\n format.html { render :edit }\n format.json { rend...
[ "0.6711888", "0.6221641", "0.61094123", "0.61021626", "0.60705394", "0.597629", "0.59345347", "0.59345347", "0.5899788", "0.5898362", "0.5882167", "0.5846475", "0.58138233", "0.57970893", "0.5794527", "0.5794527", "0.57880074", "0.5785946", "0.57852703", "0.57831985", "0.5783...
0.690267
0
DELETE /dialogs/1 DELETE /dialogs/1.json
def destroy @dialog.destroy respond_to do |format| format.html { redirect_to dialogs_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @dialog.destroy\n respond_to do |format|\n format.html { redirect_to dialogs_url, notice: 'Dialog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dialogue.destroy\n respond_to do |format|\n format.html { redirect_to dial...
[ "0.7144202", "0.6957655", "0.67515385", "0.67481536", "0.6690818", "0.66396296", "0.6588942", "0.6586188", "0.6555473", "0.6526668", "0.64984536", "0.6496319", "0.6484932", "0.6484932", "0.6475393", "0.6475393", "0.6475393", "0.6475393", "0.6474569", "0.64654595", "0.64654595...
0.7411259
0
Use callbacks to share common setup or constraints between actions.
def set_dialog @dialog = Dialog.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 dialog_params params.require(:dialog).permit(:ip, :coordinates, :city) 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.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.629...
0.0
-1
Class is selected if listing type is currently selected
def get_new_listing_tab_class(listing_type) "new_listing_form_tab_#{@listing.listing_type.eql?(listing_type) ? 'selected' : 'unselected'}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type_select_icon_class(category)\n \"listing_type_select_icon_#{@listing.category.eql?(category) ? 'selected' : 'unselected'}_#{category}\"\n end", "def get_listing_tab_class(tab_name)\n current_tab_name = params[:type] || \"list_view\"\n \"inbox_tab_#{current_tab_name.eql?(tab_name) ? 'selecte...
[ "0.6677346", "0.61910784", "0.61910784", "0.61910784", "0.60319775", "0.60249406", "0.60249406", "0.58472794", "0.5712906", "0.5561352", "0.5561352", "0.551788", "0.550998", "0.54952693", "0.54813576", "0.5461367", "0.54451317", "0.5444347", "0.5407138", "0.53911525", "0.5369...
0.70310605
0
Class is selected if category is currently selected
def get_type_select_icon_class(category) "listing_type_select_icon_#{@listing.category.eql?(category) ? 'selected' : 'unselected'}_#{category}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_category\n #Parbauda vai ekrans ir redzams\n @screens.screen_create_filter.visible?\n #Pievieno kategoriju no filtra datiem\n @screens.screen_create_filter.select_row(@filter_data.category)\n end", "def selected?; end", "def selected?; end", "def selected; end", "def selectCategory(...
[ "0.66410714", "0.600985", "0.600985", "0.59946895", "0.59726435", "0.5972357", "0.58467275", "0.5823109", "0.5822424", "0.5783398", "0.57212406", "0.5600886", "0.5572107", "0.5547639", "0.5541068", "0.5541068", "0.55362797", "0.55272615", "0.5481189", "0.54640514", "0.5458848...
0.644228
1
The classes the checkbox gets depend on to which categories its' share type belongs to.
def get_share_type_checkbox_classes(share_type) classes = "" Listing::VALID_CATEGORIES.each do |category| if Listing::VALID_SHARE_TYPES[@listing.listing_type][category] && Listing::VALID_SHARE_TYPES[@listing.listing_type][category].include?(share_type) classes += "#{category} " end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_collect_class(cllt_type, resource)\n cllt_type == 'check_box' ? get_tag_class(resource.object.name) : resource.text\n end", "def get_type_select_icon_class(category)\n \"listing_type_select_icon_#{@listing.category.eql?(category) ? 'selected' : 'unselected'}_#{category}\"\n end", "def classe...
[ "0.6323129", "0.6007488", "0.5917209", "0.55293566", "0.5478942", "0.5374005", "0.529047", "0.52528554", "0.5248263", "0.5177959", "0.5177959", "0.51761925", "0.5149101", "0.5134327", "0.50972486", "0.5096677", "0.5091888", "0.5090738", "0.5084677", "0.50575995", "0.5053975",...
0.8373561
0
Removes extra characters from datetime_select field
def clear_datetime_select(&block) time = "</div><div class='date_select_time_container'><div class='datetime_select_time_label'>#{t('listings.form.departure_time.at')}:</div>" colon = "</div><div class='date_select_time_container'><div class='datetime_select_colon_label'>:</div>" haml_concat capture_haml(&b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_select(time, options)\n date_select(time, options) + '&nbsp;at&nbsp;' + time_select(time, options)\n end", "def sanitize_date_time(value)\n value.strftime(\"%Y-%m-%d\")\n end", "def format_datetime\n if @opts[:as] == :select\n values = {}\n if v = @attr[:value]\n...
[ "0.67438483", "0.6348233", "0.6309264", "0.5955529", "0.5917187", "0.57007986", "0.5696131", "0.56909573", "0.5608724", "0.5583876", "0.55513513", "0.55481327", "0.54500437", "0.5400907", "0.5383588", "0.5353372", "0.5352533", "0.53165966", "0.5315419", "0.5301577", "0.527697...
0.70039994
2
Class is selected if listing type is currently selected
def get_listing_tab_class(tab_name) current_tab_name = params[:type] || "list_view" "inbox_tab_#{current_tab_name.eql?(tab_name) ? 'selected' : 'unselected'}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_new_listing_tab_class(listing_type)\n \"new_listing_form_tab_#{@listing.listing_type.eql?(listing_type) ? 'selected' : 'unselected'}\"\n end", "def get_type_select_icon_class(category)\n \"listing_type_select_icon_#{@listing.category.eql?(category) ? 'selected' : 'unselected'}_#{category}\"\n end...
[ "0.70310605", "0.6677346", "0.60319775", "0.60249406", "0.60249406", "0.58472794", "0.5712906", "0.5561352", "0.5561352", "0.551788", "0.550998", "0.54952693", "0.54813576", "0.5461367", "0.54451317", "0.5444347", "0.5407138", "0.53911525", "0.53695405", "0.5360523", "0.53464...
0.61910784
4
expects category_string to be "item", "favor", "rideshare" or "housing"
def localized_category_label(category_string) return nil if category_string.nil? category_string += "s" if ["item", "favor"].include?(category_string) return t("listings.index.#{category_string}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories(str)\n raise NotImplementedError\n end", "def get_category_newsgroup(category)\n case category\n when \"sell\"\n \"tori.myydaan\"\n when \"buy\"\n \"tori.ostetaan\"\n when \"give\"\n \"tori.myydaan\"\n when \"lost\"\n \"tori.kadonnut\"\n when \"rides\"\n ...
[ "0.6675052", "0.6554733", "0.62667215", "0.62634283", "0.6251667", "0.61898476", "0.6129197", "0.6111593", "0.6038447", "0.6016033", "0.6002402", "0.5994601", "0.597574", "0.59210014", "0.59175265", "0.5908912", "0.5866291", "0.5859368", "0.5840229", "0.58114874", "0.5790943"...
0.6764951
0
returns an array of numbers each word corresponds to a code.
def generate_code(str) word_arr = str.split(" ") word_arr_simple = str.downcase.split(" ").each {|x| x.gsub!(/\W+/, '')} word_hash = {} counter = 1 word_arr_simple.each do |word| if word_hash[word] != nil else word_hash[word] = counter counter += 1 end end $new_array = [] word_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_code(codes)\n arr = []\n num = codes.scan(/\\d/).join('')\n str = codes.scan(/[a-zA-Z]+/)\n arr << str\n arr << num.to_i\n arr.flatten\nend", "def extract_code\n @original.chars.map do |c|\n @code.push c.to_i if c[/\\d+/]\n end\n end", "def codes\n ...
[ "0.7127428", "0.6868839", "0.6574209", "0.6448723", "0.6167941", "0.6123397", "0.600486", "0.5847377", "0.5833271", "0.5812114", "0.5800041", "0.57928276", "0.5792336", "0.57909817", "0.57486326", "0.57239693", "0.5693276", "0.56755674", "0.56707466", "0.5655128", "0.56320924...
0.6943731
1
9. Learn how to use the ternary operator. The ternary operator is puts a ? b : c In grammatical terms below: if_this_is_a_true_value ? then_the_result_is_this : else_it_is_this However, in Ruby, if is also an expression so: if a then b else c end === a ? b : c, except for precedence issues. Both are expressions. Some E...
def nested print "Enter in a positive odd number" z = gets.chomp.to_i if z % 2 == 1 puts "That is a odd number, thank you." if z % 2 == 0 puts "That number won't work, it's even!" else puts "Cool" end else puts "It needs to be a odd number." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ternary(statement, true_result, false_result)\n statement && true_result || false_result\nend", "def if_elsif_else\nif x == true\n puts x\nend\n\nif x\n puts x\nend\n\nif x\n puts \"It's true\"\nelse\n puts \"It's false\"\nend\n\nif num <= 0\n puts \"The number is too low\"\nelsif num > 3 && num < 7\n ...
[ "0.6545612", "0.60391307", "0.59788144", "0.59563595", "0.57394534", "0.56969404", "0.56367415", "0.5610969", "0.5609063", "0.56031626", "0.55849504", "0.55779976", "0.55655056", "0.55381316", "0.5504788", "0.5474596", "0.54417384", "0.5431642", "0.5427587", "0.5424147", "0.5...
0.5733857
5
Only allow a trusted parameter "white list" through.
def member_params params.require(:member).permit(:first_name, :last_name, :email) 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
def signed_integer_to_string(number) is_negative = number 1 > 0 prefix = if is_negative number = number 1 '' elsif is_negative == false && number == 0 '' else '+' end result = '' loop do number, remainder = number.divmod(10) result.prepend(DIGITS[remainder]) break if number == 0 end prefix + result end refactor with , ...
def signed_integer_to_string(number) case number <=> 0 when -1 then "-#{integer_to_string(-number)}" when 1 then "+#{integer_to_string(number)}" else "#{integer_to_string(number)}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signed_integer_to_string(number)\n case number <=> 0\n when -1 \n prefix = '-'\n number = -number\n when +1 \n prefix = '+'\n else \n prefix = ''\n end\n prefix + integer_to_string(number)\nend", "def signed_integer_to_string(number)\n case number <=> 0\n when -1\n \"-#{integer...
[ "0.9284257", "0.9259651", "0.9169027", "0.914762", "0.9135243", "0.91240275", "0.9106091", "0.9103878", "0.90961766", "0.90244305", "0.8957153", "0.89387906", "0.8881836", "0.8804228", "0.8773761", "0.8731891", "0.87243193", "0.8720476", "0.8538236", "0.81803995", "0.81195533...
0.9197204
2
Form to create activation code
def new; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_activation_code\n end", "def generate_activation_code!\n self[:activation_code] = RandomPasswordGenerator.generate(\n 4, skip_upper_case: true, skip_symbols: true, skip_url_unsafe: true\n )\n self[:status] = Status::INTERMEDIATE\n save!\n end", "def generate_activation_code\n #se...
[ "0.71018904", "0.69882333", "0.6904598", "0.68318415", "0.6705418", "0.66952103", "0.6677684", "0.65918845", "0.6467445", "0.639648", "0.6368502", "0.63646305", "0.6336891", "0.6324899", "0.629042", "0.6277661", "0.627723", "0.6242202", "0.62177044", "0.6098925", "0.6053495",...
0.0
-1
Performs a search for geoattributes.
def all_fields(table, field_name, value) body = savon. call(:get_all_fields_records_given_a_field_name_and_value, message: { 'strFeatureClassOrTableName' => table, 'strFieldNameToSearchOn' => field_name, 'strValueOfFieldToS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _search_attributes\n _attrs.hmap do |name, settings|\n opts = settings[:options]\n next unless opts[:net_miner_search_path]\n [name, opts[:net_miner_search_path]]\n end\n end", "def search_attributes\n\t\t['dn', self.attr_firstname, self.attr_lastname, self.attr_...
[ "0.6360559", "0.60333186", "0.5921207", "0.58300626", "0.5748066", "0.5711369", "0.56499743", "0.5491631", "0.5406787", "0.52779466", "0.5250674", "0.5239203", "0.5227761", "0.5226946", "0.5219674", "0.5167995", "0.51617455", "0.5143399", "0.51241004", "0.50939614", "0.507729...
0.0
-1
Returns a Savon SOAP client instance
def savon @savon ||= Savon.client(wsdl: WSDL_URL) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client \n @client ||= Savon::Client.new do\n wsdl.document = self.endpoint\n end\n end", "def client\n @client ||= Savon.client(wsdl) do |wsdl|\n wsdl.endpoint = endpoint\n end.tap do |client|\n client.config.soap_header = soap_headers\n client.http.aut...
[ "0.854754", "0.85072464", "0.8436068", "0.83633053", "0.8297025", "0.8275988", "0.8269884", "0.81919247", "0.7782311", "0.7755417", "0.7604265", "0.74760795", "0.70497257", "0.7002952", "0.6766652", "0.66096973", "0.6580831", "0.65029275", "0.64069825", "0.6300055", "0.628354...
0.7111517
13
GET /attachments GET /attachments.json
def index @channel = Channel.find_by_name(params[:channel_id]) @attachments = @channel.attachments.order("created_at DESC") respond_to do |format| format.json { render :json => @attachments.to_json(:methods => :url) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @attachments = Attachment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attachments }\n end\n end", "def index\n @attachments = Attachment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { re...
[ "0.7475036", "0.7475036", "0.7219272", "0.7218139", "0.72067606", "0.7203128", "0.7203128", "0.7203128", "0.7203128", "0.7187078", "0.71577555", "0.71577555", "0.71577555", "0.71577555", "0.71577555", "0.7101302", "0.7087153", "0.70859534", "0.70809966", "0.7067069", "0.70449...
0.7403629
2
GET /attachments/1 GET /attachments/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attachment(id)\n response = conn.get 'api/files/attachments/' + id\n\n unless response.status == 200\n error_model = JSON.load(response.body)\n mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \\'' + response.status.to_s + '\\'', error_model...
[ "0.7398018", "0.73920506", "0.73920506", "0.73920506", "0.73920506", "0.7295379", "0.7253366", "0.72095245", "0.7198798", "0.7198798", "0.71464163", "0.7033831", "0.70257634", "0.70257634", "0.70257634", "0.70257634", "0.70257634", "0.6987171", "0.6986043", "0.6960749", "0.69...
0.0
-1
GET /attachments/new GET /attachments/new.json
def new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end", "def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: ...
[ "0.81709224", "0.8170589", "0.8170589", "0.78508574", "0.761951", "0.75803447", "0.75803447", "0.7562457", "0.75601494", "0.7498397", "0.7498397", "0.73243886", "0.71986645", "0.7149602", "0.69428575", "0.69420975", "0.69375825", "0.69180787", "0.6755026", "0.6755026", "0.674...
0.0
-1
POST /attachments POST /attachments.json
def create @channel = Channel.find_by_name(params[:channel_id]) @attachment = Attachment.new(params[:attachment]) # {"file"=>#<ActionDispatch::Http::UploadedFile:0x00000005bc3158 @original_filename="investor_faq.org", @content_type="application/octet-stream", # @headers="Content-Disposition: form-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n if params[:attachments]\n params[:attachments].each do |a|\n @attachment = @document.attachments.create!(:attachment => a)\n end\n end\n format.html {...
[ "0.67856145", "0.67284447", "0.6717782", "0.6717782", "0.6710522", "0.66664606", "0.6630575", "0.65930396", "0.65218943", "0.6507676", "0.6459344", "0.6454859", "0.6453828", "0.6449482", "0.6444526", "0.64219415", "0.640342", "0.6388061", "0.63603103", "0.6320983", "0.6305493...
0.60018635
53
PUT /attachments/1 PUT /attachments/1.json
def update @attachment = Attachment.find_by_name(params[:id]) respond_to do |format| if @attachment.update_attributes(params[:attachment]) format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' } format.json { head :ok } else format.html { rend...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @document.update(document_params)\n if params[:attachments]\n params[:attachments].each do |a|\n @attachment = @document.attachments.create!(:attachment => a)\n end\n end\n format.html { redirect_to @document, notice...
[ "0.70723903", "0.6969434", "0.69647133", "0.6940061", "0.6824948", "0.6824948", "0.6770707", "0.67692095", "0.6754012", "0.67488635", "0.6722136", "0.6639801", "0.6639801", "0.66233605", "0.6618303", "0.6527931", "0.65129924", "0.65124446", "0.6488836", "0.6439156", "0.639728...
0.69444317
3
DELETE /attachments/1 DELETE /attachments/1.json
def destroy @attachment = Attachment.find_by_name(params[:id]) @attachment.destroy respond_to do |format| format.html { redirect_to attachments_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @attachments = Attachment.find_by_id(params[:id])\n if @attachments.present?\n @attachments.destroy\n render :json=>{:response=>\"success\"}\n\t\tend\n end", "def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n f...
[ "0.7911042", "0.7847585", "0.78028", "0.78028", "0.78028", "0.76480836", "0.7554992", "0.7526424", "0.7526424", "0.7502131", "0.7484967", "0.74713784", "0.743854", "0.7387418", "0.7363765", "0.73254794", "0.73152685", "0.7279049", "0.72641194", "0.72299457", "0.72298086", "...
0.7915785
0
GET /stories or /stories.json
def index @stories = Story.order(params[:sort]).page(params[:page]).per(10) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n # description of @stories is not necessary - it is handled by decent_exposure\n end", "def story(id, query = {})\n Request.new(self, '/cdn/stories', query, id).get\n end", "def story(id, query = {})\n Request.new(self, '/cdn/stories', query, id).get\n end", "def stories(query ...
[ "0.722337", "0.7212803", "0.7212803", "0.7179449", "0.7179449", "0.71339214", "0.7131572", "0.705515", "0.7037324", "0.7033313", "0.70329833", "0.70329833", "0.6985162", "0.6951725", "0.6938928", "0.69253165", "0.69031847", "0.69031847", "0.683582", "0.6831886", "0.67619693",...
0.6255573
66
Use callbacks to share common setup or constraints between actions.
def set_story @story = Story.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 story_params params.require(:story).permit(:name, :location, :species, :gender, :affiliations, :weapon, :vehicle) 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
Use callbacks to share common setup or constraints between actions.
def set_post @post = Post.find(params[:post_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 comment_params params.require(:comment).permit(:body) 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.7122899", "0.7054107", "0.69478", "0.6902101", "0.67359334", "0.67178756", "0.66889167", "0.6677724", "0.6661157", "0.6555896", "0.6527207", "0.64584696", "0.64517015", "0.6450208", "0.644749", "0.6435074", "0.6413329", "0.6413329", "0.6391818", "0.6380081", "0.6380081", ...
0.0
-1
Method that calculates an attack against us by another set of attributes Returns true if we die, false otherwise
def attacked(attacker) attack = rand(2+attacker.agility)-rand(@agility) if attack>0 @health -= rand(attacker.strength) @game.message(self.name + " suffers " + attack.to_s + " damage!") end if self.health <= 0 return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def battle(attacker, defender)\n if accuracy_check(attacker.accuracy) \n defender.hull - attacker.firepower\n else\n return false\n end\nend", "def under_attack \n return true if warrior.health < @health\n return false\n end", "def attack_effect(attacker)\n # Clear critical flag\n...
[ "0.7118146", "0.6769496", "0.67326003", "0.6707629", "0.65526336", "0.6523617", "0.6517811", "0.64987046", "0.64560974", "0.63728356", "0.63708013", "0.6298258", "0.6298258", "0.6248337", "0.62404156", "0.6232371", "0.61978626", "0.61903983", "0.61868703", "0.6182573", "0.617...
0.68720734
1
Gets h more life points
def heal(h) if @health+h > @max_health @health = @max_health else @health += h end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def life\n return @life\n end", "def hp\n h / 360.0\n end", "def current_hp\n\t\t@current_hp + temp_hp\n\tend", "def gets_damage(less_points)\n @life_points = @life_points - less_points \n if @life_points <= 0...
[ "0.65977895", "0.6204684", "0.5952867", "0.59456986", "0.5942923", "0.5926019", "0.59238946", "0.5879227", "0.58359516", "0.58267635", "0.5798215", "0.5751958", "0.5721998", "0.5721955", "0.56946695", "0.56946695", "0.56900513", "0.5688455", "0.5686052", "0.5683969", "0.56822...
0.0
-1
Adds an age unit to the creature. When it's too young or old, it should not be a very good fighter. During it's postpuberty, it may try to reproduce. If it grows too old, it will die. Returns false if it dies, true otherwise
def take_age @age += 1 @infertility -= 1 if @infertility > 0 @hunger += 1 if @age > @max_age return false end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def age!\n @age < @max_age ? @age+=1 : @dead = true\n @height+=2 unless @height==20\n grow_fruit\n end", "def dead?\n @age >= 25\n end", "def levelup?\n if @monster.experience >= @monster.level**3\n @monster.level += 1\n @monster.turns = @monster.level\n @monster.health = 95+(5*...
[ "0.6399961", "0.63615847", "0.6212811", "0.60780495", "0.60689574", "0.60213107", "0.5997589", "0.595466", "0.5889478", "0.5887682", "0.5877463", "0.58593535", "0.5821057", "0.5795861", "0.5787952", "0.57857525", "0.5761596", "0.573856", "0.57152367", "0.56787217", "0.5670556...
0.718269
0
Checks whether the creature is in reproduction age and out of infertility periods
def fertile? a = @age.to_f/@max_age.to_f if $log $log.debug("#{@sex} is of age #{a}, infertility is #{@infertility}") end if a.between?(0.25, 0.75) && @infertility == 0 return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probably_dead?\n self.date_of_death.present? ||\n (self.date_of_birth.present? &&\n Date.today.year - self.birth_date.year > 90)\n end", "def probably_dead?\n definitely_dead = !death_date.nil?\n no_record = !definitely_dead && birth_date.nil?\n age = Date.today.year - (birt...
[ "0.6464342", "0.6413438", "0.62566745", "0.62566745", "0.6214962", "0.6184015", "0.6173121", "0.61007816", "0.6080041", "0.60637105", "0.60624135", "0.6054979", "0.60515356", "0.60401696", "0.60080737", "0.59807086", "0.59795046", "0.59740806", "0.5968689", "0.596615", "0.592...
0.0
-1
We consider the creature to be hungry when its hunger is superior to its max HP divided by two
def hungry? return (@hunger > @max_health/2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heal(h)\n if @health+h > @max_health\n @health = @max_health\n else\n @health += h\n end\n end", "def heal\n 2.times { super } # or self.helth = [self.helth + 2, MAX_HEALTH].min\n 'Ready for Battle!'\n end", "def heal!\n @health_remaining = @max_health\n end", "def hurt?\n\...
[ "0.75002056", "0.7095083", "0.7081408", "0.6958044", "0.69507575", "0.68810934", "0.6880237", "0.6843405", "0.68217933", "0.6779654", "0.6778553", "0.67660284", "0.67170787", "0.6700179", "0.66936404", "0.66322154", "0.66320914", "0.6614127", "0.6603931", "0.6598512", "0.6582...
0.75795424
0
We eat whatever is here
def eat(food) if food.veggie? && !@carnivore @hunger -= 10 elsif food.meat? && @carnivore @hunger -= 10 end @hunger = 0 if @hunger < 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bye; end", "def eat_and_bake\n puts bake\n eat\n end", "def does\n puts \"ALL THE THINGESSSS!!!eleventy\"\nend", "def eat\n puts \"split in half\"\n puts \"now eat it!\"\n super\n end", "def eat\n puts \"Eating the oreo cookie~~\"\n super\n end", "def eat\n \"Nom. Nom. N...
[ "0.65932643", "0.641959", "0.6413102", "0.6343458", "0.63267523", "0.63150865", "0.6295445", "0.6256553", "0.6185216", "0.6185216", "0.6106535", "0.6091879", "0.6091879", "0.6091879", "0.6063522", "0.6053853", "0.60481846", "0.60466003", "0.60449237", "0.6031037", "0.6028719"...
0.0
-1
The creature shall enter an infertility period
def enter_infertility @infertility = @p_o_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aide3()\n\n @indiceFortFlag = TRUE\n @timer.add(120)\n end", "def dead\r\n @energy < 0\r\n @gameover = true\r\n @timeout = true\r\n @time == 0\r\nend", "def encounter#instance method\n\n if !survive_attack?\n \"You died.\"\n elsif !outrun_zombie?\n \"You have been chased down.\"\...
[ "0.61666507", "0.6119798", "0.6045934", "0.59858143", "0.59858143", "0.5961142", "0.58706886", "0.5773955", "0.5705975", "0.57005566", "0.5657362", "0.5647225", "0.5645293", "0.56448597", "0.56198215", "0.5575726", "0.5540993", "0.55367315", "0.55191875", "0.5514104", "0.5503...
0.62831944
0
GET /request_templates GET /request_templates.json
def index @request_templates = RequestTemplate.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "def list\n @client.make_request :get, templates_path\n end", "def show\n redirect_to edit_request_path(@request) if current_user.admin? && @request.pending?\n @request_templates = Reque...
[ "0.73878103", "0.73573303", "0.7257521", "0.72427607", "0.7185743", "0.70785123", "0.7077442", "0.7074015", "0.68151075", "0.6721269", "0.6553466", "0.65324426", "0.65099543", "0.64859885", "0.6430347", "0.6420109", "0.63800323", "0.6360719", "0.63318795", "0.63074654", "0.62...
0.73790467
1
POST /request_templates POST /request_templates.json
def create @request_template = RequestTemplate.new(request_template_params) respond_to do |format| if @request_template.save respond format, 'Request template was successfully created.' else format.html { render :new } format.json { render json: @request_template.errors, sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @request_templates = RequestTemplate.all\n end", "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "def list\n @client.make_request :get, templates_path\n end", "def show\n redirect_to edit_request_path(@request) if curr...
[ "0.65851843", "0.64167845", "0.6336792", "0.6284566", "0.62101465", "0.6083735", "0.6068648", "0.6034663", "0.6013137", "0.59893763", "0.59628445", "0.59602255", "0.59482664", "0.5876555", "0.58422744", "0.57748574", "0.57510185", "0.57476985", "0.5728922", "0.5709782", "0.56...
0.67905277
0
PATCH/PUT /request_templates/1 PATCH/PUT /request_templates/1.json
def update respond_to do |format| if @request_template.update(request_template_params) respond format, 'Request template was successfully updated.' else format.html { render :edit } format.json { render json: @request_template.errors, status: :unprocessable_entity } end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_template_files(opts)\n template_id = opts.delete(:template_id)\n path = \"/template/update_files/#{template_id}\"\n prepare_files opts\n\n HelloSign::Resource::Template.new post(path, body: opts)\n end", "def set_request_template\n @request_template = RequestTemplat...
[ "0.629729", "0.6247277", "0.62214077", "0.61918956", "0.6136233", "0.609886", "0.6057968", "0.6029072", "0.60271925", "0.6007233", "0.6004755", "0.6003703", "0.59962213", "0.5988059", "0.59747094", "0.59622484", "0.594716", "0.5942636", "0.59343684", "0.5930996", "0.59290284"...
0.72079736
0
DELETE /request_templates/1 DELETE /request_templates/1.json
def destroy @request_template.destroy respond_to do |format| respond format, 'Request template was successfully destroyed.' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "def delete\n response = CreateSend.delete \"/templates/#{template_id}.json\", {}\n end", "def delete(options={})\n DNSimple::Client.delete \"templates/#{id}\", options\n end", "def destroy\n @template.destroy\n respo...
[ "0.8061225", "0.76833373", "0.73084533", "0.71539706", "0.71461254", "0.7126423", "0.7111957", "0.7064959", "0.70546407", "0.7034069", "0.7023614", "0.70230514", "0.7022959", "0.70214623", "0.70214623", "0.70139796", "0.7010606", "0.7010606", "0.7010606", "0.7005003", "0.7002...
0.7535392
2
Use callbacks to share common setup or constraints between actions.
def set_request_template @request_template = RequestTemplate.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.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def request_template_params params.require(:request_template).permit(:name, :cpu_cores, :ram_gb, :storage_gb, :operating_system) 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
Returns a single translation status for the given project
def translation_status(project_id, status_id) c_r Lokalise::Resources::CustomTranslationStatus, :find, [project_id, status_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trans_status_textual\r\n STATUSES[self['trans_status']]\r\n end", "def project_status\n\t\t@project = Project.find(params[:id])\n\n\t\trender 'projects/project_status'\n\tend", "def status_translations\n @status_translations ||= Assembla.statuses['ticket_statuses']\nend", "def create_transla...
[ "0.6844893", "0.6664638", "0.6339318", "0.63098574", "0.6105781", "0.6035228", "0.5992366", "0.59807795", "0.593065", "0.5915725", "0.5896544", "0.5891722", "0.5863265", "0.58352613", "0.5816226", "0.5814109", "0.58110774", "0.5767038", "0.57388294", "0.57296056", "0.5725027"...
0.81025016
0
Creates translation status inside the given project
def create_translation_status(project_id, params) c_r Lokalise::Resources::CustomTranslationStatus, :create, project_id, params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_in_project(client, project: required(\"project\"), text: required(\"text\"), color: required(\"color\"), options: {}, **data)\n with_params = data.merge(text: text, color: color).reject { |_,v| v.nil? || Array(v).empty? }\n Resource.new(parse(client.post(\"/projects/#{project}/project_...
[ "0.6804595", "0.67013425", "0.65500647", "0.6343985", "0.62295705", "0.6156416", "0.61193246", "0.60826874", "0.6061255", "0.60582423", "0.60375607", "0.60368425", "0.6002224", "0.59719414", "0.5970482", "0.595719", "0.5935667", "0.59208035", "0.59108263", "0.5902242", "0.590...
0.82210314
0
Updates the given translation status inside the given project
def update_translation_status(project_id, status_id, params) c_r Lokalise::Resources::CustomTranslationStatus, :update, [project_id, status_id], params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translation_status(project_id, status_id)\n c_r Lokalise::Resources::CustomTranslationStatus, :find, [project_id, status_id]\n end", "def edit_project(description, status)\n update!(description: description, status: status)\n end", "def create_translation_status(project_id, params)\n c_r L...
[ "0.6916143", "0.6741629", "0.6609215", "0.62971115", "0.6281249", "0.6244652", "0.62268203", "0.62059724", "0.61841774", "0.6163271", "0.6149499", "0.6109986", "0.61035675", "0.61026967", "0.61026967", "0.6099646", "0.6082145", "0.6034373", "0.5991403", "0.598226", "0.5966623...
0.81826407
0
Deletes translation status inside the given project
def destroy_translation_status(project_id, status_id) c_r Lokalise::Resources::CustomTranslationStatus, :destroy, [project_id, status_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_translations\n end", "def destroy\n @project_status = ProjectStatus.find(params[:id])\n @project_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @project = AzProject.find(...
[ "0.70029676", "0.67618185", "0.67617273", "0.6732007", "0.67281353", "0.6712774", "0.6618373", "0.66147643", "0.6613793", "0.6609593", "0.6607866", "0.6600219", "0.65936816", "0.65766174", "0.6564709", "0.6532797", "0.65144646", "0.642646", "0.6416615", "0.6369575", "0.636551...
0.8149208
0
Returns an array of available colors that can be assigned to custom translation statuses
def translation_status_colors(project_id) c_r Lokalise::Resources::CustomTranslationStatus, :colors, [project_id, 'colors'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_colors_translated\n colors_translated = {}\n Calendar::Event::COLORS.each do |color, hex|\n colors_translated[t(\"colors.#{color}\")] = hex;\n end\n colors_translated\n end", "def possible_colors\n %w(R G B Y)\n end", "def colorNames\n colors = [\"red\", \"ora...
[ "0.7453258", "0.7098631", "0.6880048", "0.68631685", "0.6662618", "0.6608648", "0.6596603", "0.656664", "0.65605634", "0.65172577", "0.65147156", "0.6432875", "0.63793206", "0.63533807", "0.6319983", "0.6305622", "0.6291686", "0.62278354", "0.62068564", "0.61579996", "0.61556...
0.77412397
0
These helpers are just some toys if you want to try them! I pulled them out of the NSSfutureperfectCLI repo.
def strip_control_characters_and_excesses(string) last = string.split("\033[2;0f").last#.gsub(/(\e\[\d+\w)|(\e\[\w)/,"") if last.empty? "" else last.gsub(/(\e\[\d+\w)|(\e\[\w)/,"").gsub(" +","") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd; end", "def show_usage\n puts\n puts \"Available Commands & General Usage:\".white.underline\n puts \" config\".light_yellow + \" => \".white + \"Configure Connection Credentials\".light_yellow\n puts \" os_scan\".light_yellow + \" => \".white + \"SMB OS Discovery Scan\".ligh...
[ "0.58951813", "0.57804245", "0.5773434", "0.5708779", "0.56049514", "0.5561557", "0.55281943", "0.5509963", "0.5479134", "0.54769653", "0.54769653", "0.54769653", "0.54646474", "0.5443408", "0.5443258", "0.54055357", "0.53738576", "0.53381354", "0.5332917", "0.5324755", "0.53...
0.0
-1
Seek to the beginning of the file
def rewind select_io_from_pos(0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rewind(f)\n # '.seek()' command moves to the start of the file\n f.seek(0)\nend", "def rewind(f)\n #seeks for f at line 0\n f.seek(0)\n end", "def rewind(f)\n f.seek(0) # .seek looks for an indexed part of the file, could use any number to place within a file.\nend", "def rewind(f)\n # the...
[ "0.741359", "0.7371233", "0.7248637", "0.7247478", "0.7244695", "0.71952647", "0.71789443", "0.7152667", "0.7087586", "0.70634896", "0.7037251", "0.7032709", "0.7032709", "0.7032709", "0.7032709", "0.7032709", "0.7032709", "0.7032709", "0.70303136", "0.7013952", "0.6984718", ...
0.0
-1
The current position in the sequence
def tell @current_io_start + @current_io.tell end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pos() @current end", "def pos\n @position[:current]\n end", "def position\n current.position\n end", "def current_position\n @start_position + delta\n end", "def pos\n @pos\n end", "def cur_pos\n @cursor.pos\n end", "def position\n return @position\n ...
[ "0.82977897", "0.82276475", "0.8043575", "0.7803495", "0.7648334", "0.7575584", "0.7542907", "0.7542907", "0.753224", "0.7478208", "0.7395998", "0.73089325", "0.7296934", "0.7296934", "0.7296934", "0.7296934", "0.7296934", "0.7296934", "0.7296934", "0.7296934", "0.7256634", ...
0.0
-1
Seek to the given absolute position in the sequential stream
def seek(pos) if pos < @current_io_start || @current_io_end <= pos select_io_from_pos(pos) end @current_io.seek(pos - @current_io_start, IO::SEEK_SET) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seek(*args)\n raise ArgumentError, \"no stream\" unless __advance!\n @_st_stream.seek(*args)\n end", "def seek(p0) end", "def test_seek_at_position\n sample = stream.seek(10)\n assert_equal 10, stream.sample_index\n assert_equal Time.at(5), stream.time\n assert_equa...
[ "0.7930072", "0.76887316", "0.7554531", "0.75505155", "0.74827766", "0.74148446", "0.7404862", "0.7388249", "0.71331865", "0.71331865", "0.70246464", "0.7018061", "0.6991763", "0.69917077", "0.69900465", "0.6984661", "0.69794095", "0.68303657", "0.67766345", "0.67324436", "0....
0.6985674
15
Read a certain amount of bytes in the underlying IO A read can never cross IO boundaries (i.e. it will only be served by a single file)
def read(byte_count) buffer = @current_io.read(byte_count) if !buffer select_next_io @current_io.read(byte_count) else buffer end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readpartial(size)\n rescue_readable do\n socket.read_nonblock(size)\n end\n end", "def read_bytes_full\n @_io.read\n end", "def read(length=99, buf=\"buffer\") end", "def read(io, size)\n io.read_nonblock(size)\n rescue IO::WaitReadable\n IO.select([io])\n ...
[ "0.7236927", "0.7100403", "0.70259225", "0.6991769", "0.69357836", "0.6923383", "0.68481535", "0.68481535", "0.68481535", "0.68386036", "0.68249035", "0.6781562", "0.6757524", "0.6748955", "0.6745684", "0.67406255", "0.6670069", "0.66685855", "0.6635056", "0.6635056", "0.6620...
0.67675924
12
makes a blast database from the query and the target
def makedb # check if the query is a nucleotide sequence query_file = Bio::FastaFormat.open(@query) query_file.each do |entry| raise "Query sequence looks like it's not nucleotide" if !entry.isNucl? end # check if the target is a nucl or prot seq target_file = Bio::FastaFormat.open(@targe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makedb\n # only scan the first few hundred entries\n n = 100\n # check if the query is a nucl or prot seq\n query_file = Bio::FastaFormat.open(@query)\n count_p=0\n count=0\n query_file.take(n).each do |entry|\n count_p += 1 if entry.isProt?\n count += 1\n ...
[ "0.76542264", "0.62342674", "0.6004211", "0.5931667", "0.57991505", "0.5712789", "0.5599148", "0.5586061", "0.5571026", "0.5544832", "0.55104125", "0.55101055", "0.54857016", "0.53862256", "0.53532094", "0.53528064", "0.5336783", "0.5306926", "0.5299666", "0.52707386", "0.527...
0.73802865
1
Use callbacks to share common setup or constraints between actions.
def set_post @question = Question.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 post_params params.require(:question).permit(:quesbox) 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
Checks if a charname exists for a given User
def exists?(user, charname) #TODO: Figure out why querying for user fails not Character.first(:user_id => user._id, :name => charname).nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def char_taken?(char)\n check_char = Character.find_by_name(char.name)\n if check_char == nil \n \"no_entry\"\n else\n if check_char.user_id == 0\n \"unassigned\"\n else\n check_char.user.name\n end\n end\n end", "def user_exists?(name)\n Etc.getpwnam(name).nam...
[ "0.7199486", "0.7026632", "0.6931521", "0.6828559", "0.6773235", "0.6740338", "0.67331254", "0.67331254", "0.6708668", "0.67040217", "0.6702168", "0.6701418", "0.6673328", "0.66070193", "0.6586637", "0.65844977", "0.6580599", "0.6556602", "0.6553824", "0.65457207", "0.651632"...
0.8671146
0
Checks if a character name is a reserved word
def reserved? charname ['create', 'list'].include? charname end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def carefull_name?(name)\n not !! (name =~ /\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}/)\nend", "def reserved_word?(str)\n RESERVED_WORDS.include?(str.downcase)\n end", "def identifier_char?(c)\n c =~ /[\\.a-zA-Z0-9_]/ ? true : false\n end", "def valid_name (name)\r\n /^\\w+$/.matc...
[ "0.6927531", "0.686184", "0.6846887", "0.6838027", "0.68100804", "0.6765642", "0.6752511", "0.6706572", "0.6697595", "0.6670274", "0.6651417", "0.6597012", "0.659397", "0.6545267", "0.6540057", "0.6538487", "0.6517937", "0.6443867", "0.6391634", "0.6381689", "0.63207966", "...
0.78915423
0
Creates a new character
def create(name, race, cclass, session_key) user = API::UserMethods::Helpers::Auth::get_logged_in_user(session_key) return APIError.new(13, []) if user.nil? return APIError.new(11, [name]) if reserved? name return APIError.new(2, [user.username, name]) if exists?(user, name) r = Races.get(race) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_char(name)\n new_char = CharacterSheet.roll_char(name)\n self.characters << new_char\n end", "def create(name)\n name = name.downcase\n\n char = self.new(name)\n char.save\n\n @characters ||= {}\n @characters[name] = char\n\n char\n end", "def...
[ "0.78458524", "0.7482761", "0.6809261", "0.6784149", "0.66882825", "0.66339636", "0.64668936", "0.64668936", "0.64668936", "0.64668936", "0.64668936", "0.64668936", "0.64668936", "0.64668936", "0.64668936", "0.64667785", "0.64667785", "0.64667785", "0.64667785", "0.64667785", ...
0.56662244
80
Determines how to display the invitation, depending on the invitation type. Options: :link_to_invitation will link to the invitee show page (for internal invitations) :expose_external_invitation_email will expose the external invitee's email (should only be exposed to sponsor)
def format_invitation(invitation, options = {}) expose_external_invitation_email = options.delete(:expose_external_invitation_email) || false link_to_invitation = options.delete(:link_to_invitation) || false if invitation.is_a? SurveyInvitation || NetworkInvitation then if link_to_invitation the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invitation_url(type, employee)\n if type == :invite\n new_account_organization_invitation_path(current_account, current_organization, invitation: { employee_id: employee.id })\n else\n edit_account_organization_invitation_path(current_account, current_organization, employee.invitation)\n end...
[ "0.68081903", "0.65692526", "0.6463543", "0.634456", "0.6200775", "0.6004903", "0.599529", "0.5945305", "0.59146553", "0.59000784", "0.5894578", "0.5890768", "0.5882308", "0.58757615", "0.5873278", "0.5816881", "0.5806074", "0.58054644", "0.5804733", "0.5799731", "0.5790276",...
0.7751789
0
Appends the required image to the text
def required(text) text + image_tag("required.gif") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_text\n\t\ttext = Magick::Draw.new\n\t\ttext.font_family = 'georgia'\n\t\ttext.font_weight = Magick::NormalWeight\n\t\ttext.pointsize = 40\n\t\ttext.fill = COLOR\n\t\ttext.gravity = Magick::SouthGravity\n\t\ttext.annotate(@image, 0, 0, 0, 60, Base64.encode64(MESSAGE_1_64))\n\t\ttext.pointsize = 20\n\t\tte...
[ "0.7186853", "0.679442", "0.67216253", "0.66585636", "0.6643977", "0.66163063", "0.65904677", "0.6585813", "0.6538829", "0.64881206", "0.64517665", "0.63967407", "0.6294845", "0.6293493", "0.6186263", "0.6176253", "0.61697733", "0.615134", "0.6136433", "0.610785", "0.61031413...
0.546584
80
Simplifies making form items nested next to each other. Use in conjunction with form_block
def form_row(&block) @template.concat @template.content_tag(:div, @template.capture(&block), :class => 'box_container') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nested_forms\n []\n end", "def form_fields\n @item_fields = @model.typus_fields_for('form')\n @item_has_many = @model.typus_relationships_for('has_many')\n @item_has_and_belongs_to_many = @model.typus_relationships_for('has_and_belongs_to_many')\n end", "def wrap_with_repeatable_ui\n # coc...
[ "0.6328769", "0.6173854", "0.588981", "0.58455527", "0.57499915", "0.57132757", "0.56502134", "0.56113344", "0.55932367", "0.5572365", "0.550355", "0.5488177", "0.5467904", "0.5436469", "0.54042727", "0.53969127", "0.53790313", "0.53582305", "0.53582305", "0.5343148", "0.5340...
0.54309714
14
Passes text through a gauntlet of functions to improve the results for an end user Used for description fields.
def link_and_format(text, options = {}) simple_format(auto_link(text, :html => {:target => '_blank'}), options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description; @text; end", "def filter_description(text, readmore, url)\n if text\n _text = Sanitize.fragment(text[0...1000] + '&hellip;', Sanitize::Config::RELAXED)\n if readmore && url\n _text = \"#{_text} <p><a class=\\\"event-read-more\\\" href=\\\"#{url}\\\">#{readmore}</a></p>\"\n end\n ...
[ "0.666894", "0.633859", "0.6285273", "0.6259451", "0.6226951", "0.6151665", "0.60948324", "0.60936344", "0.6054658", "0.6049204", "0.6044971", "0.6031333", "0.60033727", "0.60031116", "0.5974844", "0.5974844", "0.5974844", "0.5974844", "0.5974844", "0.5974844", "0.5974844", ...
0.0
-1
Auto links with links opening in a new window.
def auto_link_new_window(text) auto_link(text, :html => {:target => '_blank'}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autolink(text)\n auto_link(text, :html => { :target => '_blank' })\n end", "def auto_pop_up_link(text, target, options, url = nil)\n link_to text, (url || '#'), {\n :class => \"auto_pop_up_link#{ \" #{options[:class]}\" if options[:class]}\", \n :title => options[:title], \n ...
[ "0.73316765", "0.62646824", "0.62419754", "0.61859185", "0.6129746", "0.6116993", "0.6114377", "0.6104605", "0.6089998", "0.60438794", "0.60173136", "0.60162044", "0.6000066", "0.6000066", "0.5998933", "0.5959792", "0.5959693", "0.59428495", "0.5940938", "0.59347", "0.5864641...
0.8422221
0
Determines the subdomain that should be used when creating a CS link for the organization Checks to see if the email address passed belongs to an uninitialized association member
def subdomain_for(params) organization = params[:organization] email = params[:email] organization = Organization.find_by_email(email) if email if organization && organization.association then organization.association.subdomain else '' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_domain\n self.organization.email_domain\n end", "def email_domain\n if !self[:email].blank?\n split_host = URI.parse(\"#{self[:email]}\").path.split('@')\n \"#{split_host.last}\" if 2 == split_host.size\n else\n self.organization.site_domain if self.organization\n end\n res...
[ "0.6958954", "0.69572556", "0.6837677", "0.6816106", "0.68153965", "0.679085", "0.6783052", "0.6714236", "0.6680976", "0.66498625", "0.6596912", "0.6593131", "0.6574284", "0.65547556", "0.6538046", "0.6523232", "0.65048563", "0.6483532", "0.64826614", "0.64585835", "0.6445896...
0.7887933
0
determines how to display the association contact information based on what fields are available
def association_contact_information contact = "<a href='mailto: #{current_association.contact_email}'>#{current_association.contact_name.blank? ? current_association.name : current_association.contact_name}</a>" contact += " at #{current_association.formatted_contact_phone}" unless current_associatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end", "def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end", "def dis...
[ "0.7142459", "0.7142459", "0.6882651", "0.67908657", "0.6738646", "0.6607511", "0.64317495", "0.63859105", "0.6362152", "0.634692", "0.6328542", "0.6311444", "0.6274218", "0.626543", "0.61689734", "0.61396945", "0.613674", "0.6133293", "0.6100573", "0.6086176", "0.60791934", ...
0.72065777
0
GET /artists/:artist_id/subscription GET /users/:user_id/subscriptions/:id
def show respond_to do |format| format.html # show.html.erb format.json { render :json => @subscription } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup_subscription\n @subscription = if params.has_key?(:id)\n UserSubscription.find(params[:id])\n else\n current_user.user_subscriptions.where(artist: @user).first\n end\n end", "def show\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n ...
[ "0.74408406", "0.65484357", "0.65484357", "0.6431358", "0.6392557", "0.63695854", "0.63327", "0.63327", "0.62078106", "0.6179628", "0.6074405", "0.60738605", "0.6072351", "0.60710096", "0.60710096", "0.60710096", "0.60710096", "0.6069355", "0.6066334", "0.6054746", "0.6022597...
0.5757218
52
DELETE /artists/:artist_id/subscription/:id DELETE /users/:user_id/subscription/:id
def destroy @subscription.destroy respond_to do |format| format.html { redirect_to artist_subscription_path } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy \n Instagram.delete_subscription({:id => params[:id]})\n local_subscription = Subscription.find_by_original_id params[:id]\n local_subscription.destroy if local_subscription\n redirect_to :admin_subscriptions\n end", "def destroy\n @artist.destroy\n respond_to do |format|\n f...
[ "0.71585166", "0.7127667", "0.7106162", "0.70964944", "0.70713276", "0.7069454", "0.7045476", "0.7044647", "0.7041809", "0.7041801", "0.7041801", "0.7041801", "0.7041801", "0.7041557", "0.7011846", "0.7004748", "0.7003779", "0.70001084", "0.699246", "0.6980299", "0.69652104",...
0.8008545
0
Get associated subscription (two paths)
def lookup_subscription @subscription = if params.has_key?(:id) UserSubscription.find(params[:id]) else current_user.user_subscriptions.where(artist: @user).first end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subscription subscription_name, options = {}\n subscriber.get_subscription subscription: subscription_path(subscription_name, options)\n end", "def subscription\n device = APN::Device.where(:subscriptions => {'$elemMatch' => { :_id => self.subscription_id }}).first\n device.subs...
[ "0.7095705", "0.70048296", "0.6807343", "0.6756315", "0.67531", "0.6704194", "0.6674504", "0.66607", "0.66307056", "0.6566782", "0.6546216", "0.6509602", "0.6486157", "0.6481763", "0.6481763", "0.6443684", "0.6433032", "0.63475186", "0.6336381", "0.6287016", "0.62773794", "...
0.70075405
1
Registers new query definition in the system with given queryName
def create_query_definition(query_name, body, opts = {}) data, _status_code, _headers = create_query_definition_with_http_info(query_name, body, opts) return data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addQueryName(theName)\n @metadata.addQueryName(theName)\n end", "def register_percolator_query(query_name, options = {})\n server.request(:put, percolator_query_path(query_name), nil, options)\n end", "def add_query(query)\n add_actions \"AddQuery(#{query})\"\n end", "def alias_qu...
[ "0.76185566", "0.7026084", "0.6599814", "0.6434121", "0.6083875", "0.6057601", "0.6047296", "0.59659106", "0.5883214", "0.5880212", "0.578039", "0.5776657", "0.5757622", "0.5732028", "0.5687732", "0.5659406", "0.5581932", "0.5568742", "0.55284953", "0.55284953", "0.55284953",...
0.6002378
7