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 |
|---|---|---|---|---|---|---|
classes that extend SeleniumTestCase and override SeleniumTestCasesetup should ALWAYS call 'super' | def setup
# reload the fixtures since each test is NOT wrapped in a transaction
self.class.fixtures :all
self.class.open_browser(@@testing_browser)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n setup_with_selenium\n\tend",
"def setup\n @verification_errors = []\n if $selenium\n @selenium = $selenium\n else\n @selenium = Selenium::Client::Driver.new \"localhost\", 4444, \"*firefox\", $domain, 10000\n @selenium.start_new_browser_session\n end\n @selenium.set_c... | [
"0.7233518",
"0.71220523",
"0.6809176",
"0.6667857",
"0.65346235",
"0.64697737",
"0.64660805",
"0.6375521",
"0.63686156",
"0.63293874",
"0.6315449",
"0.6286003",
"0.6284963",
"0.6284963",
"0.622046",
"0.62069386",
"0.6162866",
"0.6113433",
"0.60728407",
"0.6052086",
"0.603980... | 0.6572143 | 4 |
your code goes here | def begins_with_r(tools_array)
count = 0
tools_array.each {|tool|
if tool[0].include?('r')
count +=1
end}
count == tools_array.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply\n\t\t\t\t\n\t\t\tend",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run\n end",
"def run\n \n end",
"def run\n \n end",
"def run\n end",
"def custom; end"... | [
"0.6193367",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.6169166",
"0.6124124",
"0.6124124",
"0.6094903",
"0.60627353",
"0.60627353",
"0.5983734",
"0.5979919",
"0.5979919",
"0.5897549",
"0.58... | 0.0 | -1 |
HACK KILL THIS LATER WHEN MONGOID IS COMPETNENT | def add_like(like_name)
UserLikeLinker.link_user_and_like(self, self.personality.get_new_like(like_name))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def superweening_adorningly(counterstand_pyrenomycetales)\n end",
"def anchored; end",
"def silly_adjective; end",
"def offences_by; end",
"def romeo_and_juliet; end",
"def forkless(interspinous_interdevour, cladodontid_michel)\n end",
"def probers; end",
"def gounod; end",
"def jack_handey; ... | [
"0.63994884",
"0.62494296",
"0.6030416",
"0.5829986",
"0.5753828",
"0.57501286",
"0.57290304",
"0.5698997",
"0.5692193",
"0.5692052",
"0.5672398",
"0.5654222",
"0.56345373",
"0.56267095",
"0.5580502",
"0.5580502",
"0.5570641",
"0.5556714",
"0.55246025",
"0.5500887",
"0.550088... | 0.0 | -1 |
check if private goal shows up for admin or friend on profile page | def private_goal(user)
create_goal("Learn to paint", "true")
create_goal("Play the piano")
click_link 'Sign Out'
other_user(user)
click_link 'Wilbur'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_authorized(current_user)\n return self.goal.public? || self.edit_authorized(current_user)\n end",
"def admin?\n\t self.profile == \"admin\"\n\tend",
"def is_visible?\n is_public? && ProfileStatus::VISIBLE.include?(profile_status)\n end",
"def personal_page?\n return false unless current_... | [
"0.72225755",
"0.7099956",
"0.70981014",
"0.7025745",
"0.70147413",
"0.6934049",
"0.69229436",
"0.6880233",
"0.6852199",
"0.6843538",
"0.6775172",
"0.6739458",
"0.6634377",
"0.6611007",
"0.65952224",
"0.6589982",
"0.652066",
"0.6486491",
"0.6480981",
"0.64765555",
"0.64759696... | 0.6243458 | 50 |
To retain Sufia's expectations, depositor will return the nick of the AICUser | def depositor
return unless aic_depositor
aic_depositor.nick
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nick\n @name\n end",
"def nickname\n @nick\n end",
"def nickname\n user_info['nickname']\n end",
"def nickname\r\n return @user.nickname\r\n end",
"def nick\r\n return for_context(nil, false) { |c| c.nick }\r\n end",
"def nickname\n @nickname\n end",
... | [
"0.6654001",
"0.6605563",
"0.6498443",
"0.64821476",
"0.6462692",
"0.6456304",
"0.6219964",
"0.61803865",
"0.6171497",
"0.6150262",
"0.60680896",
"0.6037113",
"0.603695",
"0.6036605",
"0.60069084",
"0.59953195",
"0.5990369",
"0.5989589",
"0.5953333",
"0.5951565",
"0.59483504"... | 0.7762566 | 0 |
out the current state. | def display_board(board)
print print_row(board[0], board[1], board[2])
puts "-----------"
print print_row(board[3], board[4], board[5])
puts "-----------"
print print_row(board[6], board[7], board[8])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_state; end",
"def write_state; end",
"def state_out(path:)\n add option: \"-state-out=#{path}\"\n end",
"def pop_state\t\n\t\t\t@state_buffer = Proc.new do\n\t\t\t\t@objs2 = []\n\t\t\t\t@current_state = @states.pop\n\t\t\tend\n\t\tend",
"def final_state(state)\n final_states(state)\n ... | [
"0.72624224",
"0.72624224",
"0.67279774",
"0.6647568",
"0.6577878",
"0.6515",
"0.6501546",
"0.6501546",
"0.64870685",
"0.64463556",
"0.64091253",
"0.63802713",
"0.6377393",
"0.6373034",
"0.6373034",
"0.6373034",
"0.6373034",
"0.6373034",
"0.6373034",
"0.6373034",
"0.6373034",... | 0.0 | -1 |
Cette fonction etait initialment ici avant l'utilisation des micropost now elle se trouve dans app/helpers/sessions_helper.rb | def authenticate
deny_access unless signed_in?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_pending_micropost\n micropost = nil\n if current_user && session[:pending_micropost].present?\n micropost = current_user.microposts.build(session[:pending_micropost])\n micropost.save!\n session[:pending_micropost] = nil\n end\n micropost\n end",
"def create\n @micropost... | [
"0.5965398",
"0.5888402",
"0.5840835",
"0.5809173",
"0.5800534",
"0.5756563",
"0.5750473",
"0.57462966",
"0.5733187",
"0.57043797",
"0.5671515",
"0.56383044",
"0.5637153",
"0.56366986",
"0.5624444",
"0.5620271",
"0.56183916",
"0.5615949",
"0.56139153",
"0.5610314",
"0.5579136... | 0.0 | -1 |
sum all element in array | def sum arr
return arr.sum() # 합
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(array)\n array.reduce(0) {|base, ele|\n base+=ele\n }\n end",
"def sum(array)\n\tarray.reduce(:+)\nend",
"def sum(array)\n\treturn array.reduce(:+)\nend",
"def simple_array_sum arr\n arr.reduce(:+)\n end",
"def sum_array(array)\n sum = 0\n array.each do |elem... | [
"0.849785",
"0.8450193",
"0.84278995",
"0.8391767",
"0.8330338",
"0.82908344",
"0.82831603",
"0.8271955",
"0.82610494",
"0.82380587",
"0.8228478",
"0.8224968",
"0.8221884",
"0.8216801",
"0.8212479",
"0.820131",
"0.820131",
"0.8198361",
"0.8193897",
"0.81856024",
"0.8183175",
... | 0.0 | -1 |
sum of maximum element in array up to second | def max_2_sum arr
# arr.max(2).sum()
return arr.sort.reverse[0,2].sum() # 내림차순 sort하고 2개 합
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_2_sum(array)\n sum(array.sort.last(2))\nend",
"def max_2_sum(array)\n sum array.sort.last(2)\nend",
"def max_2_sum arr\n sum(arr.sort.last(2))\nend",
"def max_2_sum arr\n sum(arr.sort.last(2)) \nend",
"def max_2_sum arr\n return 0 if arr.... | [
"0.8598641",
"0.8576382",
"0.8382342",
"0.83763695",
"0.8198644",
"0.8191242",
"0.8172018",
"0.8130514",
"0.8113261",
"0.80837435",
"0.80638826",
"0.8063069",
"0.80564874",
"0.80362076",
"0.79974115",
"0.7993593",
"0.79835194",
"0.79661",
"0.79625624",
"0.79625624",
"0.793364... | 0.8218435 | 4 |
Part 2 print "hello name" | def hello(name)
p "Hello, #{name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def say_hello_to(name)\n puts \"Hello, #{name}. It's good to see you.\"\n puts \" \"\n end",
"def say_hello_personal(name)\n\tputs \"Hello \" + name\nend",
"def print_name(name)\n p \"Hello #{name}.\"# YOUR CODE HERE\nend",
"def sayHi\n\t\tputs \"hello, my name is #{@name}\"\n\tend",
"def print_... | [
"0.8039454",
"0.7831427",
"0.77741885",
"0.7763436",
"0.77336884",
"0.770971",
"0.77003306",
"0.7692978",
"0.7687812",
"0.7679259",
"0.76490426",
"0.76435935",
"0.76421404",
"0.7640583",
"0.7601019",
"0.75944823",
"0.75934356",
"0.7583389",
"0.75498176",
"0.7529255",
"0.75285... | 0.0 | -1 |
return true if string start with consonant | def starts_with_consonant? s
# if /^[^aeiou\W]/i.match(s) == nil then false else true end
/^[^aeiou\W]/i.match(s)==nil ? false : true
# !%w(a e i o u).include? s[0].downcase unless s.empty? or /^\W/.match(s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def starts_with_consonant? s\n return false if s == ''\n return false if !s[0].match(/^[[:alpha:]]$/)\n s[0] =~ /[AaEeIiOoUu]/ ? false : true\nend",
"def starts_with_consonant? s\n return false if s.empty?\n consonant = 'bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ'\n consonant.each_char{|c|\n return true... | [
"0.88301486",
"0.8761197",
"0.8761197",
"0.8760806",
"0.87263465",
"0.86633235",
"0.86605513",
"0.86605513",
"0.86186093",
"0.8608998",
"0.8608357",
"0.85945475",
"0.85473204",
"0.85381204",
"0.85264605",
"0.85159284",
"0.8506939",
"0.8506209",
"0.8493862",
"0.84862584",
"0.8... | 0.80129784 | 41 |
'initialize' is in base | def initialize(bot:, user:)
super
@settings = user.student_settings
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize() end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize\nend",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initializ... | [
"0.79208535",
"0.77879363",
"0.77879363",
"0.77879363",
"0.77879363",
"0.7662159",
"0.7626896",
"0.7626896",
"0.7626896",
"0.7626896",
"0.7626896",
"0.7626896",
"0.7626896",
"0.7626896",
"0.7626896",
"0.7626896",
"0.7626896",
"0.75987947",
"0.758498",
"0.7558257",
"0.7490796"... | 0.0 | -1 |
A helper to delete, and recreate the ElasticSearch index used for specs. This code is borrowed from the stretcher specs. | def reset_index
ElasticMapper.index_name = "elastic_mapper_tests"
index = ElasticMapper.index
server = ElasticMapper.server
index.delete rescue nil # ignore exceptions.
server.refresh
index.create({
:settings => {
:number_of_shards => 1,
:number_of_replicas => 0
}
})
# Why do both? Doesn't hurt, and it fixes some races
server.refresh
index.refresh
# Sometimes the index isn't instantly available
(0..40).each do
idx_metadata = server.cluster.request(:get, :state)[:metadata][:indices][index.name]
i_state = idx_metadata[:state]
break if i_state == 'open'
if attempts_left < 1
raise "Bad index state! #{i_state}. Metadata: #{idx_metadata}"
end
sleep 0.1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_and_create_index(cli=Elasticsearch::Persistence.client)\n\t\tbegin\n\t\t\tcli.indices.delete index: get_index_name\n\t\trescue => e\n\t\t\tputs \"index doesnt exist.\"\n\t\tend\n\t\t#if (Elasticsearch::Persistence.client.indices.exists? index: get_index_name)\n\t\t\t\n\t\t#end\n\t\tcli.indices.create in... | [
"0.7307886",
"0.70942247",
"0.69209576",
"0.67302036",
"0.6679855",
"0.65879786",
"0.65315366",
"0.64297205",
"0.6411632",
"0.634878",
"0.6343844",
"0.62874925",
"0.62874925",
"0.62644243",
"0.625734",
"0.6213438",
"0.62122345",
"0.61563253",
"0.6122971",
"0.6055173",
"0.6034... | 0.65955824 | 5 |
Index the model provided, and refresh the index so that the document can be searched. | def index(model)
model.index
ElasticMapper.index.refresh
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_index\n self.reload\n SearchIndex.update_record(self)\n end",
"def update_index\n self.reload\n SearchIndex.update_record(self)\n end",
"def reindex!\n indexed if generate_solr_index\n end",
"def index!\n set_search_text!\n set_query_attribut... | [
"0.79874825",
"0.79874825",
"0.7397342",
"0.7232072",
"0.713185",
"0.71318173",
"0.7065228",
"0.7058602",
"0.70386994",
"0.69899833",
"0.6929208",
"0.6906534",
"0.6896153",
"0.68444043",
"0.68444043",
"0.6842677",
"0.6757176",
"0.675473",
"0.67458135",
"0.6739188",
"0.6731412... | 0.7972524 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_salary_component_template
@salary_component_template = SalaryComponentTemplate.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.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.533008... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def salary_component_template_params
params.require(:salary_component_template).permit(:manual_template_code, :salary_template_id, :salary_component_id, :is_deducted, :parent_salary_component_id, :percentage, :to_be_paid)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /guests/1 GET /guests/1.json | def show
@guest = Guest.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @guest }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n render json: @guest\n end",
"def guests\n raw_response = get_request('users/guests')\n parse_response(raw_response, :users)\n end",
"def index\n @guests = @wedding.guests.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render... | [
"0.7458121",
"0.73382664",
"0.7215058",
"0.7033528",
"0.70042014",
"0.69795614",
"0.69333076",
"0.6922181",
"0.69139594",
"0.6904934",
"0.6904934",
"0.6904934",
"0.68863195",
"0.6767749",
"0.6753951",
"0.66843134",
"0.6630034",
"0.6560386",
"0.6479089",
"0.6458332",
"0.636784... | 0.75954425 | 0 |
GET /guests/new GET /guests/new.json | def new
@guest = Guest.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @guest }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @guest = @wedding.guests.new\n\n respond_to do |format|\n format.html { render layout: false if request.xhr? }\n format.json { render json: @guest }\n end\n end",
"def new\n session[:guests] = nil\n @guest_response = GuestResponse.new\n respond_to do |format|\n format.... | [
"0.78125614",
"0.76682293",
"0.75126433",
"0.72681093",
"0.721477",
"0.71770984",
"0.71684915",
"0.7083862",
"0.7077876",
"0.70425427",
"0.68885595",
"0.68173665",
"0.6811159",
"0.6801338",
"0.677905",
"0.677905",
"0.677905",
"0.6761304",
"0.675986",
"0.675986",
"0.675986",
... | 0.80501676 | 0 |
POST /guests POST /guests.json | def create
@guest = Guest.new(params[:guest])
respond_to do |format|
if @guest.save
format.html { redirect_to @guest, notice: 'Guest was successfully created.' }
format.json { render json: @guest, status: :created, location: @guest }
# Notifier.invited(@guest).deliver
else
format.html { render action: "new" }
format.json { render json: @guest.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @guest = Guests.new(guest_params)\n\n respond_to do |format|\n if @guest.save\n format.html { redirect_to @guest, notice: 'Guests was successfully created.' }\n format.json { render :show, status: :created, location: @guest }\n else\n format.html { render :new }\n ... | [
"0.74058604",
"0.7187157",
"0.7106102",
"0.7010956",
"0.70109063",
"0.6963059",
"0.6898701",
"0.6752196",
"0.668241",
"0.6641024",
"0.65609205",
"0.6528493",
"0.6528493",
"0.6516105",
"0.6514571",
"0.65061224",
"0.64786446",
"0.6457377",
"0.6394079",
"0.6348535",
"0.6327577",... | 0.7081464 | 3 |
PUT /guests/1 PUT /guests/1.json | def update
@guest = Guest.find(params[:id])
@events = Event.all
@events.each do |f|
if @guest.event_id == f.id
@event = f
end
end
respond_to do |format|
if @guest.update_attributes(params[:guest])
format.html { redirect_to :back, notice: "Thanks for responding, if you'd like to change your rsvp, please log back in using your email and guest password."}
format.json { render json: @guest, status: :updated, location: @guest }
Notifier.sendNotification(@guest, @event).deliver
session[:letin] = "ok"
else
format.html { render action: "edit" }
format.json { render json: @guest.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @guest = Guest.find(params[:id])\n\n if @guest.update(guest_params)\n head :no_content\n else\n render json: @guest.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @guest.update(guest_params)\n format.html { redirect... | [
"0.7212594",
"0.6936108",
"0.6901038",
"0.6870867",
"0.6870867",
"0.67776793",
"0.66966784",
"0.6687218",
"0.6626471",
"0.6580758",
"0.65778446",
"0.65778446",
"0.65778446",
"0.65778446",
"0.65778446",
"0.6518579",
"0.6512878",
"0.6512878",
"0.6512878",
"0.6512878",
"0.649946... | 0.59824574 | 32 |
DELETE /guests/1 DELETE /guests/1.json | def destroy
@guest = Guest.find(params[:id])
@guest.destroy
respond_to do |format|
format.html { redirect_to :back }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @guest = current_user.guests.find(params[:id])\n respond_to do |format|\n @guest.destroy\n format.html { redirect_to guests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @guest = Guest.find(params[:id])\n respond_to do |format|\n @... | [
"0.7682652",
"0.7624057",
"0.76105297",
"0.752881",
"0.75223434",
"0.75223434",
"0.75223434",
"0.75223434",
"0.7520783",
"0.74585533",
"0.7425384",
"0.74140626",
"0.74110943",
"0.7390798",
"0.72222036",
"0.717309",
"0.7148982",
"0.70599604",
"0.70492697",
"0.70492697",
"0.704... | 0.74991184 | 9 |
GET /formaspagamentos GET /formaspagamentos.json | def index
@formaspagamentos = Formaspagamento.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @formapagamentos = Formapagamento.all\n end",
"def index\n @formapagtos = Formapagto.all\n end",
"def index\n @formaenvios = Formaenvio.all\n end",
"def create\n @formaspagamento = Formaspagamento.new(formaspagamento_params)\n\n respond_to do |format|\n if @formaspagamento.... | [
"0.71389174",
"0.6854117",
"0.6834684",
"0.6613129",
"0.65721816",
"0.6566794",
"0.65378267",
"0.6532672",
"0.65221894",
"0.65204424",
"0.65181255",
"0.65181255",
"0.64982885",
"0.6461535",
"0.64550996",
"0.6434424",
"0.6416065",
"0.64136714",
"0.6407414",
"0.6406784",
"0.638... | 0.7194226 | 0 |
POST /formaspagamentos POST /formaspagamentos.json | def create
@formaspagamento = Formaspagamento.new(formaspagamento_params)
respond_to do |format|
if @formaspagamento.save
format.html { redirect_to formaspagamentos_url, notice: 'Forma de Pagamento criada com sucesso.' }
format.json { head :no_content }
else
format.html { render :new }
format.json { render json: @formaspagamento.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @formapagamento = Formapagamento.new(formapagamento_params)\n\n respond_to do |format|\n if @formapagamento.save\n format.html { redirect_to @formapagamento, notice: 'Formapagamento was successfully created.' }\n format.json { render :show, status: :created, location: @formapa... | [
"0.69206643",
"0.68048906",
"0.67155963",
"0.6694695",
"0.6537899",
"0.64714104",
"0.64165425",
"0.6370223",
"0.6363701",
"0.63546455",
"0.63306373",
"0.6275153",
"0.627217",
"0.62618643",
"0.6257837",
"0.622886",
"0.6227954",
"0.6219953",
"0.6209362",
"0.6204535",
"0.6190564... | 0.73332834 | 0 |
PATCH/PUT /formaspagamentos/1 PATCH/PUT /formaspagamentos/1.json | def update
respond_to do |format|
if @formaspagamento.update(formaspagamento_params)
format.html { redirect_to formaspagamentos_url, notice: 'Forma de Pagamento editada com sucesso.' }
format.json { head :no_content }
else
format.html { render :edit }
format.json { render json: @formaspagamento.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @formaenvio.update(formaenvio_params)\n format.html { redirect_to @formaenvio, notice: 'Forma de envio alterado com sucesso.' }\n format.json { render :show, status: :ok, location: @formaenvio }\n else\n format.html { render :edit }\n ... | [
"0.6815033",
"0.6791691",
"0.6762929",
"0.65790826",
"0.6565553",
"0.64537275",
"0.642614",
"0.63841873",
"0.63011736",
"0.6288342",
"0.62805",
"0.6247628",
"0.6218082",
"0.6207376",
"0.6191563",
"0.6178375",
"0.6169054",
"0.61650974",
"0.61550653",
"0.6152695",
"0.6151498",
... | 0.7120545 | 0 |
DELETE /formaspagamentos/1 DELETE /formaspagamentos/1.json | def destroy
@formaspagamento.destroy
respond_to do |format|
format.html { redirect_to formaspagamentos_url, notice: 'Forma de Pagamento excluída com sucesso.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @formasdepago.destroy\n respond_to do |format|\n format.html { redirect_to formasdepagos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @formaenvio.destroy\n respond_to do |format|\n format.html { redirect_to formaenvios_url, notice: 'Forma de e... | [
"0.7810993",
"0.7799794",
"0.7761224",
"0.7706335",
"0.7686646",
"0.76553327",
"0.76500046",
"0.7633475",
"0.75764596",
"0.7479715",
"0.7469021",
"0.74562705",
"0.74413294",
"0.74348444",
"0.742747",
"0.7426955",
"0.7379663",
"0.73599774",
"0.735507",
"0.73274493",
"0.7320694... | 0.78516924 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_formaspagamento
@formaspagamento = Formaspagamento.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 formaspagamento_params
params.require(:formaspagamento).permit(:nome)
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.6981537",
"0.67835593",
"0.6748275",
"0.67436063",
"0.6736311",
"0.65937173",
"0.6503359",
"0.6498499",
"0.6482832",
"0.6478776",
"0.645703",
"0.6439998",
"0.63802195",
"0.6377008",
"0.6366287",
"0.632018",
"0.63016284",
"0.63011277",
"0.62932974",
"0.62919617",
"0.6290564... | 0.0 | -1 |
Check if a collection is equal to another object. Will check the name and the database for equality. | def ==(other)
return false unless other.is_a?(Collection)
name == other.name && database == other.database && options == other.options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ===(other)\n other === collection\n end",
"def ==(other)\n other.kind_of?(Orchestrate::Collection) && \\\n other.app.api_key == app.api_key && \\\n other.name == name\n end",
"def ==(other_collection)\r\n if(other_collection.class != self.class)\r\n false\r\n ... | [
"0.7313521",
"0.68679494",
"0.6694435",
"0.6591357",
"0.6539819",
"0.6536641",
"0.6429956",
"0.63803566",
"0.63465685",
"0.62555796",
"0.6197801",
"0.6169735",
"0.58865297",
"0.5873764",
"0.5864569",
"0.5849819",
"0.581638",
"0.5810691",
"0.5802268",
"0.5784332",
"0.5750179",... | 0.81450915 | 1 |
Is the collection capped? | def capped?
database.command(:collstats => name).documents[0]['capped']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capped?\n @capped ||= [1, true].include?(@db.command({:collstats => @name})['capped'])\n end",
"def capped?\n database.command(collstats: name)[\"capped\"]\n end",
"def capped?\n database.list_collections(filter: { name: name })\n .first\n &.dig('options', CAPPED) || fals... | [
"0.8026971",
"0.79149467",
"0.7358155",
"0.68934214",
"0.68889415",
"0.6815647",
"0.6772031",
"0.67296726",
"0.67296726",
"0.67296726",
"0.6519425",
"0.6519425",
"0.6514357",
"0.6494703",
"0.6463",
"0.64603823",
"0.6372018",
"0.63609403",
"0.62744415",
"0.6234608",
"0.6213297... | 0.7743593 | 2 |
Force the collection to be created in the database. | def create
database.command({ :create => name }.merge(options))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_collection\n self._collection = Mongoid::Collection.new(self, self.collection_name)\n end",
"def create_collection(client, collection_name)\n client[collection_name].drop\n client[collection_name].create\n end",
"def create_collection(name)\n @change_collections_mutex.synchron... | [
"0.6504288",
"0.6421876",
"0.641693",
"0.62701106",
"0.6087825",
"0.60783875",
"0.59641254",
"0.5949219",
"0.5930254",
"0.5930254",
"0.5914532",
"0.5905925",
"0.58965653",
"0.5874644",
"0.5863913",
"0.5857529",
"0.58403045",
"0.5827305",
"0.5771857",
"0.5745649",
"0.5723858",... | 0.0 | -1 |
Drop the collection. Will also drop all indexes associated with the collection. | def drop
database.command(:drop => name)
rescue Error::OperationFailure => ex
raise ex unless ex.message =~ /ns not found/
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop\n @db.drop_collection(@name)\n end",
"def drop\n @db.drop_collection(@name)\n end",
"def removeIndexes(collection)\n collection.indexes.drop_all()\n end",
"def removeCollection(collection)\n collection.drop\n end",
"def drop_collection(collection_name)\n ... | [
"0.8104996",
"0.80356055",
"0.78297246",
"0.7457844",
"0.7341409",
"0.7341409",
"0.70186406",
"0.6701994",
"0.660353",
"0.65731096",
"0.6522848",
"0.6475378",
"0.64628154",
"0.6443593",
"0.6409021",
"0.6323626",
"0.63116956",
"0.6286491",
"0.62661505",
"0.622266",
"0.6190094"... | 0.5231957 | 93 |
Find documents in the collection. | def find(filter = nil)
View.new(self, filter || {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findAndFetchDocuments(collection, query)\n return collection.find(query)\n end",
"def fetchAllDocuments(collection)\n return collection.find({})\n end",
"def find\n\t\tif defined?(@collection)\n\t\t\treturn @collection.find\n \tend\n\tend",
"def find(options={})\n query(option... | [
"0.7934282",
"0.73125094",
"0.69864905",
"0.67800605",
"0.6762628",
"0.67108727",
"0.6687708",
"0.6660967",
"0.6635335",
"0.6621497",
"0.6523171",
"0.65185165",
"0.6495012",
"0.6464645",
"0.64415985",
"0.6421404",
"0.63581115",
"0.63555163",
"0.63224316",
"0.6298371",
"0.6273... | 0.0 | -1 |
Get a view of all indexes for this collection. Can be iterated or has more operations. | def indexes(options = {})
Index::View.new(self, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all\n @client.request(:get, '/system/indices/index_sets')\n end",
"def all_indexes\n Chewy.eager_load!\n Chewy::Index.descendants - [Chewy::Stash::Journal, Chewy::Stash::Specification]\n end",
"def indexes\n @indexes ||= []\n end",
"def indexes\n ... | [
"0.7543549",
"0.7384539",
"0.73561406",
"0.7149536",
"0.71198213",
"0.711348",
"0.7100322",
"0.70030403",
"0.6997905",
"0.69180304",
"0.6890006",
"0.68668056",
"0.68281525",
"0.67447305",
"0.6699983",
"0.6668436",
"0.6632062",
"0.6559219",
"0.65234244",
"0.6498102",
"0.648444... | 0.6126683 | 36 |
Instantiate a new collection. | def initialize(database, name, options = {})
raise Error::InvalidCollectionName.new unless name
@database = database
@name = name.to_s.freeze
@options = options.freeze
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @collection = Collection.new\n end",
"def new_collection\n Models::Collection.new\n end",
"def new_collection(query, resources = nil, &block)\n Collection.new(query, resources, &block)\n end",
"def new_collection\n primitive.new\n end",
"def initialize\n ... | [
"0.80918837",
"0.8074968",
"0.7841337",
"0.78045195",
"0.77740103",
"0.75719297",
"0.75654894",
"0.7560787",
"0.7525039",
"0.7508435",
"0.744219",
"0.74135435",
"0.7310497",
"0.7249492",
"0.7248865",
"0.7227633",
"0.7087816",
"0.70792717",
"0.7071029",
"0.7066272",
"0.7066272... | 0.6318737 | 53 |
Get a pretty printed string inspection for the collection. | def inspect
"#<Mongo::Collection:0x#{object_id} namespace=#{namespace}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_inspect\n self.inspect\n end",
"def inspect\n redacted_string(:inspect)\n end",
"def inspect\n redacted_string(:inspect)\n end",
"def pretty\n regex = /\"[A-z]?\"$/\n self.pretty_inspect.lines.reject { |l| l =~ regex }.join\n end",
"def inspec... | [
"0.67964303",
"0.65839064",
"0.65839064",
"0.6502654",
"0.6448236",
"0.63827896",
"0.63731456",
"0.63721085",
"0.63555974",
"0.63536704",
"0.63536704",
"0.63536704",
"0.63536704",
"0.63536704",
"0.6348834",
"0.6348834",
"0.6348834",
"0.6348834",
"0.6348834",
"0.6348834",
"0.6... | 0.0 | -1 |
Execute a batch of bulk write operations. | def bulk_write(operations, options = {})
BulkWrite.get(self, operations, options).execute
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bulk_write(requests, options = {})\n BulkWrite.new(self, requests, options).execute\n end",
"def execute\n raise Error::EmptyBatch.new if operations.empty?\n\n @index = -1\n @ops = []\n\n operations.each do |operation|\n operation.each do |name, document|\n if resp... | [
"0.76756",
"0.74333847",
"0.7184523",
"0.6750245",
"0.65584695",
"0.6513581",
"0.6488986",
"0.64475083",
"0.64389414",
"0.6382716",
"0.6315643",
"0.6288538",
"0.6255885",
"0.62314355",
"0.6226037",
"0.6196284",
"0.61924285",
"0.61796767",
"0.614641",
"0.6138767",
"0.61221933"... | 0.75336677 | 1 |
Get the fully qualified namespace of the collection. | def namespace
"#{database.name}.#{name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namespace_name\n @namespace_name ||= namespaces.join('::')\n end",
"def namespace\n @namestack.join(\"::\")\n end",
"def namespace\n self.class.new split(NAMESPACE_SEPARATOR).first\n end",
"def namespace\n return @namespace\n end",
"def namespace\n ... | [
"0.7052244",
"0.6880313",
"0.6865228",
"0.6859837",
"0.6859837",
"0.68481106",
"0.68134826",
"0.6714324",
"0.6711053",
"0.66712844",
"0.6576671",
"0.652307",
"0.6516509",
"0.65154123",
"0.65154123",
"0.6486964",
"0.6468617",
"0.6423423",
"0.6395951",
"0.63339454",
"0.63000536... | 0.62151283 | 24 |
GET /mealplans/1 GET /mealplans/1.json | def update_all
params['mealplan'].keys.each do |id|
@mealplan = Mealplan.find(id.to_i)
@mealplan.update_attributes(mealplan_params(id))
end
# Mealplan.update_all({veg: 4},{id: params[:id]})
redirect_to(mealplans_url)
# redirect_to(new_mealplan_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @mealplans = Mealplan.all\n end",
"def index\n @meal_plans = MealPlan.all\n end",
"def index\n @plans = Plan.all\n\n render json: @plans\n end",
"def show\n @plan = Plan.find(params[:id])\n\n render json: @plan\n end",
"def show\n render json: @plan\n end",
"def inde... | [
"0.75388074",
"0.75351787",
"0.7311544",
"0.72063076",
"0.7103383",
"0.7082313",
"0.7080815",
"0.6940663",
"0.69212526",
"0.6886327",
"0.68441695",
"0.6805409",
"0.67816705",
"0.6758348",
"0.6747644",
"0.6736549",
"0.6727098",
"0.6727098",
"0.6713398",
"0.6696523",
"0.6683906... | 0.0 | -1 |
POST /mealplans POST /mealplans.json | def create
@mealplan = Mealplan.new(mealplan_params)
respond_to do |format|
if @mealplan.save
format.html { redirect_to @mealplan, notice: 'Mealplan was successfully created.' }
format.json { render :show, status: :created, location: @mealplan }
else
format.html { render :new }
format.json { render json: @mealplan.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @meal_plan = MealPlan.new(meal_plan_params)\n\n respond_to do |format|\n if @meal_plan.save\n format.html { redirect_to @meal_plan, notice: 'Meal plan was successfully created.' }\n format.json { render :show, status: :created, location: @meal_plan }\n else\n forma... | [
"0.75760716",
"0.73374605",
"0.7247715",
"0.68953687",
"0.6840292",
"0.6826356",
"0.6811271",
"0.6773997",
"0.6736919",
"0.67277724",
"0.6720091",
"0.67177385",
"0.66807455",
"0.66582286",
"0.66512555",
"0.66034514",
"0.65569776",
"0.65569776",
"0.6528226",
"0.6528226",
"0.64... | 0.74891603 | 1 |
PATCH/PUT /mealplans/1 PATCH/PUT /mealplans/1.json | def update
@mealplan = Mealplan.find(params[:id])
respond_to do |format|
if @mealplan.update(mealplan_params)
format.html { redirect_to @mealplan, notice: 'Mealplan was successfully updated.' }
format.json { render :show, status: :ok, location: @mealplan}
else
format.html { render :edit }
format.json { render json: @mealplan.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @meal_plan.update(meal_plan_params)\n format.html { redirect_to @meal_plan, notice: 'Meal plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal_plan }\n else\n format.html { render :edit }\n for... | [
"0.7219035",
"0.7157095",
"0.7082909",
"0.70116854",
"0.68152",
"0.6672833",
"0.6603327",
"0.6590716",
"0.65897095",
"0.657995",
"0.65711445",
"0.65711445",
"0.6526526",
"0.6526526",
"0.6526526",
"0.6526526",
"0.6526526",
"0.6497256",
"0.64898413",
"0.64403677",
"0.6439913",
... | 0.71834326 | 1 |
DELETE /mealplans/1 DELETE /mealplans/1.json | def destroy
@mealplan = Mealplan.find(params[:id])
@mealplan.destroy
respond_to do |format|
format.html { redirect_to mealplans_url, notice: 'Mealplan was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @meal_plan.destroy\n respond_to do |format|\n format.html { redirect_to meal_plans_url, notice: 'Meal plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mealplan.destroy\n respond_to do |format|\n format.html { redirec... | [
"0.7723894",
"0.7720382",
"0.7489956",
"0.7370137",
"0.73670727",
"0.73670727",
"0.7255314",
"0.72511923",
"0.7245081",
"0.7245081",
"0.7245081",
"0.7116851",
"0.71106994",
"0.70913094",
"0.7086441",
"0.70836806",
"0.70815885",
"0.70711493",
"0.70711493",
"0.70711493",
"0.707... | 0.77716404 | 0 |
Use callbacks to share common setup or constraints between actions. def set_mealplan | def mealplan_params(id)
params.require(:mealplan).fetch(id).permit(:user_id, :date, :mealtype, :veg, :fruit, :grain, :meat, :milk, :additional_serve)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_mealplan\n @mealplan = Mealplan.find(params[:id])\n end",
"def set_meal_plan\n @meal_plan = MealPlan.find(params[:id])\n end",
"def set_mealplan_meal\n @mealplan_meal = MealplanMeal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.available.exclusive(current_user).f... | [
"0.70514286",
"0.704422",
"0.6927956",
"0.6404687",
"0.62859195",
"0.6246785",
"0.6246785",
"0.6246785",
"0.6246785",
"0.6246785",
"0.6246785",
"0.6246785",
"0.6246785",
"0.6177519",
"0.61340964",
"0.6130568",
"0.6130568",
"0.60429907",
"0.60185814",
"0.59736043",
"0.5972824"... | 0.5119123 | 99 |
Construct a ciruclar linkedlist representing the compass directions | def initialize
self.directions = Array.new(Direction.absolute.length)
self.direction_hash = { }
Direction.absolute.each_with_index { |direction, index|
directions[index] = CompassItem.new(
Direction.absolute[index - 1],
direction,
Direction.absolute[index + 1]
)
direction_hash[direction] = directions[index]
}
directions.last.right = Direction.absolute.first
directions.last.relative_hash[Direction::RIGHT] = Direction.absolute.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjacency_list\n list = []\n list << self * 2 unless @parent == self * 2 or self * 2 > @@roof\n list << self / 2 unless self.odd? or @parent == self / 2\n list << self + 2 unless self + 2 > @@roof\n list\n end",
"def initialize directions\n self.directions = directions\n self.curre... | [
"0.5875106",
"0.5729097",
"0.5621773",
"0.5618484",
"0.5608251",
"0.5597276",
"0.5556198",
"0.5545356",
"0.5540729",
"0.5534634",
"0.548826",
"0.539409",
"0.5363287",
"0.5312717",
"0.5310372",
"0.5294026",
"0.52913415",
"0.525877",
"0.525748",
"0.5252052",
"0.52502686",
"0.... | 0.6792803 | 0 |
Return the direction on this compass Use left/right to explore the other directions | def get_direction(direction)
direction_hash[direction]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_direction\n return (@dir || @character.direction)\n end",
"def compass_direction\n angle = Sketchup.active_model.shadow_info[\"NorthAngle\"].degrees\n rotation = Geom::Transformation.rotation(ORIGIN, Z_AXIS, -angle)\n\n Y_AXIS.transform(rotation)\n end",
"def dir(direction... | [
"0.8193958",
"0.7568277",
"0.7520402",
"0.73688877",
"0.73323727",
"0.7316741",
"0.7310873",
"0.728899",
"0.7276677",
"0.7253305",
"0.71760434",
"0.7145114",
"0.7123685",
"0.7113231",
"0.7109948",
"0.70893943",
"0.69750565",
"0.6972925",
"0.6924853",
"0.6918943",
"0.68881166"... | 0.6778029 | 29 |
strangely ? can't be used as a placeholder | def sql
@sql ||= begin
bind_params = []
i = 1
(selector_keys.length + setter_keys.length).times do
bind_params << "$#{i}"
i += 1
end
hstore_delete_handlers.length.times do
bind_params << "$#{i}::text[]"
i += 1
end
%{SELECT #{name}(#{bind_params.join(', ')})}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepared_arg_placeholder\n PREPARED_ARG_PLACEHOLDER\n end",
"def prepared_arg_placeholder\n PREPARED_ARG_PLACEHOLDER\n end",
"def is_question?( statement )\n statement.end_with? '?'\n end",
"def let?(param0 = T.unsafe(nil)); end",
"def query_variable?(obj)\n begin\n ... | [
"0.6243708",
"0.6150184",
"0.5834363",
"0.57737726",
"0.5740285",
"0.5712499",
"0.56707346",
"0.56257635",
"0.56198627",
"0.56044483",
"0.55935365",
"0.5570695",
"0.5549353",
"0.55356944",
"0.55046815",
"0.55041456",
"0.5502087",
"0.5491647",
"0.5487335",
"0.5487335",
"0.5477... | 0.0 | -1 |
the "canonical example" from differentiate between selector and setter | def create!
Upsert.logger.info "[upsert] Creating or replacing database function #{name.inspect} on table #{table_name.inspect} for selector #{selector_keys.map(&:inspect).join(', ')} and setter #{setter_keys.map(&:inspect).join(', ')}"
first_try = true
connection.execute(%{
CREATE OR REPLACE FUNCTION #{name}(#{(selector_column_definitions.map(&:to_selector_arg) + setter_column_definitions.map(&:to_setter_arg) + hstore_delete_handlers.map(&:to_arg)).join(', ')}) RETURNS VOID AS
$$
DECLARE
first_try INTEGER := 1;
BEGIN
LOOP
-- first try to update the key
UPDATE #{quoted_table_name} SET #{update_column_definitions.map(&:to_setter).join(', ')}
WHERE #{selector_column_definitions.map(&:to_selector).join(' AND ') };
IF found THEN
#{hstore_delete_handlers.map(&:to_pgsql).join(' ')}
RETURN;
END IF;
-- not there, so try to insert the key
-- if someone else inserts the same key concurrently,
-- we could get a unique-key failure
BEGIN
INSERT INTO #{quoted_table_name}(#{setter_column_definitions.map(&:quoted_name).join(', ')}) VALUES (#{setter_column_definitions.map(&:to_setter_value).join(', ')});
#{hstore_delete_handlers.map(&:to_pgsql).join(' ')}
RETURN;
EXCEPTION WHEN unique_violation THEN
-- seamusabshere 9/20/12 only retry once
IF (first_try = 1) THEN
first_try := 0;
ELSE
RETURN;
END IF;
-- Do nothing, and loop to try the UPDATE again.
END;
END LOOP;
END;
$$
LANGUAGE plpgsql;
})
rescue
if first_try and $!.message =~ /tuple concurrently updated/
first_try = false
retry
else
raise $!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setter_to_getter(node); end",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read... | [
"0.65989244",
"0.65484715",
"0.64858246",
"0.6444747",
"0.64438045",
"0.6291921",
"0.6113987",
"0.6106116",
"0.6056102",
"0.6047561",
"0.6008346",
"0.6005532",
"0.59802824",
"0.5936422",
"0.59114885",
"0.5903109",
"0.5902642",
"0.5888491",
"0.58614814",
"0.585771",
"0.5857290... | 0.0 | -1 |
Remove any base action | def remove_action(path: "#{base_path}.{format}", action:)
raise ArgumentError unless action.is_a?(Symbol)
@swagger_path_node_map[path.to_sym].data.delete(action)
@swagger_path_node_map.delete(path.to_sym) if @swagger_path_node_map[path.to_sym].data.blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_action_methods!; end",
"def clear_action_methods!; end",
"def clear_all_actions; end",
"def clear_action_methods!\n @action_methods = nil\n end",
"def forget(file); @actions << Action::ForgetAction.new(file); end",
"def clear_action_methods! # :doc:\n @action_methods = ni... | [
"0.7237984",
"0.7237984",
"0.7111086",
"0.66508",
"0.65086675",
"0.6451704",
"0.6198913",
"0.61941075",
"0.61436194",
"0.614157",
"0.6112078",
"0.60880387",
"0.6075203",
"0.6070963",
"0.6025243",
"0.5998956",
"0.59922254",
"0.5953189",
"0.59478694",
"0.5931616",
"0.5925942",
... | 0.61737764 | 8 |
Add extra path or action on existing path | def add_action(path, &block)
unless path.start_with? "/"
path = "#{base_path}/#{path}"
end
if @swagger_path_node_map[path]
@swagger_path_node_map[path].instance_eval(&block)
else
swagger_path path, &block
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_to_path(path)\n @path+= path\n end",
"def append_view_path(path); end",
"def append_view_path(path); end",
"def append_path(path)\n @trail.append_path(path)\n end",
"def append_path(path)\n expire_index!\n @trail.append_path(path)\n end",
"def add_path(path)\n r... | [
"0.72643423",
"0.7049178",
"0.7049178",
"0.6956496",
"0.6847439",
"0.6846963",
"0.6778047",
"0.64792234",
"0.64792234",
"0.64350903",
"0.64182955",
"0.64036626",
"0.6392937",
"0.63827395",
"0.6359481",
"0.63146293",
"0.62980956",
"0.6278247",
"0.6276681",
"0.6270299",
"0.6136... | 0.7106899 | 1 |
GET /trails/1 GET /trails/1.json | def show
@trail = Trail.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @trail }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_trails_by_id(params = {})\n request_by_ids(\"get-trails-by-id\", params)\n end",
"def index\n @trails = Trail.all\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond... | [
"0.67620075",
"0.65563715",
"0.6496824",
"0.6356491",
"0.6335956",
"0.6279109",
"0.6279109",
"0.6269156",
"0.5979131",
"0.59642714",
"0.593978",
"0.591592",
"0.587915",
"0.58728063",
"0.58388495",
"0.58374083",
"0.58301926",
"0.58276844",
"0.5789107",
"0.5692108",
"0.5681412"... | 0.569512 | 20 |
GET /trails/new GET /trails/new.json | def new
@trail = Trail.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @trail }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end",
"def new\n @trips_connect = TripsConnect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trips_connect }\n ... | [
"0.7074807",
"0.6895032",
"0.6790631",
"0.6768362",
"0.6760386",
"0.6746907",
"0.67411345",
"0.67411345",
"0.6706291",
"0.66647685",
"0.6662493",
"0.6635011",
"0.66347736",
"0.6610813",
"0.65791756",
"0.65707946",
"0.655158",
"0.6549234",
"0.652724",
"0.65198624",
"0.6516108"... | 0.69050395 | 2 |
POST /trails POST /trails.json | def create
@trail = Trail.new(params[:trail])
respond_to do |format|
if @trail.save
format.html { redirect_to @trail, notice: 'Trail was successfully created.' }
format.json { render json: @trail, status: :created, location: @trail }
else
format.html { render action: "new" }
format.json { render json: @trail.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_twit(twit)\n RestClient.post configuration.base_url + '/twits',\n { twit: twit }.to_json,\n content_type: :json,\n accept: :json\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n ... | [
"0.5731495",
"0.5689929",
"0.56787777",
"0.5668801",
"0.5617508",
"0.55776143",
"0.5570686",
"0.55389667",
"0.551131",
"0.54804826",
"0.54478455",
"0.5429116",
"0.5428999",
"0.5383949",
"0.5367201",
"0.5358847",
"0.53508264",
"0.53463566",
"0.53361285",
"0.5318913",
"0.531707... | 0.5411318 | 13 |
PUT /trails/1 PUT /trails/1.json | def update
@trail = Trail.find(params[:id])
respond_to do |format|
if @trail.update_attributes(params[:trail])
format.html { redirect_to @trail, notice: 'Trail was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @trail.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n begin\n Twitter.user_timeline(params[:foodtruck][:handle])\n foodtruck = Foodtruck.find(params[:id])\n foodtruck.update_attributes(params[:foodtruck])\n redirect_to '/foodtruck... | [
"0.5816167",
"0.5649722",
"0.56153476",
"0.5586911",
"0.558661",
"0.55785614",
"0.557388",
"0.55583507",
"0.5557538",
"0.55517393",
"0.55273306",
"0.55186176",
"0.5518315",
"0.5502771",
"0.54971665",
"0.5496481",
"0.5496435",
"0.5482984",
"0.54725087",
"0.5470477",
"0.5459741... | 0.5553477 | 9 |
DELETE /trails/1 DELETE /trails/1.json | def destroy
@trail = Trail.find(params[:id])
@trail.destroy
respond_to do |format|
format.html { redirect_to trails_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenan... | [
"0.71687925",
"0.68458474",
"0.67081493",
"0.6603068",
"0.65571797",
"0.6510399",
"0.65071917",
"0.6504434",
"0.6498869",
"0.6482673",
"0.6435511",
"0.64277935",
"0.64277935",
"0.64274895",
"0.64270264",
"0.6414412",
"0.6414412",
"0.6414412",
"0.640821",
"0.64027435",
"0.6398... | 0.6521021 | 5 |
This should return the minimal set of values that should be in the session in order to pass any filters (e.g. authentication) defined in SelectionSessionsController. Be sure to keep this updated too. | def valid_session
{}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selected_sessions #:nodoc:\n select_hash = params[:_cb_sessions] || {}\n select_hash.keys.select { |sub| select_hash[sub] == '1' }.sort\n end",
"def sessions\n @@session_set ||= ActiveRecord::SessionStore::Session.all.select{|s| s.data.has_key?(\"user_credentials_id\")}\n @@session_set.select{|... | [
"0.68518865",
"0.6291252",
"0.6057935",
"0.5941964",
"0.5892551",
"0.58502024"
] | 0.0 | -1 |
Update the contact record if necessary We match contact details, and if the new contact detail isn't there we create a new one Returns an array of details that were changed TODO should I be updating the first name or last name here also? I am, assuming that the new contact record is newer than the existing one NOTE: This assumes the contact records have matched already, e.g already_exists? has been run | def update_if_necessary(new_contact_record)
matched = []
updated_details = []
self.first_name = new_contact_record.first_name
self.last_name = new_contact_record.last_name
new_contact_record.details.each do |ncd|
details.each do |ocd|
matched << [ocd,ncd] and break if ocd.matches?(ncd)
end
end
# Update the matched records if necessary
matched.each do |ocd,ncd|
if not ocd.update_if_necessary(ncd).empty?
updated_details << ocd
end
end
# Also add the new contact details that we are adding
# We need to dup to make sure we don't overwrite the original
(new_contact_record.details - matched.column(1)).each do |ncd|
self.details << ncd.dup
updated_details << self.details.last
end
updated_details
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_contact_details\n last_booking = Bookings::Booking.last_accepted_booking_by(bookings_school)\n\n return false if last_booking.blank?\n\n assign_attributes(\n contact_name: last_booking.contact_name,\n contact_email: last_booking.contact_email,\n contact_number: last... | [
"0.68238914",
"0.6700693",
"0.6396842",
"0.63138205",
"0.62421536",
"0.6223738",
"0.6204833",
"0.6201809",
"0.6183449",
"0.6126709",
"0.6087692",
"0.6080248",
"0.606509",
"0.6063381",
"0.6009549",
"0.59987664",
"0.59702075",
"0.5958819",
"0.59460247",
"0.5916542",
"0.5912568"... | 0.84827185 | 0 |
Returns a new contact record that has the contact details shared with the two records | def &(contact_record_2)
me = dup
me.details = self.class.shared_contact_details(self,contact_record_2)
me
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def -(contact_record_2)\n me = dup\n me.details = details - self.class.shared_contact_details(self,contact_record_2)\n me\n end",
"def create_shared_contact(_entity)\n _contact = SharedContact.create(first_name: first_name, last_name: last_name, company: company,\n ... | [
"0.66071624",
"0.6490947",
"0.64308286",
"0.64180183",
"0.6219568",
"0.6148425",
"0.6083396",
"0.60293",
"0.598277",
"0.5968689",
"0.59599584",
"0.59237075",
"0.5891053",
"0.5876841",
"0.58309466",
"0.58105636",
"0.57820463",
"0.57820463",
"0.57820463",
"0.57820463",
"0.57820... | 0.7378223 | 0 |
Returns a new contact record that only has the details that existed in the first contact but not the second contact | def -(contact_record_2)
me = dup
me.details = details - self.class.shared_contact_details(self,contact_record_2)
me
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_if_necessary(new_contact_record)\n matched = []\n updated_details = []\n self.first_name = new_contact_record.first_name\n self.last_name = new_contact_record.last_name\n \n new_contact_record.details.each do |ncd|\n details.each do |ocd|\n matched << [ocd,ncd] and break if... | [
"0.68878937",
"0.6794143",
"0.6449034",
"0.64040995",
"0.61290646",
"0.6109358",
"0.59145814",
"0.59034985",
"0.58413947",
"0.571169",
"0.56650263",
"0.5662038",
"0.5652913",
"0.5644028",
"0.5635833",
"0.55509174",
"0.5510281",
"0.55093133",
"0.5494304",
"0.5492543",
"0.54754... | 0.65519625 | 2 |
Sometimes we get contacts with blank details | def remove_blank_contacts
self.details = details.select { |cd| !cd.value.blank? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrape_contacts; end",
"def contact_mix_2\n $testCaseID = \"VT229-0020\"\n con_remove\n createContact 20\n @contact = Rho::RhoContact.find(:all, :per_page => 5, :offset => 5, :select => [\"id\", \"last_name\"], :conditions => {:phone => 'is_nil', :email => 'is_nil'})\n puts @contact\n redir... | [
"0.69225466",
"0.67489314",
"0.66737777",
"0.66030496",
"0.6522998",
"0.64753634",
"0.64629626",
"0.64550817",
"0.6444806",
"0.6444806",
"0.643379",
"0.64303124",
"0.6395975",
"0.6364217",
"0.63335484",
"0.6292982",
"0.62766594",
"0.6275589",
"0.6268381",
"0.62669516",
"0.625... | 0.72751766 | 0 |
Try to match this contact number to a user NOTE: this will rematch even if it's already matched matches to an existing user and returns the user Notes: We don't match on name just phone number and email Even if the name is completely different, we keep things as is for now, that is, we don't doublecheck against name to see if there was a phone typo. | def existing_user_match
# First see if any of the phones match the "tested" phone (stored in user's profile)
matching_users = []
contact_details.each do |cd|
if cd.is_phone?
# Make sure we make the search using the full value b/c that's what we save in the user's mobile number record
if user = User.find_by_mobile_number(cd.normalized_value)
cd.update_attribute(:kind,:mobile_phone) unless cd.is_mobile_phone?
matching_users << user
end
elsif cd.is_email?
# Now let's see if this contact's emails match a verified email in the system
user = User.find_by_email(cd.email) and matching_users << user
else
raise "Contact record has to either be a phone or an email : #{cd.inspect}"
end
# If we haven't found a user to bind to yet based upon confirmed results,
# see if we match other contact details which may have already been bound to a user
# already. If so, then we don't make a new user, but just bind to the same existing user.
# We consider mobile phones and emails to be unique. If it's not a unique identifier
# then we treat them as separate users
unless user
ContactDetail.where({:value => cd.value,:kind => cd.kind}).each do |cd2|
if cd2.user && (cd.is_unique_identifier? || self.name_matches(cd2.contact_record))
matching_users << cd2.user
end
end
end
end
# It's very possible to match multiple times because one contact record may have the
# email and another a phone number, for example.
if matching_users.uniq.length > 1
# For now just raise an error, later we'll have to deal with it somehow
logger.warn "OH OH, found multiple matching users #{matching_users.uniq.ids.inspect} for contact record #{id}"
end
return matching_users.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_match\n user_match = User.find_by(id: self.id)\n end",
"def matching_user\n User.active.where(email: email).first\n end",
"def find_user(name)\n if ( name.downcase != name )\n @logger.info \"Looking for #{name.downcase} instead of #{name}\"\n end\n\n if @cached_users.has_... | [
"0.6158126",
"0.6001241",
"0.5898365",
"0.5670366",
"0.56619924",
"0.5641852",
"0.55790544",
"0.5536688",
"0.5516408",
"0.54772896",
"0.5463426",
"0.5446817",
"0.5406353",
"0.53884447",
"0.5365986",
"0.5361785",
"0.53459793",
"0.5342557",
"0.53369635",
"0.53361386",
"0.533100... | 0.7814232 | 0 |
What is the largest prime factor of the number 600851475143? for understanding of why don't have to specifically test for primes | def factor_primes(num)
return "Not a valid number" if num < 2
for divisor in 2..(num - 1)
while num % divisor == 0
(divisor * divisor > num) ? (return num) : (num /= divisor)
# puts "The divisor is #{divisor}"
# puts "The new num is #{num}"
end
end
puts "only divisible by 1 and itself"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prime_factor\n max = 600851475143**0.5\n\n for i in (1..max).step(2)\n if 600851475143 % i == 0\n if is_prime(i)\n ans = i\n end\n end\n end\n ans\nend",
"def largest_prime_factor\n number = 600851475143\n n = 2\n while n < number\n if number % n == 0\n factor = number /... | [
"0.8439139",
"0.8415072",
"0.8137972",
"0.78512084",
"0.77540916",
"0.76913226",
"0.7496761",
"0.74734783",
"0.73741734",
"0.73619246",
"0.73610765",
"0.73103803",
"0.7300754",
"0.72964966",
"0.72823435",
"0.72807956",
"0.72778493",
"0.72738737",
"0.72692806",
"0.7265883",
"0... | 0.0 | -1 |
GET /letters GET /letters.json GET /me/letters GET /users/1/letters | def index
@letters = Letter.where(rough_draft: false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n response = if Flipper.enabled?(:mobile_lighthouse_letters, @current_user)\n lighthouse_service.get_letters[:letters]\n else\n evss_service.get_letters.letters\n end\n\n render json: Mobile::V0::LettersSerializer.n... | [
"0.7901811",
"0.65236646",
"0.6277547",
"0.6167518",
"0.59220946",
"0.5873356",
"0.5759396",
"0.5750629",
"0.5735818",
"0.5704949",
"0.5660527",
"0.5616132",
"0.5581165",
"0.5570245",
"0.5557786",
"0.5548408",
"0.55230105",
"0.55198294",
"0.55164945",
"0.55106574",
"0.5505456... | 0.5134771 | 55 |
GET /letters/1 GET /letters/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n response = if Flipper.enabled?(:mobile_lighthouse_letters, @current_user)\n lighthouse_service.get_letters[:letters]\n else\n evss_service.get_letters.letters\n end\n\n render json: Mobile::V0::LettersSerializer.n... | [
"0.7214264",
"0.6740362",
"0.654657",
"0.65192586",
"0.63988364",
"0.6313106",
"0.61577356",
"0.60973233",
"0.6076441",
"0.6024851",
"0.59156674",
"0.59153086",
"0.5890378",
"0.587121",
"0.5853633",
"0.5830461",
"0.58240527",
"0.57849085",
"0.5776157",
"0.57716674",
"0.576191... | 0.0 | -1 |
POST /me/letters POST /me/letters.json | def create
@letter = current_user.letters.new(letter_params)
@recipient = find_recipient
@letter.recipient = @recipient
render :new and return unless @recipient.persisted?
@letter.rough_draft = true
respond_to do |format|
if @letter.save
format.html { redirect_to @letter, notice: 'Letter was successfully created.' }
format.json { render action: 'show', status: :created, location: @letter }
else
format.html { render action: 'new' }
format.json { render json: @letter.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letter_params\n params.require(:letter).permit(:name, :email, :number, :message, :appointment, :month)\n end",
"def create\n @esod_outgoing_letter = Esod::OutgoingLetter.new(esod_outgoing_letter_params)\n\n respond_to do |format|\n if @esod_outgoing_letter.save\n format.html { redirect_... | [
"0.63490856",
"0.6276164",
"0.6262757",
"0.6212577",
"0.62115717",
"0.6206667",
"0.61614835",
"0.61568296",
"0.6040464",
"0.5955806",
"0.5867146",
"0.5784706",
"0.57429856",
"0.5686991",
"0.5646645",
"0.5641068",
"0.5615602",
"0.5551611",
"0.5439415",
"0.5423358",
"0.5368398"... | 0.63262874 | 1 |
PATCH/PUT /me/letters/1 PATCH/PUT /me/letters/1.json | def update
@recipient = find_recipient
@letter.recipient = @recipient
render :new and return unless @recipient.persisted?
respond_to do |format|
if @letter.update(letter_params)
format.html { redirect_to @letter, notice: 'Letter was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @letter.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @letter_request.update(letter_request_params)\n format.html { redirect_to @letter_request, notice: 'Letter request was successfully updated.' }\n format.json { render :show, status: :ok, location: @letter_request }\n else\n format.html { re... | [
"0.65212667",
"0.63609916",
"0.6348891",
"0.60147274",
"0.59287053",
"0.5918083",
"0.58768034",
"0.5875527",
"0.5875527",
"0.5867627",
"0.5862208",
"0.5853734",
"0.5853734",
"0.5853655",
"0.58303946",
"0.580688",
"0.577115",
"0.57559526",
"0.57489693",
"0.57325613",
"0.572975... | 0.5962255 | 4 |
DELETE /me/letters/1 DELETE /me/letters/1.json | def destroy
@letter.destroy
respond_to do |format|
format.html { redirect_to rough_drafts_me_letters_path }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @letter = Letter.find(params[:id])\n @letter.destroy\n\n respond_to do |format|\n format.html { redirect_to letters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chalie_vice_letter.destroy\n respond_to do |format|\n format.html { redirect_t... | [
"0.7123277",
"0.68765646",
"0.6849404",
"0.67393064",
"0.67310435",
"0.6730403",
"0.67106146",
"0.664475",
"0.66412526",
"0.6606972",
"0.6606003",
"0.6583448",
"0.6583448",
"0.6583448",
"0.6583448",
"0.6583066",
"0.6545259",
"0.6545259",
"0.6543282",
"0.6496441",
"0.6462464",... | 0.7218731 | 0 |
GET /users/1/letters/followed GET /me/letters/followed | def followed
@letters = @user.followed_letters.sort { |x, y| y.created_at <=> x.created_at }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_followers\n HTTParty.post(\"#{@api_path}/users/followers/#{@handle}/#{@password}\")\n end",
"def get_followees\n HTTParty.post(\"#{@api_path}/users/followees/#{@handle}/#{@password}\")\n end",
"def followers(params={})\n args = params.map{|k,v| \"#{k}=#{v}\"}.join('&')\n get(\... | [
"0.67722124",
"0.66890126",
"0.66748816",
"0.6413942",
"0.63654536",
"0.6273074",
"0.6267091",
"0.622248",
"0.6212278",
"0.62046546",
"0.61955076",
"0.61939526",
"0.61818117",
"0.6177775",
"0.6156718",
"0.6134891",
"0.61202466",
"0.6119452",
"0.6119452",
"0.61147404",
"0.6110... | 0.7310757 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_letter
@letter = Letter.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.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.533008... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def letter_params
params.require(:letter).permit(:title, :text)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /dudas GET /dudas.json | def index
@dudas = Duda.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dnas = Dna.all\n\n render json: @dnas\n end",
"def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end",
"def show\n @deuda = Deuda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deuda }\n end... | [
"0.6714385",
"0.65547675",
"0.6396548",
"0.6202602",
"0.61894405",
"0.6152666",
"0.6050183",
"0.60005563",
"0.59865385",
"0.59701806",
"0.59568053",
"0.58709675",
"0.5865183",
"0.58413",
"0.5839175",
"0.5822943",
"0.58191407",
"0.58089924",
"0.58085203",
"0.5785639",
"0.57753... | 0.69119376 | 0 |
GET /dudas/1 GET /dudas/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dudas = Duda.all\n end",
"def index\n @dnas = Dna.all\n\n render json: @dnas\n end",
"def show\n @deuda = Deuda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deuda }\n end\n end",
"def index\n @denuncia ... | [
"0.6891711",
"0.6687261",
"0.66556376",
"0.6590031",
"0.6271184",
"0.62449086",
"0.6238876",
"0.62289196",
"0.61877036",
"0.61602795",
"0.6157742",
"0.61241037",
"0.61196727",
"0.61077297",
"0.6100108",
"0.6087703",
"0.60581064",
"0.6027865",
"0.5984991",
"0.59831554",
"0.595... | 0.0 | -1 |
POST /dudas POST /dudas.json | def create
@duda = Duda.new(duda_params)
respond_to do |format|
if @duda.save
format.html { redirect_to @duda, notice: 'Duda was successfully created.' }
format.json { render action: 'show', status: :created, location: @duda }
else
format.html { render action: 'new' }
format.json { render json: @duda.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def douga_params\n params.require(:douga).permit(:douga, :title, :text)\n end",
"def create\n @duo = Duo.new(duo_params)\n\n respond_to do |format|\n if @duo.save\n format.html { redirect_to @duo, no... | [
"0.6079863",
"0.60335225",
"0.59779775",
"0.5962789",
"0.580429",
"0.57868284",
"0.57641405",
"0.5749669",
"0.57062525",
"0.5695775",
"0.56809276",
"0.56663424",
"0.56535006",
"0.5643021",
"0.56426483",
"0.56336534",
"0.55995286",
"0.55990607",
"0.55954695",
"0.5594179",
"0.5... | 0.6539906 | 0 |
PATCH/PUT /dudas/1 PATCH/PUT /dudas/1.json | def update
respond_to do |format|
if @duda.update(duda_params)
format.html { redirect_to @duda, notice: 'Duda was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @duda.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'P... | [
"0.65581393",
"0.643185",
"0.63618815",
"0.63077813",
"0.62757295",
"0.6256849",
"0.62226754",
"0.6181574",
"0.61588115",
"0.6145409",
"0.612751",
"0.6112365",
"0.6100872",
"0.6093459",
"0.6085277",
"0.607345",
"0.6068736",
"0.60549664",
"0.60434777",
"0.6043323",
"0.6043319"... | 0.6512291 | 1 |
DELETE /dudas/1 DELETE /dudas/1.json | def destroy
@duda.destroy
respond_to do |format|
format.html { redirect_to dudas_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete path\n make_request(path, \"d... | [
"0.7396564",
"0.7129029",
"0.7126865",
"0.70894015",
"0.70406353",
"0.7019884",
"0.6972061",
"0.6948451",
"0.6940609",
"0.6915521",
"0.6915521",
"0.69140935",
"0.6888147",
"0.6888147",
"0.6888147",
"0.6888147",
"0.68805414",
"0.6879619",
"0.68761885",
"0.68694353",
"0.6861617... | 0.719617 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_duda
@duda = Duda.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 duda_params
params.require(:duda).permit(:ngaa)
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.6981537",
"0.67835593",
"0.6748275",
"0.67436063",
"0.6736311",
"0.65937173",
"0.6503359",
"0.6498499",
"0.6482832",
"0.6478776",
"0.645703",
"0.6439998",
"0.63802195",
"0.6377008",
"0.6366287",
"0.632018",
"0.63016284",
"0.63011277",
"0.62932974",
"0.62919617",
"0.6290564... | 0.0 | -1 |
Find all cities in a country | def cities()
sql="SELECT * FROM cities WHERE country_id = $1"
values = [@id]
cities = SqlRunner.run(sql, values)
return cities.map{|city| City.new(city)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cities()\n sql = \"SELECT cities.* FROM cities WHERE country_id = $1\"\n values = [@id]\n cities = SqlRunner.run(sql, values)\n result = City.map_items(cities)\n return result\n end",
"def cities()\n sql = \"SELECT cities.* FROM cities WHERE country_id = $1;\"\n values = [@id]\n city... | [
"0.77698725",
"0.75691235",
"0.74936783",
"0.7217286",
"0.71473694",
"0.7124089",
"0.6951363",
"0.6910682",
"0.6746799",
"0.6640098",
"0.66375095",
"0.6632132",
"0.6632105",
"0.6611792",
"0.6609331",
"0.6585424",
"0.65577763",
"0.65526307",
"0.65424114",
"0.65238285",
"0.6512... | 0.7599518 | 1 |
method that computes the square of its argument (the square is the result of multiplying a number by itself). | def multiply(number1, number2)
number1 * number2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def square(num)\n multiply(multiply(num, num), num)\nend",
"def square(x) = x * x",
"def square(num) #I calculate a simple method for calculating squares (after I will need it)\n return num * num\n end",
"def square(number)\n return number*number*number\nend",
"def square number\n return number **... | [
"0.85404533",
"0.8493905",
"0.83986217",
"0.83834726",
"0.83494705",
"0.83343196",
"0.8317622",
"0.8317622",
"0.8317622",
"0.8317622",
"0.8317622",
"0.8317622",
"0.8309385",
"0.83092296",
"0.83092296",
"0.8305825",
"0.82529175",
"0.8248532",
"0.8215727",
"0.8215727",
"0.82157... | 0.0 | -1 |
Health check page for e.g. NewRelic | def healthy
render plain: 'healthy'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def healthcheck\n url = \"#{self.url}/healthcheck\"\n status, _ = rest_get( url )\n return( status )\n end",
"def healthcheck\n url = \"#{self.url}/healthcheck\"\n status, _ = rest_get( url )\n return( status )\n end",
"def render_health_html\n render :file => hea... | [
"0.7222596",
"0.7222596",
"0.67823905",
"0.64944994",
"0.64076394",
"0.631865",
"0.6287462",
"0.62849927",
"0.6268716",
"0.6268716",
"0.62295586",
"0.6205022",
"0.6205022",
"0.60842216",
"0.6065815",
"0.60642785",
"0.60547566",
"0.59795934",
"0.5946595",
"0.59080404",
"0.5901... | 0.67821234 | 3 |
Internal server error page | def internal_server_error(exception = nil)
error_rendering exception, __callee__
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error\n render plain: '500 Internal Server Error', status: :internal_server_error\n end",
"def internal_server_error\r\n redirect_to(request.referrer || root_path, alert: 'Internal Server Error', status: 500)\r\n end",
"def error\n\t\t@page_title = '500 Error'\n\t\t@url_path = get_path\n\t\tflash.n... | [
"0.8607539",
"0.8104662",
"0.80607116",
"0.8026709",
"0.79564315",
"0.78651553",
"0.7848648",
"0.74041414",
"0.73990387",
"0.73355025",
"0.7293972",
"0.72903395",
"0.7282535",
"0.72685885",
"0.72448635",
"0.72441816",
"0.7154835",
"0.7150439",
"0.7115536",
"0.7100287",
"0.708... | 0.77063584 | 7 |
Capture exceptions and display the error using error template. | def error_rendering(exception, symbol)
Rails.logger.error exception
@exception = exception
@symbol = symbol
@code = Rack::Utils::SYMBOL_TO_STATUS_CODE[symbol].to_i
respond_with @exception, status: @code, template: ERROR_PATH, prefixes: _prefixes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_error(exception)\n # use the exception_notifier gem to send out an e-mail to the notification list specified in config/environment.rb\n ExceptionNotifier.notify_exception(exception)\n\n #TODO: hide stack traces from students after the beta. leave @error undefined to hide stack traces\n @err... | [
"0.74354964",
"0.7337999",
"0.7170834",
"0.701979",
"0.69890654",
"0.697994",
"0.6868646",
"0.6808246",
"0.6799994",
"0.6674189",
"0.6667086",
"0.6665465",
"0.66564846",
"0.6594203",
"0.6536694",
"0.65071154",
"0.6491056",
"0.64823246",
"0.6426986",
"0.6423628",
"0.64095557",... | 0.6232462 | 39 |
Initialize a new API client | def initialize(username, password, http_adapter = nil)
http_adapter = http_adapter.nil? ? HTTPAdapter.new : http_adapter
http_adapter.set_auth(username, password)
@http_client = HTTPClient.new(CLX::base_url, http_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_client; end",
"def initialize(api_key)\n @client = HTTPClient.new(\n default_header: {\n 'X-Auth-Token' => api_key,\n 'Content-Type' => 'application/json'\n }\n )\n end",
"def initialize(api_key)\n @client = Juicer::Client.new(api_key)\n end",
"def initialize(*args... | [
"0.7925353",
"0.7855423",
"0.7756064",
"0.7706189",
"0.7699616",
"0.7667308",
"0.7518137",
"0.75087273",
"0.7481278",
"0.7472487",
"0.74616605",
"0.7437687",
"0.7426036",
"0.7410075",
"0.7402081",
"0.738459",
"0.735896",
"0.7294313",
"0.7281478",
"0.72627366",
"0.72627366",
... | 0.0 | -1 |
Enables change of credentials after initialization | def set_auth(username, password)
@http_client.http_adapter.set_auth(username, password)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_demo_credentials!\n self.username = 'demo'\n self.password = 'password'\n end",
"def set_credentials\n @user = User.find(current_user.id)\n end",
"def set_credentials(credentials)\n @credentials = credentials\n end",
"def set_active_resource_credentials\n puts... | [
"0.7149071",
"0.67464685",
"0.6697505",
"0.65162474",
"0.6441332",
"0.64177555",
"0.63728994",
"0.6327718",
"0.6327718",
"0.6327718",
"0.6327718",
"0.6327718",
"0.6311877",
"0.6286437",
"0.6286437",
"0.6286437",
"0.6286437",
"0.6286437",
"0.6245523",
"0.6238755",
"0.6136914",... | 0.57352775 | 62 |
Enables change of base URL after initialization | def set_base_url(url)
@http_client.base_url = url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_base_url(url)\n base_url = url\n end",
"def set_base_url\n uri = URI.parse(@page_url)\n @base_url = \"#{uri.scheme}://#{uri.host}\"\n end",
"def set_base_url\n $base_url = (ENV['base_url'].nil? || ENV['base_url'].empty?) ? CONFIG['default_base_url'] : ENV['base_url']\nend"... | [
"0.8142059",
"0.7929456",
"0.7670091",
"0.7431272",
"0.737923",
"0.72810286",
"0.72069865",
"0.7202162",
"0.7198999",
"0.7176805",
"0.717039",
"0.715724",
"0.71539",
"0.7137671",
"0.70799804",
"0.7039431",
"0.70198035",
"0.696769",
"0.6951107",
"0.69124144",
"0.6874662",
"0... | 0.77743185 | 2 |
Get all operators from the API | def get_operators
url = CLX.paths[:operator]
@http_client.get(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_operators(type)\n for_type(type).collect(&:operator)\n end",
"def index\n @operators = Operator.search(params)\n @operators = Operator.all\n end",
"def operators\n to_array search_by_text 'оператор'\n end",
"def index\n @operators = Operator.all\n end",
"def index\n ... | [
"0.7177308",
"0.6992604",
"0.6809814",
"0.6753954",
"0.6657315",
"0.66405565",
"0.65839356",
"0.6435626",
"0.6430164",
"0.62887317",
"0.6258672",
"0.62570953",
"0.6177321",
"0.6146739",
"0.61253285",
"0.61253285",
"0.61253285",
"0.61253285",
"0.61253285",
"0.60578686",
"0.605... | 0.8360811 | 0 |
Get one operator based on it's operator id | def get_operator_by_id(operator_id)
valid_id?(operator_id)
url = CLX.paths[:operator] + '/' + operator_id.to_s
@http_client.get(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operator_for( type )\n return operator if(@operator_type == type.to_sym)\n nil\n end",
"def get_operator\n OPERATORS[get_token]\n end",
"def operator_name(operator_id)\n @operator_name.fetch(operator_id, :undefined)\n end",
"def operator\n return @operator\n ... | [
"0.73871714",
"0.698909",
"0.6906512",
"0.69022685",
"0.69022685",
"0.69022685",
"0.6804691",
"0.6803566",
"0.67766076",
"0.67316276",
"0.67316276",
"0.67316276",
"0.67316276",
"0.67311347",
"0.669922",
"0.66962385",
"0.66659296",
"0.6614986",
"0.64775425",
"0.6398254",
"0.63... | 0.7988109 | 0 |
Get one gateway based on it's gateway id | def get_gateway_by_id(gateway_id)
valid_id?(gateway_id)
url = CLX.paths[:gateway] + '/' + gateway_id.to_s
@http_client.get(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gateway\n @attributes.fetch('gateway', nil)\n end",
"def gateway\n if @@gateway\n return @@gateway if @@gateway.is_a? ActiveMerchant::Billing::Gateway\n @@gateway = @@gateway.to_s.classify.constantize.gateway\n else\n Gateway.default_gateway\n end\n end"... | [
"0.6665615",
"0.65946245",
"0.6566665",
"0.64773875",
"0.6476027",
"0.6414301",
"0.6371695",
"0.6279566",
"0.60914207",
"0.6063367",
"0.6060148",
"0.60544586",
"0.6007614",
"0.5909355",
"0.5868161",
"0.5868161",
"0.57887316",
"0.5783003",
"0.57536924",
"0.5693908",
"0.5670502... | 0.8425382 | 0 |
Get price entires based on gateway id | def get_price_entires_by_gateway_id(gateway_id)
valid_id?(gateway_id)
url = CLX.paths[:gateway] + '/' + gateway_id.to_s + '/price'
@http_client.get(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_price_entries_by_gateway_id_and_operator_id(gateway_id, operator_id)\r\n valid_id?(gateway_id)\r\n valid_id?(operator_id)\r\n url = CLX.paths[:gateway] + '/' + gateway_id.to_s + '/price/' + operator_id.to_s\r\n @http_client.get(url)\r\n end",
"def all_prices\n request :pub... | [
"0.74839145",
"0.6953068",
"0.6812073",
"0.680992",
"0.65371644",
"0.6242243",
"0.62009805",
"0.6135967",
"0.610125",
"0.60123897",
"0.6001761",
"0.59634066",
"0.59523183",
"0.59189534",
"0.58962935",
"0.5887293",
"0.5882112",
"0.58582807",
"0.58118373",
"0.57748824",
"0.5770... | 0.86095315 | 0 |
Get price entiry based on gateway id and operator id | def get_price_entries_by_gateway_id_and_operator_id(gateway_id, operator_id)
valid_id?(gateway_id)
valid_id?(operator_id)
url = CLX.paths[:gateway] + '/' + gateway_id.to_s + '/price/' + operator_id.to_s
@http_client.get(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_price_entires_by_gateway_id(gateway_id)\r\n valid_id?(gateway_id)\r\n url = CLX.paths[:gateway] + '/' + gateway_id.to_s + '/price'\r\n @http_client.get(url)\r\n end",
"def get_price_entries_by_gateway_id_and_operator_id_and_date(gateway_id, operator_id, date)\r\n valid_id?(gateway_... | [
"0.7342834",
"0.7233655",
"0.60759676",
"0.59264904",
"0.59193474",
"0.5858548",
"0.58414596",
"0.58170277",
"0.5758511",
"0.57001925",
"0.5667578",
"0.5557399",
"0.555458",
"0.55065334",
"0.5485084",
"0.54831105",
"0.54763615",
"0.5468298",
"0.545985",
"0.54580545",
"0.54314... | 0.80706555 | 0 |
Get price entiry based on gateway id, operator id and a date | def get_price_entries_by_gateway_id_and_operator_id_and_date(gateway_id, operator_id, date)
valid_id?(gateway_id)
valid_id?(operator_id)
valid_date?(date)
date_query = "?date=#{date.year}-#{date.month}-#{date.day}"
url = CLX.paths[:gateway] + '/' + gateway_id.to_s + '/price/' + operator_id.to_s + '/' + date_query
@http_client.get(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_price_entries_by_gateway_id_and_operator_id(gateway_id, operator_id)\r\n valid_id?(gateway_id)\r\n valid_id?(operator_id)\r\n url = CLX.paths[:gateway] + '/' + gateway_id.to_s + '/price/' + operator_id.to_s\r\n @http_client.get(url)\r\n end",
"def get_price_entires_by_gateway_id(ga... | [
"0.7808872",
"0.69856477",
"0.59266305",
"0.58648705",
"0.58376306",
"0.5749449",
"0.5689772",
"0.5689772",
"0.5689772",
"0.5607675",
"0.5512726",
"0.54641163",
"0.54587996",
"0.54547757",
"0.5410945",
"0.5410945",
"0.54085565",
"0.5394899",
"0.53313136",
"0.52826196",
"0.527... | 0.8344282 | 0 |
Validates that in is of type integer and is grater than zero | def valid_id?(id)
raise CLXException, 'Id must be integer' unless id.is_a? Integer
raise CLXException, 'Id must be greater than zero' unless id > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_number?(num)\n num.to_i != 0\nend",
"def valid_number?(num)\n num.to_i != 0\nend",
"def validate_non_negative_integer(source,value)\n if not value.kind_of?(Integer) or value < 0\n raise ArgumentError, \"#{source} must be a non-negative integer\"\n end\n ... | [
"0.69204485",
"0.69204485",
"0.68953794",
"0.68709266",
"0.6805932",
"0.6793877",
"0.6793877",
"0.67525667",
"0.67435527",
"0.67393863",
"0.6700688",
"0.6683356",
"0.6672773",
"0.6632364",
"0.66110796",
"0.6593508",
"0.6588385",
"0.6558223",
"0.6554175",
"0.6538766",
"0.65360... | 0.0 | -1 |
Validates that date is of type DateTime | def valid_date?(date)
raise CLXException, 'Date must be of type DateTime' unless date.is_a? DateTime
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_start_date_is_valid_datetime\n errors.add(:start_date, 'start date must be a valid datetime') if (:start_date.kind_of? DateTime)\n end",
"def is_valid?\n is_valid_datetime?\n end",
"def datetime_validate(value)\n begin\n return DateTime.parse(value)\n rescue ArgumentError, NoMethodErr... | [
"0.80758345",
"0.7467449",
"0.72996336",
"0.7271125",
"0.6998333",
"0.6977483",
"0.69308364",
"0.6832346",
"0.6808712",
"0.6795265",
"0.67452496",
"0.6703359",
"0.665789",
"0.66323006",
"0.6557009",
"0.64952594",
"0.64665896",
"0.64468455",
"0.6360783",
"0.62853694",
"0.62374... | 0.82500786 | 0 |
A Disjunction with a contradiction left operand is equivalent to the right | def optimize
right
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_simplification_rules_for_conjunction\n end",
"def exclusive_or (p,q)\n p ^ q\nend",
"def new_dsnf_rules_for_conjunction\n end",
"def ast\n disjunction\n end",
"def disjunction_expressions(left_expression, left_expression_joins, right_expression,\n rig... | [
"0.7532387",
"0.68175954",
"0.6776914",
"0.6623896",
"0.66022885",
"0.6564193",
"0.6524616",
"0.6471969",
"0.64393735",
"0.6435836",
"0.6364011",
"0.6350732",
"0.63432306",
"0.63301307",
"0.62593955",
"0.6221029",
"0.62151074",
"0.62097746",
"0.6188633",
"0.61873704",
"0.6185... | 0.0 | -1 |
A Disjunction with a contradiction right operand is equivalent to the left | def optimize
left
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_simplification_rules_for_conjunction\n end",
"def exclusive_or (p,q)\n p ^ q\nend",
"def disjunction_expressions(left_expression, left_expression_joins, right_expression,\n right_expression_joins)\n if left_expression == ALWAYS_TRUE || right_expression == ALWAYS_TRUE\n... | [
"0.75244546",
"0.68592876",
"0.6743161",
"0.67383975",
"0.6717988",
"0.66077983",
"0.6529525",
"0.64678967",
"0.64292294",
"0.6380649",
"0.63528484",
"0.63502413",
"0.6321883",
"0.628411",
"0.6262778",
"0.6235164",
"0.6215479",
"0.6197452",
"0.61922234",
"0.6180254",
"0.61531... | 0.0 | -1 |
Return an Inclusion for an attribute having a set of values | def optimize
left.left.include(merged_right_enumerables).optimize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validates_includes(set, atts, opts={})\n validatable_attributes(atts, opts){|a,v,m| (m || \"is not in range or set: #{set.inspect}\") unless set.include?(v)}\n end",
"def extract_inclusion_values(klass, attribute)\n values = nil\n\n klass.validators_on(attribute).each do |validator|... | [
"0.701397",
"0.6715701",
"0.6488619",
"0.64000595",
"0.63879776",
"0.6356366",
"0.6354355",
"0.6337568",
"0.6224024",
"0.5885387",
"0.5868857",
"0.58022106",
"0.5741742",
"0.5658976",
"0.5578531",
"0.5537731",
"0.55185294",
"0.5505063",
"0.5499432",
"0.54994124",
"0.5494394",... | 0.0 | -1 |
Funcion para imprimir pipes. | def print_pipe(pipe)
for i in 1..pipe
print "| "
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pipe(other)\n Pipeline.new(@pipes + [other])\n end",
"def pipe(&block)\n cmds = Commands.new(mode: :pipe)\n cmds.instance_eval(&block)\n self.!(cmds.to_a)\n end",
"def pipe(*cmd, stdin: nil)\n IO.popen(cmd, \"r+\", err: %i[child out]) do |io|\n io.write stdin if stdin\n io.... | [
"0.6444401",
"0.6437345",
"0.6152394",
"0.6142668",
"0.61058575",
"0.6062891",
"0.60602176",
"0.59304756",
"0.5798351",
"0.57190686",
"0.5707612",
"0.5647955",
"0.5601003",
"0.556957",
"0.55591524",
"0.5539096",
"0.5511442",
"0.54599226",
"0.54432106",
"0.5426121",
"0.5392672... | 0.5855131 | 9 |
Returns a BTC::Script instance that signs BTC::TransactionInput. Second argument is BTC::TransactionOutput that is being spent in that input. Returns a signature script (BTC::Script) or nil. If nil is returned, input is left unsigned. | def signature_script_for_input(input: nil, output: nil)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signature_hash_for_input(input_idx, outpoint_tx, script_pubkey=nil, hash_type=nil, drop_sigs=nil, script=nil)\n # https://github.com/bitcoin/bitcoin/blob/e071a3f6c06f41068ad17134189a4ac3073ef76b/script.cpp#L834\n # http://code.google.com/p/bitcoinj/source/browse/trunk/src/com/google/bitcoin/core/... | [
"0.6479405",
"0.62731004",
"0.57512194",
"0.5661401",
"0.5520381",
"0.55181557",
"0.540374",
"0.53343004",
"0.52975583",
"0.52801466",
"0.527127",
"0.52520406",
"0.52378774",
"0.52347046",
"0.52289474",
"0.520949",
"0.51669997",
"0.51248944",
"0.5046288",
"0.50307417",
"0.503... | 0.72260356 | 0 |
GET /contests GET /contests.json | def index
@contests = Contest.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @contests }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { re... | [
"0.80966395",
"0.7623794",
"0.76101625",
"0.75512016",
"0.75512016",
"0.7509743",
"0.7509743",
"0.7509743",
"0.7509743",
"0.7278885",
"0.70287955",
"0.6942451",
"0.6846595",
"0.68122125",
"0.68060964",
"0.6797226",
"0.6769983",
"0.6732931",
"0.66822207",
"0.66822207",
"0.6673... | 0.8140358 | 0 |
GET /contests/1 GET /contests/1.json | def show
@contest = Contest.find(params[:id])
add_breadcrumb "Tramanta", :root_path
add_breadcrumb @contest.name.capitalize, @contest
@title_content = @contest.name
@meta_description_content = @contest.instructions
@og_type = 'article'
@og_image = 'http://www.tramanta.com'+@contest.image.url(:xl)
@og_description = @contest.name+' - '+@contest.instructions
respond_to do |format|
format.html # show.html.erb
format.json { render json: @contest }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format... | [
"0.8039824",
"0.80027866",
"0.79434526",
"0.79434526",
"0.7894636",
"0.78603256",
"0.74444187",
"0.73176265",
"0.73176265",
"0.73176265",
"0.73176265",
"0.7205758",
"0.7156151",
"0.7156151",
"0.71495616",
"0.7118187",
"0.7028238",
"0.6884724",
"0.6837134",
"0.6814197",
"0.681... | 0.666305 | 35 |
GET /contests/new GET /contests/new.json | def new
add_breadcrumb "nueva", :new_contest_path
@contest = Contest.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @contest }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n ... | [
"0.84166914",
"0.84166914",
"0.8337581",
"0.81820256",
"0.7914554",
"0.76854205",
"0.7533876",
"0.7533876",
"0.7533876",
"0.75304234",
"0.7507851",
"0.7507851",
"0.7381418",
"0.7381418",
"0.7381418",
"0.7335629",
"0.72180265",
"0.72180265",
"0.72180265",
"0.7210044",
"0.71955... | 0.8151595 | 4 |
POST /contests POST /contests.json | def create
@contest = Contest.new(params[:contest])
respond_to do |format|
if @contest.save
format.html { redirect_to @contest, notice: 'Contest was successfully created.' }
format.json { render json: @contest, status: :created, location: @contest }
else
format.html { render action: "new" }
format.json { render json: @contest.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @contest = @event.contests.build(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to [@event, @contest], notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: @contest }\n else\n ... | [
"0.7152174",
"0.7103855",
"0.70241404",
"0.70208913",
"0.69897294",
"0.695391",
"0.68805426",
"0.68404317",
"0.68307537",
"0.68174773",
"0.6759615",
"0.6731611",
"0.67187345",
"0.67118084",
"0.6692199",
"0.6692199",
"0.66318876",
"0.66176033",
"0.6520299",
"0.6520299",
"0.652... | 0.74872786 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.