query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
POST /image_paths POST /image_paths.xml | def create
@image_path = ImagePath.new(params[:image_path])
respond_to do |format|
if @image_path.save
flash[:notice] = 'ImagePath was successfully created.'
format.html { redirect_to(@image_path) }
format.xml { render :xml => @image_path, :status => :created, :location => @image... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def element\n image_name_list = get_image_name_list ORIGINALS_PATH\n image_name_list.each { |image_name| post(image_name) }\n end",
"def make_request(img_paths)\n # Load contents of the imagefiles and instantiate Google::Apis::VisionV1::Image objects\n img_data = img_paths.map { |p| File.open(p).rea... | [
"0.6240876",
"0.5513908",
"0.5493714",
"0.5417255",
"0.5392265",
"0.5390093",
"0.53345364",
"0.5307892",
"0.5270956",
"0.5249065",
"0.5232015",
"0.523189",
"0.523189",
"0.5208456",
"0.5186416",
"0.5184379",
"0.5132494",
"0.5111202",
"0.51083183",
"0.510389",
"0.50965774",
"... | 0.5596245 | 1 |
PUT /image_paths/1 PUT /image_paths/1.xml | def update
@image_path = ImagePath.find(params[:id])
respond_to do |format|
if @image_path.update_attributes(params[:image_path])
flash[:notice] = 'ImagePath was successfully updated.'
format.html { redirect_to(@image_path) }
format.xml { head :ok }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(path = '/files/', params = {})\n request :put, path, params\n end",
"def update\n\n params = image_params\n params[\"tags\"] = params[\"tags\"].delete_suffix(',')\n\n respond_to do |format|\n if @image.update(params)\n format.html { redirect_to @image, notice: \"Image was suc... | [
"0.6095052",
"0.5699765",
"0.56992865",
"0.5659542",
"0.56241524",
"0.56241524",
"0.56108135",
"0.5590362",
"0.5552536",
"0.55395144",
"0.5532609",
"0.5496175",
"0.5492888",
"0.5485352",
"0.5474991",
"0.54723066",
"0.54717857",
"0.5469874",
"0.5453326",
"0.5435665",
"0.543083... | 0.6370364 | 0 |
DELETE /image_paths/1 DELETE /image_paths/1.xml | def destroy
@image_path = ImagePath.find(params[:id])
@image_path.destroy
respond_to do |format|
format.html { redirect_to(image_paths_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @img = Img.find(params[:id])\n @img.destroy\n\n respond_to do |format|\n format.html { redirect_to(imgs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n \n imagen = @image.filename\n \n #function in manage_images... | [
"0.6799447",
"0.67660975",
"0.6710873",
"0.66433656",
"0.66433656",
"0.66433656",
"0.66241515",
"0.6623799",
"0.6623578",
"0.65880513",
"0.6587223",
"0.6548239",
"0.65446794",
"0.6543704",
"0.65315104",
"0.65198755",
"0.6518764",
"0.65038085",
"0.65017927",
"0.64876753",
"0.6... | 0.7535475 | 0 |
PATCH/PUT /therapists/1 PATCH/PUT /therapists/1.json | def update
respond_to do |format|
if @therapist.update(therapist_params)
format.html { redirect_to @therapist, notice: 'Therapist was successfully updated.' }
format.json { render :show, status: :ok, location: @therapist }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n if @therapist.update_attributes(params[:therapist])\n format.html { redirect_to @therapist, notice: 'Therapist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html... | [
"0.6600802",
"0.64254564",
"0.62123835",
"0.6177276",
"0.59769326",
"0.5938455",
"0.5935275",
"0.58813494",
"0.58594966",
"0.58484775",
"0.58376294",
"0.5820418",
"0.5815003",
"0.57989615",
"0.57927454",
"0.5791307",
"0.5763348",
"0.5754602",
"0.5751635",
"0.57411397",
"0.573... | 0.67339206 | 1 |
Helper method to ensure wait time with additional buffer | def wait_until_with_buffer(args, &block)
original_timeout = args[:timeout] || ENV['WAIT_TIMEOUT'].to_i
args_buffered = args.dup
args_buffered[:timeout] = 60
start_time = Time.now
Frank::Cucumber::WaitHelper.wait_until(args_buffered) { block.call() }
end_time = Time.now
delta = end_time - start_time
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_readable_or_timeout; end",
"def wait_until_not_full; end",
"def wait_writable_or_timeout; end",
"def wait; end",
"def wait; end",
"def wait; end",
"def wait_for_rx\n sleep DATA_REFRESH_RATE + @latency\n end",
"def wait\n sleep WAIT_TIME unless @skip_wait\n end",
"def wait\n ... | [
"0.697314",
"0.6893673",
"0.65395635",
"0.65077627",
"0.65077627",
"0.65077627",
"0.64972615",
"0.6451797",
"0.63891727",
"0.6375768",
"0.63728917",
"0.6355762",
"0.6327225",
"0.62768304",
"0.62280184",
"0.62280184",
"0.616895",
"0.6149683",
"0.6135843",
"0.61253667",
"0.6086... | 0.6911476 | 1 |
Expected options: :output_dir: A folder to dump filtered sql files into. This folder will be emptied before running the dump. :mysql_options: Command line options to pass mysql (e.g. u root some_db_name). :db_connection: An active record connection to the database to dump. :column_filters: A hash of column types to fil... | def initialize(options = {})
self.output_dir = options[:output_dir]
self.mysql_options = options[:mysql_options]
self.db_connection = options[:db_connection]
self.column_filters = (options[:column_filters] || {}).stringify_keys!
self.table_filters = (options[:table_filters] || []).map(&:to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dump_tables(opts)\n if opts[:schema]\n _literal_table_sort(tables(opts.merge(:qualify=>true)))\n else\n tables(opts).sort\n end\n end",
"def dump(db = config[\"database\"], data_selection: {})\n file_namer = Postgres::FileNameGenerator.new(working_dir)\n exclude_tab... | [
"0.60283154",
"0.589884",
"0.5849439",
"0.57685965",
"0.5689041",
"0.56366765",
"0.5518343",
"0.5504224",
"0.5498455",
"0.54618114",
"0.54434943",
"0.5412365",
"0.53963107",
"0.53621936",
"0.5312326",
"0.52636266",
"0.52486044",
"0.52257913",
"0.5223067",
"0.5200668",
"0.5179... | 0.7232968 | 0 |
Execute the mysqldump command for the given table. Any column or table filters will be applied. | def dump_table(table)
conditions = conditions_for(table)
cmd = "mysqldump #{ mysql_options } --tables #{ table }"
cmd += " \"--where=#{ conditions }\"" if conditions.present?
if post_dump_command
cmd += "| #{post_dump_command}"
end
cmd += " > #{ output_dir }/#{ table }#{fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump\n check_dependencies('mysqldump', 'bzip2', '/bin/sh')\n options = {}\n while arg = args.shift\n case arg\n when '-f', '--force'\n options[:force] = true\n when /^[^-]/\n raise CommandFailed, \"too many arguments passed\" if options[:filename]\n ... | [
"0.58444566",
"0.57970226",
"0.5688865",
"0.56162184",
"0.5516886",
"0.5512034",
"0.5509626",
"0.5462216",
"0.5455626",
"0.54280394",
"0.5311821",
"0.52377546",
"0.5107581",
"0.50713354",
"0.50572675",
"0.5049411",
"0.5007488",
"0.49645013",
"0.4902564",
"0.48862857",
"0.4852... | 0.78548235 | 0 |
Any conditions that should be used to filter table based on type | def column_filter_conditions_for(table, type)
values = column_filters[type].join(', ')
foreign_key = type.singularize.foreign_key
if table == type
"\\`id\\` in (#{ values })"
elsif columns_for(table).include?(foreign_key)
"\\`#{ foreign_key }\\` in (#{ values })"
end
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_conditions(type)\n sql = ' WHERE ' + (T_DELETABLE.include?(type) ? 'deleted_at IS NULL AND ' : '')\n\n if T_LISTS.include? type\n check_api_token\n\n unless @current_user\n return 'ERROR'\n end\n\n id = @current_user.theatre_id\n\n if type == 'theatres' && id != 0\n ... | [
"0.70685226",
"0.7011513",
"0.6773623",
"0.67075807",
"0.65949965",
"0.6562494",
"0.65536016",
"0.65347576",
"0.64803755",
"0.6434349",
"0.64013046",
"0.6395308",
"0.6290136",
"0.6280743",
"0.6252328",
"0.6252328",
"0.62393916",
"0.6214773",
"0.6202415",
"0.6193779",
"0.61319... | 0.7718533 | 0 |
A list of all tables in the db | def tables
db_connection.select_values("show tables")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tables\n execute(\"SHOW TABLES FROM #{@opts[:database]}\")\n .map{ |i| i.values }\n .reduce(:+)\n .map{ |i| i.to_sym }\n end",
"def tables()\n tables = []\n @client.query(\"SHOW TABLES;\").each do |table|\n tables.push(table.values[0... | [
"0.8499479",
"0.83081716",
"0.81848574",
"0.81427336",
"0.80861485",
"0.80534613",
"0.7979202",
"0.7953699",
"0.79384804",
"0.79357654",
"0.7846949",
"0.7829539",
"0.7824308",
"0.7812821",
"0.78055245",
"0.77726704",
"0.7763799",
"0.7755373",
"0.7754824",
"0.77542955",
"0.769... | 0.84634954 | 1 |
A list of all columns for table | def columns_for(table)
db_connection.select_values("show columns from `#{ table }`")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_columns\n columns\n end",
"def table_columns\n klass.column_names\n end",
"def all\n __getobj__.column_names\n end",
"def get_table_column_names(table)\r\n @db[table].columns\r\n end",
"def columns(table_name)\n @db.table_info(table_name).map { |info| info[\"name... | [
"0.8558935",
"0.80598795",
"0.7951822",
"0.7878924",
"0.7862773",
"0.78619456",
"0.78464586",
"0.7842156",
"0.78395635",
"0.78395635",
"0.7834244",
"0.7816846",
"0.7771062",
"0.7770335",
"0.7751243",
"0.77316546",
"0.7706285",
"0.7704942",
"0.7699515",
"0.76968247",
"0.769595... | 0.8322581 | 1 |
GET /married_statuses GET /married_statuses.json | def index
@married_statuses = MarriedStatus.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end",
"def set_married_status\n @married_status = MarriedStatus.find(params[:id])\n end",
"def show_status(status_id)\n get \"statuses/show/#{status_id}\"\n end",
"def update\n respond_to do |forma... | [
"0.64134794",
"0.63754165",
"0.59984237",
"0.595277",
"0.59112424",
"0.5827594",
"0.5805667",
"0.5798412",
"0.57732296",
"0.56787175",
"0.5674036",
"0.56538707",
"0.56222755",
"0.56222755",
"0.56143117",
"0.55412096",
"0.55409783",
"0.55313104",
"0.5514922",
"0.5490368",
"0.5... | 0.7358902 | 0 |
POST /married_statuses POST /married_statuses.json | def create
@married_status = MarriedStatus.new(married_status_params)
respond_to do |format|
if @married_status.save
format.html { redirect_to @married_status, notice: 'Married status was successfully created.' }
format.json { render :show, status: :created, location: @married_status }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def married_status_params\n params.require(:married_status).permit(:name)\n end",
"def create_statuses\n end",
"def create_statuses\n end",
"def index\n @married_statuses = MarriedStatus.all\n end",
"def set_married_status\n @married_status = MarriedStatus.find(params[:id])\n end",
... | [
"0.647825",
"0.6294594",
"0.6294594",
"0.6277677",
"0.6146193",
"0.59509134",
"0.58110416",
"0.5783689",
"0.57458234",
"0.56536686",
"0.56203765",
"0.55974174",
"0.5560564",
"0.55356175",
"0.551086",
"0.55105096",
"0.5473909",
"0.54488045",
"0.54235417",
"0.53783315",
"0.5369... | 0.6917205 | 0 |
PATCH/PUT /married_statuses/1 PATCH/PUT /married_statuses/1.json | def update
respond_to do |format|
if @married_status.update(married_status_params)
format.html { redirect_to @married_status, notice: 'Married status was successfully updated.' }
format.json { render :show, status: :ok, location: @married_status }
else
format.html { render :edit ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @current_statuses.update(current_statuses_params)\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully updated.' }\n format.json { render :show, status: :ok, location: @current_statuses }\n else\n format... | [
"0.6699571",
"0.6523629",
"0.65057445",
"0.6272926",
"0.62283516",
"0.6162448",
"0.6126403",
"0.6071017",
"0.6068237",
"0.60560423",
"0.604338",
"0.60276586",
"0.60276586",
"0.6022956",
"0.6012158",
"0.5965091",
"0.59637815",
"0.593372",
"0.5921117",
"0.5921117",
"0.59066504"... | 0.7180156 | 0 |
DELETE /married_statuses/1 DELETE /married_statuses/1.json | def destroy
@married_status.destroy
respond_to do |format|
format.html { redirect_to married_statuses_url, notice: 'Married status was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_status(status_id)\n delete \"statuses/destroy/#{status_id}\"\n end",
"def delete_status(id)\n delete(\"/statuses/#{id}\")\n end",
"def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url }\n format.json { head :no_content }\n ... | [
"0.7316664",
"0.7198055",
"0.7114044",
"0.7109347",
"0.7086772",
"0.707513",
"0.7041838",
"0.7009426",
"0.6996029",
"0.6927694",
"0.6922116",
"0.6827844",
"0.68117946",
"0.6797788",
"0.6797788",
"0.67199755",
"0.6717694",
"0.6704238",
"0.6693786",
"0.6670758",
"0.6669584",
... | 0.7700158 | 0 |
Build Apartments using their description and features. Get HTML, then parse it and collect parameters. | def build(apartment_url)
@apartment = Nokogiri::HTML(Net::HTTP.get(URI(apartment_url)))
description = apartment_description
features = apartment_features
description['apartment_features'] = features
Apartments.new(description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\n if params[:sample]\n analyse = Ca::Analyse.new(HTMLReader.instance.page(params[:sample][:address]));\n end\n if params[:text]\n analyse = Ca::Analyse.new(params[:text][:content]);\n end\n descript = analyse.description\n @problems = descript.problems\n @text = de... | [
"0.5359373",
"0.53573185",
"0.52481955",
"0.52323633",
"0.5228217",
"0.5209506",
"0.5098252",
"0.50677514",
"0.505511",
"0.505511",
"0.505511",
"0.5024265",
"0.49952686",
"0.49942705",
"0.49534038",
"0.49341407",
"0.49321362",
"0.49249387",
"0.4918939",
"0.49103743",
"0.48976... | 0.7131718 | 0 |
Makes common apartments description. Hash, based on constant APARTMENT_DESCRIPTION, first merge it, then find unique description | def apartment_description
apartment_description = {}
apartment_description.merge!(APARTMENT_DESCRIPTION)
apartment_description.keys.each { |key| apartment_description[key] = send(apartment_description[key]) }
apartment_description
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_info_description(info, val)\n\t\tmerge_info_string(info, 'Description', val)\n\tend",
"def merge_description_notes\n src_notes = @src.all_notes\n dest_notes = @dest.all_notes\n src_notes.each_key do |f|\n if dest_notes[f].blank?\n dest_notes[f] = src_notes[f]\n el... | [
"0.58629906",
"0.5643776",
"0.5629066",
"0.55231047",
"0.5436626",
"0.5427282",
"0.53373724",
"0.5335062",
"0.5315231",
"0.53100395",
"0.5269072",
"0.5264237",
"0.52463824",
"0.5243661",
"0.523188",
"0.5208591",
"0.52035874",
"0.51994884",
"0.5180714",
"0.5176603",
"0.5171239... | 0.6304396 | 0 |
Makes common apartments features. Hash, based on constant APARTMENT_FEATURES, first merge it, then find unique features | def apartment_features
apartment_features = {}
apartment_features.merge!(APARTMENT_FEATURES)
features_unavailable.each { |feature| apartment_features[feature] = false }
apartment_features
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end",
"def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end",
"def selected_features(activating_contexts, active_contexts)\n concerned = concerned_features(activat... | [
"0.5694013",
"0.5694013",
"0.54719406",
"0.5449497",
"0.5445721",
"0.54392433",
"0.5367435",
"0.5349743",
"0.53452206",
"0.5340121",
"0.531569",
"0.5293815",
"0.52930105",
"0.5287015",
"0.52672917",
"0.52443814",
"0.52270395",
"0.52179515",
"0.5188723",
"0.5186548",
"0.516943... | 0.6113703 | 0 |
Courses related to the Cluster | def courses
@courses ||= CourseList.new(:cluster => slug.gsub('-', ' ')).
sort_by { |c| c.title + c.edition }.
uniq { |c| c.code + c.edition }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def courses\n [self]\n end",
"def courses\n course_list = []\n \n semesters.collect do |semester|\n course_list << semester.cis_courses\n end\n \n course_list << course_bin.cis_courses\n \n return course_list\n end",
"def courses\n Content::Courses.new(token: @token)\n ... | [
"0.6577266",
"0.64513713",
"0.64507455",
"0.6379219",
"0.63550264",
"0.6263102",
"0.62602764",
"0.6251284",
"0.6235173",
"0.6113608",
"0.60380566",
"0.5993471",
"0.5989406",
"0.5977029",
"0.5928846",
"0.5905281",
"0.5895975",
"0.58901745",
"0.5882325",
"0.5856688",
"0.5842029... | 0.6826941 | 0 |
Store a global content data object as a part of content data keeping service. If type is full flush then content data is saved as it. Otherwise incremental diff of comparison with the latest saved file is calculated and saved. In the later case content data objects containing data regarding added files and removed file... | def add(is_full_flush)
content_data = $local_content_data
return if content_data.empty?
# for the latest content data added to the DB
latest_snapshot = nil
# for instances that were added regarding latest_snapshot
added_cd = nil
# for insrances that were removed regarding late... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def global_data\n @global_data ||= DataStore.new(File.expand_path(\"global_data.json\", home_path))\n end",
"def save(content_data, type, from, till)\n filename = DiffFile.compose_filename(type, from, till)\n path = case type\n when DiffFile::SNAPSHOT_TYPE\n File.join(... | [
"0.5787639",
"0.57433087",
"0.5566787",
"0.55094874",
"0.54253364",
"0.5327555",
"0.53268236",
"0.5261412",
"0.5210791",
"0.51719934",
"0.51689905",
"0.51689905",
"0.51615727",
"0.5160665",
"0.5109377",
"0.5072805",
"0.505124",
"0.50323355",
"0.5016275",
"0.49901885",
"0.4990... | 0.5880467 | 0 |
and returns true if the string includes all the letters in the alphabet and false otherwise "the quick brown fox jumps over the lazy dog" | def string_has_all_letters(str)
result = {}
str.each_char do |c|
return true if result.length == 26
if c == " "
next
elsif !result.include?(c)
result[c] = c
end
end
result.length == 26 ? true : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_letters? str\r\n str[/[a-zA-z]+/] == str\r\nend",
"def letters?(word)\n\t\t# Split word and check if each letter is within the range a-z\n\t\tword.split('').each do |letter| # Use each loop as it is slightly better in performance, 'letter' iterator is encapsulated in a way that it cannot be accessed bey... | [
"0.8151747",
"0.76416415",
"0.7584866",
"0.7579621",
"0.75392896",
"0.7463846",
"0.7459924",
"0.74596894",
"0.73800147",
"0.7341007",
"0.7337289",
"0.7306161",
"0.73020756",
"0.7297379",
"0.7256316",
"0.7241348",
"0.7197539",
"0.7149373",
"0.7136688",
"0.7136688",
"0.7136688"... | 0.7732584 | 1 |
Query relation tuples Get all relation tuples that match the query. Only the namespace field is required. | def get_relation_tuples(namespace, opts = {})
data, _status_code, _headers = get_relation_tuples_with_http_info(namespace, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_relation_tuples_with_http_info(namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReadApi.get_relation_tuples ...'\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && nam... | [
"0.64533687",
"0.5897142",
"0.58628005",
"0.5677368",
"0.55983114",
"0.555004",
"0.555004",
"0.5404969",
"0.5391372",
"0.53506917",
"0.5291705",
"0.52539784",
"0.52229613",
"0.51843756",
"0.51743656",
"0.51691085",
"0.5137401",
"0.51104915",
"0.50819343",
"0.50815237",
"0.504... | 0.70719904 | 0 |
Query relation tuples Get all relation tuples that match the query. Only the namespace field is required. | def get_relation_tuples_with_http_info(namespace, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ReadApi.get_relation_tuples ...'
end
# verify the required parameter 'namespace' is set
if @api_client.config.client_side_validation && namespace.nil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_relation_tuples(namespace, opts = {})\n data, _status_code, _headers = get_relation_tuples_with_http_info(namespace, opts)\n data\n end",
"def tuples\n results = run_tuples(@last_query_context.to_sparql_select)\n results[\"results\"][\"bindings\"].map do |h|\n h.keys.each do... | [
"0.70719904",
"0.5897142",
"0.58628005",
"0.5677368",
"0.55983114",
"0.555004",
"0.555004",
"0.5404969",
"0.5391372",
"0.53506917",
"0.5291705",
"0.52539784",
"0.52229613",
"0.51843756",
"0.51743656",
"0.51691085",
"0.5137401",
"0.51104915",
"0.50819343",
"0.50815237",
"0.504... | 0.64533687 | 1 |
Set the unformatted schema name for the given model / connection class EX: class User 'users_db' User.table_name_prefix => 'users_db.' User.table_name => 'users_db.users' | def schema_name=schema_name
self.table_name_prefix = "#{schema_name}." if schema_name && !schema_name.blank?
self.table_name = "#{self.table_name_prefix}#{self.table_name}" unless self.abstract_class?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_schema(schema)\n define_class_method(:schema) {schema.to_s.to_sym}\n end",
"def schema_name\n return self.table_name.split('.')[0] if self.table_name && self.table_name =~ /\\./\n return self.table_name_prefix.to_s.gsub(/\\./,'') if self.table_name_prefix && self.table_name_prefix =... | [
"0.7063645",
"0.665204",
"0.6544634",
"0.65237355",
"0.63980806",
"0.63883513",
"0.6381655",
"0.6375005",
"0.6353489",
"0.6264394",
"0.62488264",
"0.62342995",
"0.6219615",
"0.61584246",
"0.60872304",
"0.60706234",
"0.60491985",
"0.60254496",
"0.6018481",
"0.60173607",
"0.600... | 0.72890466 | 0 |
Collects all contained fields. | def all_fields
found_fields = Array.new
self.fields.each do |field|
found_fields << field
found_fields = found_fields + field.all_fields if field.type == 'ObjectField'
end
found_fields
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_fields\n fields.values\n end",
"def all_fields\n @fields.values\n end",
"def fields\n @fields ||= self.class.fields.collect { |f| f.clone_for(self) }\n end",
"def fetch_fields\n @fields\n end",
"def fields\n @_fields ||= {}\n end",
"def all_fields\n superc... | [
"0.7575919",
"0.75224596",
"0.7179399",
"0.707724",
"0.70342255",
"0.6961201",
"0.69537",
"0.69453555",
"0.6915724",
"0.69142556",
"0.69055235",
"0.68843734",
"0.68843734",
"0.68843734",
"0.68843734",
"0.68843734",
"0.68798184",
"0.6860387",
"0.68035775",
"0.6751277",
"0.6727... | 0.7798035 | 0 |
push counts of c_i^d = k | def push(_d, _i, _k)
abort("invalid push") if @c[_d][_i] != nil
@c[_d][_i] = _k
# push to @Cp
@Cp[_d][_k] += 1
# push to @Ce
vkey = Array.new(@d){|d| 0}
vkey[_d] = _i
begin
ckey = vkey2ckey(vkey)
@Ce[ckey][ @A[vkey] ] += 1
end while (vkey = succ_vkey_d(vkey, _d)) != ni... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(r)\n c = Hash.new(0)\n r.each { |z| c[z] += 1}\n c\nend",
"def accum_counts(counts)\n each_byte do |b| counts[b - ?a] += 1 if b >= ?a && b <= ?z end\n end",
"def value_counts\n values = @data.each_with_object(Hash.new(0)) do |d, memo|\n memo[d] += 1\n end\n\n... | [
"0.60302407",
"0.58939534",
"0.58923584",
"0.57873565",
"0.5749837",
"0.57431436",
"0.57389754",
"0.57326794",
"0.57213223",
"0.5686016",
"0.56297314",
"0.56034267",
"0.5586053",
"0.5566902",
"0.5560124",
"0.54522985",
"0.5439403",
"0.54251623",
"0.54156923",
"0.5397596",
"0.... | 0.73087424 | 0 |
cal log marginal likelihood | def cal_log_ml
lml = 0
# log p(c^d | \alpha)
for d in 0..@d-1
lml += cal_log_Z(@c[d], @a)
end
# log p(A | c, \beta)
@Ce.keys.each do |ckey|
lml += cal_log_Z(@Ce[ckey], @b)
end
lml -= @Ce.size * cal_log_Z(Array.new(@v){|v| 0}, @b)
lml
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _log_likelihood x,y,b \n sum = 0\n x.row_size.times{|i|\n xi = Matrix.rows([x.row(i).to_a.collect{|v| v.to_f}])\n y_val = y[i,0].to_f\n sum += log_likelihood_i xi, y_val, b\n }\n\n sum\n end",
"def log_likelihood_i(xi,yi,b)\n ... | [
"0.67267185",
"0.62142074",
"0.6121376",
"0.60136694",
"0.578968",
"0.57686424",
"0.5716097",
"0.5686498",
"0.55817014",
"0.55808157",
"0.5564415",
"0.55126923",
"0.547832",
"0.54488754",
"0.5436698",
"0.5428239",
"0.5417961",
"0.5405465",
"0.5386149",
"0.53357977",
"0.530324... | 0.7073148 | 0 |
Create Portfolio after sign up | def create_portfolio
@user = User.last
@portfolio = Portfolio.new
@user.portfolio = @portfolio
@user.save
@portfolio.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @portfolio = Portfolio.new(portfolio_params)\n @portfolio.user = current_user\n @portfolio.save\n redirect_to portfolios_path\n end",
"def create\n @user = User.find(current_user.id)\n @portfolio = @user.portfolios.new(portfolio_params)\n\n @portfolio.save\n redirect_to port... | [
"0.7819454",
"0.7574676",
"0.75654054",
"0.731147",
"0.7281913",
"0.72338015",
"0.7152069",
"0.70759106",
"0.7046227",
"0.698251",
"0.6973377",
"0.6947983",
"0.6867119",
"0.6826884",
"0.6746863",
"0.6725744",
"0.67071706",
"0.6686586",
"0.6653073",
"0.6649722",
"0.66370326",
... | 0.78604203 | 0 |
GET /schoolclasses/1 GET /schoolclasses/1.json | def show
@schoolclass = Schoolclass.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @schoolclass }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_class }\n end\n end",
"def index\n @my_school = MySchool.find(params[:my_school_id])\n @school_classes = @my_school.school_classes\n en... | [
"0.7824359",
"0.7518366",
"0.75055057",
"0.73523563",
"0.7185839",
"0.68708754",
"0.6861611",
"0.6851329",
"0.68487114",
"0.6650509",
"0.6650509",
"0.65533996",
"0.65050083",
"0.64843845",
"0.64511657",
"0.64191383",
"0.641253",
"0.6379158",
"0.6367003",
"0.6359515",
"0.63522... | 0.78391814 | 0 |
GET /schoolclasses/new GET /schoolclasses/new.json | def new
@schoolclass = Schoolclass.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @schoolclass }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @school_class = SchoolClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_class }\n end\n end",
"def new\n @school_class = SchoolClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { rende... | [
"0.8186771",
"0.813327",
"0.7530987",
"0.7530987",
"0.75097907",
"0.7479836",
"0.7405693",
"0.732036",
"0.7269546",
"0.7236531",
"0.722363",
"0.7220031",
"0.71494496",
"0.71483105",
"0.7148163",
"0.7095364",
"0.70575887",
"0.70448697",
"0.70258254",
"0.70223063",
"0.7021761",... | 0.8184719 | 1 |
POST /schoolclasses POST /schoolclasses.json | def create
@schoolclass = Schoolclass.new(params[:schoolclass])
respond_to do |format|
if @schoolclass.save
format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully created.' }
format.json { render json: @schoolclass, status: :created, location: @schoolclass }
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @school_class = SchoolClass.new(school_class_params)\n\n respond_to do |format|\n if @school_class.save\n format.html { redirect_to school_classes_path, notice: 'School class was successfully created.' }\n format.json { render :show, status: :created, location: @school_class }... | [
"0.7602586",
"0.73850614",
"0.68936133",
"0.6857708",
"0.6785983",
"0.6615852",
"0.6565927",
"0.65261465",
"0.65056866",
"0.6500984",
"0.64996314",
"0.6489415",
"0.6489415",
"0.6479692",
"0.64769685",
"0.6449867",
"0.6448041",
"0.6443338",
"0.6423649",
"0.640711",
"0.63762796... | 0.75350237 | 1 |
PUT /schoolclasses/1 PUT /schoolclasses/1.json | def update
@schoolclass = Schoolclass.find(params[:id])
respond_to do |format|
if @schoolclass.update_attributes(params[:schoolclass])
format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully updated.' }
format.json { head :no_content }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n if @school_class.update_attributes(params[:school_class])\n format.html { redirect_to school_classes_url, notice: 'Class was successfully updated.' }\n format.json { head :no_content }\n else\n ... | [
"0.75379795",
"0.74619305",
"0.7293535",
"0.70673627",
"0.70673627",
"0.6641032",
"0.65808344",
"0.6577612",
"0.65368724",
"0.6466882",
"0.64667374",
"0.64667374",
"0.6442209",
"0.6427981",
"0.6409784",
"0.6402281",
"0.6373682",
"0.6371725",
"0.6371725",
"0.6371725",
"0.63717... | 0.75529194 | 0 |
DELETE /schoolclasses/1 DELETE /schoolclasses/1.json | def destroy
@schoolclass = Schoolclass.find(params[:id])
@schoolclass.destroy
respond_to do |format|
format.html { redirect_to schoolclasses_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @school_class = SchoolClass.find(params[:id])\n @school_class.destroy\n\n respond_to do |format|\n format.html { redirect_to school_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_class.destroy\n respond_to do |format|\n format... | [
"0.8061161",
"0.79784995",
"0.7889176",
"0.7889176",
"0.73943055",
"0.7377076",
"0.73629004",
"0.7356273",
"0.735389",
"0.735389",
"0.7290641",
"0.7275605",
"0.7273691",
"0.7221712",
"0.7167595",
"0.7156748",
"0.7156748",
"0.7156748",
"0.7156748",
"0.7135215",
"0.71255416",
... | 0.80867434 | 0 |
FUNCTIONS SECTION FUNCTION: section_looper PURPOSE: Iterate the process on all sections PARAMETERS: email_body: Get content of the email to generate RETURNS: / | def section_looper(email_body)
section = [:first_section, :second_section, :third_section]
section.each do |section|
type_looper(email_body, section)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type_looper(email_body, section)\n type = [:new_features, :improvements, :tasks, :bugs]\n \n type.each do |cType|\n tickets_looper(email_body, section, email_body[section][cType][:type], email_body[section][:file], email_body[section][:statuses], email_body[section][cType][:tickets], email_body... | [
"0.6385215",
"0.57354605",
"0.57348484",
"0.529475",
"0.52321064",
"0.52304584",
"0.50928223",
"0.5091631",
"0.50468063",
"0.5020342",
"0.49834192",
"0.49819717",
"0.49706936",
"0.49700984",
"0.4970024",
"0.49690086",
"0.49573338",
"0.4954731",
"0.49545157",
"0.49358028",
"0.... | 0.83576405 | 0 |
FUNCTION: type_looper PURPOSE: Itearate the process on all type of tickets PARAMETERS: email_body: Get content of the email to generate section: Current section to iterate on RETURNS: / | def type_looper(email_body, section)
type = [:new_features, :improvements, :tasks, :bugs]
type.each do |cType|
tickets_looper(email_body, section, email_body[section][cType][:type], email_body[section][:file], email_body[section][:statuses], email_body[section][cType][:tickets], email_body[section]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def section_looper(email_body)\n section = [:first_section, :second_section, :third_section]\n\n section.each do |section|\n type_looper(email_body, section)\n end\nend",
"def tickets_looper(email_body, section, type, file, statuses, tickets, ticket_details)\n i = 0\n\n File.open(file).read... | [
"0.7281999",
"0.6319089",
"0.5115296",
"0.5028149",
"0.4963669",
"0.49442703",
"0.4907207",
"0.48945594",
"0.4881189",
"0.48711103",
"0.48128298",
"0.48034742",
"0.4789139",
"0.47480574",
"0.4737166",
"0.47207668",
"0.47063154",
"0.4703522",
"0.46566662",
"0.46546182",
"0.465... | 0.81906307 | 0 |
FUNCTION: tickets_looper PURPOSE: Iterate on all lines of sprint files (last and next sprints) PARAMETERS: email_body: Get content of the email to generate section: Current section to iterate on type: ? file: ? statuses: ? tickets: ? ticket_details: ? RETURNS: / | def tickets_looper(email_body, section, type, file, statuses, tickets, ticket_details)
i = 0
File.open(file).readlines.each do |cLine|
# Check if the file has been added
if cLine.include?(type) && statuses.inject(false) { |memo, status| cLine.downcase.include?(status.downcase) || memo }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type_looper(email_body, section)\n type = [:new_features, :improvements, :tasks, :bugs]\n \n type.each do |cType|\n tickets_looper(email_body, section, email_body[section][cType][:type], email_body[section][:file], email_body[section][:statuses], email_body[section][cType][:tickets], email_body... | [
"0.61876667",
"0.5540164",
"0.53832775",
"0.5038448",
"0.49030867",
"0.47823453",
"0.47660002",
"0.47210208",
"0.46933335",
"0.46853894",
"0.46736747",
"0.4673664",
"0.45883363",
"0.45359203",
"0.4525512",
"0.4515053",
"0.4487482",
"0.44786972",
"0.4473849",
"0.44706592",
"0.... | 0.7760518 | 0 |
FUNCTION: pluralize PURPOSE: Add the pluralize PARAMETERS: word: The word to check if we need to add plural of not nb: Number to identify plural RETURNS: Current string with adjustment on plural word | def pluralize(word, nb)
if (nb > 1)
return "#{word}s"
else
return "#{word}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pluralize(word); end",
"def pluralize(word)\n result = word.to_s.dup\n\n if word.empty? || inflections.uncountables.include?(result.downcase)\n result\n else\n inflections.plurals.each do |(rule, replacement)| \n break if result.gsub!(rule, replacement)\n end\n res... | [
"0.8291213",
"0.7874297",
"0.7760038",
"0.7757809",
"0.7757809",
"0.7733956",
"0.7672149",
"0.75080585",
"0.74505484",
"0.7440822",
"0.73560196",
"0.7138265",
"0.70662105",
"0.7050328",
"0.70469284",
"0.6951704",
"0.69056594",
"0.6899908",
"0.6888621",
"0.6883731",
"0.6871323... | 0.804285 | 1 |
FUNCTION: getfilename PURPOSE: Determine the filename with current date PARAMETERS: / RETURNS: Path of the file to create serving to add all information of the sprint update | def getfilename()
current_time = Time.new.strftime("%Y-%m-%d")
# Create filename
filename = current_time + "_sprint_update_CS.html"
# Create folder with all file of sprint update
foldername = "History"
Dir.mkdir(foldername) unless File.exists?(foldername)
return File.join(".", foldern... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_current_time + \"_\" + original_filename\n end",
"def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_curren... | [
"0.74618983",
"0.74618983",
"0.7234299",
"0.7227529",
"0.7157259",
"0.71547526",
"0.71396947",
"0.71308124",
"0.7087508",
"0.70554817",
"0.6999715",
"0.69842774",
"0.69481206",
"0.69449836",
"0.69214165",
"0.6884821",
"0.6883223",
"0.6862304",
"0.684564",
"0.68437064",
"0.680... | 0.81904453 | 0 |
Creates an instance of a Cluster class, initialized with defaults or the provided points and/or centroid. Params: :points An array of Point objects that will become the members of the cluster. :centroid A Point object representing the centroid of the cluster. Returns: A Cluster instance. | def initialize(params = {})
self.points = params[:points] || []
self.centroid = params[:centroid] || nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(points=[])\n @iterations = 3\n @cluster_count = 0\n @points = points\n @clusters = []\n @logger = Log4r::Logger.new('Clusterer')\n @logger.add('default')\n \n # R... | [
"0.61567456",
"0.57494426",
"0.5444567",
"0.5435973",
"0.5412673",
"0.5357415",
"0.5237831",
"0.5223695",
"0.5154099",
"0.5043205",
"0.49439824",
"0.4931941",
"0.49198112",
"0.4798184",
"0.47895426",
"0.4767987",
"0.4761733",
"0.47542825",
"0.47532475",
"0.4727614",
"0.472761... | 0.5963908 | 1 |
Calculates a range for each dimension such that it covers all coordinates in that dimension for all points in the cluster. Returns: An Array of Range objects, sucn that each range_i covers point.coords_i, for all points. | def dimensional_ranges
points = self.points.map &:coords
points.transpose.map { |d| d.min.to_f..d.max.to_f }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_coords_in(minmax, coord=[], coords=[])\n if minmax.empty?\n coords << coord\n else\n min, max = minmax[0]\n (min..max).each do |dim_coord|\n all_coords_in(minmax[1..-1], coord + [dim_coord], coords)\n end\n end\n coords\n end",
"def convert_all_ranges\n if self.... | [
"0.644344",
"0.5969025",
"0.5824408",
"0.582361",
"0.5816668",
"0.5792295",
"0.57451147",
"0.56550246",
"0.5614021",
"0.5585035",
"0.554071",
"0.55277926",
"0.5515443",
"0.54791194",
"0.5463592",
"0.5430055",
"0.5415276",
"0.5402412",
"0.53921646",
"0.53666866",
"0.53626174",... | 0.7443832 | 0 |
Adds the specified Point object to this cluster, removing it from any other clusters first. In the future we may make it possible for a point to belong to more than one Cluster, or for a point to have a fuzzy relationship with clusters. Params: point the Point object that should be added to this cluster. Returns: This ... | def add_point(point)
point.cluster.remove_point point if point.cluster
self.points << point
point.cluster = self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def <<(point)\n @points << ensure_point_is_location_object(point)\n @points.uniq!\n self\n end",
"def add_to_point point\n add_to_point! point.dup\n end",
"def add_point(point)\n puts \"adding p: #{point}\" if @debug\n @points << point\n if self.mec && self.mec.center\n unle... | [
"0.73217535",
"0.69854754",
"0.6917421",
"0.68061155",
"0.67658496",
"0.6754942",
"0.65452325",
"0.64526933",
"0.6427863",
"0.6403132",
"0.63457894",
"0.6309248",
"0.62558997",
"0.61804616",
"0.6139067",
"0.60212547",
"0.5910567",
"0.5857493",
"0.5713876",
"0.5705562",
"0.565... | 0.8310775 | 0 |
Removes the specified Point object from this cluster. Note that if two points with the same coordinates are members of the cluster, only the one with the same memory address will be removed. (Removal is done by instance equality which is based on the memory address not coordinate equality.) Params: point the Point obje... | def remove_point(point)
self.points.delete point
point.cluster = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(p)\n @first = counterclockwise(@first) if @first.equal?(p)\n @first = nil if @first.equal?(p)\n @neighbors.delete(p)\n end",
"def add_point(point)\n point.cluster.remove_point point if point.cluster\n self.points << point\n point.cluster = self\n end",
"def remove... | [
"0.6343471",
"0.5907696",
"0.5858198",
"0.56060785",
"0.5529343",
"0.5511267",
"0.5491795",
"0.5482285",
"0.53937984",
"0.53906137",
"0.53814256",
"0.53576195",
"0.53563154",
"0.5354377",
"0.5319888",
"0.52398646",
"0.5208203",
"0.5185692",
"0.51625717",
"0.51625717",
"0.5156... | 0.84225297 | 0 |
load_and_authorize_resource GET /game_alphabets GET /game_alphabets.json | def index
@game_alphabets = GameAlphabet.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gather_alphabets\n \talphabets = helpers.gather_alphabets\n\n render json: {\n data: alphabets\n }\n \t\n end",
"def index\n @alphabets = Alphabet.all\n end",
"def game_alphabet_params\n params.require(:game_alphabet).permit(:game_id, :round_number, :alphabet)\n end",
"def lett... | [
"0.7761794",
"0.69334084",
"0.62090445",
"0.62068486",
"0.6199391",
"0.6199386",
"0.6175006",
"0.61218184",
"0.61218184",
"0.606902",
"0.5921776",
"0.5847844",
"0.5835356",
"0.5808569",
"0.58034414",
"0.5765683",
"0.5726098",
"0.5703627",
"0.57005197",
"0.5629907",
"0.5605382... | 0.71056765 | 1 |
PATCH/PUT /game_alphabets/1 PATCH/PUT /game_alphabets/1.json | def update
respond_to do |format|
if @game_alphabet.update(game_alphabet_params)
format.html { redirect_to @game_alphabet, notice: 'Game alphabet was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n\tGameAlphabet.delete_game_alphabets(@game.id)\n\tTimer.delete_game_timers(@game.id)\n\t if @game.update(game_params)\n\t #@alphabets = ['s','y','z','a','b']\n\t @alphabets = ['الف' , 'ب' , 'پ' , 'ت' , 'ث' , 'ج' , 'چ' , 'ح' , 'خ' , 'د' , 'ذ' , 'ر' , 'ز' , 'ژ' , '... | [
"0.65018547",
"0.63964003",
"0.6322317",
"0.5881074",
"0.58541435",
"0.58275914",
"0.581786",
"0.57623035",
"0.5753232",
"0.57061666",
"0.5646209",
"0.5645754",
"0.5602462",
"0.55933595",
"0.5565832",
"0.55248165",
"0.5502193",
"0.54931694",
"0.54881835",
"0.54822016",
"0.548... | 0.707947 | 0 |
DELETE /game_alphabets/1 DELETE /game_alphabets/1.json | def destroy
@game_alphabet.destroy
respond_to do |format|
format.html { redirect_to game_alphabets_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @alphabet.destroy\n respond_to do |format|\n format.html { redirect_to alphabets_url, notice: 'Alphabet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_... | [
"0.68337625",
"0.65308505",
"0.6520827",
"0.6441445",
"0.64321023",
"0.63990873",
"0.6390668",
"0.63752997",
"0.63562566",
"0.63177323",
"0.62914115",
"0.62773186",
"0.62600774",
"0.6230565",
"0.6228064",
"0.62231183",
"0.62030023",
"0.6192674",
"0.61836994",
"0.6176086",
"0.... | 0.7739876 | 0 |
check if user_id is in current conversation | def is_in_conversation?(_user_id)
conversation_members.where(user_id: _user_id).any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sent_by?(user)\n from_user_id == user&.id\n end",
"def usr_msg? convo, usr\n (usr.id == convo.user_id && convo.status == 'active') || (usr.id == convo.recipient_id && convo.recipient_status == 'active')\n end",
"def has_conversation?(conversation_id)\r\n self.conversations.has_key?(conversatio... | [
"0.7299198",
"0.7231549",
"0.7068452",
"0.70051",
"0.69285077",
"0.68953055",
"0.68942624",
"0.6828195",
"0.6828195",
"0.6819626",
"0.68095887",
"0.67378473",
"0.673119",
"0.6685123",
"0.66744745",
"0.6656612",
"0.6654996",
"0.66523147",
"0.66236967",
"0.66088057",
"0.6571263... | 0.8621658 | 0 |
check if user_id is admin from current conversation | def is_admin?(_user_id)
conversation_members.admin.where(user_id: _user_id).any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin?(user_id)\n\t\treturn admin == user_id\n\tend",
"def admin_user\n @current_user.admin?\n end",
"def user_admin?\n \t@admin_user = Usuario.find(session[:user_id]).admin\n end",
"def admin_user\n (current_user.present? && current_user.admin?)\n end",
"def admin_user?\n if curr... | [
"0.78232646",
"0.734285",
"0.7296295",
"0.7212587",
"0.7212086",
"0.7202949",
"0.72008276",
"0.71941465",
"0.7188969",
"0.7172338",
"0.7138661",
"0.71316415",
"0.71249884",
"0.7095167",
"0.70883363",
"0.70812905",
"0.70787835",
"0.7078168",
"0.7071933",
"0.70621085",
"0.70384... | 0.86353064 | 0 |
add a new participant to the current conversation user_ids: (Array) new participants ID current_user: user who is adding the new participant | def add_participant(_user_ids, _current_user = nil)
update(new_members: _user_ids.is_a?(Array) ? _user_ids : [_user_ids], updated_by: _current_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_participant\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n participant_ids = params[\"participant_ids\"]\n comment = params[\"comment\"].nil? ? \"\" : params[\"comment\"]\n\n if user != nil and meeting != nil and participant_ids.length > 0\n particip... | [
"0.7643294",
"0.7124458",
"0.7001229",
"0.68382394",
"0.6800617",
"0.6722664",
"0.6548295",
"0.6525721",
"0.6512752",
"0.638485",
"0.63684577",
"0.6291235",
"0.62403136",
"0.6214687",
"0.6189608",
"0.6174519",
"0.61706316",
"0.6160917",
"0.6121028",
"0.60921985",
"0.60032094"... | 0.8498038 | 0 |
check if current conversation is a group conversation | def is_group_conversation?
group_title.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end",
"def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end",
"def group?\n type == :group_id\n end",
"def group?\n type == :group_id\n end",
"def in_group?(group)\n ... | [
"0.68405974",
"0.68405974",
"0.67577523",
"0.67577523",
"0.67383814",
"0.6635502",
"0.6622683",
"0.6622683",
"0.6613604",
"0.660063",
"0.6564338",
"0.65473104",
"0.65115345",
"0.6505596",
"0.6484703",
"0.6484046",
"0.64710736",
"0.6445479",
"0.6444146",
"0.64360994",
"0.63634... | 0.7886707 | 0 |
add a message sent from Bot | def add_bot_message(message)
messages.notification.create(sender_id: User.bot_id, body: message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_message(name, message)\n\t\tend",
"def say(msg)\n self.signed_request '/api/v1/chat.postMessage', 'POST', {roomId: @channel_id, text: '>' + msg}\n end",
"def message(options)\n @sent_messages << options[:text]\n end",
"def send_message(message); end",
"def send_message(message); end",
"de... | [
"0.71807367",
"0.6894628",
"0.68368524",
"0.6793057",
"0.6793057",
"0.67133904",
"0.6705784",
"0.6675791",
"0.6658184",
"0.6643782",
"0.66180044",
"0.6607805",
"0.6591836",
"0.6574539",
"0.65744114",
"0.65706927",
"0.6564723",
"0.65646774",
"0.651196",
"0.6507823",
"0.6447554... | 0.7620624 | 0 |
add a message _user_id: sender id | def send_message(_user_id, message, extra_data = {})
messages.create!({sender_id: _user_id, body: message}.merge(extra_data))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_id=(user_id); @message_impl.setUserId user_id; end",
"def send_message_to(_user, _message, extra_data = {})\n return if _user.id == id # skip send message to self\n Conversation.get_single_conversation(id, _user.id).send_message(id, _message, extra_data)\n end",
"def send_message(to_user, conte... | [
"0.7130977",
"0.702478",
"0.7009058",
"0.689858",
"0.6893213",
"0.6836311",
"0.66877353",
"0.66082627",
"0.65985245",
"0.65744346",
"0.65359706",
"0.64976954",
"0.64968634",
"0.6470018",
"0.6446893",
"0.643502",
"0.6415428",
"0.64149505",
"0.6408142",
"0.6400727",
"0.63836414... | 0.75429964 | 0 |
return cache key unread messages for user member | def get_unread_cache_key_for(_user_id)
"cache-count_pending_messages_for-#{id}-#{(last_activity || Time.current).to_i}-#{_user_id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unread_messages(user)\n Rails.cache.fetch(\"#{cache_key_with_version}/unread_messages/#{user.id}\") do\n Message.unread_by(user).where(chat_room: self).where.not(user: user).to_a\n end\n end",
"def unread_chats_count_cache_key\n \"#{self.cache_key}/unread_chats_count\"\n end",
"def count_pe... | [
"0.7219761",
"0.7171557",
"0.71668696",
"0.71536136",
"0.70160645",
"0.6866475",
"0.66438717",
"0.65122837",
"0.64741737",
"0.6407556",
"0.636092",
"0.630194",
"0.6278316",
"0.6201542",
"0.6185977",
"0.5996763",
"0.599096",
"0.59581995",
"0.5945157",
"0.5942546",
"0.592076",
... | 0.8371134 | 0 |
ban a member from current conversation group | def ban_member(_user_id)
unless is_in_conversation?(_user_id)
errors.add(:base, "This user is not member of current group")
return false
end
unless is_group_conversation?
errors.add(:base, "This is not a conversation group")
return false
end
banned_users.create(user_id: _user... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ban!\n MTurkUtils.ban_user self\n end",
"def ban_group\n banned_group = PreviaGroup.find(params[:previa_group_id])\n BanGroupFromGroup.call(@previa_group, banned_group)\n\n respond_to do |format|\n format.html { redirect_to @previa_group, notice: 'El grupo de previa fue bloqueado con éxito.... | [
"0.70904666",
"0.6986597",
"0.69524926",
"0.6900115",
"0.6833348",
"0.6833348",
"0.67607754",
"0.6615547",
"0.6580129",
"0.6530699",
"0.6421638",
"0.6383988",
"0.637283",
"0.6359341",
"0.6323711",
"0.6323711",
"0.6308084",
"0.62976444",
"0.62763244",
"0.62065524",
"0.6166832"... | 0.79552454 | 0 |
send instant notifications for stop typing | def stop_typing(_user)
PubSub::Publisher.new.publish_for(user_participants.online.where.not(id: _user.id), 'stop_typing', {source: {id: id}, user: {id: _user.id}}, {foreground: true})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_typing\n PubSub::Publisher.new.publish_for(conversation.user_participants.online.where.not(id: sender.id), 'stop_typing', {source: {id: conversation_id}, user: {id: sender.id}}, {foreground: true})\n end",
"def start_typing(data); end",
"def start_typing(data); end",
"def typing(recipient:)\n\t\... | [
"0.69841737",
"0.6149496",
"0.6149496",
"0.58092123",
"0.5680132",
"0.5670255",
"0.5641455",
"0.56201845",
"0.5503337",
"0.5445626",
"0.54041046",
"0.53622854",
"0.5352317",
"0.5321119",
"0.52746415",
"0.5264371",
"0.52412313",
"0.52366",
"0.5235099",
"0.5219051",
"0.5197758"... | 0.6624377 | 1 |
create default message after group was created | def generate_welcome_message
if default_message.present?
messages.notification.create(sender_id: owner_id, body: default_message)
else
messages.notification.create(sender_id: owner_id, body: "#{owner.full_name(false)} created this conversation group.") if is_group_conversation?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @group = Group.find(params[:message][:group_id])\n\n # @message = current_user.messages.build(params[:message])\n\n @message = current_user.messages.build(content: params[:message][:content], picture: params[:message][:picture])\n # Group.find(params[:message][:group_id]).messages << @mess... | [
"0.6610715",
"0.6553855",
"0.6473169",
"0.6460432",
"0.6399084",
"0.6390135",
"0.6381072",
"0.6350813",
"0.6350813",
"0.62970865",
"0.6278066",
"0.62121356",
"0.6178017",
"0.6157355",
"0.6081889",
"0.6061881",
"0.60579675",
"0.60546786",
"0.6052238",
"0.60520756",
"0.6043146"... | 0.75084144 | 0 |
Returns true if the document has code callouts | def has_callouts?
parser = REXML::Parsers::PullParser.new(File.new(@docbook_file))
while parser.has_next?
el = parser.pull
if el.start_element? and (el[0] == "calloutlist" or el[0] == "co")
return true
end
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_code?\n code != nil\n end",
"def has_source_code_info?\n file_descriptor_proto.has_field?(:source_code_info)\n end",
"def documented?\n return true if @received_nodoc\n return false if @comment_location.empty?\n @comment_location.any? { |comment, _| not comment.empty? }\n end",
... | [
"0.6282136",
"0.58863693",
"0.58442706",
"0.5786657",
"0.57627934",
"0.5745519",
"0.5724832",
"0.5724832",
"0.56664175",
"0.566509",
"0.5627609",
"0.5601201",
"0.55927086",
"0.55607563",
"0.5542513",
"0.5497151",
"0.5466728",
"0.54513615",
"0.54509765",
"0.5432641",
"0.535471... | 0.7357287 | 0 |
calculating VORP comparing runs produced for replacement player vs. selected player, then normalize for 150 game season formula adapted from | def calcVORP(statsArray)
#constants
lgBA = 0.253
lgOBP = 0.317
lgSLG = 0.396
lgRunsPerOut = 0.1633
replaceR = 0.8
replaceRadical = (25 * lgOBP * lgSLG) / (1 - lgBA)
replaceRoot = (replaceRadical ** (1/3.0))
replaceP = (0.1073-(0.11 * replaceR)) * replaceRoot
ab = statsArray[1]
hits = statsAr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def least_accurate_team(seasonasstring) # shots in game team stats\n #inverse of above\n end",
"def oppg\n (opp_possessions.to_f)/games\n end",
"def oppg\n (opp_possessions.to_f)/games\n end",
"def recompute_team\n teams = CollegiateResult.where(:year => @year).all\n teams.each do |team|\n c... | [
"0.61966324",
"0.6085875",
"0.6085875",
"0.6063497",
"0.5908922",
"0.59044",
"0.58793205",
"0.5878793",
"0.5838307",
"0.57961273",
"0.57791847",
"0.57746035",
"0.57484806",
"0.5710608",
"0.5669978",
"0.566497",
"0.56545335",
"0.56449217",
"0.56404686",
"0.5626321",
"0.5624581... | 0.6263473 | 0 |
Sets the attribute content_type_db_path | def content_type_db_path=(_arg0); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attachment_content_type=(value)\n self.content_type=value\n end",
"def database_path=(val)\n @database_path = val.index(\"://\").nil? ? \"sqlite3://#{val}\" : val\n load_signatures\n end",
"def content_type=(value)\n @content_type = value\n end",
"de... | [
"0.6289128",
"0.6219748",
"0.6199551",
"0.6135668",
"0.6132708",
"0.6067474",
"0.606524",
"0.6064842",
"0.60540867",
"0.6016864",
"0.6015564",
"0.5944689",
"0.5937697",
"0.58732784",
"0.58732784",
"0.5795332",
"0.5745594",
"0.5618715",
"0.5617794",
"0.5611179",
"0.5605457",
... | 0.8190598 | 1 |
Returns the value of attribute ext_db_path. source://mini_mime//lib/mini_mime.rb20 | def ext_db_path; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ext_db_path=(_arg0); end",
"def ext_db_path=(_arg0); end",
"def ext\n @ext ||= File.extname(path)\n end",
"def extension\n return _meta_data['extension'] if _meta_data.has_key? 'extension'\n ext\n end",
"def ext_path\n \"/#{@file.bucket}/#{@file.name}\"\n end",
"def con... | [
"0.7334237",
"0.7333733",
"0.66358954",
"0.6597917",
"0.6575811",
"0.6510848",
"0.6510848",
"0.63989675",
"0.63763756",
"0.6374886",
"0.6374886",
"0.6374886",
"0.6374886",
"0.63449854",
"0.631336",
"0.6271865",
"0.6263179",
"0.6249302",
"0.6240995",
"0.62256783",
"0.619985",
... | 0.7712467 | 1 |
Sets the attribute ext_db_path | def ext_db_path=(_arg0); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ext_db_path; end",
"def ext_db_path; end",
"def database_path=(val)\n @database_path = val.index(\"://\").nil? ? \"sqlite3://#{val}\" : val\n load_signatures\n end",
"def default_database_file_path=(file_path)\n\t\t\t@default_database_file_path = file_path\n\t\tend",
"def set_d... | [
"0.78596187",
"0.78596187",
"0.66641337",
"0.65256745",
"0.63663983",
"0.6299413",
"0.5958631",
"0.5946366",
"0.5946366",
"0.57527965",
"0.5747584",
"0.5663391",
"0.5639228",
"0.5637322",
"0.56135833",
"0.56046647",
"0.5601055",
"0.5571381",
"0.5559642",
"0.5559642",
"0.55230... | 0.7895364 | 1 |
This will both create and update any merchants | def create_update(user)
merchant_list.each do |m|
# Look for merchants that this affiliate account is actively associated with.
if m['Association_Status'] == 'active'
merchant = do_db(m)
user.merchants << merchant unless user.merchants.include?(merchant)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merchants=(merchants)\n assert_unloaded\n @merchants = Array(merchants)\n end",
"def put_merchants_into_iso_group\n if @merchants\n @logger.info(\"Puting merchants into ISO groups\")\n @merchants.each do |merchant|\n unless (merchant.emp_agent.empty? || merchant.emp_a... | [
"0.64741534",
"0.645472",
"0.5900176",
"0.58992934",
"0.58387935",
"0.5817",
"0.5794663",
"0.5778153",
"0.57429475",
"0.5719455",
"0.57098025",
"0.5692008",
"0.56396145",
"0.55900717",
"0.55840194",
"0.55569285",
"0.5553731",
"0.5553731",
"0.5551272",
"0.5546224",
"0.5539523"... | 0.70734984 | 0 |
DELETE /inputs/1 DELETE /inputs/1.json | def destroy
@input.destroy
respond_to do |format|
format.html { redirect_to inputs_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @input = Input.find(params[:id])\n @input.destroy\n\n respond_to do |format|\n format.html { redirect_to inputs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @input = Input.find(params[:id])\n @input.destroy\n\n respond_to do |format|\n format.ht... | [
"0.7373269",
"0.7045474",
"0.69982064",
"0.69982064",
"0.69982064",
"0.68879783",
"0.6537254",
"0.6522398",
"0.6506208",
"0.6461221",
"0.6440606",
"0.64076704",
"0.6401998",
"0.6374614",
"0.63727653",
"0.63696504",
"0.63326794",
"0.63042337",
"0.62839556",
"0.6283335",
"0.627... | 0.73094314 | 1 |
Retry block for node.find method above. | def retry_block(n = MAX_NODE_QUERY_RETRIES, &block)
begin
block.call
rescue Selenium::WebDriver::Error::StaleElementReferenceError, Capybara::TimeoutError, Capybara::ElementNotFound, Selenium::WebDriver::Error::UnknownError, Capybara::Driver::Webkit::NodeNotAttachedError
if (n -= 1) >= 0
sleep(30 / (n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retry_before_failing\n sleeping(NODE_QUERY_WAIT_TIME).seconds.between_tries.failing_after(MAX_NODE_QUERY_RETRIES).tries do\n yield\n end\n yield\n end",
"def try(&block)\n\n tries = REST_MAX_TRIES\n\n begin\n yield\n rescue\n tries -= 1\n ... | [
"0.669279",
"0.64966637",
"0.62885845",
"0.60105735",
"0.6005823",
"0.59410286",
"0.5929285",
"0.5856484",
"0.5844667",
"0.5785246",
"0.5763981",
"0.5679922",
"0.5641416",
"0.55891514",
"0.5549016",
"0.5540158",
"0.54744464",
"0.5470114",
"0.54663366",
"0.54635406",
"0.545497... | 0.65911436 | 1 |
Generate a "state" key that can be passed to the OAuth endpoints | def oauth_state
org = retrieve_organization
state = "#{org.name}:#{org.salt}:#{org.owner_email}"
Base64.urlsafe_encode64(Digest::SHA256.digest(state))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_personal_key\n self.personal_key = OaUtils.generate_random_key\n self.state = :active\n end",
"def get_key(state)\n state.sort.join('_')\n end",
"def create_auth_state\n\t auth_state = {:pathway => params[:gift_template][:pathway], \n :gift_template_id => params[:gift_template][:g... | [
"0.69740146",
"0.6727542",
"0.63871044",
"0.636521",
"0.6336195",
"0.6336195",
"0.6229482",
"0.61574787",
"0.61331517",
"0.61231816",
"0.6086252",
"0.60823876",
"0.6042761",
"0.6024395",
"0.6024395",
"0.60148674",
"0.59776145",
"0.5924675",
"0.5914351",
"0.59079206",
"0.58545... | 0.7164228 | 0 |
Normalize a Github URL into a Cyclid style source definition | def normalize(url)
uri = URI.parse(url)
source = {}
source['url'] = "#{uri.scheme}://#{uri.host}#{uri.path.gsub(/.git$/, '')}"
source['token'] = uri.user if uri.user
source['branch'] = uri.fragment if uri.fragment
source
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canonicalize_source(source)\n if source.is_a?(Hash) && source[:github]\n source = source.dup\n source[:git] = \"https://github.com/#{source[:github]}.git\"\n source.delete(:github)\n end\n source\n end",
"def parse_repo\n matches = @source_url.match @github_regexp\n ... | [
"0.6804975",
"0.62760067",
"0.6219566",
"0.6122229",
"0.6038586",
"0.6035815",
"0.6034577",
"0.60073704",
"0.5977274",
"0.59274054",
"0.58976954",
"0.588535",
"0.5858931",
"0.58440596",
"0.5813602",
"0.5800523",
"0.5791087",
"0.5764799",
"0.5749009",
"0.5714034",
"0.57110137"... | 0.67116916 | 1 |
Extract the "humanish" part from a Git repository URL | def humanish(uri)
uri.path.split('/').last.gsub('.git', '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repo_slug_from_url(url)\n url[%r{github.com[/:]([^/]*/(?:(?!\\.git)[^/])*)\\.*}, 1]\nend",
"def parse(url)\n matches = url.match(%r{[:/](?<user>[^/]+)/(?<repo>[^/]+)\\z})\n [matches[:user], matches[:repo].gsub(/\\.git\\z/, '')]\n rescue StandardError => e\n raise ParseError, 'Can not parse... | [
"0.75882846",
"0.687914",
"0.6862683",
"0.67006266",
"0.6687775",
"0.66173285",
"0.65410864",
"0.64908105",
"0.6456824",
"0.6399951",
"0.63889337",
"0.6376433",
"0.6371352",
"0.63341993",
"0.62853706",
"0.6277719",
"0.6247843",
"0.62295043",
"0.6168993",
"0.6160706",
"0.61432... | 0.7497892 | 1 |
=begin As a user, if I select add I am prompted to enter a 'first name', 'last name', 'email' and 'note'. =end | def add_new_contact
puts "\e[H\e[2J"
p "enter firstname"
first_name = gets.chomp
p "enter lastname"
last_name = gets.chomp
p "enter email address"
email = gets.chomp
p "enter note: optional"
note = gets.chomp
contact = Contact.create(
first_name: first_name,
last_na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_new_contact\nprint \"Contact first name:\"\nfirst_name = gets.chomp\n\nprint \"Contact last name:\"\nlast_name = gets.chomp\n\nprint \"Enter Contact's Email Address\"\nemail = gets.chomp\n\nprint \"Enter Note\"\nnote = gets.chomp\n\nContact.create(first_name, last_name, email, note)\n end",
"def add_pa... | [
"0.6682645",
"0.6556868",
"0.6545092",
"0.6487292",
"0.63802725",
"0.63300973",
"0.6308948",
"0.62953323",
"0.61733705",
"0.6155862",
"0.6113139",
"0.6099168",
"0.6095556",
"0.60854536",
"0.6066083",
"0.60628515",
"0.6060296",
"0.6023926",
"0.6006099",
"0.60005045",
"0.598974... | 0.6863274 | 0 |
GET /rent_images GET /rent_images.json | def index
@rent_images = RentImage.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def images() \n uri = URI.parse(\"http://\" + @location.host + \":9292/v2/images\")\n return get_request(uri, @token)\n end",
"def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end",
"def getimagesinfo\n trek = Trek.find_by_id(params[:id]... | [
"0.747183",
"0.73400784",
"0.7327491",
"0.72308004",
"0.716566",
"0.7116451",
"0.7109326",
"0.7036103",
"0.70052963",
"0.7003318",
"0.6969881",
"0.6957036",
"0.6905841",
"0.6882117",
"0.68696594",
"0.685551",
"0.6818415",
"0.6799595",
"0.675445",
"0.6732359",
"0.6704539",
"... | 0.7560634 | 0 |
DELETE /rent_images/1 DELETE /rent_images/1.json | def destroy
id = @rent_image.rent_id
@rent_image.destroy
respond_to do |format|
format.html { redirect_to "/rents/gallery/"+id.to_s, notice: 'Rent image was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end",
"def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n \n... | [
"0.74352014",
"0.73909354",
"0.7364131",
"0.7344567",
"0.73016953",
"0.72948766",
"0.7286952",
"0.7286952",
"0.7286952",
"0.7286952",
"0.7286952",
"0.7286952",
"0.7282794",
"0.72614497",
"0.72614497",
"0.72614497",
"0.72614497",
"0.72614497",
"0.72614497",
"0.72614497",
"0.72... | 0.7583723 | 0 |
to get the currency object of money | def currency
money.currency
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currency\n number_to_currency(self)\n end",
"def money(amount, name)\n Currency::Money.new(amount, name)\n end",
"def to_base_currency(money)\n bank.exchange_with(money, price_currency)\n end",
"def currency; end",
"def currency; end",
"def currency\n order.currency\n end",
"def... | [
"0.7613107",
"0.743933",
"0.7408067",
"0.7406263",
"0.7406263",
"0.7369911",
"0.73444813",
"0.7232111",
"0.7223922",
"0.7180694",
"0.7167575",
"0.7167575",
"0.7150755",
"0.7145329",
"0.71406937",
"0.71224636",
"0.70858604",
"0.7085225",
"0.7085225",
"0.70794135",
"0.70429695"... | 0.8082185 | 0 |
imperials is the imperials value | def metrics
standard.unit.convert_to_metric imperials
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_imperial_to_metric(measurement, conversion_factor)\n measurement * conversion_factor\nend",
"def imperial\n weight = get_weight(\"pounds\")\n height = get_height(\"inches\")\n\n bmi = \"#{(weight * 703) / (height * height) }\"\n puts \"Your BMI is: #{bmi}\"\n return bmi\nend",
"def ics( temps... | [
"0.6674475",
"0.5988048",
"0.58842003",
"0.57024825",
"0.5697752",
"0.5692208",
"0.5636939",
"0.5604348",
"0.56018656",
"0.56018054",
"0.55756456",
"0.5559663",
"0.55584055",
"0.550088",
"0.54956603",
"0.548406",
"0.5449152",
"0.5412982",
"0.5405265",
"0.5403666",
"0.5392998"... | 0.70229995 | 0 |
replaces a function with the arguments passed in command: the command to do the substitution in name: the name of the function args: the argument list expression: the expression of the function | def args_replace command, name, args, expression
initial_offset = offset = (command =~ /\b#{Regexp.escape name}\(/) + name.length + 1
bracket_count = 1
# find the last bracket
while offset < command.length
if command[offset] == ?(
bracket_count += 1
elsif command[offset] == ?)
bracket_count... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_sexp(sexp, predicate, function)\n Macro.new.replace(sexp, predicate, function)\nend",
"def expandify_element(element, *args)\n match = //\n to_process = nil\n args_index = 0\n\n # handle ${#} input replacement\n if (element =~ TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN)\n args_in... | [
"0.60614115",
"0.59935087",
"0.58503205",
"0.57638806",
"0.56547594",
"0.56185436",
"0.5611285",
"0.5553941",
"0.5503618",
"0.5503504",
"0.54755974",
"0.545029",
"0.54123527",
"0.5400505",
"0.5373905",
"0.5370587",
"0.53671026",
"0.53323203",
"0.5287228",
"0.5283144",
"0.5271... | 0.79910326 | 0 |
This method helps with building options_for_select for an object that has an association to a nested_set model returns options_for_select with the following rules: class_or_item must be a class (or object of a class) that uses acts_as_nested_set items listed in excluded_items array will not be included in the list (to ... | def nested_set_association_options_for_select(class_or_item, excluded_items=[], prompt="Please select..." )
throw ArgumentError.new "nested_set_association_options_for_select - class_or_item must use acts_as_nested_set" unless class_or_item.respond_to?(:roots)
def get_children(node, excluded... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nested_select(object, method, collection, options = {}, html_options = {})\n choices = nested_as_options(collection) { |record| [\"#{@indent} #{record.name}\", record.id] }\n select(object, method, choices, options, html_options)\n end",
"def items_for_select_menu(options = {}) \n # clean out... | [
"0.5853356",
"0.58169144",
"0.56734586",
"0.5573087",
"0.54456633",
"0.53816307",
"0.5375258",
"0.53659135",
"0.53654087",
"0.5328789",
"0.5318871",
"0.529789",
"0.5257301",
"0.5209802",
"0.52038795",
"0.5149186",
"0.5141086",
"0.5134187",
"0.5129201",
"0.51081806",
"0.507457... | 0.8240456 | 0 |
GET /batches GET /batches.json | def index
@batches = Batch.all
respond_to do |format|
format.html {}
format.json {
data = Hash.new
data["batches"] = @batches
return_success_response(data, "Request Successful", 200)
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @batches = Batch.page(params[:page]).per(15)\n @page = params[:page] || 1\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batches }\n end\n end",
"def list_batches_with_http_info(opts = {})\n if @api_client.config.debugging\n ... | [
"0.75632226",
"0.7415398",
"0.73286897",
"0.711194",
"0.70886123",
"0.6862114",
"0.6839725",
"0.6813342",
"0.677585",
"0.65964687",
"0.64586616",
"0.63962585",
"0.63733006",
"0.6344917",
"0.6290671",
"0.6246177",
"0.62068826",
"0.61685944",
"0.61382574",
"0.61215985",
"0.6117... | 0.7686503 | 0 |
Find a note by notebook | def find_note_by_notebook(notebook, sleep = false)
sleep(5) if sleep
title = Formatting.date_templates[notebook]
@model.find_note_contents(title)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notebook\n @notebook ||= note_store.listNotebooks.select{|notebook| notebook.name == notebook_name}.first\n end",
"def notebook\n @note.notebookGuid\n end",
"def search_note(string)\n logger.info 'Searching for a string within a note'\n search string\n end",
"def find_notebook\... | [
"0.72482955",
"0.70199686",
"0.68029636",
"0.67772716",
"0.67260605",
"0.6438709",
"0.6371517",
"0.6353533",
"0.6353533",
"0.6298389",
"0.6230734",
"0.6211419",
"0.61774856",
"0.60875726",
"0.6066735",
"0.60615426",
"0.59805685",
"0.59652555",
"0.592485",
"0.59010124",
"0.587... | 0.8060751 | 0 |
draw a bar at given column with provided value (this command does not overwrite the screen) | def bar(column, value)
command "B#{column},#{value}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_values(total, cur)\n @value = (cur * 100 / total).round rescue 0\n width = ((@icon.width - 6) * @value / 100).round rescue 0\n\n # Draw bar\n @icon.clear\n @icon.draw_rect(0, 0, @icon.width - 1, @icon.height - 1, false)\n @icon.draw_rect(3, 3, width, @icon.height - 6, true) if(0 < width)... | [
"0.64666945",
"0.6215702",
"0.60802513",
"0.60577494",
"0.5940602",
"0.59248483",
"0.5922719",
"0.589253",
"0.5836636",
"0.58333576",
"0.5799103",
"0.579083",
"0.5780918",
"0.5755637",
"0.5750297",
"0.57136726",
"0.57136726",
"0.57136726",
"0.56806564",
"0.5675468",
"0.566160... | 0.7504416 | 0 |
do an action on a pixel at given column/row | def pixel(column, row, action)
command "P#{column},#{row},#{action.to_s.upcase}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pixel(row: 0, col: 0, color: \"W\")\n raise Useditor::Workspace::PixelLocationError.new(\"Row out of bounds\") if row < 0 || row > (@rows -1)\n raise Useditor::Workspace::PixelLocationError.new(\"Col out of bounds\") if col < 0 || col > (@cols -1)\n @image[row][col]\n end",
"def set_pix... | [
"0.64924747",
"0.6438124",
"0.6388152",
"0.63619256",
"0.6358999",
"0.63124216",
"0.63106084",
"0.62380743",
"0.6237493",
"0.6232126",
"0.6212054",
"0.6182094",
"0.6144389",
"0.61216664",
"0.6005289",
"0.5991073",
"0.59621125",
"0.5919221",
"0.59104174",
"0.5890347",
"0.58750... | 0.7726494 | 0 |
scroll to left or right with given offset | def scroll(offset)
command "SCROLL#{offset}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scroll_left (x1,x2,y1,y2)\r\n #driver.swipe(start_x: 1000, end_x: 100, start_y: y, end_y: y, duration: 1000)\r\n #driver.swipe(start_x: x1, end_x: x2, start_y: y1, end_y: y2, duration: 1000)\r\n scroll_in_any_direction(x1,x2,y1,y2)\r\n end",
"def cursor_scroll_dn\n moveto(pos() + MSCROLL)\nend",
... | [
"0.7063579",
"0.644053",
"0.644053",
"0.63071156",
"0.63048923",
"0.6162941",
"0.6085208",
"0.6039461",
"0.6001291",
"0.5989853",
"0.59657437",
"0.59635425",
"0.5923462",
"0.5914706",
"0.5900576",
"0.5881104",
"0.5848924",
"0.58294195",
"0.58241266",
"0.5806432",
"0.5788537",... | 0.7441704 | 0 |
print a character at given column/row | def char(column, row, char)
command "T#{column},#{row},#{char}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def char_at(column)\n line[column, 1]\n end",
"def print_char (i, j, s)\n if maze_mat[i][j] == 1\n print s\n else\n print \" \"\n end\n end",
"def move_to_column(x); puts \"\\e[#{x}F\" end",
"def display(line, column=0)\n result = \"\\e[s\"\n result << \"\\e[#{line.to_i}... | [
"0.7378273",
"0.7140198",
"0.70540226",
"0.6794265",
"0.67835265",
"0.6746956",
"0.6741829",
"0.6590594",
"0.65766704",
"0.657374",
"0.6566235",
"0.6552443",
"0.6552443",
"0.6552443",
"0.65387094",
"0.64899075",
"0.64899075",
"0.6478533",
"0.6432986",
"0.6426349",
"0.6421638"... | 0.7382112 | 0 |
which fields will be visible on the index page | def index_fields
if @rails.choice[:index_fields].blank?
@rails.resource.fields.keys
else
@rails.choice[:index_fields].collect{|field| field.split(':').first}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @fields = all_fields\n end",
"def index\n @fields = Field.all\n end",
"def document_show_fields\n Blacklight.config[:show_fields][:field_names]\n end",
"def index_fields\n self.class.fields.values.select { |field| field.index }\n end",
"def index_fields\n fields - %i[no... | [
"0.7662567",
"0.74445957",
"0.7378373",
"0.71553946",
"0.7101874",
"0.7101874",
"0.7100855",
"0.70655817",
"0.70632076",
"0.70022136",
"0.69699955",
"0.6936733",
"0.6891161",
"0.6891161",
"0.6891161",
"0.6887004",
"0.6841685",
"0.6835867",
"0.68349355",
"0.68349355",
"0.68273... | 0.75662607 | 1 |
GET /authors/new GET /authors/new.xml | def new
@author = Author.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @author }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @author_repository = AuthorRepository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @author_repository }\n end\n end",
"def new\n @author = Author.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json {... | [
"0.7443775",
"0.70914954",
"0.68965006",
"0.6862118",
"0.6814787",
"0.6762321",
"0.66597104",
"0.66587365",
"0.66358787",
"0.66285527",
"0.66285527",
"0.66283363",
"0.6617511",
"0.6612877",
"0.6601246",
"0.6554841",
"0.6536575",
"0.65275043",
"0.65275043",
"0.65275043",
"0.65... | 0.7725193 | 0 |
PUT /authors/1 PUT /authors/1.xml | def update
@author = Author.find(params[:id])
respond_to do |format|
if @author.update_attributes(params[:author])
format.html { redirect_to(@author, :notice => 'Author was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @author = Author.find(params[:id])\n @author.update_attributes(params[:author])\n respond_with(@author)\n end",
"def update\n @book.authors = params[:book][:authors].delete_if { |x| x == '' }.map { |i| Author.find(i) } if params[:book][:authors].present?\n respond_to do |format|\n ... | [
"0.6331983",
"0.62035245",
"0.6054555",
"0.60039806",
"0.5974912",
"0.5966066",
"0.5953054",
"0.5952967",
"0.59294695",
"0.5922155",
"0.5914838",
"0.5844891",
"0.5838828",
"0.5788342",
"0.5779889",
"0.5770354",
"0.5770354",
"0.5770354",
"0.5770354",
"0.5770354",
"0.57546765",... | 0.63688856 | 1 |
DELETE /authors/1 DELETE /authors/1.xml | def destroy
@author = Author.find(params[:id])
@author.destroy
respond_to do |format|
format.html { redirect_to(authors_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n Author.destroy(params[:id])\n redirect_to '/authors'\n end",
"def destroy\n Author.delete(params[:id])\n redirect_to(authors_path)\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @author.destroy\n respond_... | [
"0.686459",
"0.68583137",
"0.6798691",
"0.6657785",
"0.6657785",
"0.6614151",
"0.6614151",
"0.65511936",
"0.65001845",
"0.6499806",
"0.6468818",
"0.64463925",
"0.64429945",
"0.64429945",
"0.64429945",
"0.64429945",
"0.64429945",
"0.64429945",
"0.6419601",
"0.6416993",
"0.6403... | 0.7327123 | 1 |
Method moves a card from game cards to specified hand | def deal_card(hand)
#hand is a string whose valid values are 'player_cards' and 'dealer_cards'
if !['player_cards','dealer_cards'].include?(hand)
raise "Unknown hand #{hand}"
end
#Check for an empty deck and reshuffle if necessary
if (session['game_cards'].length == 0)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_card(guess)\n @board[guess].reveal\n @player.store_cards(guess, @board[guess].value)\n p @player.store\n end",
"def deal(card)\n\t\t@hand.push(card)\n\tend",
"def take_turn( player, hand )\n turn = nil\n case turn = player.take_turn(hand, @dealer.up_card)\n when :hit:\n han... | [
"0.72171724",
"0.7138571",
"0.7109097",
"0.7089356",
"0.706713",
"0.70414263",
"0.6991335",
"0.696174",
"0.6937465",
"0.69079477",
"0.6865887",
"0.68263716",
"0.6822201",
"0.68142325",
"0.67830056",
"0.6734797",
"0.6711113",
"0.6711113",
"0.6691604",
"0.6683179",
"0.66782117"... | 0.7269293 | 0 |
Totals the points for a hand | def hand_total(hand)
#A flag to see if the hand contains an ace
have_ace = ! ( session[hand].select{|card| card['rank'] == "ace"}.empty? )
total = 0
#Look up the point value of each card in the hand
session[hand].each do |card|
total += RANK_TO_POINTS[ card['rank']]
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcScore(hand)\n return hand.inject(0) { |sum, n| sum + n.points }\nend",
"def points\n @puntos = 0\n students.each do |s| \n @puntos += s.points\n end\n @puntos += house_points\n end",
"def player_hand_total\n players_hand.inject(0) {|sum, card| sum + card.va... | [
"0.73431003",
"0.6987293",
"0.6947591",
"0.69389284",
"0.69366807",
"0.6907244",
"0.6902562",
"0.68712276",
"0.68426865",
"0.68361413",
"0.6812822",
"0.6750951",
"0.6711056",
"0.66690224",
"0.6664042",
"0.6629807",
"0.6557108",
"0.6540432",
"0.6540071",
"0.6514982",
"0.649941... | 0.75406694 | 0 |
POST /preparar_mates POST /preparar_mates.json | def create
@empresa = Empresa.find(params[:empresa_id])
@producto = @empresa.productos.find(params[:producto_id])
@preparar_mate = @producto.preparar_mates.build(preparar_mate_params)
respond_to do |format|
if @preparar_mate.save
format.html { redirect_to empresa_producto_preparar_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @mate = Mate.new(params[:mate])\n\n respond_to do |format|\n if @mate.save\n format.html { redirect_to @mate, notice: 'Mate was successfully created.' }\n format.json { render json: {mate: @mate}, status: :created, location: @mate }\n else\n format.html { render ac... | [
"0.55769044",
"0.53530544",
"0.5340133",
"0.5335051",
"0.52413374",
"0.5225603",
"0.5192981",
"0.5163182",
"0.51625496",
"0.5141869",
"0.51200545",
"0.5104154",
"0.51031977",
"0.5053567",
"0.50192183",
"0.49981737",
"0.49896193",
"0.4987082",
"0.49710417",
"0.49698752",
"0.49... | 0.6040503 | 0 |
PATCH/PUT /preparar_mates/1 PATCH/PUT /preparar_mates/1.json | def update
@empresa = Empresa.find(params[:empresa_id])
@producto = @empresa.productos.find(params[:producto_id])
@preparar_mate = @producto.preparar_mates.find(params[:id])
respond_to do |format|
if @preparar_mate.update(preparar_mate_params)
format.html { redirect_to empresa_producto_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end",
"def update\n @mate = Mate.find(params[:id])\n\n respond_to do |format|\n if @mate.update_attributes(pa... | [
"0.60174227",
"0.5998688",
"0.5731182",
"0.5701388",
"0.5689525",
"0.56807256",
"0.56611806",
"0.565699",
"0.5638485",
"0.5633029",
"0.56301004",
"0.56210715",
"0.5616712",
"0.5614435",
"0.5582845",
"0.5559411",
"0.5553166",
"0.55479866",
"0.55236256",
"0.55137575",
"0.550263... | 0.62828004 | 0 |
Retrieve all the tag guids for a provided service entry and tag group | def tag_guids_for_tag_group(service_entry, tag_group)
guids = service_entry['TagGuids']
return [] if guids.blank?
# The first element of the tag strings ARE the tag group. We'll group
# by that value and return the requested group. This saves a fair amount
# of logic from having to be copy and pas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags\n get.tagGuids\n end",
"def get_tags() tag_ids.inject([]) { |l, tag_id| l << get_tag_from_id(tag_id) } end",
"def add_tag_return_IDs(tag)\n # Split and strip the tags\n tags = tag.split(\",\").collect{|x| x.strip}\n i = 0\n iDs = []\n while i < tags.count do\n # Check if... | [
"0.68090504",
"0.6358161",
"0.58911306",
"0.57307017",
"0.56719035",
"0.56540555",
"0.5642764",
"0.5616005",
"0.5607584",
"0.55675405",
"0.55518913",
"0.55439836",
"0.5536333",
"0.55092025",
"0.547324",
"0.546704",
"0.5419871",
"0.5419157",
"0.5414881",
"0.5395047",
"0.538184... | 0.8447853 | 0 |
Provided a service entry this will pull out concept ids from tag guids and request the collections from CMR | def collections_from_service_entry_tags(service_entry)
concept_ids = concept_ids_from_service_entry_tags(service_entry)
return [] if concept_ids.blank?
response = cmr_client.get_collections_by_post({ concept_id: concept_ids, page_size: concept_ids.size }, token)
if response.success?
response.bod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_datasets_for_service_implementation(params = {})\n # service_interface_guid is not a permitted param for CMR but we need it for this call\n # so we'll use delete to pop the value from the params hash\n response = echo_client.get_service_entries(echo_provider_token, params.delete('service_interface... | [
"0.67045355",
"0.5408727",
"0.52200097",
"0.5209009",
"0.5118803",
"0.5095901",
"0.5079721",
"0.5060224",
"0.4980422",
"0.4968335",
"0.492527",
"0.49205932",
"0.49064764",
"0.48901784",
"0.48868728",
"0.48775038",
"0.48773345",
"0.48670405",
"0.48604652",
"0.4857313",
"0.4841... | 0.7808586 | 0 |
Delete the given user configurations. deletions on keys prefixed by 'biapi.' (except callback_url) are ignored keys (string): list of coma separated keys to be deleted. | def users_id_user_config_delete(id_user, opts = {})
users_id_user_config_delete_with_http_info(id_user, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @userconfig.destroy\n respond_to do |format|\n format.html { redirect_to userconfigs_url, notice: \"Userconfig was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete_by_id(user_id)\n Iterable.request(conf, \"/users/byUserId/#{user_id}\"... | [
"0.6190237",
"0.60056967",
"0.5939117",
"0.58024246",
"0.5745868",
"0.56886286",
"0.56784123",
"0.567366",
"0.5672965",
"0.56620175",
"0.5642824",
"0.5607411",
"0.5581179",
"0.5533959",
"0.5527929",
"0.55043656",
"0.54897654",
"0.5470818",
"0.5467372",
"0.54495454",
"0.543773... | 0.6246653 | 0 |
Create a recurrence which will only emit values within the date range, also called "masking." | def covering(date_range)
merge(covering: date_range)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_recurrences\n # remove all already scheduled occurrences in the future\n Occurrence.where('event_id = ? AND date >= ?', self.id, Date.current).delete_all\n \n if read_attribute(:recurrence).empty?\n Occurrence.create(event: self, date: self.date)\n else\n # schedule events for... | [
"0.5772766",
"0.57313657",
"0.5722943",
"0.57097423",
"0.567828",
"0.56194764",
"0.5584516",
"0.5511722",
"0.55078065",
"0.54709476",
"0.5457419",
"0.542211",
"0.5421099",
"0.5386382",
"0.53843",
"0.53743654",
"0.53717947",
"0.53642535",
"0.53174984",
"0.5309649",
"0.52733326... | 0.5876295 | 0 |
Takes an array of three integers to add to VERSION and three integers to multiply to VERSION | def bump(by,reset)
version_triplet.zip(by, reset).collect{|x,y,z| (x+y)*z}.join(".")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bump_numeric\n value_ = ::Versionomy.create([1, 9, 2, 'a2'], :semver)\n value_ = value_.bump(:patch)\n assert_equal([1, 9, 3, ''], value_.values_array)\n end",
"def custom_multiply(array, number)\n result = []\n number.times { array.each { |element| result << element}}\n res... | [
"0.60821146",
"0.6035046",
"0.5951242",
"0.5840144",
"0.58135456",
"0.5794542",
"0.5758383",
"0.57424957",
"0.5730996",
"0.5718913",
"0.5711211",
"0.57071185",
"0.5693568",
"0.56609046",
"0.56587124",
"0.5647613",
"0.5642471",
"0.56391037",
"0.5638697",
"0.5625911",
"0.559904... | 0.6652467 | 0 |
Returns a key that will be used to group ids into batches. | def group_key(id)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_key\n [id.to_s]\n end",
"def to_key\n [id]\n end",
"def to_key\n key = id\n [key] if key\n end",
"def batch_key(_record)\n raise \"Implement in child\"\n end",
"def redis_key_for(id)\n \"#{redis_prefix}:#{Array(id).join(':')}\"\n end",
"def to... | [
"0.6898292",
"0.68468094",
"0.6801638",
"0.6737686",
"0.65537804",
"0.6535845",
"0.649238",
"0.64242184",
"0.63658416",
"0.635251",
"0.6320878",
"0.63197047",
"0.6316198",
"0.626829",
"0.6267376",
"0.6253607",
"0.6253607",
"0.62518734",
"0.6230364",
"0.62069833",
"0.61809623"... | 0.6976525 | 0 |
Public: Returns a curve which describes the demand for electricity caused by the activities within the calculator. | def elec_demand_curve
@elec_demand_curve ||= ElectricityDemandCurve.from_adapters(adapters)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def demand_curve\n load_curve('demand.csv')\n end",
"def demand_curve\n @demand_curve ||= begin\n unlimited_carrier_curve.map do |value|\n value < @carrier_capacity ? value : @carrier_capacity\n end\n end\n end",
"def calculate_carrier_demand\n ... | [
"0.7033966",
"0.70048326",
"0.6853632",
"0.67025465",
"0.65962905",
"0.6502511",
"0.6428135",
"0.6428135",
"0.6353733",
"0.6330756",
"0.6001785",
"0.59905463",
"0.59339285",
"0.57778776",
"0.5752317",
"0.5727273",
"0.55787647",
"0.55787647",
"0.5575891",
"0.5567091",
"0.55669... | 0.73674726 | 0 |
Public: Returns the adapter for the node matching `key` or nil if the node is not a participant in the group. | def adapter(key)
if (config = @context.graph.node(key).fever)
adapters_by_type[config.type].find { |a| a.node.key == key }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](key)\n @adapter[key.to_s]\n end",
"def get_node(key); end",
"def [](key)\n\t\t\treturn dial!(key)\n\t\tend",
"def fetch_node(key)\n node = fetch_node_nt(key)\n raise unless node\n node\n end",
"def node_for(path_or_key)\n key = PathEx::Key.new(path_or_key)\n return ni... | [
"0.55878437",
"0.55456716",
"0.5412625",
"0.5281771",
"0.52773225",
"0.5255326",
"0.5246342",
"0.5224118",
"0.5180288",
"0.5157669",
"0.51574326",
"0.5157236",
"0.5137",
"0.5110948",
"0.5108243",
"0.50745267",
"0.503432",
"0.5034296",
"0.5025054",
"0.50127786",
"0.50102276",
... | 0.71893305 | 0 |
Internal: Maps Fever types (:consumer, :storage, etc) to adapters. | def adapters_by_type
return @adapters if @adapters
@adapters =
Manager::TYPES.each_with_object({}) do |type, data|
data[type] =
Etsource::Fever.group(@name).keys(type).map do |node_key|
Adapter.adapter_for(
@context.graph.node(node_k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adapters\n adapters_by_type.values.flatten\n end",
"def adapters\n @adapters ||= {}\n end",
"def adapters\n @adapters ||= {}\n end",
"def register_adapter(type, adapter); end",
"def adapters\n @adapters ||=\n @nodes.transform_values do |convs|\n ... | [
"0.6957223",
"0.64922756",
"0.6475926",
"0.615097",
"0.6124453",
"0.60587054",
"0.590596",
"0.5777547",
"0.5777547",
"0.56655526",
"0.55141914",
"0.54472643",
"0.54305834",
"0.53451043",
"0.53404623",
"0.53288406",
"0.52990973",
"0.5272447",
"0.5253847",
"0.5224774",
"0.52136... | 0.72373736 | 0 |
This method looks at the params hash. Its looking for a param that ends in '_id'. Once found it removes the id and then returns the class and the id to look up. For example in the route /learning_paths/:learning_path_id/custom_content the method would find `learning_path_id` and then return the class LearningPath and l... | def resource_class
params.each do |name, _value|
if /(.+)_id$/.match?(name)
model = name.match(%r{([^\/.]*)_id$})
return model[1].classify.constantize, name
end
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_klass_and_id\n klass = params[:commentable].constantize\n commentable_id = \"#{klass}_id\".downcase.to_sym\n return klass, commentable_id\n end",
"def get_id(path, user, classname)\n begin \n if classname == \"person\"\n return People.all.first.to_param\n end\n \n ... | [
"0.6184204",
"0.5998596",
"0.59538954",
"0.5832948",
"0.5788657",
"0.57686955",
"0.5625831",
"0.5625831",
"0.56169355",
"0.55943364",
"0.5585347",
"0.549406",
"0.54765767",
"0.54430145",
"0.54159385",
"0.5381057",
"0.53735405",
"0.5333437",
"0.5329433",
"0.52723914",
"0.52720... | 0.60759187 | 1 |
Adds +action_names+ to the list of valid actions for this resource. Does not include superclass's action list when appending. | def actions(*action_names)
action_names = action_names.flatten
if !action_names.empty? && !@allowed_actions
self.allowed_actions = ([ :nothing ] + action_names).uniq
else
allowed_actions(*action_names)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_actions(actions)\n # Remove the empty action (dead pokemon)\n actions.delete_if(&:empty?)\n # Merge the actions\n @actions.concat(actions)\n end",
"def include_actions(*actions)\n self.actions ||= []\n self.actions.push(*actions)\n end",
"def add_action(a... | [
"0.6996415",
"0.6754788",
"0.6661041",
"0.6623624",
"0.65538853",
"0.63702375",
"0.6365066",
"0.63529104",
"0.6340668",
"0.6312769",
"0.62622046",
"0.6175846",
"0.61708295",
"0.6154739",
"0.61301893",
"0.6121649",
"0.61059654",
"0.6072857",
"0.603807",
"0.6031886",
"0.6025334... | 0.7872911 | 0 |
Define a method `rec_sum(nums)` that returns the sum of all elements in an array recursively | def rec_sum(nums)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(nums)\n return 0 if nums.empty?\n nums[0] + sum_rec(nums[1..-1])\nend",
"def sum_rec(nums)\n return 0 if nums.empty?\n nums[0] + sum_rec(nums[1..-1])\nend",
"def sum_rec(nums)\n return 0 if nums.empty?\n nums[0] + sum_rec(nums.drop(1))\nend",
"def sum_rec(nums)\n return 0 if nums.length == 0\n... | [
"0.83367825",
"0.82483006",
"0.8013581",
"0.79152244",
"0.79009026",
"0.78916806",
"0.782543",
"0.78227",
"0.78149915",
"0.77546424",
"0.769735",
"0.7678221",
"0.76095736",
"0.75948626",
"0.7591033",
"0.75586843",
"0.7542731",
"0.7514435",
"0.7514305",
"0.7504766",
"0.7500284... | 0.83437324 | 1 |
GET /certifieds GET /certifieds.json | def index
@certifieds = Certified.where(user: self.current_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @certifications = Certification.all\n end",
"def certs\n request :get, '/certs'\n end",
"def set_certified\n @certified = Certified.find(params[:id])\n end",
"def index\n @certifications = @certifications.sort_by(&:name)\n\n respond_to do |format|\n format.html # index.html... | [
"0.64023674",
"0.64013535",
"0.62414056",
"0.6160832",
"0.6140631",
"0.59337527",
"0.5896812",
"0.58808196",
"0.57871866",
"0.5755358",
"0.5751683",
"0.57469463",
"0.57280207",
"0.57280207",
"0.57280207",
"0.57280207",
"0.5726518",
"0.5675416",
"0.5665637",
"0.56452423",
"0.5... | 0.6654699 | 0 |
POST /certifieds POST /certifieds.json | def create
@certified = Certified.new(certified_params)
@certified.events = events
@certified.attendees = attendees
@certified.slug = generate_token
@certified.user = self.current_user
flash[:notice] = "Certificado criado com sucesso." if @certified.save
respond_with(@certified) do |format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n respond_to do |format|\n if @certification.save\n format.html { redirect_to Certification, :notice => 'Certification was successfully created.' }\n format.json { render :json => @certification, :status => :created, :location => @certification }\n else\n format.html { ... | [
"0.6489707",
"0.6436034",
"0.6311841",
"0.6270349",
"0.6267243",
"0.6254824",
"0.6254824",
"0.6172796",
"0.60597944",
"0.6047397",
"0.6047397",
"0.6040358",
"0.6034543",
"0.5952242",
"0.59151787",
"0.5858251",
"0.58091444",
"0.57874733",
"0.57859355",
"0.5741499",
"0.57053375... | 0.69736564 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.