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 |
|---|---|---|---|---|---|---|
DELETE /venues/1 DELETE /venues/1.json | def destroy
@venue = Venue.find(params[:id])
@venue.destroy
respond_to do |format|
format.html { redirect_to venues_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.ht... | [
"0.7553671",
"0.7531355",
"0.74199617",
"0.73949975",
"0.7332596",
"0.72691673",
"0.7267232",
"0.7267232",
"0.7267232",
"0.7267232",
"0.7213395",
"0.7181069",
"0.7181069",
"0.7181069",
"0.7181069",
"0.7181069",
"0.7181069",
"0.7181069",
"0.71450377",
"0.7079433",
"0.69543564"... | 0.7507718 | 5 |
def abc_two a = m2 n2 b = 2mn c = m2 + n2 min = Math.sqrt(1000).floor max = 1000/2 (min..max).each do |x| (min..max).each do |y| if (a2 + b2 == c2) && (a+b+c==1000) p a, b, c, abc end end end end def is_thousand?(a,b,c) return true if num == 1000 end | def abc_three
2.upto(1000) do |a|
(a+1).upto(1000) do |b|
c = Math.sqrt(a**2 + b**2)
if (a+b+c==1000)
return a*b*c
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divisible_by_thousand?(number)\n (number % 1000).zero?\n end",
"def one_to_one_thousand()\n\n\tmega_string = \"\"\n\n\tone_to_nine = {1 => \"one\", 2 => \"two\",\n\t\t\t\t3 => \"three\", 4 => \"four\",\n\t\t\t\t5 => \"five\", 6 => \"six\",\n\t\t\t\t7 => \"seven\", 8 => \"eight\",\n\t\t\t\t9 => \"nine... | [
"0.7437179",
"0.68677",
"0.6422802",
"0.6387155",
"0.6359352",
"0.6317125",
"0.63094485",
"0.63008124",
"0.62440723",
"0.62364566",
"0.62066823",
"0.6204026",
"0.620317",
"0.6188308",
"0.6130871",
"0.61027163",
"0.6091141",
"0.60055715",
"0.60055715",
"0.5955523",
"0.59463245... | 0.6606114 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_location
@location = Location.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def location_params
params.require(:location).permit(:name)
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.7120904",
"0.70538116",
"0.69469863",
"0.6901261",
"0.67348766",
"0.6717708",
"0.66874576",
"0.6676195",
"0.66601187",
"0.65563625",
"0.6525127",
"0.64565873",
"0.64494514",
"0.644928",
"0.64452374",
"0.6433947",
"0.6412815",
"0.6412815",
"0.6391939",
"0.63792473",
"0.6379... | 0.0 | -1 |
Quick assessor to the book's template, if it exists | def template
sheet.book.template
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template() false end",
"def get_template(template); end",
"def template_guide\n @title = \"Template Guide\"\n end",
"def has_template?(tmpl, cookbook=nil)\n has_source?(tmpl, :templates, cookbook)\n end",
"def template\n raise \"Template was not loaded: #{@template}\" if !@loadOK\n ... | [
"0.6289395",
"0.62296546",
"0.6190897",
"0.613874",
"0.61187226",
"0.6087844",
"0.60222125",
"0.60222125",
"0.60222125",
"0.60222125",
"0.60222125",
"0.60222125",
"0.60222125",
"0.5905035",
"0.58998805",
"0.5897826",
"0.58887726",
"0.5846172",
"0.581595",
"0.58008295",
"0.580... | 0.59944654 | 13 |
Returns the header of this table (typically the first row, but can be a different row). The header row is also used for finding values in a aribrary row. | def header
if defined?(@header) && (@header == false)
false
elsif defined?(@header) && @header
@header
else
first
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header\n self.mult_table.header_line.to_s + \"\\n\"\n end",
"def headers\n rows.first\n end",
"def header\n @header ||= csv_rows.first\n end",
"def header\n @header ||= csv_rows.first\n end",
"def headers\n @headers ||= next_row\n end",
"def header\n ... | [
"0.838396",
"0.82827437",
"0.78242344",
"0.78242344",
"0.72135174",
"0.71913993",
"0.71412426",
"0.71115595",
"0.71086997",
"0.70380956",
"0.70294106",
"0.7023688",
"0.699342",
"0.69593656",
"0.6957059",
"0.69055456",
"0.6885586",
"0.6883383",
"0.687614",
"0.68557835",
"0.679... | 0.6322588 | 50 |
Set the header of this table (typically the first row, but can be a different row). The header row is also used for finding values in a aribrary row. | def header= h
@header = if h.is_a? Numeric
self[h]
else
h
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header\n self.mult_table.header_line.to_s + \"\\n\"\n end",
"def create_header\n @sheet.row(0).concat @header_row\n end",
"def header(value = nil)\n value ? self.header = value : @header\n end",
"def header=(header)\n @header = header\n end",
"def Header(*arg... | [
"0.7390407",
"0.71262795",
"0.7074884",
"0.7011479",
"0.699448",
"0.6967637",
"0.68315315",
"0.68315315",
"0.6818663",
"0.6796648",
"0.6790612",
"0.6779485",
"0.6729811",
"0.6710698",
"0.66400176",
"0.66347694",
"0.6615254",
"0.661425",
"0.65519613",
"0.65097535",
"0.64889485... | 0.6875173 | 6 |
Returns the index of the header row | def header_row_index
index(header)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header_index_of(value)\n header_cell_values.index(value)\n end",
"def index_by_header( header )\n sheet.header_rows > 0 or fail NoMethodError, 'No header rows present'\n col_index( colref_by_header( header ) )\n end",
"def index(heading)\n col = header.index(heading)\n r... | [
"0.79737324",
"0.78903276",
"0.7370094",
"0.70228994",
"0.70156693",
"0.7015623",
"0.7015623",
"0.6998545",
"0.6995231",
"0.69654375",
"0.68993574",
"0.6776076",
"0.67462033",
"0.66803354",
"0.66567814",
"0.6637578",
"0.6629631",
"0.6537697",
"0.6492499",
"0.6409036",
"0.6391... | 0.93337303 | 0 |
Generates a new row, with optionally predefined cellvalues, that is already connected to this table. | def new_row cell_values = []
r = Workbook::Row.new(cell_values, self)
r
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row\n new_row = RowBuilder.new\n\n yield new_row\n\n @rows << new_row\n end",
"def cell_for_row(id)\n cells.find_or_create_by(row_id: id)\n end",
"def new_row(data=[], options ={})\n @rows << self.class::ROW_CLASS.new(self, data, options)\n @rows.last\n end",
"def add_cel... | [
"0.6702393",
"0.64103514",
"0.63992363",
"0.6351645",
"0.6301215",
"0.6279697",
"0.6255884",
"0.6242553",
"0.61831987",
"0.6176256",
"0.615137",
"0.6112382",
"0.6089449",
"0.60750556",
"0.6052122",
"0.6001058",
"0.5994964",
"0.59669113",
"0.59470564",
"0.59440315",
"0.5932506... | 0.73587626 | 0 |
Removes all empty lines. This function is particularly useful if you typically add lines to the end of a templatetable, which sometimes has unremovable empty lines. | def remove_empty_lines!
delete_if { |r| r.nil? || r.compact.empty? }
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_empty_lines(source)\n for_outstrings_of(source) do |str|\n str.gsub /\\n\\s*\\n/m, \"\\n\"\n end\n end",
"def remove_blank_rows\n end",
"def remove_blank_lines!(file_lines)\n raise ArgumentError.new(\"Input must not be nil\") if file_lines.nil?\n\n # delete_if method modifie... | [
"0.7532963",
"0.72176784",
"0.72118694",
"0.72021854",
"0.7155428",
"0.71300924",
"0.7019915",
"0.7004604",
"0.6964927",
"0.6865582",
"0.6702689",
"0.6678458",
"0.6661517",
"0.65794533",
"0.6503742",
"0.6476132",
"0.6468246",
"0.64170927",
"0.64070094",
"0.63877386",
"0.63088... | 0.8249443 | 0 |
Returns true if the row exists in this table | def contains_row? row
raise ArgumentError, "table should be a Workbook::Row (you passed a #{t.class})" unless row.is_a?(Workbook::Row)
collect { |r| r.object_id }.include? row.object_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists?\n rec = run_sql(\"SELECT * FROM #{table} WHERE id = #{@id};\")\n if rec.empty?\n @errors << \"That id does not exist in the table.\"\n false\n else\n true\n end\n end",
"def row_exists?(unique_identifier)\n wait_for_results\n exists? result_row(unique_identifier)\n ... | [
"0.7966932",
"0.7775523",
"0.7775523",
"0.7475441",
"0.72892195",
"0.72533154",
"0.71845245",
"0.71183056",
"0.70793843",
"0.70793843",
"0.70793843",
"0.70739967",
"0.7066404",
"0.7066404",
"0.70525473",
"0.70328754",
"0.70135593",
"0.6997986",
"0.6979936",
"0.6958681",
"0.69... | 0.6981302 | 18 |
Returns the sheet this table belongs to, creates a new sheet if none exists | def sheet
return @sheet if defined?(@sheet) && !@sheet.nil?
self.sheet = Workbook::Sheet.new(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSheet\n case ftype\n when FTYPE_SHEET\n return Sheet.find_by_id(type_index)\n else # \n return nil\n end\n end",
"def create_new_sheet(date, new_spreadsheet_id)\n #make copy of template sheet to new spreadsheet\n new_sheet_id = copy_sheet(new_spreadsheet_id)\n \n #set t... | [
"0.7222633",
"0.67463064",
"0.65346515",
"0.65218556",
"0.65150934",
"0.64788175",
"0.64746517",
"0.64746517",
"0.64746517",
"0.64613867",
"0.64501977",
"0.6380132",
"0.6380132",
"0.6380132",
"0.6380132",
"0.63659984",
"0.6323067",
"0.6293076",
"0.6158235",
"0.6157584",
"0.61... | 0.72331095 | 0 |
Removes all lines from this table | def delete_all
delete_if { |b| true }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_all_lines\n @deleted_lines.concat @lines\n @lines.clear\n end",
"def clear\n @lines.clear\n end",
"def clear\n self.rows = nil\n end",
"def clear_lines lines\n lines = lines.map do |line|\n line = line.gsub(/(\\n)$/, \"\")\n line = line.gsub(/(\\t)/,\"\")\n next if... | [
"0.76472265",
"0.7276229",
"0.7081545",
"0.66424364",
"0.6627011",
"0.65356016",
"0.6528286",
"0.64912915",
"0.6353903",
"0.632912",
"0.63275975",
"0.6271435",
"0.6249183",
"0.61956936",
"0.6184965",
"0.6172013",
"0.6153487",
"0.6153487",
"0.61475396",
"0.61454946",
"0.613475... | 0.0 | -1 |
clones itself and the rows it contains | def clone
t = self
c = super
c.delete_all
t.each { |r| c << r.clone }
c.header = c[header_row_index] if header_row_index
c
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone\n Matrix.rows(@rows)\n end",
"def de_populate_rows\n @rows.each_with_index do |row, y|\n row.each_index do |x|\n @rows[y][x] = nil\n end\n end\n end",
"def reset_to_new_row\n self.row = Row.new\n self.state = NEW_ROW\n self.cur_family = nil\n ... | [
"0.7583218",
"0.698998",
"0.6890056",
"0.67771816",
"0.6666614",
"0.6660116",
"0.6562475",
"0.64939225",
"0.6457434",
"0.64544576",
"0.64211106",
"0.64000887",
"0.6397501",
"0.6376579",
"0.6355298",
"0.6341398",
"0.6317754",
"0.6290176",
"0.6280988",
"0.6249328",
"0.6248706",... | 0.6950751 | 2 |
Overrides normal Array's []function with support for symbols that identify a column based on the headervalues | def [] index_or_string
if index_or_string.is_a? String
match = index_or_string.match(/([A-Z]+)([0-9]*)/i)
col_index = Workbook::Column.alpha_index_to_number_index(match[1])
row_index = match[2].to_i - 1
self[row_index][col_index]
elsif index_or_string.is_a? Range
coll... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header_array\n @columns.collect {|c|\n if @table[c]\n @table[c][:name].to_s\n else\n \"\"\n end\n }.compact\n end",
"def data_with_head(columnheader)\r\n Array(raw_data_sheet.column(columnheaders_raw.index(columnheader)))\r\n ... | [
"0.66174453",
"0.6427469",
"0.62880933",
"0.6164664",
"0.6119292",
"0.6113802",
"0.609453",
"0.602517",
"0.60188985",
"0.59662735",
"0.5951456",
"0.59449196",
"0.5913096",
"0.5893474",
"0.58827674",
"0.5877183",
"0.58640236",
"0.5808103",
"0.5794432",
"0.57872975",
"0.5782063... | 0.5485721 | 59 |
Overrides normal Row's []=function; automatically converting to row and setting with the label correctly | def []= index_or_string, new_value
if index_or_string.is_a? String
match = index_or_string.upcase.match(/([A-Z]*)([0-9]*)/)
cell_index = Workbook::Column.alpha_index_to_number_index(match[1])
row_index = match[2].to_i - 1
self[row_index][cell_index].value = new_value
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row; end",
"def row(row)\n Row.new(@data, row)\n end",
"def row(index)\n end",
"def mylabel args, x, row, message\r\n [x, row_to_px(args, row), message, font]\r\nend",
"def transform_row(row)\n row\n end",
"def handle_row(business, row)\n\n end",
"def format_rows\n [trait.... | [
"0.675862",
"0.6523564",
"0.6395776",
"0.62996274",
"0.62312686",
"0.6119553",
"0.60891294",
"0.6075753",
"0.6027534",
"0.60259145",
"0.59811735",
"0.58975244",
"0.58903533",
"0.5867933",
"0.58478725",
"0.58459187",
"0.58319324",
"0.5777857",
"0.5749658",
"0.57416266",
"0.573... | 0.53943694 | 65 |
remove all the trailing emptyrows (returning a trimmed clone) | def trim desired_row_length = nil
clone.trim!(desired_row_length)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_blank_rows\n end",
"def strip_blank_lines\n\t\t# algorithm: keep only the non-blank lines\n\t\t\n\t\t\n\t\t# work inwards from the outside until you fine lines that are not empty\n\t\tmin_i = self.index{ |line| line != \"\" }\n\t\tmax_i = self.rindex{ |line| line != \"\" }\n\t\t\n\t\t\n\t\t# keep o... | [
"0.8036338",
"0.7597153",
"0.75787437",
"0.74748623",
"0.6991855",
"0.688752",
"0.67900366",
"0.67418915",
"0.67260706",
"0.6717761",
"0.6636148",
"0.6600066",
"0.6554529",
"0.65467936",
"0.65456855",
"0.6519629",
"0.6468853",
"0.6460453",
"0.6440026",
"0.63978285",
"0.636989... | 0.7437945 | 4 |
remove all the trailing emptyrows (returning a trimmed self) | def trim! desired_row_length = nil
max_length = collect { |a| a.trim.length }.max
self_count = count - 1
count.times do |index|
index = self_count - index
if self[index].trim.empty?
delete_at(index)
else
break
end
end
each { |a| a.trim!(m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_blank_rows\n end",
"def remove_empty_lines!\n delete_if { |r| r.nil? || r.compact.empty? }\n self\n end",
"def strip_blank_lines\n\t\t# algorithm: keep only the non-blank lines\n\t\t\n\t\t\n\t\t# work inwards from the outside until you fine lines that are not empty\n\t\tmin_i = self.... | [
"0.79536957",
"0.76602286",
"0.7455536",
"0.73241806",
"0.71779233",
"0.68114793",
"0.6803917",
"0.6798734",
"0.6716559",
"0.6673077",
"0.66521734",
"0.6583476",
"0.65700424",
"0.65473783",
"0.6542703",
"0.6529204",
"0.6491683",
"0.6459884",
"0.6452196",
"0.63462645",
"0.6339... | 0.797678 | 0 |
Returns The dimensions of this sheet based on longest row | def dimensions
height = count
width = collect { |a| a.length }.max
[width, height]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def longest_sheet\n sheet(worksheets.inject {|m, o|\n o.row_count > m.row_count ? o : m\n }.name)\n end",
"def width\n @width ||= (cells.map(&:to_s) << to_s).map(&:size).max\n end",
"def height\n rows\n end",
"def width\n ensure_complete!\n sum_width = cell_widths.reduce... | [
"0.7161097",
"0.6971016",
"0.66748184",
"0.65676975",
"0.6552076",
"0.6497476",
"0.64519495",
"0.64186376",
"0.6411895",
"0.639921",
"0.6383481",
"0.6381545",
"0.6351201",
"0.6343277",
"0.6319459",
"0.63169295",
"0.6305253",
"0.6291993",
"0.6291431",
"0.6277166",
"0.6263154",... | 0.66676223 | 3 |
Returns an array of Columnclasses describing the columns of this table | def columns
@columns ||= header.collect { |header_cell|
Column.new(self)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def columns\n @columns = @clazz.columns_hash.map do |name, column|\n [name, @columns[name] || Column.new(column, @dump)]\n end.to_h.with_indifferent_access\n end",
"def columns\n self.class.const_get(:COLUMNS) rescue []\n end",
"def table_columns\n klass.column_names\n e... | [
"0.7862211",
"0.78487915",
"0.77550834",
"0.76308656",
"0.75855166",
"0.7557814",
"0.7490357",
"0.74653584",
"0.74653584",
"0.74529976",
"0.74305147",
"0.74024594",
"0.73889303",
"0.7370637",
"0.73614407",
"0.7317371",
"0.7317371",
"0.7289822",
"0.7285033",
"0.72827786",
"0.7... | 0.7314427 | 17 |
Returns an array of Columnclasses describing the columns of this table | def columns= columns
columns.each { |c| c.table = self }
@columns = columns
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def columns\n @columns = @clazz.columns_hash.map do |name, column|\n [name, @columns[name] || Column.new(column, @dump)]\n end.to_h.with_indifferent_access\n end",
"def columns\n self.class.const_get(:COLUMNS) rescue []\n end",
"def table_columns\n klass.column_names\n e... | [
"0.78607666",
"0.7847507",
"0.77561134",
"0.7629256",
"0.7583749",
"0.75562185",
"0.74895275",
"0.74642897",
"0.74642897",
"0.7452229",
"0.742845",
"0.74009067",
"0.7389353",
"0.73708385",
"0.73604834",
"0.73162335",
"0.73162335",
"0.73139435",
"0.7289134",
"0.72832364",
"0.7... | 0.0 | -1 |
Overload handle_unverified_request to ensure that exception is raised each time a request does not pass validation. should be redundent after Rails 4 upgrade read: | def handle_unverified_request
unless request.path == lpn_path
add_flash :error, "Invalid Authenticity Token, if trying again does not work then contact support"
redirect_to session[:previous_url] || root_path and return
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_unverified_request\n raise ActionController::InvalidAuthenticityToken\n end",
"def handle_unverified_request\n raise ActionController::InvalidAuthenticityToken\n end",
"def handle_unverified_request; end",
"def handle_unverified_request; end",
"def handle_unverified_request\n true\n... | [
"0.8403302",
"0.8403302",
"0.81585836",
"0.81585836",
"0.80688787",
"0.80688787",
"0.7888295",
"0.7888295",
"0.7888295",
"0.7888295",
"0.7888295",
"0.7888295",
"0.7888295",
"0.7888295",
"0.7888295",
"0.7888295",
"0.7888295",
"0.7888295",
"0.7811655",
"0.7479515",
"0.7063058",... | 0.7092665 | 20 |
def primeiro_grupo_ativo self.grupos.where(ativo: true).order(prioridade: :asc).first end | def primeiro_grupo_ativo_com_fila_ativa
filas = self.grupos\
.where(ativo: true)\
.where.not(fila: nil)\
.order(prioridade: :asc).all
filas_ativas = filas.to_a.select { |f| f.ativo }
filas_ativas[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jogo\n @estilo.jogo(@grupo)\n end",
"def index\n @profissionais = Profissional.where(:ativo => true)\n \n end",
"def emprestimo_atual\n self.emprestimos.where('data_devolucao IS NULL').first\n end",
"def index\n @grupos = Grupo.find(:all).sort_by {|p| p.asignatura.curso.codi... | [
"0.5864878",
"0.58516806",
"0.57729685",
"0.5722077",
"0.5700124",
"0.5689776",
"0.5680724",
"0.5629369",
"0.5493206",
"0.54727596",
"0.5464004",
"0.5444137",
"0.5429004",
"0.5419007",
"0.5414242",
"0.5402023",
"0.5398625",
"0.53812057",
"0.5379755",
"0.5379755",
"0.5379755",... | 0.8641104 | 0 |
HOW DOES MIN BY WORK? | def unique_distance_to_point?
# ALL_POINTS.sort_by { |obj| obj.distance_to_main }.first
@distances = ALL_POINTS.map(&:distance_to_main)
@sorted_distances = @distances.sort
@closest = @sorted_distances.first
@distances.one?(@closest)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min() end",
"def min; end",
"def min; end",
"def min\n end",
"def min\n end",
"def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end",
"def get_min()\n end",
"def my_min_once\n min = first\n each do |num|\n if num < min\n... | [
"0.8118658",
"0.75971633",
"0.75971633",
"0.7475502",
"0.7475502",
"0.7393644",
"0.7081959",
"0.7075531",
"0.703913",
"0.6984881",
"0.69595134",
"0.68292034",
"0.682678",
"0.6821082",
"0.6787917",
"0.67708725",
"0.6756871",
"0.6710437",
"0.6694355",
"0.6688875",
"0.6674427",
... | 0.0 | -1 |
p points.sort PART 2, FIND REGION OF POINTS WITHIN 10_000 | def find_region
count = 0
GRID.each_with_index do |y_values, current_x|
y_values.each do |current_y|
distance = 0
ALL_POINTS.each do |point|
distance += ((point.y - current_y).abs + (point.x - current_x).abs)
end
p distance
count += 1 if distance < 10_000
end
end
p ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partition_points(points)\n points.sort_by! {|x| x[0]} #why I think my algorithm needs to be nlogn\n return points.in_groups(2)\nend",
"def main(points) # array with all the points\n #copy of the array by an especific cordinate\n #nlogn\n # This is a primitive, aka operations that are costless compared t... | [
"0.69798887",
"0.68809664",
"0.6558677",
"0.6159212",
"0.60818595",
"0.60414433",
"0.6040284",
"0.6037687",
"0.59564596",
"0.59412426",
"0.590176",
"0.58767897",
"0.58272344",
"0.58155006",
"0.5812906",
"0.57330406",
"0.57308424",
"0.5728703",
"0.57132083",
"0.5700275",
"0.56... | 0.6528698 | 3 |
Convenience method to factor out repeated statements | def solve(arg1, arg2)
solver = subject.solver_for([arg1, arg2], ctx)
solver.resume
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(statements); end",
"def next_statement; end",
"def simplify\n repeat_until_unchanged do |ast|\n ast.trim_once.simplify_once\n end\n end",
"def combine_multi_statements(total_sql)\n total_sql\n end",
"def combine_multi_statements(total_sql)\n tota... | [
"0.5839053",
"0.5728849",
"0.562268",
"0.5579249",
"0.5491028",
"0.5427385",
"0.53871655",
"0.5368569",
"0.5368569",
"0.5368569",
"0.53289706",
"0.53173655",
"0.5317317",
"0.5298909",
"0.52987933",
"0.5277643",
"0.52742785",
"0.5264681",
"0.5256461",
"0.52180326",
"0.5195658"... | 0.0 | -1 |
for the d&d sorting ajax helpers TODO: this is pretty messy. | def sort
raise l(:priority_sort_no_project_error) if !parent_object
@priorities = parent_object.priorities
params.keys.select{|k| k.include? UL_ID }.each do |key|
Priority.sort_priorities(@priorities, params[key])
end
render :nothing => true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_params; end",
"def sort_params; end",
"def check_sort_options() #:nodoc:\r\n table_name = @tables.first[1]\r\n old_sort = session[table_name][:sort].to_s\r\n sort, direction = old_sort.split(' ')\r\n# sort is requested\r\n if params['sort']\r\n # reverse sort if same selected\r\n if params['... | [
"0.70687604",
"0.70687604",
"0.6604219",
"0.6562309",
"0.64857554",
"0.6473549",
"0.6473549",
"0.6473549",
"0.6473549",
"0.6473549",
"0.6473549",
"0.64727545",
"0.64690936",
"0.6462122",
"0.64297384",
"0.63926667",
"0.6384232",
"0.6373503",
"0.63693935",
"0.63693935",
"0.6345... | 0.0 | -1 |
TODO: there may be a better way... | def parent_object
prioritizable = Project.find(params[:project_id]) if params[:project_id]
raise ActiveRecord::RecordNotFound, "Priority association not FOUND! " if !prioritizable
return prioritizable
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def offences_by; end",
"def stderrs; end",
"def identify; end",
"def anchored; end",
"def terpene; end",
"def verdi; end",
"def formation; end",
"def ... | [
"0.68800724",
"0.6217065",
"0.5994085",
"0.5994085",
"0.5994085",
"0.5994085",
"0.59842616",
"0.5892336",
"0.56414926",
"0.56149274",
"0.5575942",
"0.55539113",
"0.5553721",
"0.5552096",
"0.5513593",
"0.5513593",
"0.5513593",
"0.5513593",
"0.5492244",
"0.5492244",
"0.5492244"... | 0.0 | -1 |
Returns a list of all the mounted loop directories. | def mount_paths_listing
Dir["#{mounts_path}/*"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def directories\n directory.directoires\n end",
"def listDirectories\n return contentHost.listDirectories(baseDir)\n end",
"def directories\n @directories ||= []\n end",
"def directories\n @directories ||= []\n end",
"def directories\n @directories.values\n e... | [
"0.7221511",
"0.72190714",
"0.7115413",
"0.7115413",
"0.6986627",
"0.68379766",
"0.6749512",
"0.6731495",
"0.661153",
"0.65931857",
"0.6557161",
"0.64236796",
"0.64100605",
"0.6398645",
"0.63909745",
"0.6369611",
"0.6334823",
"0.62971973",
"0.6295507",
"0.6281028",
"0.6280121... | 0.76351464 | 0 |
Loads from the tabfile "8652bd0a\t16777216" Only creates the loop devices/mounts that don't exist. | def resolve_tabfile
File.readlines(tabfile_path).map do |line|
line.chomp!
unless line.empty?
name, size, owner = line.split("\t")
_create(name, size, owner) unless _exists?(name)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(slot_name, filename)\n @slot_name = slot_name\n if FileTest.exist?(filename)\n @used = true\n # Start load data\n file = File.open(filename, \"r\")\n @time = file.mtime\n @characters = Marshal.load(file)\n @frame_count = Marshal.load(file)\n @last_bgm = Marsh... | [
"0.5443924",
"0.53405946",
"0.5263487",
"0.5069737",
"0.50349605",
"0.4988254",
"0.49726242",
"0.49693",
"0.49486843",
"0.49319166",
"0.49273533",
"0.49175295",
"0.4913371",
"0.4905984",
"0.48976076",
"0.48832852",
"0.4862245",
"0.48441076",
"0.48378703",
"0.48194978",
"0.481... | 0.5964586 | 0 |
Checks if the loop device is created. | def _exists?(loop_name)
`losetup -a`.include? loop_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_loop?\n begin\n topology_sort\n false\n rescue Deployment::LoopDetected\n true\n end\n end",
"def is_loop\n\n false\n end",
"def looping?\n !sample_loop_length.zero?\n end",
"def is_loop\n\n true\n end",
"def attached?\n re... | [
"0.65980864",
"0.6234125",
"0.61386406",
"0.6088348",
"0.6027494",
"0.5930476",
"0.5768976",
"0.5710152",
"0.56699806",
"0.5652708",
"0.5600154",
"0.5597336",
"0.55813164",
"0.55512875",
"0.5541376",
"0.5536378",
"0.5504907",
"0.55019945",
"0.54994845",
"0.5496223",
"0.547545... | 0.6706461 | 0 |
this method used by wishlist stimulus controller | def domain_wishlist_availability
wishlist_item = current_user.wishlist_items.build(domain_name: params[:domain_name])
if wishlist_item.valid?
msg = { status: 'fine', domain_name: params[:domain_name] }
else
msg = { status: 'wrong', domain_name: params[:domain_name], errors: wishlist_item.errors.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def witcher; end",
"def set_wishlist\n # @wishlist = Wishlist.find(params[:id])\n end",
"def whiny; end",
"def set_wish_list\n @wish_list = WishList.where(user_id: current_user_id)\n end",
"def _activate\n\t\t\tend",
"def skier_quest; end",
"def set_wish_list\n @wish_list = WishLis... | [
"0.60469496",
"0.58886796",
"0.5866795",
"0.58093727",
"0.5714806",
"0.56904346",
"0.56835306",
"0.56835306",
"0.5661254",
"0.56249803",
"0.5618773",
"0.5617269",
"0.559846",
"0.55709094",
"0.5564357",
"0.55599886",
"0.55278176",
"0.55229396",
"0.5519752",
"0.5507023",
"0.550... | 0.0 | -1 |
Write a method which takes a grocery list (array) of fruits with quantities and converts it into an array of the correct number of each fruit. Example: | def buy_fruit(grocery_list)
result = []
grocery_list.each do |fruit|
fruit[1].times do
result << fruit[0]
end
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buy_fruit(grocery_list)\n array_of_fruits = []\n\n grocery_list.each do |fruit|\n fruit[1].times { array_of_fruits << fruit[0]}\n end\n array_of_fruits\nend",
"def buy_fruit_2(arr)\n arr.map { |fruit, quantity| [fruit] * quantity }.flatten # => [\"apples\", \"apples\", \"apples\", \"orange\", \"bana... | [
"0.77594995",
"0.77274424",
"0.77265346",
"0.75434834",
"0.7523351",
"0.7523351",
"0.7523351",
"0.7491215",
"0.74819005",
"0.74105877",
"0.7393099",
"0.7358743",
"0.73562044",
"0.73295516",
"0.7271861",
"0.7116199",
"0.7098769",
"0.7039163",
"0.7017643",
"0.70115113",
"0.7011... | 0.77352154 | 1 |
O(log n)T 0(1)S def binary_search(arr, target) high = arr.length 1 low = 0 while low arr[mid] low = mid + 1 else return mid end end 1 end Recursion O(log(n))ST | def binary_search(arr, target)
binary_search_helper(arr, target, 0, arr.length - 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binary_search(array, target)\n return nil if array.length == 1 && array[0] != target\n mid = array.length / 2\n\n if target == array[mid]\n return mid\n elsif target < array[mid]\n return binary_search(array[0...mid], target)\n else\n found = binary_search(array[mid+1..-1], ... | [
"0.89862436",
"0.8972381",
"0.8968001",
"0.89481276",
"0.8912648",
"0.88481414",
"0.88009924",
"0.87864757",
"0.878307",
"0.8748843",
"0.87324995",
"0.8699345",
"0.86973715",
"0.86192507",
"0.86146194",
"0.8565653",
"0.8563202",
"0.85595363",
"0.8529198",
"0.852197",
"0.85214... | 0.84512496 | 25 |
Prepares date for for findind if the stock did perform, and if it would have resulted in profit | def did_stock_perform date,company_id,price
profit_book_price = price - price * @profit_book_percentage
stop_loss_price = price + price * @stop_loss_percentage
profit_book_quote = Quote.get_worst_performer_after_interval date,company_id,profit_book_price
stop_loss_quote = Quote.get_best_performer_after_inte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pro_rata_start_date\n # \n # Tue Nov 23 00:53:04 IST 2010, ramonrails\n # * we will never use \"installation_datetime\"\n # * installation_datetime is the \"desired\" installation datetime\n # * Pro-rata is charged from the date a panic button is received making user ready to install\n ... | [
"0.6580512",
"0.6283143",
"0.6158876",
"0.6127789",
"0.61219776",
"0.6108997",
"0.6071014",
"0.6052504",
"0.60405797",
"0.59679425",
"0.59495085",
"0.59330213",
"0.5899121",
"0.58598334",
"0.5827346",
"0.5826379",
"0.58238864",
"0.5817161",
"0.58066237",
"0.57703817",
"0.5769... | 0.6027626 | 9 |
moves the rover towards its current orientation using one of the private methods below. Use key value mapping if cardinal directions increase. | def move
self.send(@orientation.current.to_sym)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move\n case @rover_facing\n when 'N'\n @coordinates[1] += 1\n when 'E'\n @coordinates[0] += 1\n when 'S'\n @coordinates[1] -= 1\n when 'W'\n @coordinates[0] -= 1\n end\n end",
"def move_rover()\n puts \"DEBUG: moving: #{@orientation}\" if DEBUG\n case @orientatio... | [
"0.6996666",
"0.6945809",
"0.6873296",
"0.6859139",
"0.68524116",
"0.68190706",
"0.68011093",
"0.6707798",
"0.6602807",
"0.65603065",
"0.6529206",
"0.65222037",
"0.6484232",
"0.6477445",
"0.64714384",
"0.6445488",
"0.6381426",
"0.6370627",
"0.63525254",
"0.63483953",
"0.63323... | 0.6490693 | 12 |
moves the rover forward | def N
@y += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward_move\n case @facing\n when 'NORTH'\n @y += 1\n when 'SOUTH'\n @y -= 1\n when 'EAST'\n @x += 1\n when 'WEST'\n @x -= 1\n end\n self\n end",
"def forward(steps)\n move(steps)\n end",
"def move(rover)\n rover.command.each do |m|\n remove_rover(rove... | [
"0.7400109",
"0.7314591",
"0.72227085",
"0.7206972",
"0.7206972",
"0.7184031",
"0.7175001",
"0.7170626",
"0.7159038",
"0.7159038",
"0.71248436",
"0.7080824",
"0.7049029",
"0.7038005",
"0.7035736",
"0.7032901",
"0.70272255",
"0.70008636",
"0.6955088",
"0.6927975",
"0.6875804",... | 0.0 | -1 |
moves the rover right | def E
@x += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_right\n\t\tmove([1,0])\n\tend",
"def move_right\r\n if @x + @vel_x < SCREEN_WIDTH - GAME_PRESET[\"player_move_right\"]\r\n @x += @vel_x\r\n end\r\n end",
"def move_right\n @board.each(&:reverse!)\n action = move_left\n @board.each(&:reverse!)\n action\n end",
"def right\n ... | [
"0.82254356",
"0.7771812",
"0.7769296",
"0.7743646",
"0.7604763",
"0.75174546",
"0.75133204",
"0.7511792",
"0.74743927",
"0.7468792",
"0.7455424",
"0.7447993",
"0.74113095",
"0.7388173",
"0.73252004",
"0.73112804",
"0.73007756",
"0.73007756",
"0.7294589",
"0.72898906",
"0.727... | 0.0 | -1 |
moves the rover down | def S
@y -= 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_down\n\t\tmove([0,1])\n\tend",
"def move_down\r\n if @y + @vel_y < SCREEN_HEIGHT - GAME_PRESET[\"player_move_down\"]\r\n @y += @vel_y\r\n end\r\n end",
"def move_down(environment)\n @previous_action = 'moved down'\n location[:y] += 1 if can_move_down?(environment)\n environment.st... | [
"0.7160345",
"0.69376045",
"0.67937666",
"0.67516476",
"0.6748232",
"0.6737948",
"0.6688412",
"0.664669",
"0.6644453",
"0.66222936",
"0.6509226",
"0.6509143",
"0.6490141",
"0.64626884",
"0.6447922",
"0.6445966",
"0.6435767",
"0.641811",
"0.64099395",
"0.64065224",
"0.6396354"... | 0.0 | -1 |
moves the rover left | def W
@x -= 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_left\n\t\tmove([-1,0])\n\tend",
"def turn_left\n turn(:left)\n end",
"def move_left\n\t\t# if the horse isn;t yet at the left of of the screne move it left 20\n\t\tif @x > 0\n\t\t\t\t@x = @x -20\n\t\tend\n\tend",
"def move_left(environment)\n @previous_action = 'moved left'\n location[... | [
"0.79965013",
"0.7768699",
"0.76791024",
"0.7526979",
"0.7516778",
"0.750206",
"0.7417304",
"0.7304689",
"0.72879094",
"0.72656244",
"0.72416973",
"0.72138095",
"0.7212505",
"0.7191822",
"0.7186259",
"0.718383",
"0.71266675",
"0.71266675",
"0.71210384",
"0.71097594",
"0.70977... | 0.0 | -1 |
A variant of forward which accept the axis order as (lat, lon). | def forward_latlon (lat, lon, z = nil)
return forward(lon, lat, z)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_forward_gk\n result = @proj_gk.forward( Proj4::Point.new( deg2rad(@lon), deg2rad(@lat) ) ) \n assert_in_delta @rw, result.x, 0.1\n assert_in_delta @hw, result.y, 0.1\n end",
"def move_forward\n\t\tnew_position = forward_position\n\t\t@x = new_position[0]\n\t\t@y = new_position[1]... | [
"0.63077843",
"0.6116667",
"0.61149234",
"0.6056466",
"0.6027966",
"0.59276485",
"0.5865449",
"0.58545524",
"0.5833161",
"0.5711355",
"0.55892074",
"0.55733144",
"0.55338454",
"0.5517755",
"0.54839367",
"0.5472159",
"0.54669833",
"0.5386587",
"0.5359718",
"0.52771044",
"0.524... | 0.7203906 | 0 |
A variant of inverse which return the output with the axis order in (lat, lon). | def inverse_latlon (x, y, z = nil)
return inverse_latlon(x, y, z)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_inverse_gk\n result = @proj_gk.inverse( Proj4::Point.new(@rw, @hw) ) \n assert_in_delta @lon, rad2deg(result.x), 0.000000001\n assert_in_delta @lat, rad2deg(result.y), 0.000000001\n end",
"def to_local(point)\n inverse * point\n end",
"def normalize_coords(x, y)\n ... | [
"0.67561376",
"0.62579185",
"0.62254757",
"0.6214044",
"0.61589587",
"0.5927931",
"0.5918906",
"0.5903229",
"0.5903229",
"0.5857931",
"0.58160794",
"0.57956415",
"0.5788508",
"0.57729995",
"0.5740907",
"0.57403576",
"0.57342786",
"0.5698444",
"0.5698274",
"0.56915104",
"0.564... | 0.70063126 | 0 |
Returns a internal information of the object | def pj_info
info = _pj_info
if info["id"] == "unknown"
transform(0,0)
info = _pj_info
if info["id"] == "unknown"
return OpenStruct.new(info)
else
return pj_info
end
else
info["definition"] = info["definition"].strip.split(/\s+/).map{|s| "+"+s}.join(" ")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info\n @info\n end",
"def info\n return @info\n end",
"def info\n @info\n end",
"def info\n @info\n end",
"def info()\n #This is a stub, used for indexing\n end",
"def inspect\n @info.inspect\n end",
"def inspect\n @info.ins... | [
"0.7883159",
"0.7872306",
"0.78678924",
"0.77560085",
"0.76604116",
"0.7626201",
"0.7626201",
"0.7568693",
"0.7538626",
"0.7450737",
"0.7450737",
"0.736948",
"0.7362487",
"0.72704643",
"0.72704643",
"0.72704643",
"0.7242324",
"0.72388554",
"0.715894",
"0.707693",
"0.7029325",... | 0.0 | -1 |
Returns a definition of the object | def definition
return pj_info.definition
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_definition\n\n end",
"def definition_builder; end",
"def definition_builder; end",
"def to_definition\n Definition.from(self)\n end",
"def name\n definition.name\n end",
"def get_definition(cls, bld, fun)\r\n bld.add(\"///\")\r\n bld.add(\"/// Web API get si... | [
"0.774021",
"0.69791585",
"0.69791585",
"0.68605334",
"0.67933136",
"0.67932534",
"0.67721677",
"0.6605026",
"0.65193963",
"0.6491179",
"0.6491179",
"0.6484263",
"0.645471",
"0.6384609",
"0.6383003",
"0.6383003",
"0.6383003",
"0.6383003",
"0.6383003",
"0.6383003",
"0.6383003"... | 0.6763801 | 7 |
Gets a Hash object parsed from the PROJJSON expression of the object | def to_projjson_as_hash
json = to_projjson
if json
return JSON.parse(json)
else
return nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_to_hash(json_obj)\r\n Hash[JSON.parse(json_obj)[0]]\r\n end",
"def hash_for_json(*)\n to_h\n end",
"def convert_it_to_hash_format(object)\n JSON.parse(object)\n end",
"def hashify(obj)\n JSON.parse(obj.to_json).with_indifferent_access\n end",
"def to_hash\n JSON.parse(... | [
"0.64193785",
"0.63987744",
"0.6389848",
"0.63563097",
"0.627606",
"0.62112105",
"0.6198581",
"0.61982936",
"0.61933583",
"0.61799806",
"0.6099986",
"0.6050314",
"0.6036564",
"0.60048985",
"0.59816676",
"0.59478337",
"0.5935589",
"0.5917164",
"0.59088767",
"0.58578527",
"0.58... | 0.54641926 | 43 |
define an is_fib?(num) method to return boolean do an array.select with is_fib? providing the returns | def is_fib?(num)
first = 1
second = 1
until second > num do
return true if second == num
first, second = second, first + second
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_fib?(num)\n sequence = [1, 1]\n a = 1\n b = 1\n\n return true if num == 1\n\n loop do\n c = a + b\n sequence << c\n break if c >= num\n a = b \n b = c\n end\n\n sequence.last == num ? true : false\nend",
"def is_fib?(target)\n a = 0\n b = 1\n\n loop do\n return true if b == tar... | [
"0.7522669",
"0.7518133",
"0.7411759",
"0.73825276",
"0.7353918",
"0.728389",
"0.718546",
"0.71756375",
"0.7166556",
"0.71620494",
"0.7160781",
"0.71005994",
"0.7088805",
"0.7087385",
"0.7046606",
"0.70120007",
"0.70024925",
"0.69657123",
"0.6928289",
"0.6917408",
"0.6894816"... | 0.75353795 | 0 |
Use the properties defined on the class to build and return a hash containing all the special and custom properties. | def to_identity
identity = eventr_special_properties
self.class.eventr_property_fields.each do |key, call|
identity[eventr_scrub_key key] = instance_eval &call
end
return identity
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_h\n data = {}\n\n self.class.properties.each_key do |prop|\n data[prop] = send(prop)\n end\n\n data\n end",
"def to_properties_hash\n self.class.send(:property_list).inject({}) do |hash, property|\n hash.merge(property.to_hash(self))\n end\n end",
"def properties\n sel... | [
"0.72964746",
"0.7042747",
"0.699121",
"0.6983838",
"0.6976881",
"0.6890491",
"0.682881",
"0.67896605",
"0.6723965",
"0.6673824",
"0.65040493",
"0.64907813",
"0.64565307",
"0.63949096",
"0.63772017",
"0.636959",
"0.636959",
"0.635594",
"0.63156843",
"0.63110673",
"0.6286919",... | 0.0 | -1 |
Sends the identity hash to the receivers to be processed. | def send_identity
Eventr.delegate_to_receivers(:identity, ident_id, to_identity)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_outgoing_hash\n \n \t\tdata = \tself.class.get_payumoney_key + \"|\" + self.id.to_s + \"|\" + self.amount.to_s + \"|\" + get_product_info + \"|\" + get_first_name + \"|\" + get_email + \"|||||\" + get_udf5 + \"||||||\" + self.class.get_payumoney_salt\n\n \t\tself.outgoing_hash = Digest::SHA512.hexdi... | [
"0.60495657",
"0.5861666",
"0.5579565",
"0.5464237",
"0.53856814",
"0.5380024",
"0.53233373",
"0.5304",
"0.527926",
"0.5264862",
"0.52430314",
"0.51939785",
"0.51633114",
"0.51002717",
"0.50767934",
"0.5059732",
"0.50524384",
"0.50524384",
"0.50240916",
"0.50209075",
"0.50201... | 0.7253216 | 0 |
Login user returns session | def authenticate(params)
Auth.new(params).call
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_user(user = gen_user)\n session[:user_id] = user.id\n return user\n end",
"def login_user\n\t @user_session = UserSession.new\t \n\tend",
"def login_from_session\n self.current_user = User.find_by_id( session[ :user_id ] ) if session[ :user_id ]\n end",
"def login user\n session[:us... | [
"0.80745596",
"0.8030067",
"0.8026817",
"0.79841316",
"0.7946356",
"0.7935611",
"0.7906486",
"0.7894906",
"0.7894906",
"0.7890827",
"0.78820324",
"0.7865531",
"0.7865058",
"0.7832517",
"0.7827189",
"0.78189224",
"0.78087026",
"0.78068954",
"0.77868885",
"0.7782302",
"0.777887... | 0.0 | -1 |
create a method to see if any letter of the guesed word is included in the original word | def feedback(guess_word)
guessword_array=guess_word.split("")
word_array=@word.split("")
guessword_array.each do |letter|
if word_array.include?(letter)
@result[word.index(letter)]=letter
end
end
puts "here is your feedback: #{@result}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_has?(letter)\n @word.include? letter\n end",
"def word_has?(letter)\r\n @word.include?(letter)\r\n end",
"def word_has?(letter)\n @word.include?(letter)\n end",
"def include?(word, letters)\n word.upcase.chars.all? { |letter| word.count(letter) <= letters.count(letter) }\n end",
"d... | [
"0.79019773",
"0.7792629",
"0.77797383",
"0.7773997",
"0.75665253",
"0.7442086",
"0.7409974",
"0.7313783",
"0.7312464",
"0.73070014",
"0.729082",
"0.7250756",
"0.7215658",
"0.7180584",
"0.71780586",
"0.7155425",
"0.7136885",
"0.7119358",
"0.7107788",
"0.7103724",
"0.71036476"... | 0.0 | -1 |
GET /articles GET /articles.json | def index
@articles = Article.all
@tags = @articles.map {|article| article.tags}.flatten.uniq
if params[:search]
@articles = Article.search(params[:search]).order("created_at DESC")
elsif params[:tag]
@articles = Article.tag_search(params[:tag])
else
@articles = Article.all.order("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.json { render json: @articles }\n end\n end",
... | [
"0.7823242",
"0.7757662",
"0.77491444",
"0.7650022",
"0.7650022",
"0.7650022",
"0.7650022",
"0.7650022",
"0.7650022",
"0.7612499",
"0.75499934",
"0.744125",
"0.73619306",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
... | 0.0 | -1 |
GET /articles/1 GET /articles/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n @article = Article.where(id: params[:id]).last\n\n respond_to do |format|\n format.html # show.html.er... | [
"0.7747388",
"0.75172764",
"0.75156045",
"0.74855036",
"0.7480435",
"0.7474636",
"0.7474636",
"0.7474636",
"0.7474636",
"0.7474636",
"0.7474636",
"0.7474636",
"0.7474636",
"0.7474636",
"0.7474636",
"0.7474636",
"0.7474636",
"0.7474636",
"0.7474636",
"0.7428779",
"0.7428779",
... | 0.0 | -1 |
POST /articles POST /articles.json | def create
@article = Article.new(article_params)
respond_to do |format|
if @article.save
format.html { redirect_to @article, notice: 'Article was successfully created.' }
format.json { render :show, status: :created, location: @article }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, :notice => 'Article was successfully created.' }\n format.json { render :json => @article, :status => :created, :location => @article }\n else\n ... | [
"0.71525854",
"0.7089459",
"0.7089459",
"0.7089459",
"0.7089459",
"0.7089459",
"0.7089459",
"0.7089459",
"0.7089459",
"0.7083744",
"0.70643014",
"0.70528066",
"0.7039442",
"0.702776",
"0.7018597",
"0.7008708",
"0.7002723",
"0.69954133",
"0.69954133",
"0.6974933",
"0.6959542",... | 0.7055016 | 20 |
PATCH/PUT /articles/1 PATCH/PUT /articles/1.json | def update
respond_to do |format|
if @article.update(article_params)
format.html { redirect_to @article, notice: 'Article was successfully updated.' }
format.json { render :show, status: :ok, location: @article }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @article = article_get(params[:id])\n @article.update(params[:article])\n respond_with(@article)\n end",
"def UpdateArticle id,params = {}\n \n APICall(path: \"help_center/articles/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @... | [
"0.68234307",
"0.67437166",
"0.6710601",
"0.6707802",
"0.6681087",
"0.66787845",
"0.6667555",
"0.6667555",
"0.6667555",
"0.6667555",
"0.6667555",
"0.6667555",
"0.6667555",
"0.6667555",
"0.6667555",
"0.6667555",
"0.66550744",
"0.6643639",
"0.663333",
"0.6615435",
"0.6615435",
... | 0.6374714 | 61 |
DELETE /articles/1 DELETE /articles/1.json | def destroy
@article.destroy
respond_to do |format|
format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @article = Article.find(params[:id]) \n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.where(id: params[:id]).last\n @article.destroy\n\n res... | [
"0.7844117",
"0.7832465",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
... | 0.7506414 | 77 |
Use callbacks to share common setup or constraints between actions. | def set_article
@article = Article.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.6163821",
"0.6045432",
"0.5945441",
"0.5916224",
"0.58894575",
"0.5834073",
"0.57764685",
"0.5702474",
"0.5702474",
"0.5653258",
"0.56211996",
"0.54235053",
"0.5410683",
"0.5410683",
"0.5410683",
"0.53948104",
"0.5378064",
"0.5356684",
"0.53400385",
"0.53399503",
"0.533122... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def article_params
if !params[:article][:tags].blank?
params[:article][:tags] = params[:article][:tags].split(",")
params[:article][:tags].each_with_index do |tag, index|
params[:article][:tags][index] = tag.strip.titleize
end
end
params.require(:article).permit(:user... | {
"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 |
Make sure we have a user signed in | def confirm_signed_in
if !signed_in?
redirect_to root_path, notice: "You have to be signed in to continue!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_logged_in\n login! if @user.nil?\n end",
"def make_sure_logged_in\n\n\t\tif current_user.nil?\n\n\t\tflash[:error] = \"You need to be signed up\"\n\n\t\tredirect_to new_user_path\n\n\n\t\tend\n\n\n\n\n\tend",
"def check_user\n if user_signed_in?\n else\n redirect_to root_pat... | [
"0.7858083",
"0.77459013",
"0.76833194",
"0.76833194",
"0.7676331",
"0.76316166",
"0.76234883",
"0.76234883",
"0.75939286",
"0.75812995",
"0.7484601",
"0.7458331",
"0.7450894",
"0.7435769",
"0.74270225",
"0.7408492",
"0.74009454",
"0.7378977",
"0.73668134",
"0.73498386",
"0.7... | 0.0 | -1 |
def self_hosted_site touch(" marked:'Add SelfHosted Site'") wait_for_none_animating end | def login(user,pass)
enter_text(user_field, user)
enter_text(pass_field, pass)
sleep 1
# wait_for_login_done
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_site\n \n end",
"def new_site_save\n active_submit.click\n end",
"def click_start_now_button\n click_link(@start_now_button_text)\n end",
"def post_to_fancyhands\n post_to_fancyhands_now\n end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
... | [
"0.608183",
"0.5840085",
"0.5595023",
"0.5569042",
"0.54406095",
"0.54406095",
"0.54406095",
"0.54406095",
"0.54406095",
"0.54406095",
"0.54406095",
"0.54406095",
"0.54406095",
"0.54406095",
"0.54406095",
"0.54406095",
"0.54406095",
"0.54406095",
"0.54406095",
"0.54406095",
"... | 0.0 | -1 |
Private: Initialize with specified credentials (for submitting) | def init_with_credentials(iput, oput)
raise 'input must be hash map' unless iput.kind_of? Hash
raise 'output must be hash map' unless oput.kind_of? Hash
raise 'api key must be set' unless GridVid.api_key != nil
raise 'api secret must be set' unless GridVid.api_sec != nil
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(credentials)\n @credentials = credentials\n end",
"def initialize(credentials, attributes = {})\n super(attributes)\n @credentials = credentials\n end",
"def initialize(credentials = {})\n self.client_id = credentials[:client_id]\n self.client_secret = creden... | [
"0.8291748",
"0.778561",
"0.74801964",
"0.73368186",
"0.73308253",
"0.72768795",
"0.72768795",
"0.72768795",
"0.7115918",
"0.71111333",
"0.70884085",
"0.7083239",
"0.7083239",
"0.70646924",
"0.7050599",
"0.7013304",
"0.7013304",
"0.7013304",
"0.7013304",
"0.7013304",
"0.70049... | 0.0 | -1 |
Public: Adds a job definition to the group +job+ :: type(Hash) | def add_job(job, output_file)
@_jobs << Job.new(job, @_places[:input],
@_places[:output].merge({:object => output_file})
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_job(job_def)\n\t\t\tjob = JobBuilder.new(self).build(job_def)\n\t\t\traise \"Error : job with name #{job.name} already exists\" if @jobs.has_key?(job.name)\n\t\t\t@jobs[job.name] = job\n\t\tend",
"def add_job(job)\n @stream.add_message(job.to_message)\n job\n end",
"def << job_data\n add_jo... | [
"0.76117",
"0.708704",
"0.6974623",
"0.68491703",
"0.6697572",
"0.6389055",
"0.63883793",
"0.63129497",
"0.61761105",
"0.61434877",
"0.6069405",
"0.60505426",
"0.6031945",
"0.5966009",
"0.5947371",
"0.5899759",
"0.5826349",
"0.57836825",
"0.5769569",
"0.5761827",
"0.57095283"... | 0.67488515 | 4 |
Public: Submit the loaded jobs to GridVid and stash the resultant jobids | def submit()
@_jobs.each{|job| self.jobids << job.submit()}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_job_submit\n location = Location.find_by_location_barcode(self.pdt_screen_def.get_input_control_value(\"location\"))\n self.set_temp_record(:location, location)\n if !location\n result_screen = PDTTransaction.build_msg_screen_definition(\"location does not exist\",nil,nil,nil)\n return ... | [
"0.650225",
"0.63959146",
"0.6384453",
"0.62402356",
"0.6026256",
"0.59974647",
"0.5976149",
"0.5969411",
"0.5942931",
"0.5942931",
"0.59236485",
"0.59228665",
"0.5869301",
"0.58345205",
"0.5823869",
"0.57842106",
"0.5770313",
"0.57662255",
"0.57463646",
"0.5735419",
"0.57330... | 0.7567611 | 0 |
Public: Check if all associated jobs have completed. Returns: list[ bool(finished), list[jobids_passed], list[jobids_failed], list[jobids_running] ] | def status()
return [true, [], [], []] if not self.jobids.any?
statuses = GridVid.query(@_keys.merge({:jobids => self.jobids}))
passed = []
running = []
failed = []
statuses.each_pair {|jobid, val|
case val['status']
when "PASS"
passed <<... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_if_finished\n return parent_check if parent\n\n st = status\n raise error_message(st) if st.failed?\n\n queued = st.queued?\n return [true, queued, st] if st.completed?\n\n [false, queued, nil]\n end",
"def completed?\n !self.shift_jobs.empty?\n end",
"def tasks_are_finished?\n... | [
"0.68911254",
"0.6859435",
"0.68331796",
"0.68146276",
"0.67594004",
"0.6680257",
"0.667949",
"0.6605019",
"0.6570146",
"0.65168715",
"0.6480839",
"0.64761734",
"0.6469457",
"0.6439623",
"0.6385946",
"0.6315214",
"0.627766",
"0.627766",
"0.6268946",
"0.6266496",
"0.6229312",
... | 0.6902937 | 0 |
GET /campaigns GET /campaigns.json | def index
@campaigns = Campaign.where(activated: true, completed: false)
# @campaign_goal=
# @campaign_count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def campaigns(options={})\n response = connection.get do |req|\n \treq.url \"campaigns\", options\n end\n return_error_or_body(response)\n \tend",
"def campaigns\n response = get 'campaigns'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def index\n @campaigns = sit... | [
"0.83348304",
"0.82354873",
"0.80441314",
"0.7977159",
"0.77199984",
"0.76991975",
"0.7625755",
"0.74843097",
"0.7472087",
"0.7472087",
"0.7472087",
"0.7429651",
"0.7396764",
"0.73912245",
"0.73552084",
"0.7215789",
"0.7202299",
"0.7167582",
"0.716404",
"0.7101753",
"0.709719... | 0.5987665 | 83 |
amount donated = Goal amount_raised GET /campaigns/1 GET /campaigns/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def donated\n \tdonations.sum(&:amount)\n end",
"def donated_amount\n self.fees.purchased.sum(:amount).to_f\n end",
"def total\n url = \"https://api.justgiving.com/#{Rails.application.secrets.justgiving_api_key}/v1/fundraising/pages/thebteam-cardiff\"\n begin\n response = RestClient.get \"ht... | [
"0.66952306",
"0.65349406",
"0.6475387",
"0.6465195",
"0.63539654",
"0.63459",
"0.63369215",
"0.6280607",
"0.6271043",
"0.6271043",
"0.6271043",
"0.6244283",
"0.622815",
"0.622815",
"0.6193995",
"0.61837375",
"0.6154553",
"0.614077",
"0.6136483",
"0.61270106",
"0.61150587",
... | 0.0 | -1 |
PATCH/PUT /campaigns/1 PATCH/PUT /campaigns/1.json | def update
respond_to do |format|
if @campaign.update(campaign_params)
CampaignMailer.with(campaign: @campaign).notify_user_update.deliver_later
CampaignMailer.with(campaign: @campaign).notify_super_admin_update.deliver_later
format.html { redirect_to @campaign, notice: 'Campaign was s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @campaign.update(campaign_params)\n render json: @campaign\n else\n render json: @campaign.errors, status: :unprocessable_entity\n end\n end",
"def update\n @campaign = Campaign.find_by(id: params[:id])\n if @campaign.update(update_campaign_params)\n head :no_conten... | [
"0.7724833",
"0.75469184",
"0.73714286",
"0.73528683",
"0.73486245",
"0.72748595",
"0.72167075",
"0.72012013",
"0.7181505",
"0.7094297",
"0.7075411",
"0.70584244",
"0.6972602",
"0.68623525",
"0.6846332",
"0.68019503",
"0.673894",
"0.6703578",
"0.6678335",
"0.66386783",
"0.654... | 0.6786017 | 16 |
DELETE /campaigns/1 DELETE /campaigns/1.json | def destroy
@campaign.destroy
respond_to do |format|
format.html { redirect_to campaigns_url, notice: 'Campaign was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @campaign = Campaign.find(params[:id])\n @campaign.destroy\n\n respond_to do |format|\n format.html { redirect_to campaigns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @campaign = Campaign.find(params[:id])\n @campaign.destroy\n\n respond_to... | [
"0.80190796",
"0.80190796",
"0.80190796",
"0.80190796",
"0.8003105",
"0.79688114",
"0.7941027",
"0.7874502",
"0.785269",
"0.7749027",
"0.7735497",
"0.76956415",
"0.7602506",
"0.75066817",
"0.7506488",
"0.7505273",
"0.74960756",
"0.74908847",
"0.7452369",
"0.7428898",
"0.73041... | 0.7815982 | 12 |
Use callbacks to share common setup or constraints between actions. | def set_campaign
@campaign = Campaign.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.6163821",
"0.6045432",
"0.5945441",
"0.5916224",
"0.58894575",
"0.5834073",
"0.57764685",
"0.5702474",
"0.5702474",
"0.5653258",
"0.56211996",
"0.54235053",
"0.5410683",
"0.5410683",
"0.5410683",
"0.53948104",
"0.5378064",
"0.5356684",
"0.53400385",
"0.53399503",
"0.533122... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def campaign_params
params.require(:campaign).permit(:campaign_category_id, :image, :activated, :user_id, :name, :story, :facebooK_shares, :twitter_shares, :likes, :goal)
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 |
Use callbacks to share common setup or constraints between actions. | def set_workout_template
@workout_template = WorkoutTemplate.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def workout_template_params
# params.require(:workout_template).permit(:title, :isTemplate, :boolean, :exerciseCount, :user_id,:id)
params .permit(:title, :isTemplate, :boolean, :exerciseCount, :user_id,: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 |
square every digit of a number Example 9119 > 811181 should start with an integer input and end with an integet input | def square_digits num
num.to_s.chars #turn the number into a string and split up each digit
.map{|x| x.to_i ** 2} # square each digit
.join('') #recombine the digits into one string
.to_i #change the string back into an integer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def square_digits(num)\n num.to_s.split(\"\").map { |v| v.to_i * v.to_i }.join.to_i\nend",
"def square_digits(num)\n num.to_s.split(\"\").map{ |n| n.to_i * n.to_i }.join.to_i\nend",
"def square_digits num\n arr = num.to_s.split('')\n newArr = []\n arr.each { |n| newArr.push(n.to_i * n.to_i)}\n newArr.joi... | [
"0.7948973",
"0.79425424",
"0.7918663",
"0.786734",
"0.78125626",
"0.7778126",
"0.7767016",
"0.77562416",
"0.77245027",
"0.7713244",
"0.771132",
"0.7674902",
"0.7661594",
"0.7654321",
"0.7562072",
"0.7415154",
"0.73153484",
"0.7248291",
"0.70601654",
"0.69418424",
"0.6892762"... | 0.79581004 | 0 |
TODO: Refactor this properly together with the method in Course::Assessment::SubmissionQuestion::CommentsController | def last_post_from(topic)
# @post is in topic.posts, so we filter out @post, which has no id yet.
topic.posts.ordered_topologically.flatten.select(&:id).last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @comments = Comment.where(\"submission_id=\" + (params[:id])).order(\"created_at DESC\")\n end",
"def comment\n if logged_in?\n if params[:comment]\n @comment = Comment.new(params[:comment])\n @comment.user_id = current_user.id\n @comment.save\n \n @user ... | [
"0.6702595",
"0.654907",
"0.6481206",
"0.6449851",
"0.6390124",
"0.637394",
"0.637394",
"0.637394",
"0.637394",
"0.637394",
"0.637394",
"0.63611126",
"0.63611126",
"0.63611126",
"0.62878925",
"0.6281829",
"0.6219249",
"0.6185266",
"0.6171816",
"0.6154665",
"0.614595",
"0.61... | 0.0 | -1 |
NOTE: Localization tests go though Stringto_ascii because you really shouldn't be having to go through the base method | def test_localize_from_hash
hash = {
"en" => {"é" => "ee"}
}
Stringex::Unidecoder.localize_from hash
assert_equal "ee", "é".to_ascii
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_ascii!; replace(to_ascii); end",
"def to_ascii!; self.replace(self.to_ascii); end",
"def test_normalize_works_with_non_roman_chars\n assert_equal \"検-索\", Slug::normalize(\"検 索\")\n end",
"def test_to_norm_usascii\n result = ::UTF8Proc.normalize(@asciistr)\n assert_equal @asciistr, result\n ... | [
"0.7217622",
"0.68758035",
"0.6749014",
"0.6664421",
"0.66363055",
"0.66098475",
"0.63920695",
"0.6381291",
"0.6360607",
"0.63259435",
"0.6293873",
"0.6236472",
"0.622209",
"0.61910695",
"0.6187008",
"0.6160824",
"0.5989849",
"0.5982443",
"0.5976979",
"0.5976979",
"0.5962481"... | 0.6197594 | 13 |
GET /maintenances GET /maintenances.json | def index
@search = Maintenance.search(params[:q])
@search.sorts = 'maintenance_date' if @search.sorts.empty?
@maintenances = @search.result
@view_maintenances = @maintenances.page(params[:page]||1)
respond_to do |format|
format.html
format.csv { send_data @maintenances.to_csv }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_maintenances()\n results = @zabbix.raw_api(\"maintenance.get\", {\"output\" => \"extend\", \"selectHosts\" => \"extend\", \"selectGroups\" => \"extend\"} )\n pp results\n end",
"def list_maintenance(opts = {})\n data, _status_code, _headers = list_maintenance_with_http_info(opts)\n ... | [
"0.8054899",
"0.7672247",
"0.75977856",
"0.74851817",
"0.72622985",
"0.72271633",
"0.7208726",
"0.71707475",
"0.71631837",
"0.71444714",
"0.7092098",
"0.69681585",
"0.6944117",
"0.67824227",
"0.6758716",
"0.6693137",
"0.66642785",
"0.6554173",
"0.6534048",
"0.6524808",
"0.652... | 0.0 | -1 |
GET /maintenances/1 GET /maintenances/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_maintenances()\n results = @zabbix.raw_api(\"maintenance.get\", {\"output\" => \"extend\", \"selectHosts\" => \"extend\", \"selectGroups\" => \"extend\"} )\n pp results\n end",
"def maintenance_list(statuspage_id)\n request :method => :get,\n :url => @url + 'maintenance/... | [
"0.77324086",
"0.753828",
"0.75170183",
"0.7282368",
"0.7140362",
"0.713494",
"0.70981836",
"0.70888555",
"0.7088167",
"0.7055018",
"0.7039609",
"0.6988948",
"0.69290364",
"0.69262093",
"0.69262093",
"0.69262093",
"0.69262093",
"0.69262093",
"0.6882619",
"0.6694866",
"0.66715... | 0.0 | -1 |
POST /maintenances POST /maintenances.json | def create
@maintenance = Maintenance.new(maintenance_params)
respond_to do |format|
if @maintenance.save
format.html { redirect_to @maintenance, notice: (t 'maintenances.title')+(t 'actions.created') }
format.json { render action: 'show', status: :created, location: @maintenance }
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @maintenance = Maintenance.new(maintenance_params)\n\n respond_to do |format|\n if @maintenance.save\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully created.' }\n format.json { render :show, status: :created, location: @maintenance }\n else... | [
"0.74668247",
"0.7219988",
"0.7196923",
"0.69360167",
"0.6935834",
"0.6770163",
"0.67212266",
"0.67127496",
"0.66718256",
"0.6647569",
"0.66341615",
"0.6592434",
"0.65829474",
"0.6561856",
"0.6559634",
"0.653684",
"0.653684",
"0.653684",
"0.653684",
"0.653684",
"0.6481166",
... | 0.7327934 | 1 |
PATCH/PUT /maintenances/1 PATCH/PUT /maintenances/1.json | def update
respond_to do |format|
if @maintenance.update(maintenance_params)
format.html { redirect_to @maintenance, notice: (t 'maintenances.title')+(t 'actions.updated') }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render j... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @maintenance.update(maintenance_params)\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully updated.' }\n format.json { render :show, status: :ok, location: @maintenance }\n else\n format.html { render :edit }\n ... | [
"0.7412643",
"0.7412643",
"0.73362625",
"0.7261899",
"0.6960074",
"0.67567754",
"0.6664235",
"0.6602686",
"0.659262",
"0.64589",
"0.64563847",
"0.64493895",
"0.63991725",
"0.6389806",
"0.63888764",
"0.6375915",
"0.6328041",
"0.6328041",
"0.6328041",
"0.6328041",
"0.6328041",
... | 0.7514652 | 0 |
DELETE /maintenances/1 DELETE /maintenances/1.json | def destroy
@maintenance.destroy
respond_to do |format|
format.html { redirect_to maintenances_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maintenance_delete(statuspage_id, maintenance_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n\n request :method => :post,\n :url => @url + 'maintenance/delete',\n :payload => data\n end",
"def destroy\n @maintenanc... | [
"0.8331412",
"0.7939099",
"0.7935472",
"0.7862414",
"0.7558416",
"0.74912083",
"0.7472747",
"0.74543834",
"0.73387605",
"0.7301602",
"0.7150466",
"0.7117071",
"0.70894814",
"0.7012838",
"0.6959175",
"0.6882715",
"0.6878381",
"0.68614703",
"0.6659098",
"0.66317075",
"0.6612777... | 0.8165075 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_maintenance
@maintenance = Maintenance.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.6163821",
"0.6045432",
"0.5945441",
"0.5916224",
"0.58894575",
"0.5834073",
"0.57764685",
"0.5702474",
"0.5702474",
"0.5653258",
"0.56211996",
"0.54235053",
"0.5410683",
"0.5410683",
"0.5410683",
"0.53948104",
"0.5378064",
"0.5356684",
"0.53400385",
"0.53399503",
"0.533122... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def maintenance_params
params.require(:maintenance).permit(:vehicle_id, :work_order_no, :contract_id, :repaired_by, :supplied_by, :maintenance_date, :repair_date, :repair_location,:value_repaired, :value_supplied, maintenance_details_attributes: [:id, :line_item, :line_item_price, :quantity, :unit_type, :maintena... | {
"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 |
Adds to the instance methods include ActiveModel::Naming def foo include end Adds to the class methods extend ActiveModel::Naming def self.bar extend end | def initialize(user_ids)
@user_ids = user_ids
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_name_helpers; end",
"def method_missing(method_name, *args)\n if method_name.to_s.start_with?('add_')\n extend method_name.slice(4..-1).camelize.constantize\n else\n super\n end\n end",
"def included(model_class)\n super\n\n if ::ActiveRecord::VERSION::MAJOR... | [
"0.6509398",
"0.59611905",
"0.58870983",
"0.5885967",
"0.58577514",
"0.5784742",
"0.5744521",
"0.5739056",
"0.5604031",
"0.5603605",
"0.55231893",
"0.55018795",
"0.5485901",
"0.54802006",
"0.5457703",
"0.54398143",
"0.54362",
"0.5432496",
"0.54282016",
"0.539492",
"0.5381049"... | 0.0 | -1 |
genera un grafo casuale parametri: pbar > true se si desidera una barra di avanzamento file > specifica se salvare su file una rappresentazione grafica del grafo | def initialize(g, params = {})
require 'set'
params = { :pbar => false, :file => '', :color => true, :circo => false }.merge(params)
@pbar = params[:pbar]
file = params[:file]
color = params[:color]
circo = params[:circo]
if @pbar
require 'facets/progressbar'
@labelin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zapisGpFile(nazev, nactenySoubor)\r\n file = File.open(\"skripty_gnuplot\\/generuj_obrazek_#{nazev}.gp\", \"w\")\r\n file.puts(\"set terminal png\")\r\n file.puts(\"set title \\'Assembly ID #{nactenySoubor[0][1]}\\'\")\r\n file.puts(\"set key autotitle columnhead\")\r\n file.puts... | [
"0.5777977",
"0.5606829",
"0.5566212",
"0.55023503",
"0.5495362",
"0.54195017",
"0.538644",
"0.53464574",
"0.5343799",
"0.5298535",
"0.52940303",
"0.52384746",
"0.52262276",
"0.5225546",
"0.5202717",
"0.5201818",
"0.51991576",
"0.5192829",
"0.5183082",
"0.51677275",
"0.516440... | 0.0 | -1 |
def calcola il minimo intero escluso del vertic v | def mes(v,g)
l_succ = Set.new
g.adjacent_vertices(v).each { |sv| l_succ << @l[sv] }
i = 0
i += 1 until l_succ.member?(i) == false
@l[v] = i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min\n min = @valor[0][0]\n i = 0\n self.fil.times do |i|\n j = 0\n self.col.times do |j|\n if (@valor[i][j] < min)\n min = @valor[i][j]\n end\n j=j+1\n end\n i=i+1\n\tend\n min\n e... | [
"0.61523825",
"0.60692865",
"0.5974954",
"0.59657717",
"0.59543526",
"0.58505774",
"0.583909",
"0.58385235",
"0.5811189",
"0.57814825",
"0.577165",
"0.57616717",
"0.57553816",
"0.572287",
"0.5665508",
"0.56615067",
"0.5634423",
"0.56200665",
"0.5619541",
"0.5616454",
"0.56104... | 0.5429065 | 46 |
imposta etichette e contatori | def label_and_counter(g)
### il ciclo va ripetuto finché in @unlabeled_v non ci sono vertici che soddisfano le condizioni c1 e c2
continue = true
until continue == false
continue = false
@unlabeled_v.each do |v|
if (c1?(g,v) and c2?(g,v))
set_label(v,@i)
@c[v] = @m
@m += 1
continu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suivre; end",
"def reset()\n @actual =@inicio\n end",
"def imprimir\n maquina = \"Maquina \" + @nombre + \"\\n\" + \"Estado: \" + @estado\n \n puts maquina\n #-- Solo se imprimen los insumos asociados a la maquina en caso de \n #-- que esta se encuentre en estad... | [
"0.6590622",
"0.6154822",
"0.61308813",
"0.6002831",
"0.5986448",
"0.593677",
"0.5881778",
"0.58775",
"0.58410925",
"0.58122975",
"0.57829773",
"0.5776954",
"0.5704101",
"0.56780636",
"0.5654909",
"0.5635663",
"0.5621144",
"0.56034327",
"0.5598411",
"0.5559378",
"0.552281",
... | 0.0 | -1 |
def etichetta con il valore infinito | def inf_label(g)
@unlabeled_v.each do |u|
no_follower_labeled_i = true
g.adjacent_vertices(u).each do |v|
no_follower_labeled_i = false if @l[v] == @i.to_s
end # do
set_label(u,'inf') if no_follower_labeled_i
end # do
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valorizacao\n \t\tif self.tipo_de_operacao.compra?\n ((self.atual - self.entrada) / self.entrada) * 100.0\n else\n ((self.entrada - self.atual) / self.atual ) * 100.0\n end\n \tend",
"def valor_efetivado\n\t\tself.valor_total(1)\n\tend",
"def valor_energetico\n @proteinas * 4.0 + @carb... | [
"0.68692374",
"0.6585381",
"0.6478325",
"0.64028",
"0.63995135",
"0.63676083",
"0.6342589",
"0.628823",
"0.61812586",
"0.6180659",
"0.61545193",
"0.61485875",
"0.6146677",
"0.6142744",
"0.6071759",
"0.6054357",
"0.6053009",
"0.60444194",
"0.6032843",
"0.59807974",
"0.59805834... | 0.0 | -1 |
def imposta l'etichetta l sul vertice v | def set_label(v,l)
@l[v] = l.to_s
@unlabeled_v.delete(v)
@labeling_pbar.inc if @pbar
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vel\n @velocidad\n end",
"def vin; end",
"def conta_vicini(i,j,game)\n vicini = 0\n \n #### BORDI RIGIDI\n #if i > 0\n # vicini += 1 if game[:griglia][i-1][j]\n #end\n #if i > 0 && j > 0\n # vicini += 1 if game[:griglia][i-1][j-1]\n #end\n #if i > 0 && j < CELLE_PER_RIGA\n # vicini += 1 i... | [
"0.6193849",
"0.6029909",
"0.595299",
"0.58951783",
"0.5803323",
"0.5803323",
"0.5773302",
"0.5771724",
"0.56948245",
"0.56937206",
"0.5670863",
"0.5664426",
"0.5657052",
"0.56333756",
"0.56235003",
"0.56123704",
"0.56083906",
"0.55733454",
"0.5524221",
"0.55149424",
"0.54981... | 0.0 | -1 |
def soddisfa la condizione C1? | def c1?(g,u)
g.adjacent_vertices(u).each do |v|
if @l[v] == @i.to_s
return false
end # if
end # do
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def c1= c; @c1 = (c == 1) ? 1 : 0; end",
"def c2= c; @c2 = (c == 1) ? 1 : 0; end",
"def c0= c; @c0 = (c == 1) ? 1 : 0; end",
"def cac2\n 0\n end",
"def calculCouleur(cellule,clique)\n #Gestion du clique gauche\n if clique == CLIQUEGAUCHE\n couleur = cellule.clicGauche\n #Gestion duclique ... | [
"0.6857561",
"0.654582",
"0.64520735",
"0.6300182",
"0.60268813",
"0.60092354",
"0.59176266",
"0.59176266",
"0.59176266",
"0.5895465",
"0.58765584",
"0.5815769",
"0.5796105",
"0.5796105",
"0.5796105",
"0.5775147",
"0.5768066",
"0.57362854",
"0.5728627",
"0.56707305",
"0.56588... | 0.50921357 | 88 |
def soddisfa la condizione C2? | def c2?(g,u)
ok = false
g.adjacent_vertices(u).each do |v|
if (@l[v] == nil or @l[v] == 'inf')
g.adjacent_vertices(v).each do |z|
if @l[z] == @i.to_s
ok = true
break
end # if
ok = false
end # do
if ok == false
return false
end # if
end # if
end # do
return true
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cac2\n 0\n end",
"def c2= c; @c2 = (c == 1) ? 1 : 0; end",
"def c1= c; @c1 = (c == 1) ? 1 : 0; end",
"def c0= c; @c0 = (c == 1) ? 1 : 0; end",
"def cops; end",
"def cops; end",
"def cops; end",
"def getc() end",
"def getc() end",
"def getc() end",
"def sub_c\n end",
"def mi_carre... | [
"0.6869865",
"0.68327856",
"0.63809335",
"0.61795604",
"0.616542",
"0.616542",
"0.616542",
"0.60919327",
"0.60919327",
"0.60919327",
"0.60755366",
"0.5931729",
"0.5929745",
"0.5902296",
"0.58613074",
"0.58610666",
"0.58171797",
"0.5793119",
"0.5768771",
"0.5710903",
"0.567787... | 0.5291959 | 54 |
def restituisce il valore massimo della funzione di SpragueGrundy | def max_sg_value
@l.values.max
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grasa\n\t\t1.2*imc+0.23*@edad-10.8*@sexo-5.4\n\tend",
"def grasa(sexo,peso,talla)\n\t\t@grasa = 1.2*imc(peso,talla)+0.23*@edad-10.8*sexo-5.4\n\tend",
"def suivre; end",
"def deaf_grandma\nend",
"def candidatGrille()\n\n\tend",
"def get_grasas\n @_100=((@grasas*100)/@peso)\n ... | [
"0.6314189",
"0.62779653",
"0.62380105",
"0.61667967",
"0.6135441",
"0.61254567",
"0.6048508",
"0.603933",
"0.5997799",
"0.5954912",
"0.591061",
"0.5833786",
"0.58095944",
"0.5780889",
"0.5780198",
"0.5745136",
"0.57250077",
"0.5719805",
"0.5678469",
"0.56580096",
"0.55887794... | 0.0 | -1 |
def restituisce il numero di vertici con etichetta 0 | def zeros
counter = 0
@l.each_value do |v|
counter +=1 if v == '0'
end # do
counter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertikal_bewegen(anzahl)\n bewegen_um_punkt(Punkt.new(0,anzahl))\n end",
"def nonzero_element_count\n @row_index.last\n end",
"def number_empty_cells_in_own_cube_column\n return 1\n end",
"def condicao_inicial p\n\t\tif @count == @count_ant\n\t\t\t@menor_peso = p\n\t\t\t@count += 1\n\t\t\t... | [
"0.61256826",
"0.5855334",
"0.57738906",
"0.5698614",
"0.5696905",
"0.56927115",
"0.5691197",
"0.5649538",
"0.5640687",
"0.5640687",
"0.5606693",
"0.5597936",
"0.55669034",
"0.55629027",
"0.5543083",
"0.554056",
"0.5516385",
"0.54884887",
"0.54815865",
"0.5474143",
"0.5470303... | 0.510532 | 91 |
def restituisce il numero di vertici con etichetta intera diversa da 0 | def positives
@l.size - zeros - infs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def huella\n\t\tindice1 = 0\n\t\t#dependiendo del vct de cada ingrediente, se le pone un indice\n\t\tif vct < 670\n\t\t\tindice1 = 1\n\t\t\t\n\t\telsif vct > 830\n\t\t\tindice1 = 3\n\t\telse \n\t\t\tindice1 = 2\n\t\tend \n\t\tindice2 = 0\n\t\t#dependiendo de los gases emitidos de cada ingrediente, \n\t\t#se le pon... | [
"0.6029978",
"0.595939",
"0.5942305",
"0.5901976",
"0.58827627",
"0.5820868",
"0.57772404",
"0.57393014",
"0.5680041",
"0.5670447",
"0.56485915",
"0.5599285",
"0.5574884",
"0.55569947",
"0.55492324",
"0.5548203",
"0.55276066",
"0.5521603",
"0.5504024",
"0.55003977",
"0.548765... | 0.0 | -1 |
def restituisce il numero di vertici con etichetta infinito | def infs
counter = 0
@l.each_value do |v|
counter +=1 if v == 'inf'
end # do
counter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def condicao_inicial p\n\t\tif @count == @count_ant\n\t\t\t@menor_peso = p\n\t\t\t@count += 1\n\t\t\t@vertices_menor_peso = []\n\t\tend\n\tend",
"def countNbVides()\n @nbVides = 0\n\n @grille.each do |ligne|\n ligne.each do |c|\n if( c[\"value\"] == nil)\n ... | [
"0.5896679",
"0.58054626",
"0.57506686",
"0.5729901",
"0.5666004",
"0.5663402",
"0.5663402",
"0.5654003",
"0.5600708",
"0.55617774",
"0.5560276",
"0.5560276",
"0.5552117",
"0.55391496",
"0.5526099",
"0.5526099",
"0.5470272",
"0.54695714",
"0.54578793",
"0.5446217",
"0.539963"... | 0.0 | -1 |
def conta il numero di vertici U, D, E | def count_ude(g)
@ude_counter['u'] = zeros
zeros_v = []
@l.each do |k,v|
zeros_v << k if v == 'inf'
end # do
d_v_counter = 0
zeros_v.each do |zv|
no_follower_labeled_zero = true
g.adjacent_vertices(zv).each do |v|
no_follower_labeled_zero = false if @l[v] == '0'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertical size, coordinates\n coords = []\n sc = coordinates[0]\n coords << sc\n (size - 1).times do\n coords << sc.next\n sc = sc.next\n end\n coords.map {|x| x + \"#{coordinates[1..-1]}\"}\n end",
"def vat_number; end",
"def cols\n directions.count('r') + 1\n end",
"de... | [
"0.60714537",
"0.60260046",
"0.5985435",
"0.59837097",
"0.5866214",
"0.5836598",
"0.5836598",
"0.5805881",
"0.5801368",
"0.5791248",
"0.57780695",
"0.57524943",
"0.57518476",
"0.5736196",
"0.57239985",
"0.57070476",
"0.57055235",
"0.5691835",
"0.5679261",
"0.5666277",
"0.5657... | 0.6491275 | 0 |
def stampa a video le statistiche sul numero di U, D, E e il valore massimo della funzione di SpragueGrundy | def stats(g)
puts "Numero di stati U: #{@ude_counter['u']}"
puts "Numero di stati D: #{@ude_counter['d']}"
puts "Numero di stati E: #{@ude_counter['e']}"
puts "---------------------"
puts "Valore massimo della funzione di SG: #{max_sg_value}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valormonograsasp\n\t\tvag=(grasasmono * 70) / 100\n vag.round(2)\n\tend",
"def grasa\n\t\t1.2*imc+0.23*@edad-10.8*@sexo-5.4\n\tend",
"def irgrasassaturadasp\n vag=(valorgrasassatup * 100) / 70\n vag.round(2)\n end",
"def grasa(sexo,peso,talla)\n\t\t@gra... | [
"0.6268306",
"0.61451244",
"0.6131789",
"0.61216944",
"0.60459435",
"0.60414606",
"0.5959198",
"0.5945798",
"0.5934861",
"0.589725",
"0.58865416",
"0.588226",
"0.58773655",
"0.58757013",
"0.58693856",
"0.58364856",
"0.5747887",
"0.57431316",
"0.5741851",
"0.5733637",
"0.57110... | 0.6922317 | 0 |
Generate puppet manifest for the creation of an environment with the given modulepath and manifest and env_name. The created environment will have on testing_mod module, and manifest site.pp which includes it. | def generate_environment(options)
modulepath = options[:modulepath]
manifestpath = options[:manifestpath]
env_name = options[:env_name]
environment = <<-MANIFEST_SNIPPET
file {
###################################################
# #{env_name}
#{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def environment_manifest(testdir)\n manifest = <<-MANIFEST\n File {\n ensure => directory,\n owner => puppet,\n mode => 0700,\n }\n\n file { \"#{testdir}\": }\n\n #{generate_environment(\n :modulepath => \"#{testdir}/modules\",\n ... | [
"0.77816594",
"0.6669222",
"0.6488334",
"0.62136734",
"0.6055612",
"0.5804541",
"0.5722499",
"0.5616112",
"0.54570365",
"0.5430926",
"0.53956914",
"0.5387099",
"0.538212",
"0.53123856",
"0.52758276",
"0.5275478",
"0.52416533",
"0.5221375",
"0.5221375",
"0.5221375",
"0.5221375... | 0.7570455 | 1 |
Generate one module's manifest code. | def generate_module(module_name, env_name, modulepath)
module_pp = <<-MANIFEST_SNIPPET
"#{modulepath}":;
"#{modulepath}/#{module_name}":;
"#{modulepath}/#{module_name}/manifests":;
"#{modulepath}/#{module_name}/manifests/init.pp":
ensure => file,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manifest_name\n \"MANIFEST.#{name}\"\n end",
"def generate_manifests_file\n generate_file_from_template(\"#{templates_path}/puppet/roles/manifests/init.pp.erb\", \"#{self.path}/manifests/init.pp\", {role: self})\n end",
"def manifest(m)\r\n load_paths = load_paths('lazydoc', 'confi... | [
"0.66090965",
"0.66009605",
"0.6504168",
"0.6390834",
"0.63595355",
"0.6289036",
"0.62641996",
"0.62155026",
"0.61350185",
"0.611797",
"0.6105472",
"0.60564846",
"0.604565",
"0.60248554",
"0.59843284",
"0.597262",
"0.59708303",
"0.59339106",
"0.5898972",
"0.58623165",
"0.5815... | 0.7185725 | 0 |
Default, legacy, dynamic and directory environments using generate_manifest(), all rooted in testdir. | def environment_manifest(testdir)
manifest = <<-MANIFEST
File {
ensure => directory,
owner => puppet,
mode => 0700,
}
file { "#{testdir}": }
#{generate_environment(
:modulepath => "#{testdir}/modules",
:manifestp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_base_directory_environments(tmpdir)\n puppet_conf = \"#{tmpdir}/puppet2.conf\"\n dir_envs = \"#{tmpdir}/environments\"\n\n step 'Configure a the direnv directory environment'\n apply_manifest_on master, %Q{\n File {\n ensure => directory,\n ow... | [
"0.6430996",
"0.63868946",
"0.6370377",
"0.60640186",
"0.5971913",
"0.5947117",
"0.5945614",
"0.593489",
"0.58854204",
"0.58375424",
"0.5771911",
"0.5756564",
"0.57261264",
"0.571051",
"0.5698931",
"0.56609863",
"0.56506896",
"0.5642001",
"0.56390715",
"0.5625417",
"0.5606207... | 0.7725381 | 0 |
Stand up a puppet master on the master node with the given master_opts using the passed confdir as the confdir setting, and then run through a series of environment tests for the passed environment and return a hashed structure of the results. | def use_an_environment(environment, description, master_opts, confdir, options = {})
ssldir = on(master, puppet("master --configprint ssldir")).stdout.chomp
master_puppet_conf = master_opts.dup # shallow clone
master_puppet_conf[:__commandline_args__] = "--confdir=#{confdir} --ssldir=#{ssldir}"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_puppet(mode='master', passed_opts=nil)\n\n if mode.eql?('master')\n opts = {\n :expected_exitcode => 0\n }.merge!(passed_opts)\n\n self.run('puppet agent -t', opts[:expected_exitcode])\n\n elsif mode.eql?('masterless')\n opts = {\n :expected_exitcode => 2,\n :... | [
"0.65424204",
"0.61793333",
"0.6005224",
"0.5840391",
"0.5483748",
"0.52970666",
"0.52952135",
"0.521777",
"0.51945156",
"0.51316035",
"0.51156825",
"0.50960344",
"0.5090016",
"0.50730115",
"0.50655013",
"0.5052939",
"0.5042971",
"0.5034878",
"0.50318784",
"0.50246733",
"0.50... | 0.7159768 | 0 |
Rest of the java interface | def life_cycle_failure(app, cause) ; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def implementation; end",
"def implementation; end",
"def interface; end",
"def interface; end",
"def private; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def internal; end",
"def methods() end",
"def custom; end",
"def custom; end",
"def extende... | [
"0.82489085",
"0.82489085",
"0.8126396",
"0.8126396",
"0.80023164",
"0.72903347",
"0.72903347",
"0.72903347",
"0.72903347",
"0.71845424",
"0.7072361",
"0.69719136",
"0.69719136",
"0.6955067",
"0.6941806",
"0.68917435",
"0.68917435",
"0.6863823",
"0.686131",
"0.6852404",
"0.68... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.