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 |
|---|---|---|---|---|---|---|
Only allow a trusted parameter "white list" through. | def api_key_params
params.require(:api_key).permit(:user_id)
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 |
Returns all patients with a viral load in the selected range and the regimens they are on the given point in time. | def patients
Observation.select('patient_id, birthdate, patient_current_regimen(patient_id, obs_datetime) as regimen')
.joins(:encounter)
.joins('INNER JOIN person USING (person_id)')
.where(concept_id: ConceptName.find_by_name('Viral load').concept_id,
obs_datetime: (start_date..end_date),
value_numeric: viral_load_range)
.merge(Encounter.where(encounter_type: EncounterType.find_by_name('LAB ORDERS').encounter_type_id))
.group(:person_id)
.order(obs_datetime: :desc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_visiting_patients(date)\n day_start, day_end = TimeUtils.day_bounds(date)\n Patient.find_by_sql(\n [\n 'SELECT patient.* FROM patient INNER JOIN encounter USING (patient_id)\n WHERE encounter.encounter_datetime BETWEEN ? AND ?\n AND encounter.voided = 0 AND patient.voide... | [
"0.5873042",
"0.5644456",
"0.5568839",
"0.5292783",
"0.5276463",
"0.52721125",
"0.5224486",
"0.5165538",
"0.5164641",
"0.513881",
"0.51188076",
"0.5094088",
"0.5060091",
"0.50489724",
"0.5042062",
"0.5038151",
"0.49660924",
"0.4962078",
"0.493262",
"0.493262",
"0.49099264",
... | 0.6235888 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_mood_list
@mood_list = MoodList.find_by(user_id: current_user.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.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def mood_list_params
params[:moods] = encrypt_param params[:moods]
params.permit(:moods)
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 |
Insert game_object into the map | def insert(game_object)
start_x = ( game_object.bb.left / @grid[0] ).to_i
stop_x = ( game_object.bb.right / @grid[0] ).to_i
(start_x ... stop_x).each do |x|
start_y = ( game_object.bb.top / @grid[1] ).to_i
stop_y = ( game_object.bb.bottom / @grid[1] ).to_i
@game_object_positions[game_object] = [(start_x ... stop_x), (start_y ... stop_y)]
@map[x] ||= []
(start_y ... stop_y).each do |y|
@map[x][y] = game_object
puts "#{game_object.class} => map[#{x}][#{y}]" if @debug
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_object(object, map)\r\n if map[object.handle.to_s].nil?\r\n map[object.handle.to_s] = object\r\n end\r\n end",
"def insert_object g\n @objects.add g\n end",
"def << game_object\n @mutex.synchronize do\n @ghash[game_object.game_object_id] = game_object\n end\n end"... | [
"0.7335261",
"0.7278942",
"0.7018534",
"0.6873131",
"0.68568444",
"0.67495483",
"0.65670407",
"0.6445105",
"0.6411099",
"0.6343711",
"0.63436955",
"0.63297254",
"0.62959",
"0.62278605",
"0.61978894",
"0.61600703",
"0.6109239",
"0.6107178",
"0.608967",
"0.60234284",
"0.5992161... | 0.77957714 | 0 |
Removes a specific game object from the map, replace the cellvalue with nil | def delete(game_object)
range_x, range_y = @game_object_positions[game_object]
return unless range_x && range_y
range_x.each do |x|
range_y.each do |y|
@map[x][y] = nil
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove!(jumped_pos)\n board[jumped_pos] = nil\n end",
"def clear_at(cell)\n coordinate = @board_map.fetch(cell)\n set_cell(coordinate[0],coordinate[1],cell)\n end",
"def delete_object(x, y)\n @generator_flag = false if @grid[y][x].object.class == MapAbxn::Generator\n @grid[y][x] ... | [
"0.6912418",
"0.6892103",
"0.67292494",
"0.63333184",
"0.6273143",
"0.6214252",
"0.61556935",
"0.6099111",
"0.6014436",
"0.59929305",
"0.5987733",
"0.5987733",
"0.59856796",
"0.59667414",
"0.5956288",
"0.5935599",
"0.5918449",
"0.5918449",
"0.59118706",
"0.5907783",
"0.589930... | 0.71792775 | 0 |
Clear the game object residing in the cell given by real world coordinates x/y | def clear_at(x, y)
lookup_x = (x / @grid[0]).to_i
lookup_y = (y / @grid[1]).to_i
@map[lookup_x][lookup_y] = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_at(cell)\n coordinate = @board_map.fetch(cell)\n set_cell(coordinate[0],coordinate[1],cell)\n end",
"def clear(row, col)\n cell = @grid[row][col]\n cell.clear = true\n cell.detonated?\n end",
"def clear\n @x = 0.0\n @y = 0.0\n end",
"def clear(x,y)\n if getsq(... | [
"0.7377549",
"0.72605497",
"0.7105468",
"0.7035787",
"0.6756658",
"0.67354476",
"0.66895396",
"0.66590184",
"0.6643097",
"0.664032",
"0.65423584",
"0.6502671",
"0.6464164",
"0.6455628",
"0.6430879",
"0.63509613",
"0.6348454",
"0.6347402",
"0.63472384",
"0.63088566",
"0.627655... | 0.77544993 | 0 |
Gets game object from map that resides on real world coordinates x/y | def at(x, y)
lookup_x = (x / @grid[0]).to_i
lookup_y = (y / @grid[1]).to_i
@map[lookup_x][lookup_y] rescue nil # Benchmark this against @map[lookup_x] && @map[lookup_x][lookup_y] => prob faster
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def objects_at_location\n map.objects_at_player_location\n end",
"def loc\r\n { x: @mapx,\r\n y: @mapy }\r\n end",
"def from_game_object(game_object)\r\n start_x = (game_object.bb.left / @grid[0]).to_i\r\n stop_x = (game_object.bb.right / @grid[0]).to_i\r\n \r\n (sta... | [
"0.71199524",
"0.69049",
"0.6817893",
"0.67272764",
"0.64460254",
"0.64176655",
"0.6391938",
"0.6283303",
"0.6246024",
"0.62288046",
"0.6112392",
"0.60864735",
"0.60761696",
"0.6029093",
"0.6016484",
"0.6014212",
"0.6007964",
"0.5955413",
"0.5950714",
"0.5933283",
"0.59189457... | 0.61355525 | 10 |
Return the first game object occupying any of the cells that given 'game_object' covers | def from_game_object(game_object)
start_x = (game_object.bb.left / @grid[0]).to_i
stop_x = (game_object.bb.right / @grid[0]).to_i
(start_x .. stop_x).each do |x|
start_y = (game_object.bb.top / @grid[1]).to_i
stop_y = (game_object.bb.bottom / @grid[1]).to_i
(start_y .. stop_y).each do |y|
return @map[x][y] if @map[x] && @map[x][y]
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_object\n next_x = @cur_x + DIRECTION[@hero_direction][0]\n next_y = @cur_y + DIRECTION[@hero_direction][1]\n return if next_x < 0 || next_x > 14 || next_y < 0 || next_y > 14\n #look at new square in room\n next_square = @room[next_x][next_y]\n if next_square == CHAR_POTION || ... | [
"0.63153857",
"0.6085368",
"0.59655094",
"0.5937466",
"0.5867346",
"0.577208",
"0.5715233",
"0.5714156",
"0.56617445",
"0.56548476",
"0.55852556",
"0.5571266",
"0.55704904",
"0.5519726",
"0.5486104",
"0.54313165",
"0.5396928",
"0.53897804",
"0.5383057",
"0.5380996",
"0.536082... | 0.6868127 | 0 |
Yields all game objects occupying any of the cells that given 'game_object' covers | def each_collision(game_object)
start_x = (game_object.bb.left / @grid[0]).to_i
stop_x = (game_object.bb.right / @grid[0]).to_i
(start_x ... stop_x).each do |x|
start_y = (game_object.bb.top / @grid[1]).to_i
stop_y = (game_object.bb.bottom / @grid[1]).to_i
(start_y ... stop_y).each do |y|
yield @map[x][y] if @map[x] && @map[x][y] && @map[x][y] != game_object # Don't yield collisions with itself
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan_cells(&block)\n scan_all(cells_criteria, &block)\n end",
"def from_game_object(game_object)\r\n start_x = (game_object.bb.left / @grid[0]).to_i\r\n stop_x = (game_object.bb.right / @grid[0]).to_i\r\n \r\n (start_x .. stop_x).each do |x|\r\n start_y = (game_object.bb.t... | [
"0.5865903",
"0.5782244",
"0.57566696",
"0.57566696",
"0.5697716",
"0.56021726",
"0.5548103",
"0.55251366",
"0.54347396",
"0.5401786",
"0.53337115",
"0.5326179",
"0.5289907",
"0.5274942",
"0.5254335",
"0.51963204",
"0.51589024",
"0.5103795",
"0.51024944",
"0.51024944",
"0.505... | 0.6755905 | 0 |
numbers greater than 1 can be prime. Difficulty: medium. You may use our `is_prime?` solution. | def is_prime?(number)
if number <= 1
# only numbers > 1 can be prime.
return false
end
idx = 2
while idx < number
if (number % idx) == 0
return false
end
idx += 1
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prime?(num)\n if !num.is_a?(Integer) || ( num.class == Float && !num.nan? && num == num.floor ) || num <= 1\n false\n else\n (2...num).each do |i|\n if num % i == 0\n return false\n end\n end\n true\n end\nend",
"def is_prime?(num)\n ('1' * num) !~ /^1?$|^(11+?)\\1+$/\n ... | [
"0.82976776",
"0.8213565",
"0.82086563",
"0.81576306",
"0.81227183",
"0.8120719",
"0.8120448",
"0.81031424",
"0.8093666",
"0.8091813",
"0.80786353",
"0.8073417",
"0.80681366",
"0.8057749",
"0.804996",
"0.8049394",
"0.8044924",
"0.80348283",
"0.80331975",
"0.8029797",
"0.80291... | 0.0 | -1 |
Initialize auditor proxy with given audit id === Parameters audit_id(Integer):: ID of audit entry that should be appended to | def initialize(audit_id)
@audit_id = audit_id
@buffer = ''
@timer = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(audit_id)\n @audit_id = audit_id\n @size = 0\n @buffer = ''\n @mutex = Mutex.new\n end",
"def set_audit_trail\n @audit_trail = AuditTrail.find(params[:id])\n end",
"def set_audit\n @audit = Audit.find(params[:id])\n end",
"def set_audit\n @... | [
"0.6672957",
"0.66558164",
"0.6623255",
"0.6609278",
"0.6609278",
"0.6609278",
"0.6347319",
"0.5956987",
"0.5813992",
"0.57651794",
"0.54123336",
"0.54123336",
"0.54123336",
"0.5396907",
"0.5396907",
"0.53919405",
"0.53872263",
"0.5371375",
"0.53407997",
"0.53042173",
"0.5291... | 0.70679754 | 0 |
Update audit summary === Parameters status(String):: New audit entry status options[:category](String):: Optional, must be one of RightScale::EventCategories::CATEGORIES === Return true:: Always return true | def update_status(status, options={})
send_request('update_status', normalize_options(status, options))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_status(status, options={})\n send_audit(:kind => :status, :text => status, :category => options[:category])\n end",
"def update(status)\n @pivotal_story.update(current_state: status)\n end",
"def audit_status(sequence)\n context = sequence.context\n title = context.decommis... | [
"0.73706484",
"0.5886898",
"0.57798",
"0.56823653",
"0.565463",
"0.559142",
"0.559142",
"0.5574079",
"0.5532253",
"0.5532253",
"0.5532253",
"0.5532253",
"0.5532253",
"0.5532253",
"0.5530869",
"0.55257636",
"0.55003923",
"0.5479866",
"0.54543185",
"0.54064703",
"0.53985685",
... | 0.5415629 | 19 |
Start new audit section === Parameters title(String):: Title of new audit section, will replace audit status as well options[:category](String):: Optional, must be one of RightScale::EventCategories::CATEGORIES === Return true:: Always return true | def create_new_section(title, options={})
send_request('create_new_section', normalize_options(title, options))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_section(title, options={})\n send_audit(:kind => :new_section, :text => title, :category => options[:category])\n end",
"def start_section(level, title)\n end",
"def audit_create\n if self.class.auditing_enabled\n write_audit(:create)\n end\n true... | [
"0.73888993",
"0.56593436",
"0.55276334",
"0.5206795",
"0.51364654",
"0.4957813",
"0.4898732",
"0.48579478",
"0.48226672",
"0.47788987",
"0.4730682",
"0.46824598",
"0.46711978",
"0.46370515",
"0.46322766",
"0.46135393",
"0.46021947",
"0.4595317",
"0.45554098",
"0.4524991",
"0... | 0.5897409 | 1 |
Append output to current audit section === Parameters text(String):: Output to append to audit entry === Return true:: Always return true | def append_output(text)
EM.next_tick do
@buffer << text
if @buffer.size > MIN_AUDIT_SIZE
flush_buffer
else
reset_timer
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_log_text(text)\n self.log_text = \"\" if self.log_text.nil?\n self.log_text += text + \"\\n\"\n end",
"def append_changes_to_existing_text\n return @append_changes_to_existing_text\n end",
"def append_info(text, options={})\n send_audit(:kind => :info, :text ... | [
"0.668661",
"0.65745723",
"0.6496115",
"0.64246005",
"0.6338253",
"0.6125426",
"0.6090944",
"0.60546625",
"0.59142715",
"0.5893096",
"0.5879269",
"0.5794972",
"0.5742017",
"0.5698856",
"0.56838536",
"0.56573397",
"0.56521744",
"0.56470317",
"0.56370914",
"0.5546997",
"0.55327... | 0.69587207 | 0 |
Append info text to current audit section. A special marker will be prepended to each line of audit to indicate that text is not some output. Text will be linewrapped. === Parameters text(String):: Informational text to append to audit entry options[:category](String):: Optional, must be one of RightScale::EventCategories::CATEGORIES === Return true:: Always return true | def append_info(text, options={})
options[:category] ||= EventCategories::NONE # Do not event by default
send_request('append_info', normalize_options(text, options))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_info(text, options={})\n send_audit(:kind => :info, :text => text, :category => options[:category])\n end",
"def add_log_text(text)\n self.log_text = \"\" if self.log_text.nil?\n self.log_text += text + \"\\n\"\n end",
"def append_output(text)\n EM.next_tick do\n @bu... | [
"0.8102762",
"0.6049828",
"0.5541821",
"0.54422396",
"0.5223464",
"0.5218588",
"0.51746696",
"0.51523423",
"0.5133926",
"0.5130126",
"0.5128555",
"0.5081727",
"0.5050941",
"0.50506866",
"0.5019863",
"0.49904555",
"0.49424884",
"0.4918231",
"0.49061364",
"0.4903813",
"0.489946... | 0.7396576 | 1 |
Flush output buffer then send audits to core agent and log failures === Parameters request(String):: Request that should be sent to auditor actor options(Hash):: Text to be audited with optional arguments (event category) === Return true:: Always return true | def send_request(request, options)
EM.next_tick do
flush_buffer
internal_send_request(request, options)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def internal_send_request(request, options)\n log_method = request == 'append_error' ? :error : :info\n log_text = AuditFormatter.send(format_method(request), options[:text])[:detail]\n log_text.chomp.split(\"\\n\").each { |l| RightLinkLog.__send__(log_method, l) }\n options[:audit_id] = @audit... | [
"0.6689743",
"0.5404909",
"0.5366387",
"0.5189914",
"0.50771224",
"0.5049568",
"0.50203013",
"0.49786532",
"0.4945736",
"0.49390286",
"0.493359",
"0.49144307",
"0.49034902",
"0.48927855",
"0.48626506",
"0.48561746",
"0.48523256",
"0.48487952",
"0.48486495",
"0.4838797",
"0.48... | 0.5152358 | 4 |
Actually send audits to core agent and log failures === Parameters request(String):: Request that should be sent to auditor actor text(String):: Text to be audited === Return true:: Always return true | def internal_send_request(request, options)
log_method = request == 'append_error' ? :error : :info
log_text = AuditFormatter.send(format_method(request), options[:text])[:detail]
log_text.chomp.split("\n").each { |l| RightLinkLog.__send__(log_method, l) }
options[:audit_id] = @audit_id
RightScale::RequestForwarder.push("/auditor/#{request}", options)
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setMessage(content, isRequest)\n\n @txt_input.text = \"Text is not Modified.\".to_java_bytes if @txt_input.textModified\n\n if isRequest\n makelog \"start request audit\"\n @txt_input.text = \"HTTP Request is nil or empty.\".to_java_bytes if content.nil? or content.empty?\n resultlist =... | [
"0.5594382",
"0.54898816",
"0.5463866",
"0.53713053",
"0.52279836",
"0.52273935",
"0.51133627",
"0.51123583",
"0.5106037",
"0.5105007",
"0.50954145",
"0.506699",
"0.5065968",
"0.5065968",
"0.50434613",
"0.5024757",
"0.5018423",
"0.5017952",
"0.501069",
"0.5003455",
"0.4999490... | 0.68053806 | 0 |
Normalize options for creating new audit section of updating audit summary === Parameters text(String):: New section title or new status options(Hash):: Optional hash specifying category === Return opts(Hash):: Options hash ready for calling corresponding auditor operation | def normalize_options(text, options)
opts = options || {}
opts[:text] = text
opts[:category] ||= EventCategories::CATEGORY_NOTIFICATION
unless EventCategories::CATEGORIES.include?(opts[:category])
RightLinkLog.warn("Invalid notification category '#{opts[:category]}', using generic category instead")
opts[:category] = EventCategories::CATEGORY_NOTIFICATION
end
opts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_options(text, options)\n if text.is_a? Hash\n # we need to dup the text object because we're deleting keys from this object which manipulates the object passed in here\n # if this object is reused after beeing injected into this component, the keys would be missing\n ... | [
"0.58698285",
"0.56669676",
"0.56419086",
"0.5485371",
"0.5347494",
"0.5022771",
"0.49565056",
"0.49172178",
"0.4915692",
"0.49007463",
"0.48998454",
"0.48915353",
"0.48915353",
"0.48280305",
"0.48031807",
"0.4754392",
"0.47411186",
"0.47337097",
"0.47330752",
"0.4727763",
"0... | 0.67551696 | 0 |
Send any buffered output to auditor === Return Always return true | def flush_buffer
if @timer
@timer.cancel
@timer = nil
end
unless @buffer.empty?
internal_send_request('append_output', :text => @buffer)
@buffer = ''
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_pending\n if output.length > 0\n sent = send(output.to_s, 0)\n debug { \"sent #{sent} bytes\" }\n output.consume!(sent)\n return sent > 0\n else\n return false\n end\n end",
"def pending_write?\n output.length > 0\n end",... | [
"0.7038063",
"0.6430498",
"0.63328063",
"0.61370355",
"0.6125841",
"0.61240506",
"0.61240506",
"0.60612136",
"0.6032694",
"0.60235876",
"0.60235876",
"0.59955597",
"0.5964954",
"0.5930418",
"0.5930418",
"0.5930418",
"0.59137386",
"0.58741343",
"0.58662087",
"0.5844901",
"0.58... | 0.6287954 | 3 |
Set or reset timer for buffer flush === Return true:: Always return true | def reset_timer
# note we are using a single PeriodicTimer because we were running out of
# one-shot timers with verbose script output. calling cancel on a one-shot
# timer sends a message but does not immediately remove the timer from EM
# which maxes out at 1000 one-shot timers.
(@timer = EventMachine::PeriodicTimer.new(MAX_AUDIT_DELAY) { flush_buffer }) unless @timer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def periodic_flush\n true\n end",
"def flush_buffer\n # note we must discard cancelled timer or else we never create a new timer and stay cancelled.\n if @timer\n @timer.cancel\n @timer = nil\n end\n\n to_send = nil\n @mutex.synchronize do\n unless @buffer.empty?... | [
"0.6856796",
"0.6641048",
"0.6488345",
"0.6365131",
"0.62721443",
"0.6203589",
"0.61371344",
"0.61182564",
"0.6007922",
"0.59333694",
"0.5814536",
"0.5786953",
"0.57693315",
"0.57626337",
"0.57613397",
"0.573946",
"0.573946",
"0.573946",
"0.57350755",
"0.5728671",
"0.5725622"... | 0.54234993 | 49 |
Audit formatter method to call to format message sent through +request+ === Parameters request(String):: Request used to audit text === Return method(Symbol):: Corresponding audit formatter method | def format_method(request)
method = case request
when 'update_status' then :status
when 'create_new_section' then :new_section
when 'append_output' then :output
when 'append_info' then :info
when 'append_error' then :error
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def internal_send_request(request, options)\n log_method = request == 'append_error' ? :error : :info\n log_text = AuditFormatter.send(format_method(request), options[:text])[:detail]\n log_text.chomp.split(\"\\n\").each { |l| RightLinkLog.__send__(log_method, l) }\n options[:audit_id] = @audit... | [
"0.5900999",
"0.5893942",
"0.5893942",
"0.58552265",
"0.5797278",
"0.57363343",
"0.5613109",
"0.5613109",
"0.560822",
"0.5553612",
"0.5510399",
"0.5501452",
"0.54906946",
"0.54812396",
"0.5450201",
"0.54351956",
"0.54351956",
"0.54080254",
"0.53963983",
"0.53963983",
"0.53963... | 0.6902804 | 0 |
No need to modify this code! Use this to implement the fizzbuzz_printer method. | def fizzbuzz(num)
if num % 3 == 0 && num % 5 == 0
"FizzBuzz"
elsif num % 3 == 0
"Fizz"
elsif num % 5 == 0
"Buzz"
else
num
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_fizzbuzz_sequence(start_num, end_num)\n line_index = 0 #Initialize line position\n line_threshold = 50 #Local constant controls length of print line\n is_ascending = start_num < end_num #Are we counting up or down?\n\n counter = start_num\n loop do\n # !! {\n line_index += prindex('Fizz') if c... | [
"0.7558272",
"0.7546961",
"0.7457645",
"0.74392277",
"0.73162985",
"0.72706956",
"0.72477156",
"0.7200927",
"0.7195848",
"0.71824217",
"0.717896",
"0.71765184",
"0.71746874",
"0.7131236",
"0.71272665",
"0.7092889",
"0.70891726",
"0.7084701",
"0.70836914",
"0.7072254",
"0.7070... | 0.68196106 | 70 |
GET /proyectos GET /proyectos.json | def admin?
if current_user.read_attribute(:permiso) != 1
redirect_to current_user
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @proyects = Proyect.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proyects }\n end\n end",
"def index\n if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_p... | [
"0.7265572",
"0.6786606",
"0.67556703",
"0.67556703",
"0.67556703",
"0.67556703",
"0.65600294",
"0.65600294",
"0.6409942",
"0.63700885",
"0.63417476",
"0.6318234",
"0.6315985",
"0.629483",
"0.62434584",
"0.6181625",
"0.6178821",
"0.61783075",
"0.6167004",
"0.6164779",
"0.6164... | 0.0 | -1 |
GET /proyectos/1 GET /proyectos/1.json | def show
@proyecto = Proyecto.find(params[:id])
@proyecto_actividades = @proyecto.actividads
@proyecto_usuarios = @proyecto.usuarios
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @proyects = Proyect.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proyects }\n end\n end",
"def show\n @proyect = Proyect.find(params[:id])\n if request.path != proyect_path(@proyect)\n redirect_to @proyect, status: :moved_p... | [
"0.6869162",
"0.6627264",
"0.6622362",
"0.64687264",
"0.64342415",
"0.64342415",
"0.6414031",
"0.6404556",
"0.63873637",
"0.63873637",
"0.63873637",
"0.63873637",
"0.63007545",
"0.6292506",
"0.62899554",
"0.6219895",
"0.621479",
"0.62051284",
"0.6172969",
"0.6172119",
"0.6154... | 0.0 | -1 |
POST /proyectos POST /proyectos.json | def create
@proyecto = Proyecto.new(proyecto_params)
respond_to do |format|
if @proyecto.save
format.html { redirect_to action: "index", notice: 'Proyecto was successfully created.' }
format.json { render :show, status: :created, location: @proyecto }
flash[:success] = "Proyecto creado"
else
format.html { render :new }
format.json { render json: @proyecto.errors, status: :unprocessable_entity }
flash[:danger] = "Error al crear el proyecto"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @proyect = Proyect.new(params[:proyect])\n\n respond_to do |format|\n if @proyect.save\n format.html { redirect_to @proyect, notice: 'Proyect was successfully created.' }\n format.json { render json: @proyect, status: :created, location: @proyect }\n else\n format.... | [
"0.6884024",
"0.68251574",
"0.6814909",
"0.6603385",
"0.65885675",
"0.6287788",
"0.6280281",
"0.6145302",
"0.61393917",
"0.61212",
"0.6104165",
"0.61018187",
"0.6072222",
"0.6068606",
"0.60508865",
"0.6050834",
"0.60378486",
"0.60348105",
"0.60281897",
"0.6010875",
"0.6010875... | 0.5914459 | 39 |
PATCH/PUT /proyectos/1 PATCH/PUT /proyectos/1.json | def update
respond_to do |format|
if @proyecto.update(proyecto_params)
format.html { redirect_to current_user, notice: 'Proyecto was successfully updated.' }
format.json { render :show, status: :ok, location: @proyecto }
flash[:success] = "Proyecto actualizado"
# @modificacion = Modificacion.new(:proyecto_id => @proyecto.id, usuario_id => params[:id] )
else
format.html { render :edit }
format.json { render json: @proyecto.errors, status: :unprocessable_entity }
flash[:danger] = "Error al actualizar el proyecto"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @proyect = Proyect.find(params[:id])\n\n respond_to do |format|\n if @proyect.update_attributes(params[:proyect])\n format.html { redirect_to @proyect, notice: 'Proyect was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render ac... | [
"0.6750719",
"0.65727633",
"0.6549982",
"0.6427636",
"0.6297406",
"0.62486005",
"0.6248336",
"0.6240695",
"0.62314135",
"0.6223655",
"0.6201656",
"0.6180142",
"0.61735",
"0.61706847",
"0.6152254",
"0.6148719",
"0.6139555",
"0.6128541",
"0.61111987",
"0.61111987",
"0.61111987"... | 0.5977297 | 39 |
DELETE /proyectos/1 DELETE /proyectos/1.json | def destroy
@proyecto.destroy
respond_to do |format|
format.html { redirect_to proyectos_url, notice: 'Proyecto was successfully destroyed.' }
format.json { head :no_content }
flash[:success] = "Proyecto eliminado"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @proyect = Proyect.find(params[:id])\n @proyect.destroy\n\n respond_to do |format|\n format.html { redirect_to proyects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proyect.destroy\n respond_to do |format|\n format.html { redirect_to proye... | [
"0.7300574",
"0.7018263",
"0.70138794",
"0.69423604",
"0.69423604",
"0.69423604",
"0.69423604",
"0.69410664",
"0.69392014",
"0.6930727",
"0.6881607",
"0.68775445",
"0.6863505",
"0.68587476",
"0.6850788",
"0.68427926",
"0.6756246",
"0.6753744",
"0.67408174",
"0.67301637",
"0.6... | 0.67983055 | 16 |
Use callbacks to share common setup or constraints between actions. | def set_proyecto
@proyecto = Proyecto.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 proyecto_params
params.require(:proyecto).permit(:nombre, :fecha_inicio, :fecha_final, usuario_ids:[])
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 |
Toolbar configuration for CKEditor | def editor_toolbar
[
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
'/',
{ name: 'paragraph', groups: [ 'align', 'list', 'indent', 'blocks' ], items: [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote' ] },
{ name: 'insert', items: [ 'HorizontalRule', 'SpecialChar' ] },
{ name: 'styles', items: [ 'Format' ] },
{ name: 'others', items: [ '-' ] },
{ name: 'about', items: [ 'About' ] }
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_toolbars\n # TODO\n end",
"def toolbar\n @css_class << 'toolbar'\n return self\n end",
"def load_toolbar\n @nav_body_content = \"admin/assignments/toolbar\"\n end",
"def configuration(*args)\n result = @@toolbar_config ||=\n YAML.load_file(RedmineCkeditor::... | [
"0.71775883",
"0.6951312",
"0.6895092",
"0.679198",
"0.6313865",
"0.6313865",
"0.62365603",
"0.6226606",
"0.6161785",
"0.61287934",
"0.60430986",
"0.57587034",
"0.5718484",
"0.5607573",
"0.5573634",
"0.55553687",
"0.5534893",
"0.5523974",
"0.55203676",
"0.5507239",
"0.5502666... | 0.7525186 | 0 |
calculate the number of updated column | def calculate_updated_column(saved_user, inputed_user)
result = '、';
unless saved_user.registrationNo.eql? inputed_user.registrationNo
result = result + "登録No、"
end
unless saved_user.kanjiName.eql? inputed_user.kanjiName
result = result + "名前(漢字)、"
end
unless saved_user.kanaName.eql? inputed_user.kanaName
result = result + "名前(かな)、"
end
unless saved_user.dateOfBirth.eql? inputed_user.dateOfBirth
result = result + "生年月日、"
end
unless saved_user.birthPlace.eql? inputed_user.birthPlace
result = result + "出身地、"
end
unless saved_user.height.eql? inputed_user.height
result = result + "身長、"
end
unless saved_user.weight.eql? inputed_user.weight
result = result + "体重、"
end
unless saved_user.specialSkill.eql? inputed_user.specialSkill
result = result + "特技、"
end
unless saved_user.hobby.eql? inputed_user.hobby
result = result + "趣味、"
end
unless saved_user.charmPoint.eql? inputed_user.charmPoint
result = result + "チャームポイント、"
end
unless saved_user.holidyTimeSpand.eql? inputed_user.holidyTimeSpand
result = result + "休日の過ごし方、"
end
unless saved_user.appealPoint.eql? inputed_user.appealPoint
result = result + "アピールポイント、"
end
unless saved_user.score.eql? inputed_user.score
result = result + "採点 、"
end
if result.length >1
n = result.size
result = result[0..n-2]
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_delta; end",
"def processed_rows\n edited_rows_count + created_rows_count\n end",
"def column_deltas; end",
"def edited_rows_count\n @edited_rows_codes.count\n end",
"def edited_rows_count\n @edited_rows_codes.count\n end",
"def edited_rows_count\n @edited_rows_codes.count\n en... | [
"0.6864534",
"0.6597548",
"0.6579706",
"0.64548504",
"0.64548504",
"0.64548504",
"0.6387272",
"0.6350172",
"0.6342795",
"0.63403666",
"0.63285285",
"0.6293497",
"0.6291664",
"0.6255817",
"0.6253389",
"0.6198305",
"0.6095717",
"0.6088122",
"0.60836154",
"0.6027274",
"0.6014999... | 0.0 | -1 |
store the last visited controller action | def last_visited(action_name, controller_name)
if(action_name =='find' and controller_name == 'search')
session[:action]='back'
session[:controller]=controller_name
elsif(action_name =='index' and controller_name == 'main_menu')
session[:action]=action_name
session[:controller]=controller_name
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_action\n Rails.application.routes.recognize_path(request.referrer)[:action]\n end",
"def store_location\n unless controller_name == \"sessions\" || action_name == \"activate\"\n session[:return_to] =\n if request.get?\n request.request_uri\n else\n request.... | [
"0.7239229",
"0.65947676",
"0.65531045",
"0.6485375",
"0.63915485",
"0.63915485",
"0.63915485",
"0.63915485",
"0.63915485",
"0.63915485",
"0.63901985",
"0.63856924",
"0.6344792",
"0.631518",
"0.62859535",
"0.6241631",
"0.62188554",
"0.61764526",
"0.6174074",
"0.6171718",
"0.6... | 0.78936595 | 0 |
GET /countries GET /countries.json | def index
@countries = Country.all
render json: @countries
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def country_list\n get_request( \"/api/v2_1/api/countries\")\n end",
"def get_countries\n perform(:get, 'enum/countries', nil, nonauth_headers).body\n end",
"def index\n @countries = Country.all\n json_response(@countries)\n end",
"def countries\n collection(\"countr... | [
"0.8091304",
"0.7905766",
"0.76604635",
"0.75860393",
"0.7551561",
"0.735397",
"0.7083988",
"0.70632714",
"0.7026407",
"0.70252323",
"0.69627535",
"0.6956617",
"0.6921465",
"0.6882997",
"0.6865407",
"0.6863748",
"0.68424237",
"0.67470205",
"0.67470205",
"0.67466867",
"0.67362... | 0.758825 | 3 |
GET /countries/1 GET /countries/1.json | def show
render json: @country
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def country_list\n get_request( \"/api/v2_1/api/countries\")\n end",
"def index\n @countries = Country.all\n\n render json: @countries\n end",
"def index\n @countries = Country.all\n json_response(@countries)\n end",
"def get_countries\n perform(:get, 'enum/countries'... | [
"0.7578863",
"0.74292827",
"0.742219",
"0.7259051",
"0.71466124",
"0.71466124",
"0.7121346",
"0.7067446",
"0.70150703",
"0.69914526",
"0.697479",
"0.6966437",
"0.6892705",
"0.68564665",
"0.68226105",
"0.6791426",
"0.6712157",
"0.665914",
"0.6643822",
"0.6584179",
"0.6584179",... | 0.71497154 | 4 |
POST /countries POST /countries.json | def create
@country = Country.new(country_params)
if @country.save
render json: @country, status: :created, location: @country
else
render json: @country.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @country = Country.create!(valid_params)\n json_response(@country, :created)\n end",
"def create\n @countries = Countries.new(params[:countries])\n\n respond_to do |format|\n if @countries.save\n flash[:notice] = 'Countries was successfully created.'\n forma... | [
"0.6796667",
"0.67311287",
"0.6698475",
"0.6669663",
"0.6616013",
"0.66079766",
"0.6571803",
"0.6571803",
"0.6502894",
"0.6424183",
"0.63651943",
"0.6294456",
"0.6235747",
"0.6230718",
"0.62012476",
"0.619645",
"0.61840296",
"0.61809963",
"0.6166233",
"0.61520326",
"0.6140303... | 0.70150197 | 0 |
PATCH/PUT /countries/1 PATCH/PUT /countries/1.json | def update
@country = Country.find(params[:id])
if @country.update(country_params)
head :no_content
else
render json: @country.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @country = Country.find(params[:id])\n if @country.update_attributes(:name=>params[:body][:country])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@country.errors)\n end\n end",
"def update\n @country = Country.find(params[:id])\n\n respond_to ... | [
"0.67843103",
"0.65163016",
"0.65161604",
"0.64781624",
"0.64471155",
"0.64471155",
"0.6271849",
"0.62705564",
"0.62705564",
"0.62290484",
"0.6198192",
"0.61881363",
"0.61826915",
"0.61327964",
"0.61049324",
"0.6103624",
"0.6080693",
"0.60623884",
"0.60623884",
"0.60549664",
... | 0.67023206 | 1 |
DELETE /countries/1 DELETE /countries/1.json | def destroy
@country.destroy
head :no_content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @country.destroy\n respond_to do |format|\n format.html { redirect_to countries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @country.destroy\n respond_to do |format|\n format.html { redirect_to countries_url }\n format.json { head :no_co... | [
"0.75377595",
"0.75377595",
"0.7531622",
"0.74971575",
"0.7236105",
"0.7235571",
"0.7222723",
"0.72015524",
"0.71558553",
"0.7149611",
"0.71352327",
"0.7023673",
"0.70115095",
"0.6963523",
"0.6951886",
"0.69244426",
"0.69244426",
"0.6910306",
"0.6905644",
"0.68904173",
"0.681... | 0.72911805 | 4 |
Gets the assignedUserPrincipalName property value. UPN of the user the device will be assigned | def assigned_user_principal_name
return @assigned_user_principal_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assigned_user_principal_name=(value)\n @assigned_user_principal_name = value\n end",
"def assigned_user\n User.find_by_id(assigned_id).full_name\n end",
"def assigned_user_name(issue)\n if has_assigned_user?(issue)\n User.find_by(id: issue.user_issue.user_id).name\n ... | [
"0.711039",
"0.6570505",
"0.6569766",
"0.6473234",
"0.6473234",
"0.6473234",
"0.6473234",
"0.6473234",
"0.62527835",
"0.62527835",
"0.62527835",
"0.6228687",
"0.6213782",
"0.61877847",
"0.6187155",
"0.61507785",
"0.61430955",
"0.61430955",
"0.61430955",
"0.61430955",
"0.61430... | 0.76104075 | 0 |
Sets the assignedUserPrincipalName property value. UPN of the user the device will be assigned | def assigned_user_principal_name=(value)
@assigned_user_principal_name = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_principal_name=(value)\n @user_principal_name = value\n end",
"def user_principal_name=(value)\n @user_principal_name = value\n end",
"def user_principal_name=(value)\n @user_principal_name = value\n end",
"def user_princi... | [
"0.64495754",
"0.64495754",
"0.64495754",
"0.64495754",
"0.64495754",
"0.62757325",
"0.6000005",
"0.59446996",
"0.59135413",
"0.58558893",
"0.58558893",
"0.58558893",
"0.5779624",
"0.571185",
"0.5684831",
"0.5684831",
"0.5671444",
"0.5671299",
"0.5668903",
"0.5653878",
"0.561... | 0.76899457 | 0 |
Instantiates a new importedWindowsAutopilotDeviceIdentity and sets the default values. | def initialize()
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize()\n super\n @odata_type = \"#microsoft.graph.provisionedIdentity\"\n end",
"def initialize(path_parameters, request_adapter)\n super(path_parameters, request_adapter, \"{+baseurl}/deviceManagement/windowsAutopilotDeviceIdentities/{win... | [
"0.54743296",
"0.5067282",
"0.50530857",
"0.50308394",
"0.5019731",
"0.49778712",
"0.49431852",
"0.48790756",
"0.4875615",
"0.48679578",
"0.48622453",
"0.48243284",
"0.48113123",
"0.48056272",
"0.47739807",
"0.4771653",
"0.4767872",
"0.47584084",
"0.4747075",
"0.4726015",
"0.... | 0.0 | -1 |
The deserialization information for the current model | def get_field_deserializers()
return super.merge({
"assignedUserPrincipalName" => lambda {|n| @assigned_user_principal_name = n.get_string_value() },
"groupTag" => lambda {|n| @group_tag = n.get_string_value() },
"hardwareIdentifier" => lambda {|n| @hardware_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },
"importId" => lambda {|n| @import_id = n.get_string_value() },
"productKey" => lambda {|n| @product_key = n.get_string_value() },
"serialNumber" => lambda {|n| @serial_number = n.get_string_value() },
"state" => lambda {|n| @state = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ImportedWindowsAutopilotDeviceIdentityState.create_from_discriminator_value(pn) }) },
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end",
"def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },... | [
"0.6510734",
"0.63224316",
"0.6322254",
"0.63094735",
"0.62954384",
"0.6238735",
"0.6232461",
"0.62155676",
"0.6200175",
"0.6199403",
"0.6173917",
"0.61733985",
"0.61705345",
"0.61631054",
"0.61620396",
"0.6158031",
"0.6156071",
"0.6142402",
"0.613998",
"0.6138061",
"0.612005... | 0.59844214 | 42 |
Gets the groupTag property value. Group Tag of the Windows autopilot device. | def group_tag
return @group_tag
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_tag=(value)\n @group_tag = value\n end",
"def group\n @group.name\n end",
"def group\n return @group\n end",
"def group\n return @group\n end",
"def device_tag\n return @device_tag\n en... | [
"0.72739",
"0.6650034",
"0.6575842",
"0.6575842",
"0.6474362",
"0.639696",
"0.63197726",
"0.63156873",
"0.6269976",
"0.6268997",
"0.6258324",
"0.6226683",
"0.62137276",
"0.62137276",
"0.61333174",
"0.6128991",
"0.6121046",
"0.61202705",
"0.6103257",
"0.60861814",
"0.6079471",... | 0.7440861 | 0 |
Sets the groupTag property value. Group Tag of the Windows autopilot device. | def group_tag=(value)
@group_tag = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_group(group)\n send_request(FUNCTION_SET_GROUP, [group], 'k4', 0, '')\n end",
"def group=(value)\n @group = value\n end",
"def group=(value)\n @group = value\n end",
"def set_group(param)\n @group = param\n end",
"def tag(t... | [
"0.6995956",
"0.69234306",
"0.69234306",
"0.6817846",
"0.65841335",
"0.6557671",
"0.6365477",
"0.63241565",
"0.6316847",
"0.62117404",
"0.62117404",
"0.62117404",
"0.62117404",
"0.62117404",
"0.62117404",
"0.62117404",
"0.6177378",
"0.6153126",
"0.61382973",
"0.6099297",
"0.6... | 0.79322875 | 0 |
Gets the hardwareIdentifier property value. Hardware Blob of the Windows autopilot device. | def hardware_identifier
return @hardware_identifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hardware_identifier=(value)\n @hardware_identifier = value\n end",
"def hardware_id\n config.hardware_id ||= \"aal-#{SecureRandom.uuid}\"\n end",
"def physical_device_id\n return @physical_device_id\n end",
"def hardware_node\n ... | [
"0.7267722",
"0.6816238",
"0.66773564",
"0.64218706",
"0.6417946",
"0.6249328",
"0.61052483",
"0.59381914",
"0.59381914",
"0.59381914",
"0.59381914",
"0.5927582",
"0.5761347",
"0.5741232",
"0.5711874",
"0.5550906",
"0.5550906",
"0.5550906",
"0.55166835",
"0.55166835",
"0.5516... | 0.8226272 | 0 |
Sets the hardwareIdentifier property value. Hardware Blob of the Windows autopilot device. | def hardware_identifier=(value)
@hardware_identifier = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hardware_identifier\n return @hardware_identifier\n end",
"def hardware_id\n config.hardware_id ||= \"aal-#{SecureRandom.uuid}\"\n end",
"def set_hardware\n @hardware = Hardware.find(params[:id])\n end",
"def set_hardware\n @hardware = Hardware.find(params[:... | [
"0.7052961",
"0.6750583",
"0.67390734",
"0.67390734",
"0.67390734",
"0.6581593",
"0.56818354",
"0.56209815",
"0.54742146",
"0.54734427",
"0.54734427",
"0.54734427",
"0.54734427",
"0.5430827",
"0.5416021",
"0.53931653",
"0.5378978",
"0.53646004",
"0.52603596",
"0.522259",
"0.5... | 0.8225751 | 0 |
Gets the importId property value. The Import Id of the Windows autopilot device. | def import_id
return @import_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_id=(value)\n @import_id = value\n end",
"def set_import\n @import = Import.find(params[:id])\n end",
"def set_import\n @import = Import.find(params[:id])\n end",
"def set_import\n @import = Import.find(params[:id])\n end",
"def o_id\n return... | [
"0.7528263",
"0.56846404",
"0.56846404",
"0.56846404",
"0.5631391",
"0.5570709",
"0.5436435",
"0.52523243",
"0.5170957",
"0.5113595",
"0.5111083",
"0.5110832",
"0.50994015",
"0.5068636",
"0.50657415",
"0.5061992",
"0.5054191",
"0.50173575",
"0.49988312",
"0.4989196",
"0.49891... | 0.8241686 | 0 |
Sets the importId property value. The Import Id of the Windows autopilot device. | def import_id=(value)
@import_id = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_import\n @import = Import.find(params[:id])\n end",
"def set_import\n @import = Import.find(params[:id])\n end",
"def set_import\n @import = Import.find(params[:id])\n end",
"def set_imports_import\n @imports_import = Imports::Import.find(params[:imports_import_id])\n ... | [
"0.71332693",
"0.71332693",
"0.71332693",
"0.69587696",
"0.69079155",
"0.6735145",
"0.6099198",
"0.60803604",
"0.60089505",
"0.5708596",
"0.5529925",
"0.55043834",
"0.5451965",
"0.5360999",
"0.5251674",
"0.5168001",
"0.51387125",
"0.51029664",
"0.5060682",
"0.50552183",
"0.50... | 0.8216101 | 0 |
Gets the productKey property value. Product Key of the Windows autopilot device. | def product_key
return @product_key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_key=(value)\n @product_key = value\n end",
"def product_key=(value)\n @product_key = value\n end",
"def product_id\n read('product_id')\n end",
"def get_product_key(mfg, product)\n data = YAML.load(open_file('tires', mfg))\n ... | [
"0.71052",
"0.71052",
"0.65456605",
"0.6536803",
"0.6341489",
"0.59433043",
"0.5859368",
"0.5786929",
"0.57842684",
"0.57315797",
"0.56997687",
"0.56843996",
"0.56843996",
"0.5618955",
"0.5618955",
"0.5616199",
"0.5596805",
"0.5596805",
"0.55737513",
"0.55473846",
"0.5533415"... | 0.77352536 | 1 |
Sets the productKey property value. Product Key of the Windows autopilot device. | def product_key=(value)
@product_key = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_key\n return @product_key\n end",
"def product_key\n return @product_key\n end",
"def set_Product(value)\n set_input(\"Product\", value)\n end",
"def set_product\n @product = current_api_v1_user.products.find(params[:id])\n e... | [
"0.631538",
"0.631538",
"0.62289715",
"0.595696",
"0.59250706",
"0.5784014",
"0.5782986",
"0.569839",
"0.56960464",
"0.5683324",
"0.5668215",
"0.5625743",
"0.5609744",
"0.5609506",
"0.5575163",
"0.55740464",
"0.556353",
"0.55520785",
"0.55420566",
"0.55420566",
"0.55420566",
... | 0.775446 | 1 |
Gets the serialNumber property value. Serial number of the Windows autopilot device. | def serial_number
return @serial_number
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serial\n fetch('device.serial')\n end",
"def serial_number; Common.serial_number(@handle); end",
"def serial_number=(value)\n @serial_number = value\n end",
"def get_serial_number(data)\n data['product']['serial_number'] || 'n/a'\n end",
"def serial_value(seria... | [
"0.76277477",
"0.72662205",
"0.71312696",
"0.6519197",
"0.6414575",
"0.6366991",
"0.63403445",
"0.62553483",
"0.6236588",
"0.62254167",
"0.61764246",
"0.6069209",
"0.5968872",
"0.5964111",
"0.5946545",
"0.59112406",
"0.5675265",
"0.5640561",
"0.55946356",
"0.55946356",
"0.557... | 0.7828287 | 0 |
Sets the serialNumber property value. Serial number of the Windows autopilot device. | def serial_number=(value)
@serial_number = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_serial_number number\n appname = @appname\n pattern = Regexp.new \"^#{appname}:.*$\"\n filename = @app_serial_path || \"serial_numbers\"\n # during testing redo this file does not exist, so i get errors\n if !File.exists? filename\n _get_serial_number\n end\n _backup filename\n ... | [
"0.68039805",
"0.6481677",
"0.6414766",
"0.6243922",
"0.6243922",
"0.6036031",
"0.5881071",
"0.56531096",
"0.56531096",
"0.56011415",
"0.5586165",
"0.53466207",
"0.53370655",
"0.52936906",
"0.5254781",
"0.5181164",
"0.5111061",
"0.50999695",
"0.50883293",
"0.5063474",
"0.5041... | 0.7994854 | 0 |
Serializes information the current object | def serialize(writer)
raise StandardError, 'writer cannot be null' if writer.nil?
super
writer.write_string_value("assignedUserPrincipalName", @assigned_user_principal_name)
writer.write_string_value("groupTag", @group_tag)
writer.write_object_value("hardwareIdentifier", @hardware_identifier)
writer.write_string_value("importId", @import_id)
writer.write_string_value("productKey", @product_key)
writer.write_string_value("serialNumber", @serial_number)
writer.write_object_value("state", @state)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n end",
"def serialize(object) end",
"def serialize; end",
"def serialize; end",
"def serialize\n \n end",
"def serialize\n raise NotImplementedError\n end",
"def serialize\n raise NotImplementedError\n end",
"def dump\r\n super + to_s\r\n end",
... | [
"0.7951372",
"0.7645999",
"0.7579812",
"0.7579812",
"0.7440032",
"0.720861",
"0.720861",
"0.7207583",
"0.7016516",
"0.70007193",
"0.6992252",
"0.69838214",
"0.69723576",
"0.69666415",
"0.69666415",
"0.6942002",
"0.69417155",
"0.6933786",
"0.6913977",
"0.6891677",
"0.68810964"... | 0.0 | -1 |
Gets the state property value. Current state of the imported device. | def state
return @state
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state\n self['STATE'].to_i\n end",
"def state\n self['STATE'].to_i\n end",
"def state\n self['STATE'].to_i\n end",
"def state\n self['STATE'].to_i\n end",
"def state\n self['STATE'].to_i\n end",
"def state\n ... | [
"0.6833674",
"0.6833674",
"0.6833674",
"0.6833674",
"0.6833674",
"0.6833674",
"0.68093747",
"0.6781872",
"0.6772333",
"0.67084444",
"0.66962665",
"0.66710097",
"0.66710097",
"0.66296816",
"0.6628654",
"0.6552922",
"0.6546204",
"0.654489",
"0.6459909",
"0.64468914",
"0.6427221... | 0.67454654 | 16 |
Sets the state property value. Current state of the imported device. | def state=(value)
@state = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state=(value)\n @state = value\n end",
"def state=(s)\n @state = s\n end",
"def set_state(state)\n stop if state == :error and [:initializing, :ready, :running_sm].include? resource_status\n record.set_state(state)\n end",
"def set_door_state(state)\r\n\t\t@state = state\r\n\tend",... | [
"0.688214",
"0.67629594",
"0.6609025",
"0.6513474",
"0.64058995",
"0.64058995",
"0.64058995",
"0.64058995",
"0.64058995",
"0.64058995",
"0.64058995",
"0.6384067",
"0.6371707",
"0.6371707",
"0.6371707",
"0.6371707",
"0.6371707",
"0.6371707",
"0.6371707",
"0.636407",
"0.636407"... | 0.6939945 | 8 |
method count (see Bronze::Collections::Querycount) | def matching selector
super primary_key_transform.normalize(selector)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n query.count\n end",
"def count\n query.count\n end",
"def count\n @count ||= @query.count\n end",
"def count\n collection.count\n end",
"def count(query={})\n collection.count({ query: query })\n end",
"def count(query)\n raise \"The clas... | [
"0.8618216",
"0.8618216",
"0.84792435",
"0.80583966",
"0.8025757",
"0.7983656",
"0.79193735",
"0.79193735",
"0.79112333",
"0.79112333",
"0.79112333",
"0.7897073",
"0.7897073",
"0.7897073",
"0.7878206",
"0.7843871",
"0.7813839",
"0.78118575",
"0.78098595",
"0.778215",
"0.76844... | 0.0 | -1 |
method matching (see Bronze::Collections::Querylimit) | def limit count
count.zero? ? none : super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def limit; end",
"def limit; end",
"def limit; end",
"def limit(limit); end",
"def miter_limit(limit)\n end",
"def limit=(_arg0); end",
"def method_missing(method_name, *args)\n\n method = method_name.to_s\n\n if method.end_with? '!'\n method.chop!\n error_on_empty = ... | [
"0.6642183",
"0.6642183",
"0.6642183",
"0.64243877",
"0.6263535",
"0.6047948",
"0.5991067",
"0.59830064",
"0.59578",
"0.5910016",
"0.5904481",
"0.5904481",
"0.5882202",
"0.5873513",
"0.5852853",
"0.5787797",
"0.57709384",
"0.57548565",
"0.57392025",
"0.5726678",
"0.5709665",
... | 0.532505 | 55 |
GET /consignments GET /consignments.json | def index
@consignments = Consignment.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @consignees = Consignee.all\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def index\n @concerts = Concert.all\n end",
"def index\n @concerts = Concert.all\n end",
"def index\n @concerts = Concert.all\n end",
"def index\n @concerts = C... | [
"0.65958065",
"0.6586459",
"0.631165",
"0.631165",
"0.631165",
"0.631165",
"0.6124376",
"0.6124376",
"0.6117937",
"0.6021862",
"0.59828436",
"0.5871482",
"0.5787465",
"0.57773304",
"0.56654274",
"0.5660294",
"0.56458366",
"0.56456226",
"0.5644179",
"0.5611808",
"0.55818397",
... | 0.7629327 | 0 |
GET /consignments/1 GET /consignments/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @consignments = Consignment.all\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def show\n @concerts = Concert.find(params[:id])\n end",
"def index\n @concerts = Concert.all\n end",
"def index\n @concerts = Concert.all\n end",
"def index\... | [
"0.71892685",
"0.6745785",
"0.6633944",
"0.6533211",
"0.6533211",
"0.6533211",
"0.6533211",
"0.6381323",
"0.6374828",
"0.6325026",
"0.62945086",
"0.61480194",
"0.6128118",
"0.6108577",
"0.6108577",
"0.60102177",
"0.60039824",
"0.6000654",
"0.5941926",
"0.59278834",
"0.5916773... | 0.0 | -1 |
POST /consignments POST /consignments.json | def create
@consignment = Consignment.new(consignment_params)
respond_to do |format|
if @consignment.save
format.html { redirect_to @consignment, notice: 'Consignment was successfully created.' }
format.json { render action: 'show', status: :created, location: @consignment }
else
format.html { render action: 'new' }
format.json { render json: @consignment.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @consignment = Consignment.new(consignment_params)\n\n respond_to do |format|\n if @consignment.save\n format.html {redirect_to @consignment, notice: 'Consignment was successfully created.'}\n format.json {render :show, status: :created, location: @consignment}\n else\n ... | [
"0.6604186",
"0.6229841",
"0.58449376",
"0.58449376",
"0.58073545",
"0.5775212",
"0.57567745",
"0.571386",
"0.56987745",
"0.56949973",
"0.5642516",
"0.55265236",
"0.54432213",
"0.5442408",
"0.54422826",
"0.5436934",
"0.53627443",
"0.53457934",
"0.5338138",
"0.53258866",
"0.53... | 0.66653985 | 0 |
PATCH/PUT /consignments/1 PATCH/PUT /consignments/1.json | def update
respond_to do |format|
if @consignment.update(consignment_params)
format.html { redirect_to @consignment, notice: 'Consignment was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @consignment.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @consignment.update(consignment_params)\n format.html {redirect_to @consignment, notice: 'Consignment was successfully updated.'}\n format.json {render :show, status: :ok, location: @consignment}\n else\n format.html {render :edit}\n ... | [
"0.6403328",
"0.6294707",
"0.6294707",
"0.61792785",
"0.61617196",
"0.60776126",
"0.6048915",
"0.6040333",
"0.6033305",
"0.59755737",
"0.59654635",
"0.59556365",
"0.59541935",
"0.59223056",
"0.5919229",
"0.59164006",
"0.5899871",
"0.5894683",
"0.58939004",
"0.5884851",
"0.588... | 0.6564134 | 0 |
DELETE /consignments/1 DELETE /consignments/1.json | def destroy
@consignment.destroy
respond_to do |format|
format.html { redirect_to consignments_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @consignment.destroy\n respond_to do |format|\n format.html {redirect_to consignments_url, notice: 'Consignment was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @concert.destroy\n respond_to do |format|\n format.html { redire... | [
"0.7197135",
"0.7153355",
"0.7153355",
"0.7153355",
"0.7153081",
"0.7095347",
"0.70908487",
"0.6935456",
"0.69350666",
"0.69225204",
"0.6900589",
"0.6899424",
"0.688592",
"0.6876435",
"0.6813495",
"0.67988205",
"0.6797606",
"0.67936486",
"0.67827827",
"0.67798585",
"0.6765328... | 0.7501797 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_consignment
@consignment = Consignment.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.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def consignment_params
params.require(:consignment).permit(:owner_id, :good_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.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 |
Wait for CR reception | def wait_cr(tmo=nil)
t = Machine.millis + tmo if tmo
loop {
rsp = self.gets
return rsp.chomp if rsp.size > 0
raise "XBee response timeout" if t && t <= Machine.millis
Machine.delay(10)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_cr(tmo=nil)\n tmo += Machine.millis if tmo\n s = \"\"\n while true\n c = @wifi.getc\n return s if c == CR\n if c\n s << c\n else\n raise \"XBee-wifi response timeout #{s}\" if tmo && tmo <= Machine.millis\n Machine.delay(1)\n end... | [
"0.6965205",
"0.61147755",
"0.61147755",
"0.61147755",
"0.6060272",
"0.6046571",
"0.6046426",
"0.60385346",
"0.60335195",
"0.6018435",
"0.6004146",
"0.60003126",
"0.59788054",
"0.5954433",
"0.59417325",
"0.59417325",
"0.5935579",
"0.58947027",
"0.5872913",
"0.5872913",
"0.584... | 0.6982404 | 0 |
Send AT command and receive response | def at_cr(cmd, tmo=nil)
at(cmd)
wait_cr(tmo)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_command(command)\n SerialPort.open(self.device_path, 9600, 8, 1) do |port|\n # flush anything existing on the port\n port.flush\n flush_read_buffer(port)\n\n byte_string = command.to_bytes.pack('C*')\n\n begin\n while byte_string && byte_string.length != 0\... | [
"0.6945605",
"0.6807707",
"0.6179807",
"0.6119178",
"0.6114377",
"0.6010572",
"0.5985923",
"0.5899146",
"0.58875656",
"0.58634853",
"0.5855879",
"0.5824464",
"0.5822644",
"0.57935876",
"0.57743734",
"0.57546437",
"0.57540005",
"0.57392263",
"0.57342404",
"0.5728098",
"0.56782... | 0.0 | -1 |
Enter AT command mode | def enter_at_mode
while gets.size > 0; end # discard remain data
Machine.delay(1000) # wait 1 second
loop {
self.write '+'; Machine.delay(1)
self.write '+'; Machine.delay(1)
self.write '+'
Machine.delay(1000) # wait 1 second
rsp = self.gets
return rsp if rsp == "OK\r"
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_at_mode\n while gets.size > 0; end # discard remain data\n Machine.delay(1000) # wait 1 second\n 10.times do\n begin\n self.write '+++'\n Machine.delay(1000) # wait 1 second\n rsp = wait_cr(TMO_RESPONSE)\n return rsp\n rescue => e\n ... | [
"0.79628927",
"0.6037958",
"0.59522617",
"0.5886517",
"0.5865999",
"0.5796071",
"0.568493",
"0.5670516",
"0.56375766",
"0.5600464",
"0.5562368",
"0.5549148",
"0.5516799",
"0.54940027",
"0.54439783",
"0.54282176",
"0.54164267",
"0.54159",
"0.54127866",
"0.53951305",
"0.5360886... | 0.6227585 | 1 |
Leave AT command mode | def leave_at_mode
at_cr('atcn', 1000)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_at_mode\n while gets.size > 0; end # discard remain data\n Machine.delay(1000) # wait 1 second\n 10.times do\n begin\n self.write '+++'\n Machine.delay(1000) # wait 1 second\n rsp = wait_cr(TMO_RESPONSE)\n return rsp\n rescue => e\n ... | [
"0.65236264",
"0.5687906",
"0.5608127",
"0.5498567",
"0.5478476",
"0.54426515",
"0.5437525",
"0.54296577",
"0.5415443",
"0.5314649",
"0.52843994",
"0.52319396",
"0.5220315",
"0.5208994",
"0.51994467",
"0.5198483",
"0.51576954",
"0.5143111",
"0.51408416",
"0.51394117",
"0.5133... | 0.70869315 | 0 |
get connected target addresses | def connections
targets = []
enter_at_mode
at('atnd')
while true
a = wait_cr # XXXX
break if a == ''
adrh = wait_cr # Address (H)
adrl = wait_cr # Address (L)
targets << [adrh, adrl]
6.times {wait_cr} # ' ', XXXX, XX, XX, XX, XXXX, XXXX
end
leave_at_mode
targets
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_connections\n @connected_to.keys\n end",
"def to_addrs\n to ? [to].flatten : []\n end",
"def get_connected_uri\n @connections.map {|x| x.target_uri}\n end",
"def destinations\n [to_addrs, cc_addrs, bcc_addrs].compact.flatten\n end",
"def included_addresses\n @includ... | [
"0.6911912",
"0.6893253",
"0.6804572",
"0.6684628",
"0.6544341",
"0.6403011",
"0.64008063",
"0.6395323",
"0.63453466",
"0.63110065",
"0.6301832",
"0.6301832",
"0.6249866",
"0.62381333",
"0.61843276",
"0.6181073",
"0.61681527",
"0.6149654",
"0.614957",
"0.614452",
"0.6140883",... | 0.67922 | 3 |
run processes the issue and queues up an issue job. | def run
case issue.action
when "opened"
job = PuppetLabs::Trello::TrelloIssueJob.new
job.issue = issue
delayed_job = job.queue
logger.info "Successfully queued up opened issue #{issue.repo_name}/#{issue.number} as job #{delayed_job.id}"
body = {
'job_id' => delayed_job.id,
'queue' => delayed_job.queue,
'priority' => delayed_job.priority,
'created_at' => delayed_job.created_at,
}
return [ACCEPTED, {}, body]
else
logger.info "Ignoring issue #{issue.repo_name}/#{issue.number} because the action is #{issue.action}."
body = { 'message' => 'Action has been ignored.' }
return [OK, {}, body]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n process_queue\n RailsPipeline.logger.info \"Queue: '#{@queue}'. Processed: #{@processed}\"\n if Time.now - @failure_last_checked > @failure_check_interval\n @failure_last_checked = Time.now\n check_for_failures\n end\n end",
"def queue_job; end",
"def work\n ... | [
"0.65592515",
"0.64498305",
"0.6415142",
"0.62587124",
"0.61834025",
"0.61501986",
"0.61204076",
"0.61118776",
"0.60305685",
"0.59963465",
"0.59804034",
"0.59628177",
"0.5936655",
"0.5936655",
"0.59322083",
"0.5904609",
"0.5882505",
"0.5876635",
"0.5872128",
"0.58446383",
"0.... | 0.7201812 | 0 |
Preview this email at | def password_reset
MailerMailer.password_reset
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end",
"def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end",
"def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end",
"def preview_email\r... | [
"0.71475905",
"0.71186084",
"0.70552814",
"0.6985626",
"0.6848472",
"0.6848472",
"0.6832406",
"0.6663229",
"0.64324814",
"0.631654",
"0.6304366",
"0.6181875",
"0.6167911",
"0.61338973",
"0.61305445",
"0.6115152",
"0.61100966",
"0.61100966",
"0.60882556",
"0.60132533",
"0.5982... | 0.0 | -1 |
executing rspec test, with cutting stderr application output | def run
@rspec_test_name = PATH_TO_RSPEC_SPEC_FOLDER + @rspec_test_name
unless File.exists?("#{@rspec_test_name}")
@@failed_tests.push("Test not exists: #{@rspec_test_name}")
@@failed_tests_counter +=1
return 1
end
@cmd = `rspec #{@rspec_test_name}`
describe_test(@rspec_test_name, @cmd, $?.exitstatus)
generate_and_expand_output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exit_with_error\n rspec_output.rewind\n\n abort(\n Color.red(\n 'Running the specs failed. Either your tests do not pass ' \\\n 'normally or this is a bug in RSpectre.'\n ) + <<~TEXT\n\n\n RSpec Output:\n ---\n #{rspec_output.read}\n T... | [
"0.6668268",
"0.6649357",
"0.6516782",
"0.64855236",
"0.6444209",
"0.6427117",
"0.6417295",
"0.6408425",
"0.6328995",
"0.6289788",
"0.62869716",
"0.6270394",
"0.62491",
"0.6227465",
"0.6183989",
"0.6180618",
"0.61556476",
"0.6138326",
"0.6135281",
"0.6073361",
"0.60606194",
... | 0.0 | -1 |
Push new token to "stream". | def push(type, tag, nesting)
token = Token.new(type, tag, nesting)
token.block = true
@level -= 1 if nesting < 0 # closing tag
token.level = @level
@level += 1 if nesting > 0 # opening tag
@tokens.push(token)
return token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_token(token)\n @token_stream.push(token)\n end",
"def <<(new_token)\n @tokens << new_token\n end",
"def add_tokens(tokens)\n @token_stream.concat(tokens)\n end",
"def token_stream # :nodoc:\n end",
"def add_token(token)\n process_unknown\n @tokens << token\n @position +=... | [
"0.83365464",
"0.6870992",
"0.65271384",
"0.6424977",
"0.6422",
"0.63959616",
"0.6376929",
"0.62505186",
"0.6234036",
"0.6044927",
"0.6000518",
"0.59244925",
"0.59072137",
"0.5870412",
"0.585984",
"0.58377254",
"0.57386106",
"0.5728293",
"0.57255656",
"0.57255656",
"0.5680123... | 0.5327628 | 59 |
Skip spaces from given position. | def skipSpaces(pos)
max = @src.length
while pos < max
ch = charCodeAt(@src, pos)
break if !isSpace(ch)
pos += 1
end
return pos
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip_space(ix, direction)\n diff = { :left => -1, :right => 1 }[direction]\n ix += diff until ix < 1 || char_at(ix) =~ /[^ \\t]/ || char_at(ix).blank?\n ix\n end",
"def skip_whitespace\n self.advance while self.current == \" \"\n end",
"def skip_space; end",
"def skip_space=(_... | [
"0.785046",
"0.7280818",
"0.7052874",
"0.6980078",
"0.69480604",
"0.6884099",
"0.6850493",
"0.67137694",
"0.6597582",
"0.6578728",
"0.64784604",
"0.63058054",
"0.61339027",
"0.60148954",
"0.6012264",
"0.6006008",
"0.5991304",
"0.596291",
"0.5935698",
"0.5920882",
"0.5895509",... | 0.74079305 | 1 |
Skip spaces from given position in reverse. | def skipSpacesBack(pos, min)
return pos if pos <= min
while (pos > min)
return pos + 1 if !isSpace(charCodeAt(@src, pos -= 1))
end
return pos
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip_space(ix, direction)\n diff = { :left => -1, :right => 1 }[direction]\n ix += diff until ix < 1 || char_at(ix) =~ /[^ \\t]/ || char_at(ix).blank?\n ix\n end",
"def skip_whitespace\n self.advance while self.current == \" \"\n end",
"def skipSpaces(pos)\n max = @src.le... | [
"0.7369067",
"0.6451939",
"0.64301026",
"0.6069461",
"0.6020661",
"0.59331566",
"0.5921333",
"0.59127516",
"0.5790662",
"0.5773551",
"0.57260996",
"0.5724223",
"0.57127446",
"0.5690661",
"0.56866723",
"0.5681247",
"0.5628295",
"0.5617192",
"0.56161934",
"0.56072617",
"0.56052... | 0.67966926 | 1 |
Skip char codes from given position | def skipChars(pos, code)
max = @src.length
while pos < max
break if (charCodeAt(@src, pos) != code)
pos += 1
end
return pos
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skipCharsBack(pos, code, min)\n return pos if pos <= min\n\n while (pos > min)\n return (pos + 1) if code != charCodeAt(@src, pos -= 1)\n end\n return pos\n end",
"def skipSpaces(pos)\n max = @src.length\n while pos < max\n ch = charCodeAt(@src... | [
"0.7625582",
"0.7116165",
"0.66701615",
"0.6624932",
"0.6547856",
"0.6514175",
"0.6122884",
"0.6100048",
"0.60094655",
"0.59441096",
"0.59182614",
"0.5864476",
"0.579636",
"0.5763872",
"0.56008554",
"0.5596652",
"0.55702883",
"0.5556906",
"0.55505705",
"0.5533722",
"0.5500484... | 0.8502206 | 0 |
Skip char codes reverse from given position 1 | def skipCharsBack(pos, code, min)
return pos if pos <= min
while (pos > min)
return (pos + 1) if code != charCodeAt(@src, pos -= 1)
end
return pos
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skipChars(pos, code)\n max = @src.length\n while pos < max\n break if (charCodeAt(@src, pos) != code)\n pos += 1\n end\n return pos\n end",
"def backward characters\n if (@char - characters) >= 0\n @char -= characters\n char\n else\n fal... | [
"0.6886522",
"0.6289645",
"0.6183639",
"0.6162006",
"0.61287296",
"0.61197",
"0.6042372",
"0.5956071",
"0.5954503",
"0.59443563",
"0.5914544",
"0.5882674",
"0.58488417",
"0.5838668",
"0.5828542",
"0.5804168",
"0.5799085",
"0.5787559",
"0.5780467",
"0.57640636",
"0.575358",
... | 0.6812393 | 1 |
cut lines range from source. | def getLines(line_begin, line_end, indent, keepLastLF)
line = line_begin
return '' if line_begin >= line_end
queue = Array.new(line_end - line_begin)
i = 0
while line < line_end
lineIndent = 0
lineStart = first = @bMarks[line]
if line + 1 < line_end || keepLastLF
# No need for bounds check because we have fake entry on tail.
last = @eMarks[line] + 1
else
last = @eMarks[line]
end
while first < last && lineIndent < indent
ch = charCodeAt(@src, first)
if isSpace(ch)
if ch === 0x09
lineIndent += 4 - (lineIndent + @bsCount[line]) % 4
else
lineIndent += 1
end
elsif first - lineStart < @tShift[line]
# patched tShift masked characters to look like spaces (blockquotes, list markers)
lineIndent += 1
else
break
end
first += 1
end
if lineIndent > indent
# partially expanding tabs in code blocks, e.g '\t\tfoobar'
# with indent=2 becomes ' \tfoobar'
queue[i] = (' ' * (lineIndent - indent)) + @src.slice(first...last)
else
queue[i] = @src.slice(first...last)
end
line += 1
i += 1
end
return queue.join('')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range_by_lines(range); end",
"def cut\n return unless @lines_used > 0\n\n feed(@options[:lines_total] - @lines_used + 1)\n stamp\n print(0x0c.chr)\n @lines_used = 0\n end",
"def take_lines(start_line, num_lines)\n if start_line >= 0\n start_idx = @lines.index { |l| l... | [
"0.67903715",
"0.671364",
"0.6618312",
"0.64808804",
"0.64204776",
"0.6368974",
"0.6289797",
"0.62691736",
"0.6268904",
"0.61678517",
"0.6103724",
"0.6085568",
"0.6085568",
"0.6085568",
"0.60020685",
"0.5953825",
"0.5953571",
"0.58568007",
"0.5848789",
"0.5839401",
"0.5834466... | 0.0 | -1 |
Draws the kelvins screen on the Shoes app window. | def kelvins_screen
@heading = 'Kelvins = temperature + 273.15'
background('images/conversions_large.png')
# Kelvins screen header
ScreenHeader.new(self, '/title_screen/conversions_screen', @@font, @heading)
# Kelvins screen content
flow(:height => 640, :width => 1080, :scroll => true) do
# Left margin offset
stack(:height => 640, :width => 80) do
end
# Content column
stack(:height => 640, :width => 1000) do
ScreenLabel.new(self, @@font, @heading, 'Temperature')
flow do
@temperature = ScreenEditLine.new(self, @@font, @heading)
@temperature_unit = para(strong(' °C'))
@temperature_unit.style(@@screen_unit_text_styles)
end
@calculate = button('Calculate')
@result_display = flow
@error_display = flow
@calculate.click do
@result_display.clear do
@result = Joules.to_kelvins(@temperature.text.to_f)
@kelvins = para(@result.to_s)
@kelvins_unit = para(' K')
@kelvins.style(@@screen_result_text_styles)
@kelvins_unit.style(@@screen_result_text_styles)
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n call Screen.setColor(true)\n call draw\n end",
"def draw(window)\n window.draw_quad(top_left_x_view, top_left_y_view, 0x33ffffff,\n bottom_right_x_view, top_left_y_view, 0x33ffffff,\n bottom_right_x_view, bottom_right_y_view, 0x33ffffff,\n ... | [
"0.6606168",
"0.6362887",
"0.6183852",
"0.6148091",
"0.6133532",
"0.6118135",
"0.6115432",
"0.60270387",
"0.5982933",
"0.5910254",
"0.59055966",
"0.5904751",
"0.58965105",
"0.5881203",
"0.5866509",
"0.5801632",
"0.5777589",
"0.57502574",
"0.5747857",
"0.57348573",
"0.5722634"... | 0.65770435 | 1 |
caching related releases on release page. either updated in 1 hour or via an updated_at attribute change | def related_releases
Rails.cache.fetch("releases/release-#{id}", :expires_in => 1.hour) do
real_releases.all(:order => 'date DESC', :limit => 15)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_new_release_metadata\n return false if new_files.empty?\n msg \"Caching metadata for new releases\"\n new_files.each {|f| f.fetch}\n end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def get_cache_version\n data = get_from_cdn(... | [
"0.6106076",
"0.60914594",
"0.6018742",
"0.6010483",
"0.60036814",
"0.5987728",
"0.59363794",
"0.58373016",
"0.58260685",
"0.58200955",
"0.5788265",
"0.5787008",
"0.5759254",
"0.5759254",
"0.5727306",
"0.5688849",
"0.5688849",
"0.56579304",
"0.56527627",
"0.56527627",
"0.5642... | 0.77269983 | 0 |
Load artist releases upon tracking a new artist on the timeline, limiting to 5 most recent | def timeline_releases
real_releases.order('date DESC').limit(5)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform\n artists = Artist.where(\"past_event_freshness <= ?\", 5.days.ago)\n\n artists.each do |a|\n Saver::PastEvents.perform_async(a.lastfm_id)\n end\n end",
"def top_artists\n \n artists=[]\n spotify_artists = JSON.parse(api_call(\"https://api.spotify.com/\",\"v1/me/top/artists\")... | [
"0.6380666",
"0.6238475",
"0.61190766",
"0.6062939",
"0.59994924",
"0.5809105",
"0.57804525",
"0.57104266",
"0.5693334",
"0.5613974",
"0.55636334",
"0.5541392",
"0.5466652",
"0.54422843",
"0.54377097",
"0.54362065",
"0.54139894",
"0.5408272",
"0.5401707",
"0.5396842",
"0.5380... | 0.64480793 | 0 |
print song title, duration, genre in a single line | def display_song
return "Title: #{song_title}, Duration: #{duration}, Genre: #{genre}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_songs\n songs.each { |song| puts \"#{song.name}\" }\n end",
"def print_songs\n songs.each do |song|\n puts \"#{song.name}\"\n end\n end",
"def print_songs\n @songs.each {|x| puts \"#{x.name}\\n\"}\n end",
"def print_songs\n songs.each {|song| puts so... | [
"0.694044",
"0.693019",
"0.69180095",
"0.6859085",
"0.68539625",
"0.68472224",
"0.68147373",
"0.67926705",
"0.67706805",
"0.67706805",
"0.67474157",
"0.6737379",
"0.67038304",
"0.6696807",
"0.6696009",
"0.6690794",
"0.6690794",
"0.6674225",
"0.6664251",
"0.66498226",
"0.66440... | 0.79902846 | 1 |
add song to album > first check to see if song is in album | def add_song(new_song)
@songs.include?(new_song) ? (puts "The song has already been added") : @songs.push(new_song)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song(song)\n if(!songs.include?song)\n songs.add(song)\n end\n end",
"def add_album(new_album)\n if @albums.include?(new_album)\n puts \"The album has already been added\"\n else\n @albums.push(new_album)\n end\n end",
"def add_song(song)\n i... | [
"0.77261865",
"0.770823",
"0.7705689",
"0.7628999",
"0.761904",
"0.745631",
"0.73995936",
"0.73897594",
"0.73682886",
"0.7314805",
"0.723767",
"0.72290003",
"0.71974516",
"0.719194",
"0.71371305",
"0.70011723",
"0.6996167",
"0.6961045",
"0.6906791",
"0.6903963",
"0.69006854",... | 0.72177005 | 13 |
return number of songs | def number_of_songs()
return songs.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_songs\n @songs.size\n end",
"def song_count\n return @songs.count\n end",
"def song_count\n self.lib.songs.count\n end",
"def songs_count\n \t@songs.count\n end",
"def song_count\n @song_count = 0 if @song_count.nil?\n @song_count\n end",
"def songs_count\n ... | [
"0.9100902",
"0.8900763",
"0.8839719",
"0.8760509",
"0.864129",
"0.8622001",
"0.8511633",
"0.8326866",
"0.8177174",
"0.7893799",
"0.78913605",
"0.7885858",
"0.78348935",
"0.7746643",
"0.7649355",
"0.7643667",
"0.7553485",
"0.7417125",
"0.7372233",
"0.73632646",
"0.73380184",
... | 0.90332747 | 2 |
add album first check if album exists | def add_album(new_album)
if @albums.include?(new_album)
puts "The album has already been added"
else
@albums.push(new_album)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_album(new_album)\n @albums.include?(new_album) ? (puts \"The album has already been added\") : @albums.push(new_album)\n end",
"def album\r\n #prepare_new_album extracted for reuse from spec\r\n prepare_new_album unless @content\r\n end",
"def get_or_create_album(path, album_url: nil)\... | [
"0.76650983",
"0.7251075",
"0.6756253",
"0.6748371",
"0.66566396",
"0.66259724",
"0.65905446",
"0.65157336",
"0.6461365",
"0.6450731",
"0.6413395",
"0.64083856",
"0.63962734",
"0.6385524",
"0.6371382",
"0.637038",
"0.63059765",
"0.6291961",
"0.6274533",
"0.62670827",
"0.62518... | 0.77341413 | 0 |
return number of albums for each artist | def number_of_albums()
return albums.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_artists\n if ! @n_artists_found\n @n_artists_found = songs_found\n .group_by{ |s| s[IDX_ARTIST_ID] }\n .length\n end\n return @n_artists_found\n end",
"def album_count\n return @albums.length\n end",
"def artist_count\n return @artists.length\n end",
"def number_of_... | [
"0.8056814",
"0.79768664",
"0.7956528",
"0.7723143",
"0.7723143",
"0.7710555",
"0.74543566",
"0.7441568",
"0.7290731",
"0.7267044",
"0.72110516",
"0.7124177",
"0.7040718",
"0.6973167",
"0.6858657",
"0.68029535",
"0.68029535",
"0.6735112",
"0.6706813",
"0.6559741",
"0.65597236... | 0.8032594 | 2 |
add artist to Top 10 and check if number of artist is not more than 10 | def add_artist(new_artist)
if @artists.length > 10
@artists.shift
else
@artists.push(new_artist)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_artist(new_artist)\n @artists.length > 10 ? @artists.shift : @artists.push(new_artist)\n end",
"def top_tracks_for_random_artist\n unless @artist\n @artist = Lineup.select_random_artist\n end\n\n options = { :query => { :api_key => LASTFM_API_KEY, :limit => \"10\", :format => \"jso... | [
"0.691101",
"0.64831734",
"0.6441237",
"0.63333327",
"0.6108964",
"0.587203",
"0.5822928",
"0.5773656",
"0.57640713",
"0.57528085",
"0.5726043",
"0.57206106",
"0.57145727",
"0.56875575",
"0.5681751",
"0.56659925",
"0.56645536",
"0.5651497",
"0.5651497",
"0.5636721",
"0.561052... | 0.68331295 | 1 |
return number of artists in Top 10 | def number_of_artists
return @artists.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_five_artists(db, genre_name)\n db.execute \"SELECT artists.name, COUNT(*) as c\n FROM tracks\n JOIN albums ON albums.id = tracks.album_id\n JOIN artists ON artists.id = albums.artist_id\n JOIN genres ON tracks.genre.id = genres.id\n WHERE genres.name = '#{genre_name}'\n GROUP BY artists.name\n ORDER BY c D... | [
"0.71163213",
"0.70047945",
"0.6948485",
"0.6802255",
"0.6777963",
"0.6730009",
"0.66631466",
"0.66213226",
"0.6598062",
"0.6580568",
"0.65585303",
"0.6505059",
"0.64956087",
"0.6447618",
"0.6433366",
"0.6423312",
"0.6423301",
"0.63539773",
"0.6291959",
"0.62371445",
"0.62269... | 0.68491316 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_document
if Document.exists?(params[:id])
@document = Document.find(params[:id])
unless current_user.id == @document.created_by_id
error_renderer({code: 401, message: 'Unauthorized'})
end
else
render partial: 'api/v1/error', locals: {:@error => {code: 404, message: 'Document Not Found'}}, status: 404
end
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 document_params
temp = params.permit(:name, :id_parent_folder,:limit,:offset,:format).to_hash.symbolize_keys
if temp.has_key? :id_parent_folder
temp[:parent_folder_id] = temp[:id_parent_folder]
temp.delete(:id_parent_folder)
end
temp
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 /accounts/1 GET /accounts/1.json | def show
@account = Account.find(params[:id])
@templates = @account.templates
@defaults = Template.where(is_default: true).order(:id)
@differences = Template.differences(@templates, @defaults)
respond_to do |format|
format.html # show.html.erb
format.json { render json: @account }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accounts\n get('/accounts')['accounts']\n end",
"def get_accounts()\n http_get(accounts_url)\n end",
"def get_account\n as_json(get_results('/account'))\n end",
"def account(id)\n make_json_api_request :get, \"v2/accounts/#{id}\"\n end",
"def show\n authorize @account... | [
"0.7682702",
"0.7637437",
"0.7635884",
"0.75418967",
"0.74294233",
"0.72768146",
"0.726333",
"0.7219269",
"0.7219269",
"0.7219269",
"0.7219269",
"0.7219269",
"0.7208149",
"0.7188745",
"0.71877134",
"0.7187525",
"0.7178146",
"0.7173732",
"0.71676797",
"0.7163912",
"0.7141296",... | 0.0 | -1 |
GET /accounts/new GET /accounts/new.json | def new
@account = Account.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @account }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\r\n @account = Account.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @account }\r\n end\r\n end",
"def new\n @account = Account.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json:... | [
"0.7805713",
"0.7772019",
"0.7759942",
"0.7640924",
"0.75624293",
"0.7445206",
"0.7444286",
"0.74279237",
"0.72765946",
"0.7218242",
"0.7200301",
"0.71950555",
"0.7145004",
"0.7127732",
"0.71264184",
"0.7123972",
"0.7076515",
"0.70665985",
"0.7062986",
"0.70611167",
"0.702991... | 0.7867003 | 4 |
POST /accounts POST /accounts.json | def create
@account = Account.new(account_params)
respond_to do |format|
if @account.save
Account.copy_templates(1, @account.id)
format.html { redirect_to new_account_template_path(@account), notice: 'Account was successfully created.' }
format.json { render json: @account, status: :created, location: @account }
else
flash[:error] = @account.errors.empty? ? "Error" : @account.errors.full_messages.to_sentence
format.html { render action: "new" }
format.json { render json: @account.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n megam_rest.post_accounts(to_hash)\n end",
"def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n ... | [
"0.77059096",
"0.74428105",
"0.6998076",
"0.68458116",
"0.684345",
"0.68387824",
"0.6831728",
"0.680515",
"0.67691255",
"0.67659897",
"0.67633784",
"0.6748523",
"0.67459255",
"0.67459255",
"0.67459255",
"0.67459255",
"0.67459255",
"0.67459255",
"0.67459255",
"0.67459255",
"0.... | 0.0 | -1 |
PUT /accounts/1 PUT /accounts/1.json | def update
@account = Account.find(params[:id])
respond_to do |format|
if @account.update_attributes(account_params)
format.html { redirect_to @account, notice: 'Account was successfully updated.' }
format.json { head :no_content }
else
flash[:error] = @account.errors.empty? ? "Error" : @account.errors.full_messages.to_sentence
format.html { render action: "edit" }
format.json { render json: @account.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update \n begin\n @resource = Account.find(params[:id])\n @resource.update_attributes!(params[:account])\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def update\n authorize @account\n ... | [
"0.7171354",
"0.68998396",
"0.6831369",
"0.6614414",
"0.6534509",
"0.65298426",
"0.650217",
"0.650217",
"0.6489508",
"0.64866304",
"0.648625",
"0.6464929",
"0.646357",
"0.6462444",
"0.64484173",
"0.64045215",
"0.64007765",
"0.6391459",
"0.6370063",
"0.636715",
"0.6366587",
... | 0.6170656 | 58 |
DELETE /accounts/1 DELETE /accounts/1.json | def destroy
@account = Account.find(params[:id])
@account.destroy
respond_to do |format|
format.html { redirect_to accounts_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_account\n @connection.request({\n :method => 'DELETE'\n }) \n end",
"def destroy\n @api_v1_account.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_accounts_url, notice: 'Account was successfully destroyed.' }\n format.jso... | [
"0.76637536",
"0.7554775",
"0.7551643",
"0.73527706",
"0.73527706",
"0.7347585",
"0.7347585",
"0.7347585",
"0.72816485",
"0.72816485",
"0.72570074",
"0.71952045",
"0.7174108",
"0.71412545",
"0.71045244",
"0.709996",
"0.7099952",
"0.7061333",
"0.7061333",
"0.7061333",
"0.70613... | 0.73283815 | 13 |
Calculating all primes below 2,000,000 requires a better algorithm. We will use an array with all 1,000,000 natural, odd numbers. Each time a prime is found, the array will remove all numbers along those steps. | def is_prime?(n)
(2..(n-2)).detect{ |i| n % i == 0 }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primes\n arr=Array.new\n arr[1]=false\n (2..1000).each {|i| arr[i]=true}\n (2..1000).each {|i| (i/2).floor\n (2..1000).each {|j| (j/i).floor\n arr[i*j] = false\n }}\n for i in 1..1000\n if arr[i] == true\n puts i\n end\n end\nend",
"def primes()\n return [] if @number < 2\n # ... | [
"0.77094036",
"0.7673483",
"0.76353824",
"0.7631506",
"0.75866485",
"0.757533",
"0.74879664",
"0.74868196",
"0.7481989",
"0.74782383",
"0.7461059",
"0.7446706",
"0.7420182",
"0.74109215",
"0.7408349",
"0.73917246",
"0.73878056",
"0.7342164",
"0.73348445",
"0.7331727",
"0.7314... | 0.0 | -1 |
~ Toggle with Thumbnail view. | def switchto_listview()
@browser.button(:class, "btn icon-list-view").click
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_item_thumb(document)\n if document.do_url\n link_to(\n thumbnail_image_tag(document, css: ''),\n document.do_url\n )\n else\n thumbnail_image_tag(document, css: '') + visit_partner_button(document)\n end\n end",
"def thumbnail(image_options = {})\n return supe... | [
"0.63446397",
"0.63217145",
"0.62643224",
"0.59880596",
"0.59397095",
"0.5828459",
"0.5825824",
"0.576284",
"0.57494825",
"0.5693818",
"0.56882113",
"0.5678401",
"0.56544733",
"0.5653719",
"0.5636917",
"0.5549883",
"0.55370533",
"0.5492245",
"0.546702",
"0.5409986",
"0.539922... | 0.0 | -1 |
Build a new stanza type:: [Symbol] or nil, see Iqtype to:: [JID] Recipient | def initialize(type = nil, to = nil)
super("iq")
if not to.nil?
set_to(to)
end
if not type.nil?
set_type(type)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('create',:node => node_id)\n )\n )\n\n send_iq_stanza_fibered iq\n end",
"def as_xmpp_message(to, persp=:default, body=nil, type... | [
"0.53103083",
"0.52353144",
"0.51437414",
"0.51390505",
"0.5002836",
"0.49288005",
"0.49260974",
"0.489273",
"0.48723128",
"0.48156852",
"0.4814744",
"0.48142424",
"0.47736892",
"0.47358915",
"0.47107753",
"0.47054",
"0.46958858",
"0.46947265",
"0.46892735",
"0.4682797",
"0.4... | 0.62846315 | 0 |
Get the type of the Iq stanza The following values are allowed: :get :set :result :error result:: [Symbol] or nil | def type
case super
when 'get' then :get
when 'set' then :set
when 'result' then :result
when 'error' then :error
else nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type\n result_hash['typ']\n end",
"def type\n return @type if @type != \"unknown\"\n info\n @type\n end",
"def type\n return :unknown unless properties['result_type']\n\n properties['result_type'].to_sym\n end",
"def type\r\n\t\t\t`#{BITS::BITSADMIN} /gettype ... | [
"0.66498125",
"0.65237457",
"0.64089954",
"0.6404076",
"0.6266697",
"0.626455",
"0.622348",
"0.62213725",
"0.6218859",
"0.62078166",
"0.62077034",
"0.62077034",
"0.62077034",
"0.6187456",
"0.616204",
"0.61487144",
"0.61487144",
"0.6139651",
"0.6113391",
"0.6094898",
"0.608166... | 0.66038674 | 1 |
Set the type of the Iq stanza (see Iqtype) v:: [Symbol] or nil | def type=(v)
case v
when :get then super('get')
when :set then super('set')
when :result then super('result')
when :error then super('error')
else super(nil)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_type(v)\n self.type = v\n self\n end",
"def set_q_type\n @q_type = QType.find(params[:id])\n end",
"def type(val); @type = val; self; end",
"def type=(type); end",
"def type=(type)\n @type = type\n\n setOption('type', @type)\n end",
"def set_type\n end",... | [
"0.65418696",
"0.6324375",
"0.5886321",
"0.5807674",
"0.5782197",
"0.5778622",
"0.57703036",
"0.57380307",
"0.569988",
"0.5688429",
"0.56744564",
"0.5665309",
"0.56647444",
"0.56647444",
"0.56647444",
"0.5660968",
"0.56393033",
"0.56327486",
"0.56327486",
"0.56327486",
"0.563... | 0.5599115 | 24 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.