query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
POST /api/v1/outcomes POST /api/v1/outcomes.json | def create
@api_v1_outcome = Api::V1::Outcome.new(api_v1_outcome_params)
respond_to do |format|
if @api_v1_outcome.save
format.html { redirect_to @api_v1_outcome, notice: 'Outcome was successfully created.' }
format.json { render :show, status: :created, location: @api_v1_outcome }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @api_v1_outcomes = Api::V1::Outcome.all\n end",
"def post_outcome_request\n raise IMS::LTI::InvalidLTIConfigError, \"\" unless has_required_attributes?\n\n res = post_service_request(@lis_outcome_service_url,\n 'application/xml',\n ... | [
"0.71842766",
"0.6848662",
"0.6812778",
"0.67607313",
"0.66406727",
"0.65197843",
"0.6492818",
"0.6362744",
"0.63293046",
"0.63022953",
"0.61426264",
"0.61020315",
"0.60617316",
"0.6037341",
"0.60111725",
"0.593628",
"0.5883231",
"0.5815154",
"0.57884717",
"0.5761546",
"0.568... | 0.76789504 | 0 |
PATCH/PUT /api/v1/outcomes/1 PATCH/PUT /api/v1/outcomes/1.json | def update
respond_to do |format|
if @api_v1_outcome.update(api_v1_outcome_params)
format.html { redirect_to @api_v1_outcome, notice: 'Outcome was successfully updated.' }
format.json { render :show, status: :ok, location: @api_v1_outcome }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_api_v1_outcome\n @api_v1_outcome = Api::V1::Outcome.find(params[:id])\n end",
"def update\n @outcome.update(outcome_params)\n redirect_to settings_path\n end",
"def update\n @outcome_mapping = OutcomeMapping.find(params[:id])\n\n respond_to do |format|\n if @outcome_mapping.up... | [
"0.6820422",
"0.6384593",
"0.6276005",
"0.612755",
"0.610688",
"0.61054796",
"0.60784245",
"0.6077693",
"0.60593456",
"0.59992677",
"0.5931262",
"0.591255",
"0.58987063",
"0.5866803",
"0.58505565",
"0.5787069",
"0.57733524",
"0.5772018",
"0.576707",
"0.57634693",
"0.5742048",... | 0.77380806 | 0 |
DELETE /api/v1/outcomes/1 DELETE /api/v1/outcomes/1.json | def destroy
@api_v1_outcome.destroy
respond_to do |format|
format.html { redirect_to api_v1_outcomes_url, notice: 'Outcome was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @outcome_result = OutcomeResult.find(params[:id])\n @outcome_result.destroy\n end",
"def destroy\n @outcome_comparison = OutcomeComparisonResult.find(params[:id])\n @outcome_comparison.destroy\n end",
"def destroy\n @outcome_mapping = OutcomeMapping.find(params[:id])\n @outcom... | [
"0.7529363",
"0.7035248",
"0.69829804",
"0.6924958",
"0.6924958",
"0.68746865",
"0.68106174",
"0.67960536",
"0.67723286",
"0.6759672",
"0.67341524",
"0.67282486",
"0.6713041",
"0.6669293",
"0.6649194",
"0.6642033",
"0.66354233",
"0.6621649",
"0.660805",
"0.66070086",
"0.65966... | 0.84303916 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_api_v1_outcome
@api_v1_outcome = Api::V1::Outcome.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def api_v1_outcome_params
params.fetch(:api_v1_outcome, {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
params["promotion[groupon_codes_file]"] has the upload file with one groupon code per line | def store_groupon_codes
if @promotion.is_groupon_style? && @groupon_codes_file
Rails.logger.warn("Promo is groupon style : #{@promotion.id}")
successful_imports = 0
unsuccessful_imports = 0
data = @groupon_codes_file.read
CSV.parse(data) do |row|
next if row.join.blank?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updatedb_file_group(file)\n meta = updatedb_file_ls(file)\n if meta.class.to_s == 'String'\n group = meta.split(\" \")\n group\n elsif meta.class.to_s == 'Array'\n group = meta[3]\n group\n else\n nil\n end\n end",
"def even... | [
"0.56968945",
"0.5396469",
"0.5351527",
"0.5351527",
"0.5272663",
"0.5239777",
"0.52265227",
"0.51874655",
"0.51524657",
"0.51435775",
"0.5126476",
"0.512475",
"0.51103455",
"0.51067144",
"0.50773984",
"0.50752044",
"0.5067875",
"0.50310534",
"0.5015435",
"0.50152194",
"0.499... | 0.5635751 | 1 |
Returns total number of comments below this post. | def count_children
count = children.count
if count
children.each { |child| count += child.count_children }
end
count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_comments\n self.comments.count\n end",
"def count_of_comment\n Comment.number_of_comment(self)\n end",
"def number_of_comments\n\t \tcomments.count\n\t end",
"def comment_count\n comments.length\n end",
"def number_comments \n self.comments.count\n end",
"def comme... | [
"0.72718775",
"0.712986",
"0.71203834",
"0.7021017",
"0.69800556",
"0.69741774",
"0.69741774",
"0.69373053",
"0.6862459",
"0.653725",
"0.64314395",
"0.64184254",
"0.63813543",
"0.63296133",
"0.63210833",
"0.632052",
"0.63171375",
"0.62933064",
"0.62911016",
"0.6229446",
"0.61... | 0.0 | -1 |
Destroys the window by sending the SIGINT signal (the window has its own handlers to destroy itself, so it's not our job). Does not wait for anything. | def close
SLogger.debug("[client] interrupting window (#{@window_pid})...")
Process.kill(:INT, @window_pid)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n @window.destroy if @window\n @window = nil\n end",
"def exit\n stop\n $window.deleteAllWidgets\n $window.createWidgets\n $window.deleteAllImages\n $window.cursor.unforceVisible\n terminate\n end",
"def close\n @window.destroy if @window\n VER::stop_ncurses\... | [
"0.6590848",
"0.65435445",
"0.64893305",
"0.64445484",
"0.6395514",
"0.6382377",
"0.63097876",
"0.6278679",
"0.62345034",
"0.61611664",
"0.60475844",
"0.6038848",
"0.59860563",
"0.59860563",
"0.59668845",
"0.59095025",
"0.58893996",
"0.58893996",
"0.58778477",
"0.58706695",
"... | 0.7243259 | 0 |
Initialize Author: Puneet Date: 11/11/2017 Reviewed By: | def initialize(params)
@process_failed = params[:process_failed]
@current_timestamp = Time.now.to_i
@lock_identifier = @current_timestamp
@hooks_to_be_processed = []
@success_responses = {}
@failed_hook_to_be_retried = {}
@failed_hook_to_be_ignored = {}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(title, author,year=\"unknown\", edition=\"unknown\")\n @title = title\n @author = author\n @checked_out = false\n @current_patron = nil\n @year_published = year\n @edition = edition\n @reviews = {}\n end",
"def initialize(title, author)\n @title = title\n @author = author\n... | [
"0.7333849",
"0.7129014",
"0.70955193",
"0.7070503",
"0.70354205",
"0.70291907",
"0.69931734",
"0.6881697",
"0.6878112",
"0.6813801",
"0.68099624",
"0.6763395",
"0.6728774",
"0.6726954",
"0.67229164",
"0.6708862",
"0.669641",
"0.669641",
"0.6688903",
"0.6679767",
"0.6674377",... | 0.0 | -1 |
public method to process hooks Author: Puneet Date: 11/11/2017 Reviewed By: | def perform
begin
# acquire lock and fetch the locked hooks
fetch_hooks_to_be_processed
# Process these Hooks
process_hooks
# Mark Hooks as processed
update_status_to_processed
rescue StandardError => se
@hooks_to_be_processed.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hooks\n # ???\n end",
"def hook1; end",
"def hook_name; end",
"def hooks\n @hooks ||= []\n end",
"def InitializeHooks\n end",
"def hooks\n EMPTY_HOOKS\n end",
"def hooks\n @hooks ||= Hash.new([])\n end",
"def pre_hook_send(handler); end",
"def hooks\n ... | [
"0.7865976",
"0.7650186",
"0.7527786",
"0.7244223",
"0.7189173",
"0.71713096",
"0.7074038",
"0.70010746",
"0.695313",
"0.69529814",
"0.6906488",
"0.687578",
"0.685088",
"0.6811045",
"0.67661434",
"0.6745644",
"0.673804",
"0.6704562",
"0.66892004",
"0.66786003",
"0.6657672",
... | 0.5841043 | 97 |
Fetch records from DB which are to be processed in this iteration Author: Puneet Date: 11/11/2017 Reviewed By: | def fetch_hooks_to_be_processed
acquire_lock
fetch_locked_hooks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findRecords()\n @submission_records = SubmissionRecord.where(\"team_id = ? AND assignment_id = ?\",params['team_id'],params['assignment_id'])\n\n end",
"def fetch_records\n offset = 0\n offset = @page_size * (@page_number - 1) if @page_number > 1\n\n ar_relation = UserActivityLog.usi... | [
"0.619422",
"0.61257267",
"0.6098958",
"0.59888697",
"0.596537",
"0.5930793",
"0.58816236",
"0.5813084",
"0.5795728",
"0.57464415",
"0.5706095",
"0.5578716",
"0.5544093",
"0.55181557",
"0.54870105",
"0.5475971",
"0.54729426",
"0.54455715",
"0.5443442",
"0.54426646",
"0.541334... | 0.0 | -1 |
method which process hooks and performs required operation Author: Puneet Date: 11/11/2017 Reviewed By: | def process_hooks
@hooks_to_be_processed.each do |hook|
begin
@hook = hook
process_hook
rescue StandardError => se
@failed_hook_to_be_retried[@hook.id] = {
exception: {
message: se.message,
trace: se.backtrace[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hooks\n # ???\n end",
"def hook1; end",
"def process_hook\n fail 'sub class to implement'\n end",
"def perform_hooks!\n @perform_hooks = true\n end",
"def InitializeHooks\n end",
"def hook_name; end",
"def around_hooks; end",
"def hook_run\n\trun_hook = {\n\t :return... | [
"0.7363687",
"0.73530275",
"0.6921314",
"0.6871474",
"0.68525803",
"0.6761793",
"0.67076373",
"0.66458863",
"0.65801847",
"0.6572461",
"0.6571498",
"0.6557174",
"0.65243566",
"0.6497588",
"0.647884",
"0.6410669",
"0.64067316",
"0.6374705",
"0.63534427",
"0.6340128",
"0.632121... | 0.664022 | 8 |
for the hooks which failed, unlock those records so that thet can be reprocessed later Author: Puneet Date: 11/11/2017 Reviewed By: | def release_lock_and_update_status_for_non_processed_hooks
@hooks_to_be_processed.each do |hook|
failed_hook_to_be_retried = @failed_hook_to_be_retried[hook.id]
hook.mark_failed_to_be_retried(failed_hook_to_be_retried) if failed_hook_to_be_retried.present?
failed_hook_to_be_igno... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resend_unlock_instructions; end",
"def acquire_lock_on_failed_hooks\n hook_model_klass.lock_failed_hooks(@lock_identifier)\n end",
"def check_to_unlock submission, bypass_archive_check = false\n result = []\n criteria_result = criteria_check\n\n if criteria_result && (!self.passed or b... | [
"0.58983755",
"0.5829628",
"0.5797955",
"0.56925803",
"0.5627129",
"0.5509882",
"0.54983866",
"0.5496975",
"0.54789096",
"0.5446702",
"0.54257524",
"0.5421212",
"0.5412929",
"0.5412929",
"0.5397978",
"0.5380909",
"0.53089875",
"0.5301396",
"0.5263024",
"0.52546656",
"0.525317... | 0.68037623 | 0 |
return data for logging Author: Puneet Date: 11/11/2017 Reviewed By: | def processor_response
{
@lock_identifier => {
failed_hook_ids_to_be_retried: @failed_hook_to_be_retried.keys,
failed_hook_ids_to_be_ignored: @failed_hook_to_be_ignored.keys,
synced_hook_ids: @success_responses.keys
}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def author\n [author_developer.name_and_email, author_date, author_date_gmt_offset]\n end",
"def author\n @info[:Author]\n end",
"def info\n date = self.updated_at.to_s(:short)\n wrote = self.system_log? ? \"\" : \" wrote\"\n private = self.private? ? \" [private]\" : \"\"\n \"[#{date}]... | [
"0.6633093",
"0.6378884",
"0.6349196",
"0.6349196",
"0.61346096",
"0.60713345",
"0.6032423",
"0.6021831",
"0.5994501",
"0.5994501",
"0.5970541",
"0.5955942",
"0.5924523",
"0.5908971",
"0.5899367",
"0.58937037",
"0.5881236",
"0.5824866",
"0.5821553",
"0.5815844",
"0.5811239",
... | 0.0 | -1 |
find if this is an iteration to process failed logs or fresh ones. we default to false Author: Puneet Date: 11/11/2017 Reviewed By: | def retry_failed_hooks?
@retry_failed ||= (@process_failed.nil? ? false : @process_failed)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_finished?\n more_results == :NOT_FINISHED\n end",
"def log?\n @log != false\n end",
"def log?\n @log != false\n end",
"def log?\n @log != false\n end",
"def log?\n @log ||= false\n end",
"def self_log?\n @status.exitstatus & (1 << 7) != 0\n... | [
"0.6146405",
"0.60930276",
"0.60930276",
"0.60930276",
"0.5932016",
"0.58841664",
"0.58597875",
"0.58462965",
"0.5844958",
"0.5809102",
"0.5802723",
"0.57866764",
"0.5780646",
"0.5773741",
"0.5753106",
"0.5748799",
"0.5742696",
"0.5738573",
"0.5734279",
"0.57338786",
"0.57303... | 0.6035121 | 4 |
acquire lock on a batch of records Author: Puneet Date: 11/11/2017 Reviewed By: | def acquire_lock
retry_failed_hooks? ? acquire_lock_on_failed_hooks : acquire_lock_on_fresh_hooks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acquire_lock\n\t\t@@logger.info { \"Acquiring a lock in the database.\" } if have_logger?\n\t\tTournament.dataset.filter(:id => self.id, :locked => false).update(:locked => true) != 0\n\tend",
"def work\n stat :attempting_lock_on, item_id: object_id\n if @mutex.try_lock\n stat :has_lock_on, ... | [
"0.65482813",
"0.63441247",
"0.6338628",
"0.6224721",
"0.6177887",
"0.61767924",
"0.6171775",
"0.6171775",
"0.6171775",
"0.6100297",
"0.6069971",
"0.60600215",
"0.59988296",
"0.5990425",
"0.5913537",
"0.58901745",
"0.58820534",
"0.5869661",
"0.5868211",
"0.5865806",
"0.585417... | 0.0 | -1 |
Acquire lock on Failed Hooks which have to be retired Author: Puneet Date: 11/11/2017 Reviewed By: | def acquire_lock_on_failed_hooks
hook_model_klass.lock_failed_hooks(@lock_identifier)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def release_lock_and_update_status_for_non_processed_hooks\n\n @hooks_to_be_processed.each do |hook|\n\n failed_hook_to_be_retried = @failed_hook_to_be_retried[hook.id]\n hook.mark_failed_to_be_retried(failed_hook_to_be_retried) if failed_hook_to_be_retried.present?\n\n failed_hoo... | [
"0.67782843",
"0.67569953",
"0.6552482",
"0.64848787",
"0.6385202",
"0.6261097",
"0.6223847",
"0.619017",
"0.61547536",
"0.6153648",
"0.61499906",
"0.6142967",
"0.6139292",
"0.6109815",
"0.6075194",
"0.6068103",
"0.60155034",
"0.6014192",
"0.5975774",
"0.59650433",
"0.5960493... | 0.7896335 | 0 |
Acquire lock on Fresh Hooks which have to be executed Author: Puneet Date: 11/11/2017 Reviewed By: | def acquire_lock_on_fresh_hooks
hook_model_klass.lock_fresh_hooks(@lock_identifier)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_hooks_to_be_processed\n acquire_lock\n fetch_locked_hooks\n end",
"def acquire_lock_on_failed_hooks\n hook_model_klass.lock_failed_hooks(@lock_identifier)\n end",
"def acquire_lock\n retry_failed_hooks? ? acquire_lock_on_failed_hooks : acquire_lock_on_fresh_hooks... | [
"0.6963924",
"0.6913415",
"0.68022233",
"0.6545564",
"0.6403332",
"0.62917507",
"0.62578696",
"0.62364924",
"0.6233589",
"0.6232441",
"0.62201244",
"0.61899924",
"0.61705405",
"0.6115626",
"0.6070573",
"0.6066344",
"0.60469836",
"0.60127866",
"0.59961015",
"0.59961015",
"0.59... | 0.7737162 | 0 |
query search_hooks table to fetch data for records locked with the given identifier Author: Puneet Date: 11/11/2017 Reviewed By: | def fetch_locked_hooks
@hooks_to_be_processed = hook_model_klass.fetch_locked_hooks(@lock_identifier)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def searchauthor\n end",
"def find_entries revision, status\n @svnelement.find_in_log revision, status\n end",
"def history\n PaperTrail::Version.where('whodunnit = (?) OR whodunnit like (?)', id.to_s, \"#{id} %\")\n end",
"def find_all_under(params, controlled_by)\n # controlled_by s... | [
"0.54051447",
"0.5373551",
"0.537019",
"0.53602725",
"0.5300374",
"0.52723193",
"0.51794595",
"0.5126185",
"0.5089555",
"0.50576925",
"0.49928433",
"0.4963036",
"0.49604043",
"0.49185434",
"0.49094385",
"0.48947403",
"0.48754334",
"0.48604724",
"0.48583415",
"0.48521125",
"0.... | 0.4976074 | 11 |
modal klass which has data about hooks Author: Puneet Date: 11/11/2017 Reviewed By: | def hook_model_klass
fail 'child class to return a model klass here'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modal_id\nend",
"def mgs_feedback_modal\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(div.className(\"/QSIPopOver/\"), __method__, self)\n\tend",
"def modal_show_compra(model)\n\t\tmodal = \"<div class='modal hide fade' id='#{model.class}#{model.id}'>\"\n\t\tmodal += \"<div class='modal-header'>\... | [
"0.59982485",
"0.5564862",
"0.5551371",
"0.54100597",
"0.5317362",
"0.5246709",
"0.5161041",
"0.5140636",
"0.5123929",
"0.50927925",
"0.49862057",
"0.4975472",
"0.49520263",
"0.4951018",
"0.49417746",
"0.4917776",
"0.4912011",
"0.49090263",
"0.4905497",
"0.49051684",
"0.48981... | 0.0 | -1 |
Process One Hook Author: Puneet Date: 11/11/2017 Reviewed By: | def process_hook
fail 'child class to implement'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hook_name; end",
"def hook1; end",
"def hook_owner; end",
"def hook_script_name; end",
"def hooks\n # ???\n end",
"def hook_type_name; end",
"def pre_hook_send(handler); end",
"def hook_class_name; end",
"def fire(hook, *args); end",
"def install_post_hook\n end",
"def install_pre_hook... | [
"0.7168863",
"0.7056851",
"0.695523",
"0.6705371",
"0.6355467",
"0.6306054",
"0.6258153",
"0.60913986",
"0.6055347",
"0.59999084",
"0.5931114",
"0.58616364",
"0.5742108",
"0.5727311",
"0.56879574",
"0.5660134",
"0.5652159",
"0.563509",
"0.56079656",
"0.55941236",
"0.5580818",... | 0.0 | -1 |
after successfully performing task, mark hooks as processed Author: Puneet Date: 11/11/2017 Reviewed By: | def update_status_to_processed
fail 'child class to implement'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_hooks!\n @perform_hooks = true\n end",
"def pre_task\n end",
"def after_processing\n end",
"def post_task\n end",
"def post_process\n end",
"def run_completed\n end",
"def after_processing_hook; end",
"def post_process; end",
"def perform\n\n begin\n\n ... | [
"0.6466249",
"0.6354964",
"0.6316369",
"0.6247642",
"0.6247075",
"0.6211742",
"0.61492485",
"0.61174905",
"0.6049599",
"0.5946785",
"0.59203064",
"0.59045553",
"0.5883423",
"0.5883423",
"0.58172154",
"0.5814288",
"0.58135206",
"0.58065915",
"0.58049357",
"0.57992",
"0.5785293... | 0.5338373 | 69 |
PUBLIC INSTANCE METHODS Checks to see if its safe to delete the organization. If there are other members in the organization and the current user is the owner then ownership must be changed to another user. This method will just raise a validation error. | def check_org
# Ok to delete if there is no organization related to the current
# user object.
return true unless self.owns?
org = self.owns
# Ok to delete if the organization is owned by the current user
# and the current user is the only member
return true if (org.users.count == 1) &&
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n unless current_user.try(:admin?)\n flash[:notice] = PERMISSION_DENIED\n redirect_to organization_path(params[:id]) and return false\n end\n @organization = Organization.find(params[:id])\n @organization.destroy\n\n redirect_to organizations_url\n end",
"def destroy\n au... | [
"0.6878004",
"0.67439413",
"0.67228186",
"0.6554663",
"0.64901036",
"0.6477735",
"0.6436008",
"0.63585114",
"0.6326453",
"0.62965494",
"0.62395936",
"0.61535406",
"0.61471677",
"0.6133039",
"0.6130471",
"0.61019325",
"0.60846055",
"0.60299945",
"0.60175717",
"0.60102177",
"0.... | 0.8066139 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_payment_transaction
@payment_transaction = PaymentTransaction.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def payment_transaction_params
params.require(:payment_transaction).permit(:payment_transaction_id, :booking_order_no, :bill_no, :payment_transaction_date, :payment_transaction_type, :payment_transaction_amount, :payment_mode_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.71207976",
"0.705222",
"0.69488335",
"0.69021654",
"0.67362636",
"0.6717561",
"0.6689192",
"0.6678948",
"0.66622657",
"0.6555007",
"0.6527569",
"0.64588845",
"0.64522904",
"0.6450812",
"0.6448551",
"0.6434285",
"0.6412147",
"0.6412147",
"0.6393719",
"0.6381976",
"0.6381976... | 0.0 | -1 |
parse takes the given JSON string and turns it into a string of Rust structs, suitable for use with rustc_serialize. | def parse
(type, subtype) = parse_object([@name], JSON.parse(@json))
(subtype || type).to_s.gsub(/\n\n$/, "\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(json_str)\n e = Pointer.new(:object)\n NSJSONSerialization.JSONObjectWithData(\n json_str.dataUsingEncoding(NSUTF8StringEncoding),\n options: 0,\n error: e)\n end",
"def parse(json_str)\n Oj.load(json_str)\n end",
"def parse_json str\n JSON.p... | [
"0.71339613",
"0.6720989",
"0.66984",
"0.66047025",
"0.6478569",
"0.6472309",
"0.63858294",
"0.63858294",
"0.63753885",
"0.6352711",
"0.62407315",
"0.6221776",
"0.6209759",
"0.62018645",
"0.61755747",
"0.61620957",
"0.6153571",
"0.6121103",
"0.6066416",
"0.6041585",
"0.602946... | 0.56755275 | 34 |
def find_by_url(url, live = true, clean = true) | def test_that_find_by_url_finds_us_when_nothing_else_matches
assert_equal @page, @root.find_by_url("a/page")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_by_url(url, live = true, clean = true)\n old_find_by_url(url, live, clean)\n end",
"def find_by_url(url)\n find_by(url: convert_url(url))\n end",
"def find_page(url)\n found = Page.find_by_url(url)\n found if found #and (found.published?)\n end",
"def find_url\n @url ... | [
"0.90332764",
"0.68970674",
"0.6498557",
"0.63121283",
"0.626253",
"0.605475",
"0.59958863",
"0.5982988",
"0.5904068",
"0.5900452",
"0.58015114",
"0.57863003",
"0.57742804",
"0.5751149",
"0.57363546",
"0.5724727",
"0.5704623",
"0.56950253",
"0.56074715",
"0.559881",
"0.558909... | 0.56218946 | 18 |
GET /developers GET /developers.json | def index
@developers = Developer.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @developers }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def developers\n self.sitemap\n self.follow('dtime:dashboard:developers')\n self.get\n self\n end",
"def index\n @developers = Developer.all\n respond_to do |format|\n format.html\n format.xml {render xml: @developers.as_json}\n end\n end",
"def show\n @developer =... | [
"0.6830076",
"0.6715157",
"0.6593458",
"0.65402824",
"0.65402824",
"0.65402824",
"0.65402824",
"0.65402824",
"0.65402824",
"0.64019203",
"0.63221776",
"0.62486964",
"0.62369716",
"0.61708885",
"0.61533433",
"0.60906136",
"0.6078302",
"0.5995099",
"0.5963012",
"0.593428",
"0.5... | 0.7118702 | 0 |
GET /developers/1 GET /developers/1.json | def show
@developer = Developer.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @developer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @developers = Developer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @developers }\n end\n end",
"def show\n @project_developer = ProjectDeveloper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ... | [
"0.7245031",
"0.6869981",
"0.67922837",
"0.67483413",
"0.67483413",
"0.67483413",
"0.67483413",
"0.67483413",
"0.67483413",
"0.6595884",
"0.65391034",
"0.6424363",
"0.64011705",
"0.62763184",
"0.61766607",
"0.6143493",
"0.6105403",
"0.61002475",
"0.60987216",
"0.6032526",
"0.... | 0.6900536 | 1 |
GET /developers/new GET /developers/new.json | def new
@developer = Developer.new
@developer.user = User.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @developer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @project_developer = ProjectDeveloper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_developer }\n end\n end",
"def new\n @development = Development.new\n @development.developer = current_user\n respond_to do |format|\n ... | [
"0.7150002",
"0.7136221",
"0.7001066",
"0.69997823",
"0.69526684",
"0.68106085",
"0.6796521",
"0.6796521",
"0.6796521",
"0.6796521",
"0.6793246",
"0.67890626",
"0.67880976",
"0.67779255",
"0.67745",
"0.67625093",
"0.67589325",
"0.67322135",
"0.6724609",
"0.6723167",
"0.671197... | 0.6759953 | 16 |
POST /developers POST /developers.json | def create
@developer = Developer.new(params[:developer])
@developer.email = 'none'
@developer.password = 'none'
@developer.name = 'none'
@developer.surname = 'none'
@developer.user.role = Role.find_by_title('developer')
respond_to do |format|
if @developer.save
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def developer_params\n params.require(:developer).permit(:name, :email, :url, :tags, :work_place, :code_name, :bio, :approval_status)\n end",
"def developer_params\n params.require(:developer).permit(:name, :description, :logo_url, :adress, :avatar)\n end",
"def developer_params\n params... | [
"0.64782524",
"0.63745874",
"0.6285211",
"0.6276198",
"0.6270781",
"0.6187426",
"0.6166327",
"0.61359495",
"0.60987705",
"0.6067938",
"0.6051768",
"0.59969413",
"0.5917255",
"0.59060115",
"0.5886722",
"0.58434904",
"0.58331186",
"0.581091",
"0.5798161",
"0.57804304",
"0.57795... | 0.5556116 | 32 |
PUT /developers/1 PUT /developers/1.json | def update
@developer = Developer.find(params[:id])
respond_to do |format|
if @developer.update_attributes(params[:developer])
format.html { redirect_to @developer, notice: 'Developer was successfully updated.' }
format.json { head :no_content }
else
format.html { render act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n official = Official.find(params[:id])\n ... | [
"0.64808995",
"0.6427763",
"0.63968784",
"0.63257277",
"0.6218318",
"0.6088448",
"0.60357654",
"0.60139805",
"0.6002067",
"0.59930784",
"0.59930784",
"0.59762675",
"0.5970672",
"0.5932036",
"0.592411",
"0.5884677",
"0.5860733",
"0.5858969",
"0.58578444",
"0.5840252",
"0.58336... | 0.6115199 | 5 |
DELETE /developers/1 DELETE /developers/1.json | def destroy
@developer = Developer.find(params[:id])
@developer.destroy
respond_to do |format|
format.html { redirect_to developers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @developer.destroy\n respond_to do |format|\n format.html { redirect_to developers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dev = @app.developers.first.id\n @app.destroy\n respond_to do |format|\n format.html { redirect_to developer_pa... | [
"0.7447221",
"0.7360558",
"0.7269404",
"0.7269404",
"0.7269404",
"0.7269404",
"0.71335167",
"0.7110357",
"0.70967305",
"0.70967305",
"0.70938635",
"0.70938635",
"0.70714796",
"0.70481527",
"0.7035744",
"0.70086914",
"0.698929",
"0.6896936",
"0.6878394",
"0.6863897",
"0.679880... | 0.7436049 | 1 |
GET /vendas GET /vendas.json | def index
@caixa = Caixa.current
if @caixa.present?
if session[:venda_id].present?
@venda = Venda.find(session[:venda_id])
else
@venda = Venda.new
end
else
flash.now[:alert] = "Não há caixa aberto."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\tvendas = Venda.all\n\t\trender json: vendas, status: :ok\n\tend",
"def index\n @vampires = Vampire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vampires }\n end\n end",
"def index\n @vendamesas = Vendamesa.all\n end",
"def ... | [
"0.7545557",
"0.6906841",
"0.6818045",
"0.6785532",
"0.6757907",
"0.67245144",
"0.6708613",
"0.66559136",
"0.66076094",
"0.66062194",
"0.65634567",
"0.6526745",
"0.6525964",
"0.6525964",
"0.6525919",
"0.64801055",
"0.64403087",
"0.6437207",
"0.6437207",
"0.6436552",
"0.641870... | 0.0 | -1 |
GET /vendas/1 GET /vendas/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\tvendas = Venda.all\n\t\trender json: vendas, status: :ok\n\tend",
"def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\n end\n end",
"def show\n @vano = Vano.find(params[:id])\n\n respond_t... | [
"0.74494493",
"0.6986143",
"0.6936621",
"0.6811935",
"0.67829984",
"0.67507744",
"0.67507744",
"0.67507744",
"0.6713494",
"0.6659328",
"0.66552544",
"0.6653311",
"0.6653311",
"0.6652034",
"0.66482383",
"0.6640673",
"0.6625014",
"0.6619691",
"0.6589881",
"0.65886384",
"0.65709... | 0.0 | -1 |
PATCH/PUT /vendas/1 PATCH/PUT /vendas/1.json | def update
handle_venda_update
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @venda.update(venda_params)\n format.html { redirect_to @venda, notice: 'Venda was successfully updated.' }\n format.json { render :show, status: :ok, location: @venda }\n else\n format.html { render :edit }\n format.json { render js... | [
"0.6492022",
"0.6426649",
"0.63849473",
"0.63848513",
"0.62893313",
"0.62834865",
"0.6277579",
"0.6266521",
"0.6253101",
"0.62313",
"0.6208199",
"0.6192934",
"0.61518955",
"0.61518955",
"0.6147965",
"0.61477715",
"0.6133491",
"0.6109715",
"0.6101849",
"0.6088767",
"0.60850394... | 0.0 | -1 |
DELETE /vendas/1 DELETE /vendas/1.json | def destroy
@venda.destroy
respond_to do |format|
format.html { redirect_to vendas_url, notice: 'Venda foi excluído(a) com sucesso.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @vendamesa.destroy\n respond_to do |format|\n format.html { redirect_to vendamesas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venta = Venta.fi... | [
"0.75348115",
"0.74768025",
"0.72567564",
"0.71958387",
"0.7181131",
"0.7158933",
"0.7158933",
"0.71558154",
"0.712162",
"0.7112297",
"0.7109105",
"0.7103414",
"0.70590746",
"0.7045673",
"0.70452225",
"0.703972",
"0.7034291",
"0.70305383",
"0.70283663",
"0.70278376",
"0.70241... | 0.7015381 | 21 |
Use callbacks to share common setup or constraints between actions. | def set_venda
@venda = Venda.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def venda_params
params.require(:venda).permit(:data, :preco_total, :status, :cliente_id, produto_attributes: [:nome, :_destroy])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Users never be displayed on the Show Page of Some Record like here Article, in the Show Page of Article we are just show the Article, although if there is a requirement to show then we can do this, but in general Article show page actually contains the Related Articles not the Users. | def show
@users = User.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n redirect_to user_articles_path(@user) unless @user == @current_user\n end",
"def show\n #@user = User.find(params[:id])\n #replced by the before_action at the top\n \n \n # 1 -we cant use pagination like we do in index, since there is only 1 user, \n # 1.1... | [
"0.7272544",
"0.6909685",
"0.66404074",
"0.6580961",
"0.6566429",
"0.64468217",
"0.6404885",
"0.636056",
"0.6246759",
"0.6232393",
"0.6226925",
"0.6221511",
"0.621277",
"0.6196258",
"0.6172399",
"0.61621314",
"0.6157139",
"0.61526847",
"0.6150951",
"0.6142129",
"0.61367536",
... | 0.0 | -1 |
GET /telefono_empresa_clientes/1 GET /telefono_empresa_clientes/1.xml | def show
@telefono_empresa_cliente = TelefonoEmpresaCliente.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @telefono_empresa_cliente }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @clienteles = @paramun.clienteles\n\n respond_to do |format|\n if @clienteles.empty?\n format.xml { render request.format.to_sym => \"ccliErreurA\" } ## Aucune Clientele\n else \n format.xml { render xml: @clienteles }\n end\n end\n... | [
"0.6783216",
"0.66646326",
"0.66646326",
"0.65597534",
"0.6447109",
"0.64280355",
"0.6384977",
"0.6346848",
"0.6305162",
"0.62487537",
"0.6245668",
"0.6245668",
"0.6203517",
"0.61957204",
"0.61743945",
"0.61268383",
"0.6071174",
"0.6055195",
"0.6055195",
"0.6053364",
"0.60400... | 0.6966262 | 0 |
GET /telefono_empresa_clientes/new GET /telefono_empresa_clientes/new.xml | def new
@telefono_empresa_cliente = TelefonoEmpresaCliente.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @telefono_empresa_cliente }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cliente }\... | [
"0.7639799",
"0.7639799",
"0.7441158",
"0.74191314",
"0.7337371",
"0.72531915",
"0.7193336",
"0.7172076",
"0.7171012",
"0.7171012",
"0.71678793",
"0.71343446",
"0.71194124",
"0.7082594",
"0.707889",
"0.707341",
"0.70663124",
"0.7063392",
"0.7053992",
"0.7035397",
"0.7033758",... | 0.76109314 | 2 |
POST /telefono_empresa_clientes POST /telefono_empresa_clientes.xml | def create
@telefono_empresa_cliente = TelefonoEmpresaCliente.new(params[:telefono_empresa_cliente])
respond_to do |format|
if @telefono_empresa_cliente.save
format.html { redirect_to(@telefono_empresa_cliente, :notice => 'Telefono empresa cliente was successfully created.') }
format.xml ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n respond_to do |format|\n unless @selecciones.empty?\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual... | [
"0.6664834",
"0.6510008",
"0.6363836",
"0.6362275",
"0.63599384",
"0.63558435",
"0.6288471",
"0.62390023",
"0.623597",
"0.6227901",
"0.62177587",
"0.6175823",
"0.61203355",
"0.6119605",
"0.6108853",
"0.60635614",
"0.60521054",
"0.60378104",
"0.60376686",
"0.6036638",
"0.60342... | 0.6640846 | 1 |
PUT /telefono_empresa_clientes/1 PUT /telefono_empresa_clientes/1.xml | def update
@telefono_empresa_cliente = TelefonoEmpresaCliente.find(params[:id])
respond_to do |format|
if @telefono_empresa_cliente.update_attributes(params[:telefono_empresa_cliente])
format.html { redirect_to(@telefono_empresa_cliente, :notice => 'Telefono empresa cliente was successfully updat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { render :json => {:success => true} }\n format.xml { render :xml => @cliente, :status => :created, :location => @cliente }\n else\n for... | [
"0.6527563",
"0.64385957",
"0.63959193",
"0.63867146",
"0.6216172",
"0.6209601",
"0.6187018",
"0.6164649",
"0.61467606",
"0.6141274",
"0.613235",
"0.613235",
"0.6118643",
"0.6082061",
"0.60738146",
"0.6059395",
"0.60514116",
"0.60447025",
"0.6041774",
"0.6039529",
"0.602319",... | 0.67948747 | 0 |
DELETE /telefono_empresa_clientes/1 DELETE /telefono_empresa_clientes/1.xml | def destroy
@telefono_empresa_cliente = TelefonoEmpresaCliente.find(params[:id])
@telefono_empresa_cliente.destroy
respond_to do |format|
format.html { redirect_to(telefono_empresa_clientes_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to(clientes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n... | [
"0.6942973",
"0.6942973",
"0.68663824",
"0.68599224",
"0.6791961",
"0.67101616",
"0.66767347",
"0.6618889",
"0.6598556",
"0.6596332",
"0.6568811",
"0.6559874",
"0.6559814",
"0.6516731",
"0.6501242",
"0.64860016",
"0.64565116",
"0.6455478",
"0.64554214",
"0.6449482",
"0.644800... | 0.71057737 | 0 |
queries constructs a case policy | def policy
return Case::Policy.new(user, self.case)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policy(record); end",
"def case_expression_sql(ce)\n \"(CASE #{ce.conditions.collect{|c,r| \"WHEN #{literal(c)} THEN #{literal(r)} \"}.join}ELSE #{literal(ce.default)} END)\"\n end",
"def keyword\n 'case'\n end",
"def keyword\n 'case'\n end",
"def case_clause\n # ->... | [
"0.6371698",
"0.6367277",
"0.5985745",
"0.5985745",
"0.5932342",
"0.5832929",
"0.5805101",
"0.5802997",
"0.5776156",
"0.5731918",
"0.56645155",
"0.5556812",
"0.55072963",
"0.5503636",
"0.5499924",
"0.5463049",
"0.54248434",
"0.5419892",
"0.5416545",
"0.54015344",
"0.537929",
... | 0.668359 | 0 |
Create the function we will use to determine the report names | def title_for_attribute(attribute)
attribute = 'default' if attribute.nil?
"Report for #{attribute}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report_title; end",
"def report_title; end",
"def create_report\n print_sales_report_ASCII\n print_date\n print_products_ASCII\n print_brands_ASCII\n end",
"def source_name_method\n \"#{accession_number} (#{report_date})\"\n end",
"def name()\n raise \"No name() function defined by ... | [
"0.65122193",
"0.65122193",
"0.6471366",
"0.6378567",
"0.6345414",
"0.63315684",
"0.63315684",
"0.6241134",
"0.60573655",
"0.5971731",
"0.58998436",
"0.5888581",
"0.58784413",
"0.58784413",
"0.58784413",
"0.5874696",
"0.5871653",
"0.57888657",
"0.57474965",
"0.57405627",
"0.5... | 0.0 | -1 |
Create the function we will use to determine the report filenames | def html_report_path_for_attribute(attribute)
attribute = 'default' if attribute.nil?
File.join($output_dir, "#{attribute}.html")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename_generator\n\t\tparameter_array = Array.new\n\t\tunless params[:name].blank?\n\t\t\tparameter_array << params[:name]\n\t\tend\n\t\t\n\t\tunless params[:state].blank?\n\t\t\tparameter_array << params[:state]\n\t\t end\n\t\t\n\t\tunless params[:commodity].blank?\n\t\t\tparameter_array << params[:commodit... | [
"0.6647508",
"0.6206313",
"0.6206313",
"0.6200365",
"0.6124406",
"0.6120928",
"0.6120928",
"0.60978997",
"0.60835177",
"0.6048484",
"0.60370564",
"0.60370564",
"0.60370564",
"0.60370564",
"0.60370564",
"0.60370564",
"0.60370564",
"0.60370564",
"0.60370564",
"0.60370564",
"0.6... | 0.0 | -1 |
calculate the distance between two tiles | def linear_distance(tile_a, tile_b)
x1, y1 = tile_a.x, tile_a.y
x2, y2 = tile_b.x, tile_b.y
Math.sqrt((x2 - x1)**2 + (y2 - y1)**2).abs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(a, b)\n (a.x - b.x).abs + (a.y - b.y).abs\n end",
"def find_distance_between(cell1, cell2)\n if cell1.nil? || cell2.nil?\n return 0\n end\n\n if cell1.col == cell2.col || cell1.row == cell2.row\n return ((cell1.row - cell2.row) + (cell1.col - cell2.col)).abs\n end\n\n ... | [
"0.70962906",
"0.7090216",
"0.69438684",
"0.6881748",
"0.6786396",
"0.6777224",
"0.67552155",
"0.6749684",
"0.67393273",
"0.673738",
"0.67328453",
"0.6690431",
"0.6681336",
"0.66374946",
"0.6609946",
"0.6607266",
"0.6602016",
"0.65926075",
"0.6539082",
"0.6529663",
"0.6525985... | 0.7575183 | 0 |
find a 90 degree path between two tiles | def find_path(tile_a, tile_b)
if rand(0..1).floor() === 1
# start horizontal
x, y = tile_a.x, tile_b.y
else
# start vertical
x, y = tile_b.x, tile_a.y
end
turn_point = tile_by_coordinates(x, y)
[tile_a, turn_point, tile_b]
# if (x2 > x1)
# delta_x = x2 - x1
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pathfind begTile, endTile\n @traveled_tiles = [begTile]\n @current_tiles = [begTile]\n @next_tiles = Array.new\n #iterate through the maze one movement at a time, hard stop when all tiles have been exhausted\n while (!@current_tiles.include? endTile) && @traveled_tiles.length < @maze.size\n ... | [
"0.6571991",
"0.6463992",
"0.64597565",
"0.6241605",
"0.61733514",
"0.6160973",
"0.61342204",
"0.61185384",
"0.6053973",
"0.6053973",
"0.5895151",
"0.58522266",
"0.584939",
"0.58323175",
"0.58217233",
"0.57400435",
"0.573705",
"0.5703512",
"0.5699754",
"0.5695126",
"0.5685140... | 0.76118946 | 0 |
Perform Author: Santhosh Date: 19/07/2019 Reviewed By: | def create_hooks_for_admins(client_id, attributes_hash)
puts "==== Creating hooks on admins for client_id #{client_id} for attributes #{attributes_hash}"
manager_ids = []
super_admins = {}
ClientManager.admins(client_id).all.each do |client_manager|
formatted_cm = client_manager.formatted_cache... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paper\n reviewer_recommendations_task.paper\n end",
"def performed_by(params = {})\n #TODO\n end",
"def process_created_review(review_payload)\n pr_name = review_payload['repository']['full_name'].to_s\n pr_number = review_payload['pull_request']['number'].to_s\n comment_user =... | [
"0.5782884",
"0.57451886",
"0.57434726",
"0.5664014",
"0.5619637",
"0.56061864",
"0.5558696",
"0.55402505",
"0.5481851",
"0.5478254",
"0.54780555",
"0.54080135",
"0.54020303",
"0.5351328",
"0.52926195",
"0.5276108",
"0.52720666",
"0.52487624",
"0.52487624",
"0.52430725",
"0.5... | 0.0 | -1 |
Perform Author: Santhosh Date: 19/07/2019 Reviewed By: | def update_contact(manager_id, attributes_hash)
r = Email::HookCreator::UpdateContact.new(
receiver_entity_id: manager_id,
receiver_entity_kind: GlobalConstant::EmailServiceApiCallHook.manager_receiver_entity_kind,
custom_attributes: attributes_hash,
user_settings: {}
).perform
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paper\n reviewer_recommendations_task.paper\n end",
"def performed_by(params = {})\n #TODO\n end",
"def process_created_review(review_payload)\n pr_name = review_payload['repository']['full_name'].to_s\n pr_number = review_payload['pull_request']['number'].to_s\n comment_user =... | [
"0.5782884",
"0.57451886",
"0.57434726",
"0.5664014",
"0.5619637",
"0.56061864",
"0.5558696",
"0.55402505",
"0.5481851",
"0.5478254",
"0.54780555",
"0.54080135",
"0.54020303",
"0.5351328",
"0.52926195",
"0.5276108",
"0.52720666",
"0.52487624",
"0.52487624",
"0.52430725",
"0.5... | 0.0 | -1 |
Allows for specific handling of the selected lines | def handle(vm_tracepoint); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select(&blk)\n alter do\n @lines = @lines.select(&blk)\n end\n end",
"def select_line\n buffer_current.select_current_line\n update_status_line\n end",
"def line_selector\n\n train_lines = {\n :line_n => [\"N\", \"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Sq... | [
"0.65021664",
"0.6376681",
"0.61299586",
"0.60820746",
"0.6046641",
"0.59675485",
"0.5930088",
"0.5815311",
"0.58088905",
"0.57412386",
"0.56725985",
"0.56422096",
"0.5631299",
"0.55750674",
"0.5570988",
"0.55565876",
"0.55531734",
"0.5550915",
"0.55505604",
"0.5545158",
"0.5... | 0.0 | -1 |
String each() operator reads linebyline These functions return characters | def each_char
self.each_byte{|x| yield x.chr }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_line(&block)\n string.each_line(&block)\n end",
"def each\n @theLines.each { |s| yield s }\n end",
"def each_str(&block) # :yield: string\n # tracking the position using a local variable \n # is faster than calling io.pos. \n pos = nil\n io_index.each do |(start, length)|\n ... | [
"0.7238494",
"0.6646045",
"0.6616561",
"0.6532383",
"0.6506056",
"0.64130336",
"0.62815416",
"0.6232075",
"0.62185067",
"0.61627054",
"0.616033",
"0.6139984",
"0.6132185",
"0.6067244",
"0.6025339",
"0.5913572",
"0.5910826",
"0.5909569",
"0.5824562",
"0.5818891",
"0.58112085",... | 0.5996297 | 15 |
GET /resource/password/new def new super end POST /resource/password | def create
@user = User.find_by(email:params[:user][:login])
unless params[:user][:login].empty?
unless @user.nil?
if session[:layout] == "admin"
if @user.client_type == 'empleado'
if @user.reset_password_token.nil?
ResendPasswordMailer.resend_password(@user).de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @password = Password.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @password }\n end\n end",
"def new\n resource = build_resource\n clean_up_passwords(resource)\n respond_with(resource, serialize_options(resource))\n end",
"de... | [
"0.7871598",
"0.7864839",
"0.7688182",
"0.7511597",
"0.7500005",
"0.71542495",
"0.6922398",
"0.67856133",
"0.6752737",
"0.672599",
"0.66774505",
"0.66679007",
"0.6649871",
"0.66472095",
"0.66121453",
"0.6583476",
"0.6583476",
"0.65794134",
"0.657762",
"0.6569299",
"0.6547613"... | 0.0 | -1 |
The path used after sending reset password instructions | def after_sending_reset_password_instructions_path_for(resource_name)
super(resource_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_sending_reset_password_instructions_path_for(resource_name)\n receber_email_password_path\n end",
"def after_sending_reset_password_instructions_path_for(resource_name)\n root_path\n end",
"def after_sending_reset_password_instructions_path_for(resource_name)\n store_url\n end",
"... | [
"0.7399897",
"0.7388807",
"0.7221363",
"0.7169863",
"0.70551175",
"0.70126516",
"0.7008006",
"0.6926533",
"0.6911947",
"0.6900387",
"0.6900387",
"0.6900387",
"0.6884388",
"0.68729913",
"0.6870175",
"0.6858631",
"0.6858631",
"0.6807925",
"0.6807925",
"0.6781113",
"0.6687174",
... | 0.6905408 | 10 |
:ask_user! is called before creating a new authorization, this allows us to redirect | def create
# find or create an auth_grant for a given user
application = Opro::Oauth::ClientApp.find_by_client_id(params[:client_id])
auth_grant = Opro::Oauth::AuthGrant.find_or_create_by_user_app(current_user, application)
# add permission changes if there are any
auth_grant.update_permissions(pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_user!\n # binding.pry\n unless can?(:crud, @question)\n flash[:alert] = \"Access Denied!\"\n redirect_to root_path\n\n # `head` is a method similar to `render` or `redirect_to`. It finalizes\n # the response. However, it will add content to the response. It will simply\n ... | [
"0.689843",
"0.688754",
"0.6806539",
"0.67907965",
"0.6787777",
"0.6755145",
"0.6755093",
"0.66492283",
"0.6629795",
"0.66062975",
"0.6585102",
"0.6578595",
"0.6571924",
"0.65555537",
"0.6554762",
"0.65506446",
"0.6498605",
"0.64836806",
"0.6480622",
"0.64680034",
"0.64543176... | 0.0 | -1 |
When a user is sent to authorize an application they must first accept the authorization if they've already authed the app, they skip this section | def ask_user!
if user_granted_access_before?(current_user, params)
# Re-Authorize the application, do not ask the user
params.delete(:permissions) ## Delete permissions supplied by client app, this was a security hole
return true
elsif user_authorizes_the_request?(request)
# The user jus... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorized!\n redirect_to root_url, alert: \"You need to be set up for receiving whispers first\" and return unless current_user\n end",
"def preauth(second_factor)\n !client.heroku.put(\"/apps/#{id}/pre-authorizations\", second_factor).any?\n end",
"def authorize_application\n render js... | [
"0.6988838",
"0.69725245",
"0.6955866",
"0.6949272",
"0.6907241",
"0.68275607",
"0.682728",
"0.67671335",
"0.6718986",
"0.6713335",
"0.6693732",
"0.6689788",
"0.66794145",
"0.66703355",
"0.66631246",
"0.66631246",
"0.66631246",
"0.66631246",
"0.66631246",
"0.66631246",
"0.666... | 0.671493 | 9 |
Verifying that a post was made from our own site, indicating a user confirmed via form | def user_authorizes_the_request?(request)
request.post? && referrer_is_self?(request)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_successful_post(app_window)\n # Makes sure the posting application window is closed\n assert page.driver.browser.window_handles.length == 1\n assert app_window.closed?\n # Makes sure the privly link is posted\n if @privly_testing == 'IFRAME'\n assert find_by_id('test2_textarea').valu... | [
"0.6636325",
"0.65790486",
"0.6338367",
"0.6269638",
"0.6204272",
"0.61996347",
"0.61420554",
"0.6091023",
"0.60271806",
"0.5971779",
"0.59697",
"0.5956733",
"0.59319896",
"0.5920223",
"0.5888452",
"0.5884635",
"0.58414555",
"0.58402646",
"0.5832333",
"0.57988846",
"0.5792996... | 0.5911895 | 14 |
Ensures that the referrer is the current host, to prevent spoofing | def referrer_is_self?(request)
return false if request.referrer.blank?
referrer_host = URI.parse(request.referrer).host
self_host = URI.parse(request.url).host
referrer_host == self_host
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_original_referrer\n # blank referrer\n return if request.referrer.blank?\n # self-referrer (multi-form valet service)\n return if URI(request.referrer).host == request.host\n # referrer set to authentication host\n return if URI(request.referrer).host == 'cas.columbia.edu'\n # ok - loo... | [
"0.76764387",
"0.70984095",
"0.7082141",
"0.69559366",
"0.69559366",
"0.6888485",
"0.6713241",
"0.67126477",
"0.6580863",
"0.6549227",
"0.6536749",
"0.6500493",
"0.64900625",
"0.648607",
"0.64808774",
"0.6387032",
"0.6376342",
"0.6353315",
"0.63386655",
"0.6305488",
"0.628944... | 0.7725147 | 0 |
take params[:scope] = [:write, :read, :etc] or take params[:scope] = "write, read, etc" compare against available scopes ::Opro.request_permissions return the intersecting set. or the default scope | def scope_from_params(params)
return default_scope if params[:scope].blank?
scope = params[:scope].is_a?(Array) ? params[:scope] : params[:scope].split(',')
scope = scope.map(&:downcase).map(&:strip)
return scope & default_scope
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_scopes\n scopes = Array(Rack::Utils.parse_query(request.query_string)[\"scope\"])\n return if scopes.empty?\n\n auth_scopes = {}\n\n # First try to fetch the requested scopes and the handler. If no scopes\n # were successfully given, respond with a 401.\n scopes.each do |scope|\n ... | [
"0.67474884",
"0.6731656",
"0.6638635",
"0.64624995",
"0.64138466",
"0.630907",
"0.6294749",
"0.6274364",
"0.6259648",
"0.62592167",
"0.625344",
"0.6178021",
"0.61469",
"0.6146782",
"0.6138146",
"0.61294496",
"0.6124715",
"0.61228985",
"0.61015046",
"0.6099768",
"0.607376",
... | 0.6653323 | 2 |
Load tags from a CSV file (tags must be in the first column) and order them by length | def initialize(csv)
@tags = []
CSV.foreach(csv) do |row|
@tags << row[0]
end
@tags.sort!{|x, y| y.length <=> x.length}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_from_csv( filename )\n File.open( filename ) do |file|\n print \"Reading #{filename}... \"\n\n insert_from_lines( file.readlines )\n end\n\n flush_inserts\n end",
"def load_data(csv)\n @hash.each do |sentence, count|\n csv << [sentence, count]\n end\n end",
"def sort_b... | [
"0.55973274",
"0.5497754",
"0.5439797",
"0.54233927",
"0.53697044",
"0.5358632",
"0.52951413",
"0.52231836",
"0.519954",
"0.51987827",
"0.5146796",
"0.5107475",
"0.5094431",
"0.5072957",
"0.50723433",
"0.5041577",
"0.5035866",
"0.5026729",
"0.50264806",
"0.5025711",
"0.500941... | 0.72458893 | 0 |
Match given strings with tags extracted from the CSV file Return an array of tag | def match(*strings)
result = []
@tags.each do |tag|
strings.each do |string|
if string.downcase =~ /#{tag.downcase}/
strings.delete string
result << tag
break
end
end
end
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(term)\n contact_array = []\n CSV.foreach(\"contact_data.csv\") do |line|\n if line[1].match(term)\n contact_array << line\n elsif line[2].match(term)\n contact_array << line\n end\n end\n return contact_array\n end",
"def get_tag_matches(op... | [
"0.60096955",
"0.5830024",
"0.5830024",
"0.5830024",
"0.5830024",
"0.5830024",
"0.5830024",
"0.5801398",
"0.5710634",
"0.5650683",
"0.56501395",
"0.5551195",
"0.55149084",
"0.55025035",
"0.5493275",
"0.5492178",
"0.5468336",
"0.5457882",
"0.5441359",
"0.54373634",
"0.54224783... | 0.6536011 | 0 |
Handle incoming requests from QRadar | def on_request_uri(cli, request)
print_good("#{peer} - Sending privilege escalation payload to QRadar...")
print_good("#{peer} - Sit back and relax, Shelly will come visit soon!")
send_response(cli, @payload)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_request(client, lines, requests); end",
"def process_http_request\n route_http_request\n end",
"def receive(request); end",
"def send_request; end",
"def on_dispatch_request(cli,data)\n peer = \"#{cli.ip_daddr}:\" << (cli.is_udp? ? \"#{cli.udp_dst}\" : \"#{cli.tcp_dst}\")\n # Deal with... | [
"0.6236261",
"0.6108532",
"0.6103884",
"0.6012306",
"0.5904454",
"0.58910614",
"0.58910614",
"0.58910614",
"0.58910614",
"0.58910614",
"0.58910614",
"0.58910614",
"0.58910614",
"0.58910614",
"0.58910614",
"0.58910614",
"0.58566064",
"0.5836498",
"0.58235186",
"0.58067197",
"0... | 0.62772983 | 0 |
step 1 of the exploit, bypass authentication in the ForensicAnalysisServlet | def set_cookies
@sec_cookie = SecureRandom.uuid
@csrf_cookie = SecureRandom.uuid
post_data = "#{rand_text_alpha(5..12)},#{rand_text_alpha(5..12)}," +
"#{@sec_cookie},#{@csrf_cookie}"
res = send_request_cgi({
'uri' => '/ForensicsAnalysisServlet/',
'method' => 'POST',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exploit\n begin\n # attempt a login. In this case we show basic auth, and a POST to a fake username/password\n # simply to show how both are done\n vprint_status('Attempting login')\n # since we will check res to see if auth was a success, make sure to capture the return\n res = sen... | [
"0.74155426",
"0.65845996",
"0.65440047",
"0.6512606",
"0.62762433",
"0.62092286",
"0.62064564",
"0.61261475",
"0.60630226",
"0.6055952",
"0.6024857",
"0.5930749",
"0.5861534",
"0.5751054",
"0.57128483",
"0.56896186",
"0.5682503",
"0.56763333",
"0.5655983",
"0.5652766",
"0.56... | 0.0 | -1 |
Determines if self is a valid Url or not. | def valid?
Wgit::Url.valid?(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_url\n unless UrlValidator.valid_entry_url? self.url\n errors.add :url, \"URL #{self.url} is not a valid http, https or protocol-relative URL\"\n end\n end",
"def valid_url?\n\t\t# http:// or not http://\n\t\tx = self.long_url.start_with?(\"http://\", \"https://\")\n\t\tif x == false\n\t\t\... | [
"0.77423114",
"0.76186967",
"0.75614774",
"0.7534354",
"0.7527788",
"0.7522316",
"0.7518402",
"0.75169075",
"0.7504677",
"0.7464386",
"0.7450593",
"0.7448919",
"0.7443357",
"0.74355984",
"0.74355984",
"0.74355984",
"0.74234074",
"0.739217",
"0.73803246",
"0.73673767",
"0.7357... | 0.82852435 | 0 |
Concats self and the link. | def concat(link)
Wgit::Url.concat(self, link)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_link\n \"<a href=\\\"#{self.url}\\\">#{self.name}</a>\"\n end",
"def link_self; end",
"def with_link(*args)\n @links.push(args.length == 1 ? args.first : Link.new(*args))\n self\n end",
"def my_join(link=\"\")\n str = \"\"\n i = 0\n while i < self.length\n if i != 0\... | [
"0.63445777",
"0.62990236",
"0.61991745",
"0.61857206",
"0.61856645",
"0.61398023",
"0.6033911",
"0.5957934",
"0.58793783",
"0.5871175",
"0.5861762",
"0.5816743",
"0.57943547",
"0.5772843",
"0.57552785",
"0.57481015",
"0.5744905",
"0.57425094",
"0.5732132",
"0.5714456",
"0.56... | 0.7070336 | 0 |
Normalises/escapes self and returns a new Wgit::Url. | def normalise
Wgit::Url.new(@uri.normalize.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def to_url\n\t\treturn self.\n\t\t\tunaccent.\n\t\t\tstrip_tags.\n\t\t\tgsub(\" \", \" \").\n\t\t\tgsub(\"&\", \" \").\n\t\t\tdowncase.\n\t\t\tgsub(/[^a-z0-9\\.\\s,\\-_]/, \"\").\n\t\t\tgsub(/[\\.\\s,\\-_]+/, \"-\").\n\t\t\ttrim(\"-\")\... | [
"0.7755138",
"0.73138565",
"0.71635735",
"0.7115363",
"0.7087201",
"0.6608401",
"0.6604556",
"0.66016775",
"0.6596795",
"0.6516129",
"0.64871913",
"0.64869875",
"0.64811265",
"0.64738655",
"0.6425473",
"0.6385626",
"0.63640654",
"0.63330376",
"0.63274324",
"0.6315059",
"0.629... | 0.77396727 | 1 |
Returns a normalised URI object for this URL. | def to_uri
URI(normalise)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalise\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def normalize\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def to_uri\n URI(normalize)\n end",
"def to_uri\n URI.parse self\n end",
"def uri_normalizer; end",
"def to_uri\n uri_class = ::URI.const_get scheme.u... | [
"0.8266807",
"0.8164214",
"0.80717754",
"0.8007374",
"0.7752575",
"0.76282805",
"0.76232046",
"0.76150817",
"0.760871",
"0.7608495",
"0.74915755",
"0.74630666",
"0.74092287",
"0.73667526",
"0.7362681",
"0.7311182",
"0.72409797",
"0.7196902",
"0.7168973",
"0.7140085",
"0.71118... | 0.8189973 | 1 |
Returns a new Wgit::Url containing just the scheme/protocol of this URL e.g. Given http is returned. | def to_scheme
scheme = @uri.scheme
scheme ? Wgit::Url.new(scheme) : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_base\n return nil unless @uri.scheme && @uri.host\n\n base = \"#{@uri.scheme}://#{@uri.host}\"\n Wgit::Url.new(base)\n end",
"def to_base\n return nil if @uri.scheme.nil? || @uri.host.nil?\n\n base = \"#{@uri.scheme}://#{@uri.host}\"\n Wgit::Url.new(base)\n end",
"def... | [
"0.7894519",
"0.78263533",
"0.73610425",
"0.7207013",
"0.7207013",
"0.7149706",
"0.70838934",
"0.70809066",
"0.6987326",
"0.6986751",
"0.6968143",
"0.68683463",
"0.6851308",
"0.6851308",
"0.68416893",
"0.6816973",
"0.6801234",
"0.67888296",
"0.6735219",
"0.6717135",
"0.671318... | 0.73884207 | 3 |
Returns a new Wgit::Url containing just the host of this URL e.g. Given is returned. | def to_host
host = @uri.host
host ? Wgit::Url.new(host) : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_base\n return nil unless @uri.scheme && @uri.host\n\n base = \"#{@uri.scheme}://#{@uri.host}\"\n Wgit::Url.new(base)\n end",
"def to_base\n return nil if @uri.scheme.nil? || @uri.host.nil?\n\n base = \"#{@uri.scheme}://#{@uri.host}\"\n Wgit::Url.new(base)\n end",
"def... | [
"0.7503687",
"0.746558",
"0.74560684",
"0.7128055",
"0.6951806",
"0.692723",
"0.6916802",
"0.6874359",
"0.6874359",
"0.6864328",
"0.6846684",
"0.68294907",
"0.67583543",
"0.67574465",
"0.673584",
"0.6703033",
"0.6703033",
"0.66837895",
"0.66837895",
"0.6677122",
"0.6677122",
... | 0.8231828 | 1 |
Returns a new Wgit::Url containing just the domain of this URL e.g. Given google.co.uk is returned. | def to_domain
domain = @uri.domain
domain ? Wgit::Url.new(domain) : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_url\n full_domain(:with_protocol => true)\n end",
"def full_url\n full_domain(:with_protocol => true)\n end",
"def to_sub_domain\n return nil unless to_host\n\n dot_domain = \".#{to_domain}\"\n return nil unless include?(dot_domain)\n\n sub_domain = to_host.sub(dot_domain, ... | [
"0.7459566",
"0.7459566",
"0.73008066",
"0.7230412",
"0.72289485",
"0.71570575",
"0.7137644",
"0.71228814",
"0.71032435",
"0.7081577",
"0.70456475",
"0.70456475",
"0.69652396",
"0.6927011",
"0.6908291",
"0.6824836",
"0.6817127",
"0.680714",
"0.67719626",
"0.67532814",
"0.6750... | 0.8136421 | 1 |
Returns a new Wgit::Url containing just the brand of this URL e.g. Given google is returned. | def to_brand
domain = to_domain
domain ? Wgit::Url.new(domain.split('.').first) : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_base\n return nil unless @uri.scheme && @uri.host\n\n base = \"#{@uri.scheme}://#{@uri.host}\"\n Wgit::Url.new(base)\n end",
"def to_base\n return nil if @uri.scheme.nil? || @uri.host.nil?\n\n base = \"#{@uri.scheme}://#{@uri.host}\"\n Wgit::Url.new(base)\n end",
"def... | [
"0.60805655",
"0.606524",
"0.6059005",
"0.6034202",
"0.60282534",
"0.60276663",
"0.6008156",
"0.59480643",
"0.591648",
"0.5903812",
"0.5892767",
"0.58742535",
"0.5832216",
"0.58321834",
"0.58196247",
"0.58193094",
"0.58193094",
"0.5766168",
"0.5766141",
"0.5756263",
"0.575084... | 0.8074339 | 1 |
Returns only the base of this URL e.g. the protocol and host combined. | def to_base
return nil if @uri.scheme.nil? || @uri.host.nil?
base = "#{@uri.scheme}://#{@uri.host}"
Wgit::Url.new(base)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_url\n @url.to_s.split('?').first\n end",
"def base_url\n \"#{scheme}://#{host}\"\n end",
"def base_url\n current_base_href = base_href.to_s.strip.empty? ? nil : URL.absolutify(base_href, URL.new(url).root_url)\n current_base_href || url\n end",
"def _base_url\n ... | [
"0.79993606",
"0.79629385",
"0.7863749",
"0.7859655",
"0.7830037",
"0.7582138",
"0.754174",
"0.7510367",
"0.7490074",
"0.7443478",
"0.7434938",
"0.7413168",
"0.73581153",
"0.7323202",
"0.73069924",
"0.73069924",
"0.7254035",
"0.72343564",
"0.72321385",
"0.72277224",
"0.722105... | 0.7417452 | 11 |
Returns the path of this URL e.g. the bit after the host without slashes. For example: Wgit::Url.new(" returns "about.html". See Wgit::Urlto_endpoint if you want the slashes. | def to_path
path = @uri.path
return nil if path.nil? || path.empty?
return Wgit::Url.new('/') if path == '/'
Wgit::Url.new(path).without_slashes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\r\n url.gsub(/https?:\\/\\/[^\\/]+\\//i, '').scan(/([^&]+)/i).first().first()\r\n end",
"def path\n URI.parse(@url).path\n rescue URI::InvalidURIError # Invalid URLs will be added and caught when we try to navigate to them\n @url\n end",
"def to_path\n path = @uri.path... | [
"0.79546326",
"0.77751696",
"0.76582617",
"0.74116004",
"0.74116004",
"0.7408813",
"0.7333235",
"0.7273772",
"0.7166603",
"0.7157293",
"0.7154399",
"0.7071357",
"0.7021168",
"0.69717413",
"0.6971206",
"0.69521326",
"0.692657",
"0.6923343",
"0.68859947",
"0.68859947",
"0.68355... | 0.76640385 | 2 |
Returns the endpoint of this URL e.g. the bit after the host with any slashes included. For example: Wgit::Url.new(" returns "/about.html/". See Wgit::Urlto_path if you don't want the slashes. | def to_endpoint
endpoint = @uri.path
endpoint = '/' + endpoint unless endpoint.start_with?('/')
Wgit::Url.new(endpoint)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url\n URI.parse(endpoint).join(path.to_s).to_s\n end",
"def path\r\n url.gsub(/https?:\\/\\/[^\\/]+\\//i, '').scan(/([^&]+)/i).first().first()\r\n end",
"def path\n URI.parse(@url).path\n rescue URI::InvalidURIError # Invalid URLs will be added and caught when we try to navi... | [
"0.7693175",
"0.74944645",
"0.7320359",
"0.7264741",
"0.72530276",
"0.7217383",
"0.7173813",
"0.7131886",
"0.71151775",
"0.7099274",
"0.69798326",
"0.69246066",
"0.6897178",
"0.6889023",
"0.6884089",
"0.6883722",
"0.6846943",
"0.67805976",
"0.6778339",
"0.67710286",
"0.672770... | 0.8149642 | 1 |
Returns a new Wgit::Url containing just the query string of this URL e.g. Given '?q=ruby' is returned. | def to_query_string
query = @uri.query
query ? Wgit::Url.new("?#{query}") : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def without_query_string\n query = to_query_string\n without_query_string = query ? gsub(query, '') : self\n\n Wgit::Url.new(without_query_string)\n end",
"def omit_query\n query = to_query\n omit_query_string = query ? gsub(\"?#{query}\", '') : self\n\n Wgit::Url.new(omit_query_... | [
"0.810429",
"0.81037945",
"0.8055118",
"0.7075829",
"0.66115665",
"0.6436198",
"0.64288884",
"0.63808894",
"0.63800997",
"0.6378394",
"0.63238883",
"0.6317807",
"0.6277176",
"0.62676275",
"0.6243505",
"0.62006724",
"0.6146519",
"0.6134765",
"0.61288476",
"0.6102924",
"0.60953... | 0.80677426 | 2 |
Returns a new Wgit::Url containing just the anchor string of this URL e.g. Given about is returned. | def to_anchor
anchor = @uri.fragment
anchor ? Wgit::Url.new("##{anchor}") : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def without_anchor\n anchor = to_anchor\n without_anchor = anchor ? gsub(anchor, '') : self\n\n Wgit::Url.new(without_anchor)\n end",
"def uri\n \"http://example.com#{base_path}#{anchor}\"\n end",
"def href\n href = (@url || @dos).to_s.dup\n if @fragment\n href << cli... | [
"0.7828289",
"0.6874515",
"0.6816535",
"0.63358635",
"0.6307274",
"0.6302309",
"0.62954897",
"0.6290082",
"0.6263018",
"0.62504345",
"0.62383264",
"0.62343687",
"0.6232425",
"0.6231273",
"0.620588",
"0.620588",
"0.61787134",
"0.6150819",
"0.6107359",
"0.6079462",
"0.6076625",... | 0.79887706 | 0 |
Returns a new Wgit::Url containing just the file extension of this URL e.g. Given html is returned. | def to_extension
path = to_path
return nil unless path
segs = path.split('.')
segs.length > 1 ? Wgit::Url.new(segs.last) : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ext\n @ext ||= path.split('.').size > 1 ? path.split('.')[-1] : 'html'\n end",
"def url\n make_file_name('html', name)\n end",
"def extname\n\t\treturn nil unless src\n\n\t\tFile.extname url.path\n\tend",
"def extension\n @extension ||= '.html'\n end",
"def process_url_exten... | [
"0.67364675",
"0.6664016",
"0.66057986",
"0.6595417",
"0.658198",
"0.6575542",
"0.6370251",
"0.6355511",
"0.62908596",
"0.62693536",
"0.61679435",
"0.61588454",
"0.6154119",
"0.60845596",
"0.6024701",
"0.6024701",
"0.6024211",
"0.60059154",
"0.6003777",
"0.6003596",
"0.600359... | 0.7921739 | 1 |
Returns a new Wgit::Url containing self without a trailing slash. Is idempotent meaning self will always be returned regardless of whether there's a trailing slash or not. | def without_leading_slash
start_with?('/') ? Wgit::Url.new(self[1..-1]) : self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def without_trailing_slash\n end_with?('/') ? Wgit::Url.new(chop) : self\n end",
"def omit_trailing_slash\n end_with?('/') ? Wgit::Url.new(chop) : self\n end",
"def omit_leading_slash\n start_with?('/') ? Wgit::Url.new(self[1..-1]) : self\n end",
"def without_base\n base_url = to... | [
"0.9158768",
"0.90141916",
"0.807271",
"0.79027516",
"0.76481193",
"0.712718",
"0.7101287",
"0.70585066",
"0.6790314",
"0.67224896",
"0.67222905",
"0.66251427",
"0.6472582",
"0.631971",
"0.6311744",
"0.6279464",
"0.622334",
"0.622334",
"0.6136008",
"0.6014133",
"0.5979545",
... | 0.8250759 | 2 |
Returns a new Wgit::Url containing self without a trailing slash. Is idempotent meaning self will always be returned regardless of whether there's a trailing slash or not. | def without_trailing_slash
end_with?('/') ? Wgit::Url.new(chop) : self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def omit_trailing_slash\n end_with?('/') ? Wgit::Url.new(chop) : self\n end",
"def without_leading_slash\n start_with?('/') ? Wgit::Url.new(self[1..-1]) : self\n end",
"def omit_leading_slash\n start_with?('/') ? Wgit::Url.new(self[1..-1]) : self\n end",
"def without_base\n base_... | [
"0.9014717",
"0.8251514",
"0.8073843",
"0.7903396",
"0.76492107",
"0.7128342",
"0.7101888",
"0.70594305",
"0.6792054",
"0.6724563",
"0.67243177",
"0.66262823",
"0.6472655",
"0.632151",
"0.63127023",
"0.62807125",
"0.62247735",
"0.62247735",
"0.61368173",
"0.60139394",
"0.5981... | 0.915902 | 0 |
Returns a new Wgit::Url containing self without a leading or trailing slash. Is idempotent and will return self regardless if there's slashes present or not. | def without_slashes
self.
without_leading_slash.
without_trailing_slash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def without_trailing_slash\n end_with?('/') ? Wgit::Url.new(chop) : self\n end",
"def omit_trailing_slash\n end_with?('/') ? Wgit::Url.new(chop) : self\n end",
"def without_leading_slash\n start_with?('/') ? Wgit::Url.new(self[1..-1]) : self\n end",
"def omit_leading_slash\n star... | [
"0.88118416",
"0.86669976",
"0.8508736",
"0.8412317",
"0.79435647",
"0.7774136",
"0.7271302",
"0.7039851",
"0.70168245",
"0.67061937",
"0.66692334",
"0.6595842",
"0.654158",
"0.6516023",
"0.6496111",
"0.6412203",
"0.611221",
"0.6054258",
"0.59997386",
"0.59960175",
"0.5933025... | 0.69175476 | 9 |
Returns a new Wgit::Url with the base (proto and host) removed e.g. Given search?q=somethingabout is returned. If relative and base isn't present then self is returned. Leading and trailing slashes are always stripped from the return value. | def without_base
base_url = to_base
without_base = base_url ? gsub(base_url, '') : self
return self if ['', '/'].include?(without_base)
Wgit::Url.new(without_base).without_slashes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def omit_base\n base_url = to_base\n omit_base = base_url ? gsub(base_url, '') : self\n\n return self if ['', '/'].include?(omit_base)\n\n Wgit::Url.new(omit_base).omit_slashes\n end",
"def to_base\n return nil unless @uri.scheme && @uri.host\n\n base = \"#{@uri.scheme}://#{@uri.... | [
"0.8303159",
"0.7408591",
"0.74036485",
"0.73785836",
"0.7237115",
"0.71058595",
"0.69739705",
"0.6969093",
"0.6818066",
"0.6773959",
"0.6750827",
"0.66942436",
"0.6639886",
"0.66331494",
"0.65209013",
"0.65108454",
"0.64949936",
"0.64333344",
"0.6322692",
"0.6265544",
"0.625... | 0.854451 | 0 |
Returns a new Wgit::Url with the query string portion removed e.g. Given is returned. Self is returned as is if no query string is present. A URL consisting of only a query string e.g. '?q=hello' will return an empty URL. | def without_query_string
query = to_query_string
without_query_string = query ? gsub(query, '') : self
Wgit::Url.new(without_query_string)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def omit_query\n query = to_query\n omit_query_string = query ? gsub(\"?#{query}\", '') : self\n\n Wgit::Url.new(omit_query_string)\n end",
"def omit_fragment\n fragment = to_fragment\n omit_fragment = fragment ? gsub(\"##{fragment}\", '') : self\n\n Wgit::Url.new(omit_fragment)\... | [
"0.8360348",
"0.71294236",
"0.7060415",
"0.70068467",
"0.69179744",
"0.68577904",
"0.6754279",
"0.663767",
"0.6531178",
"0.6430571",
"0.638128",
"0.6284045",
"0.62648505",
"0.6233753",
"0.61470854",
"0.61195314",
"0.6092693",
"0.60701597",
"0.5993468",
"0.59431994",
"0.591854... | 0.8786221 | 0 |
Returns a new Wgit::Url with the anchor portion removed e.g. Given is returned. Self is returned as is if no anchor is present. A URL consisting of only an anchor e.g. 'about' will return an empty URL. This method assumes that the anchor is correctly placed at the very end of the URL. | def without_anchor
anchor = to_anchor
without_anchor = anchor ? gsub(anchor, '') : self
Wgit::Url.new(without_anchor)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_url_anchor url\n url.gsub!(/#.*/, '') if url =~ /#/\n url\nend",
"def to_anchor\n anchor = @uri.fragment\n anchor ? Wgit::Url.new(\"##{anchor}\") : nil\n end",
"def remove_url_anchor(url)\n suburl = url[/[^#]+/]\n return suburl\nend",
"def remove_url_anchor(url)\n url.gsub(/\\#.*... | [
"0.7173259",
"0.70651174",
"0.69026715",
"0.68743",
"0.68104655",
"0.6799254",
"0.6775482",
"0.6746506",
"0.6636591",
"0.66355044",
"0.6613901",
"0.638379",
"0.6375641",
"0.633301",
"0.621952",
"0.6203486",
"0.6115347",
"0.59714097",
"0.5881075",
"0.5841976",
"0.5790814",
"... | 0.8777569 | 0 |
Returns true if self is a URL query string e.g. ?q=hello etc. | def is_query_string?
start_with?('?')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_provided?\n @url = params[:url]\n @url.present? && @url.strip\n end",
"def hashify_query_string\n if request.query_string && request.query_string.length > 0\n redirect_to request.url.gsub('?', '#')\n return true\n end\n return false\n end",
"def query?\n star... | [
"0.6901819",
"0.6884862",
"0.6867596",
"0.67991686",
"0.6656614",
"0.66215336",
"0.6548411",
"0.641552",
"0.6354132",
"0.6348876",
"0.6292489",
"0.6289164",
"0.6289164",
"0.62006444",
"0.61975706",
"0.6170139",
"0.6170139",
"0.61054605",
"0.60997504",
"0.6080321",
"0.60643655... | 0.791218 | 0 |
Returns true if self is a URL anchor/fragment e.g. top etc. | def is_anchor?
start_with?('#')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def absolute_url?\n (self.include?('://') || self.start_with?('/')) ? true : false\n end",
"def id_link?\n @url[0] == '#'\n end",
"def real_url?\n url && url.present? && url != \"#\"\n end",
"def internal?\n url[0] == \"#\"\n end",
"def is_url?\n self =~ /^#{URI::rege... | [
"0.70636815",
"0.7038322",
"0.6980392",
"0.69752634",
"0.68451494",
"0.68364257",
"0.67635536",
"0.66946185",
"0.663738",
"0.6623883",
"0.65935814",
"0.65106636",
"0.65052783",
"0.64656794",
"0.64476115",
"0.6445344",
"0.64431113",
"0.6437543",
"0.6436175",
"0.642565",
"0.640... | 0.74993956 | 0 |
sets the log level to FATAL for the duration of the block | def mute_logger
zk_log = Logging.logger['ZK']
orig_level, zk_log.level = zk_log.level, :off
orig_zk_level, Zookeeper.debug_level = Zookeeper.debug_level, Zookeeper::Constants::ZOO_LOG_LEVEL_ERROR
yield
ensure
zk_log.level = orig_zk_level
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fatal message; write FATAL, message, caller[0] unless level > @level end",
"def fatal\n logger.add(Logger::FATAL, nil, facility) { yield } if logger && logger.fatal?\n end",
"def fatal?; @loggers.first.level <= FATAL; end",
"def fatal?; @level <= FATAL; end",
"def fatal?; @level <= FATAL; e... | [
"0.7119224",
"0.6979921",
"0.6962192",
"0.69467545",
"0.69467545",
"0.67734295",
"0.66738135",
"0.66673833",
"0.6664614",
"0.6647761",
"0.6537867",
"0.6497637",
"0.63462627",
"0.63123727",
"0.6296745",
"0.62913674",
"0.6228875",
"0.6183279",
"0.6120704",
"0.6116453",
"0.60985... | 0.5575703 | 34 |
Using the Ruby language, have the function CountingMinutes(str) take the str parameter being passed which will be two times (each properly formatted with a colon and am or pm) separated by a hyphen and return the total number of minutes between the two times. The time will be in a 12 hour clock format. For example: if ... | def counting_minutes(str)
time1, time2 = str.split('-')
mins1, mins2 = time_to_minutes(time1), time_to_minutes(time2)
difference = mins2 - mins1
if difference.negative?
difference += 1440
end
difference
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CountingMinutesI(str)\n\n from = str.split(\"-\")[0]\n to = str.split(\"-\")[1]\n fromMinute = from.gsub(\"am\", \"\").gsub(\"pm\", \"\")\n fromMinute = fromMinute.split(\":\")[0].to_i * 60 + fromMinute.split(\":\")[1].to_i\n toMinute = to.gsub(\"am\", \"\").gsub(\"pm\", \"\")\n toMinute = toMinute.split... | [
"0.86387753",
"0.8348166",
"0.8339926",
"0.75820166",
"0.6950127",
"0.69175446",
"0.6685394",
"0.64473456",
"0.64410514",
"0.64396477",
"0.63525784",
"0.6344076",
"0.62825656",
"0.6272229",
"0.6269188",
"0.6183251",
"0.61739343",
"0.6168004",
"0.613206",
"0.6114889",
"0.60973... | 0.8487297 | 1 |
Once we explain REST in the book this will obviously be refactored. | def create_xml
self.current_user =
User.authenticate(params[:login], params[:password])
if logged_in?
if params[:remember_me] == "1"
self.current_user.remember_me
cookies[:auth_token] = {
:value => self.current_user.remember_token,
:expires => self.current_user.reme... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rest_endpoint; end",
"def rest_end_point; end",
"def consume_rest; end",
"def rest_endpoint=(_arg0); end",
"def GET; end",
"def http; end",
"def endpoint; end",
"def endpoint; end",
"def endpoint; end",
"def endpoint; end",
"def get; end",
"def apis; end",
"def request; end",
"def req... | [
"0.69799984",
"0.6729027",
"0.65852773",
"0.65851957",
"0.64332706",
"0.64317244",
"0.6420697",
"0.6420697",
"0.6420697",
"0.6420697",
"0.6348985",
"0.63228405",
"0.62290144",
"0.62290144",
"0.62290144",
"0.62290144",
"0.62290144",
"0.62290144",
"0.62290144",
"0.62290144",
"0... | 0.0 | -1 |
a dash in between odd digits. | def dasherizer(integer)
array = integer.to_s.chars.map(&:to_i)
new_string = ""
size = array.size - 1
array.each_with_index do |int, index|
if index == size
new_string << int.to_s
elsif int.odd? && array[index + 1].odd?
new_string << int.to_s + "-"
else
new_string << int.to_s
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dasherize_number(num)\n\tnum_string = num.to_s\n\tidx = 0\n\n\twhile idx < num_string.length-1\n\t\tif num_string[idx].to_i % 2 != 0\n\t\t\tnum_string.insert(idx+1, \"-\")\n\t\tend\n\t\tidx += 1\n\tend\n\n\twhile num_string[idx] != \"-\"\n\t\tif num_string[idx2].to_i % 2 == 0 && num_string[idx2+1] != \"-\"\n\t... | [
"0.8005557",
"0.79401535",
"0.78705764",
"0.7827698",
"0.7798019",
"0.7778792",
"0.7728863",
"0.772321",
"0.7659627",
"0.76567674",
"0.76509875",
"0.7644536",
"0.7642155",
"0.7607864",
"0.755812",
"0.75565875",
"0.7552442",
"0.7535938",
"0.75207597",
"0.75195843",
"0.7516787"... | 0.769064 | 8 |
Responds with either an HTML or JSON version of the available minions. | def discovery
assigned_minions = assigned_with_status
unassigned_minions = Minion.unassigned_role
pending_minions = ::Velum::Salt.pending_minions
retryable_bootstrap_orchestration = Orchestration.retryable? kind: :bootstrap
retryable_upgrade_orchestr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n request.headers\n respond_to do |format|\n format.html\n format.mobile{render :layout => !request.xhr?}\n format.js\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @modification }\n end\n end",
"def... | [
"0.609892",
"0.60717475",
"0.6058986",
"0.60248137",
"0.5966406",
"0.5887578",
"0.5885814",
"0.58552325",
"0.58341336",
"0.5827372",
"0.58254564",
"0.5811322",
"0.5795352",
"0.5792574",
"0.5771441",
"0.5767957",
"0.57321954",
"0.572273",
"0.5722057",
"0.57206583",
"0.5714719"... | 0.0 | -1 |
TODO(mssola): 1. It would make more sense to have the update status on the DB and have another process polling for this. Then, on the `discovery` method this would all be returned transparently (thus removing all the methods below). 2. NOTE: Other nodes should only be taken into consideration if automatic updates has n... | def assigned_with_status
needed, failed = ::Velum::Salt.update_status(targets: "*", cached: true)
# NOTE: this is highly inefficient and will disappear if we implement the
# idea written above.
minions = Minion.assigned_role
minions.each do |minion|
minion.update_status = Minion.computed_stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_update\n result = nil\n logger.info(\"Node: do_update start ... \")\n if (self.ec2_instance_id.nil?)\n logger.warn(\"Node: do_update unknown node type - ignoring\")\n else\n result = ec2_node_run_cts self\n end\n logger.info(\"Node: do_update end result=#{result.inspect}\")\n ... | [
"0.6438824",
"0.60865486",
"0.6055075",
"0.6032852",
"0.6029394",
"0.59293205",
"0.58942693",
"0.58141214",
"0.57875615",
"0.57760227",
"0.57415885",
"0.5700359",
"0.569727",
"0.5663717",
"0.56599236",
"0.5658946",
"0.5658946",
"0.5658946",
"0.5658946",
"0.5658946",
"0.565894... | 0.0 | -1 |
Destroys a specific tape. Only when it's an orphan. API Key Scope: tapes / destroy | def destroy_tape(tape_id, opts = {})
destroy_tape_with_http_info(tape_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @tape.destroy\n respond_to do |format|\n format.html { redirect_to tapes_url, notice: 'Tape was successfully destroyed.' }\n format.json { head :no_content }\n end #do\n end",
"def destroy\n @tape = Tape.find(params[:id])\n @tape.destroy\n\n respond_to do |format|\n ... | [
"0.7144925",
"0.7120704",
"0.69524264",
"0.67932963",
"0.67669725",
"0.6765527",
"0.6668672",
"0.6486234",
"0.6320779",
"0.6315171",
"0.62630606",
"0.6248777",
"0.6232653",
"0.6207664",
"0.6205869",
"0.6189997",
"0.6183638",
"0.6181902",
"0.6174065",
"0.6174065",
"0.6172592",... | 0.6144361 | 24 |
Destroys a specific tape. Only when it&39;s an orphan. API Key Scope: tapes / destroy | def destroy_tape_with_http_info(tape_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TapesApi.destroy_tape ...'
end
# verify the required parameter 'tape_id' is set
if @api_client.config.client_side_validation && tape_id.nil?
fail Argu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @tape.destroy\n respond_to do |format|\n format.html { redirect_to tapes_url, notice: 'Tape was successfully destroyed.' }\n format.json { head :no_content }\n end #do\n end",
"def destroy\n @tape = Tape.find(params[:id])\n @tape.destroy\n\n respond_to do |format|\n ... | [
"0.72093314",
"0.7178814",
"0.7052843",
"0.6904673",
"0.6870056",
"0.6815037",
"0.67678386",
"0.66221035",
"0.6427477",
"0.6372976",
"0.6366295",
"0.6349137",
"0.6342009",
"0.6306629",
"0.62845594",
"0.62845594",
"0.6276091",
"0.6271888",
"0.62680787",
"0.6266708",
"0.6266708... | 0.6429365 | 8 |
List all tape statistics. API Key Scope: tape_stats / index | def index_tape_stats(opts = {})
data, _status_code, _headers = index_tape_stats_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_tape_stats_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TapesApi.index_tape_stats ...'\n end\n # resource path\n local_var_path = '/tape_stats'\n\n # query parameters\n query_params = opts[:query_params] |... | [
"0.72152436",
"0.70560837",
"0.70560837",
"0.70560837",
"0.705479",
"0.6935183",
"0.6935183",
"0.6812094",
"0.66386765",
"0.65444994",
"0.65154785",
"0.65154785",
"0.65154785",
"0.6495468",
"0.64779145",
"0.64710844",
"0.643682",
"0.6325115",
"0.62835795",
"0.6237515",
"0.616... | 0.8155829 | 0 |
List all tape statistics. API Key Scope: tape_stats / index | def index_tape_stats_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TapesApi.index_tape_stats ...'
end
# resource path
local_var_path = '/tape_stats'
# query parameters
query_params = opts[:query_params] || {}
qu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_tape_stats(opts = {})\n data, _status_code, _headers = index_tape_stats_with_http_info(opts)\n data\n end",
"def index\n @stats = Stat.all\n end",
"def index\n @stats = Stat.all\n end",
"def index\n @stats = Stat.all\n end",
"def index\n @stats = Stat.all\n end"... | [
"0.81554645",
"0.7057521",
"0.7057521",
"0.7057521",
"0.70561904",
"0.69354105",
"0.69354105",
"0.68131536",
"0.66390085",
"0.65456617",
"0.65165424",
"0.65165424",
"0.65165424",
"0.64959997",
"0.64795107",
"0.64711285",
"0.6436693",
"0.63272536",
"0.6284358",
"0.62358326",
"... | 0.7214957 | 1 |
Lists all tapes. API Key Scope: tapes / index | def index_tapes(opts = {})
data, _status_code, _headers = index_tapes_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tapes = Tape.all\n end",
"def index\n @tarots = Tarot.all\n end",
"def index\n @tunes = Tune.all\n end",
"def index\n @taps = Tap.all\n end",
"def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tun... | [
"0.7304551",
"0.6834718",
"0.6767561",
"0.67243123",
"0.6594579",
"0.65806556",
"0.65656525",
"0.6565334",
"0.6556385",
"0.6556385",
"0.6556385",
"0.6481384",
"0.6374354",
"0.6352452",
"0.63298684",
"0.6276484",
"0.62576556",
"0.6249787",
"0.62455964",
"0.6231836",
"0.6228720... | 0.5942552 | 89 |
Lists all tapes. API Key Scope: tapes / index | def index_tapes_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TapesApi.index_tapes ...'
end
# resource path
local_var_path = '/tapes'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tapes = Tape.all\n end",
"def index\n @tarots = Tarot.all\n end",
"def index\n @tunes = Tune.all\n end",
"def index\n @taps = Tap.all\n end",
"def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tun... | [
"0.7304551",
"0.6834718",
"0.6767561",
"0.67243123",
"0.6594579",
"0.65806556",
"0.65656525",
"0.6565334",
"0.6556385",
"0.6556385",
"0.6556385",
"0.6481384",
"0.6374354",
"0.6352452",
"0.63298684",
"0.6276484",
"0.62576556",
"0.62455964",
"0.6231836",
"0.62287205",
"0.622367... | 0.6249787 | 17 |
Lists all tapes. API Key Scope: tapes / index | def index_tapes_by_pool(pool_id, opts = {})
data, _status_code, _headers = index_tapes_by_pool_with_http_info(pool_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tapes = Tape.all\n end",
"def index\n @tarots = Tarot.all\n end",
"def index\n @tunes = Tune.all\n end",
"def index\n @taps = Tap.all\n end",
"def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tun... | [
"0.7304551",
"0.6834718",
"0.6767561",
"0.67243123",
"0.6594579",
"0.65806556",
"0.65656525",
"0.6565334",
"0.6556385",
"0.6556385",
"0.6556385",
"0.6481384",
"0.6374354",
"0.6352452",
"0.63298684",
"0.6276484",
"0.62576556",
"0.6249787",
"0.62455964",
"0.6231836",
"0.6228720... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.