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 |
|---|---|---|---|---|---|---|
def my_find_index(&prc) index = nil i = 0 self.each do |link| if prc.call(link) need to update index index = i end i += 1 end index end | def each(&prc)
link = first
until link == self.tail
prc.call(link)
link = link.next
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_index(arg)\n self.each_with_index do |ele,idx|\n if ele == arg\n return idx\n end\n end\n return nil\n end",
"def find_at(index)\n return if (index + 1) > count || index < 0\n\n item = @head\n index.times { item = item.next }\n ... | [
"0.7038404",
"0.67932135",
"0.66767657",
"0.6661337",
"0.66362035",
"0.6623552",
"0.6558645",
"0.65362614",
"0.65333897",
"0.6526858",
"0.6521361",
"0.6507502",
"0.6506571",
"0.64914423",
"0.64888173",
"0.64777833",
"0.64771503",
"0.6470542",
"0.6455576",
"0.64458805",
"0.643... | 0.0 | -1 |
uncomment when you have `each` working and `Enumerable` included | def to_s
inject([]) { |acc, link| acc << "[#{link.key}, #{link.val}]" }.join(", ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(*) end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
... | [
"0.729552",
"0.729552",
"0.729552",
"0.729552",
"0.729552",
"0.729552",
"0.7163506",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.70454085",
"0.70422536",
"0.6950336",
"0.67... | 0.0 | -1 |
def self.link_user_info(user_info) result = nil user = User.new user.id = user_info.uid.to_i if user_info.uid && user_info.id user.user_info = user_info.id result = update_pg_user end result end Update the users table with the matched partners Return true if lacticate users was successful and nil otherwise | def lacticate_users(user1,user2)
# PostgresUser.lacticate_users(user1,user2)
lacticate_pg_users(user1,user2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateUser(linkedInInfo, user)\n user.update_attributes(:firstName => getValueFromLinkedInInfo(linkedInInfo, 'firstName'),\n :lastName => getValueFromLinkedInInfo(linkedInInfo, 'lastName'),\n :location => getValueFromLinkedInIn... | [
"0.66844976",
"0.63780236",
"0.6296657",
"0.62190723",
"0.6120629",
"0.6054091",
"0.6045318",
"0.60224813",
"0.60028905",
"0.5974822",
"0.5886708",
"0.58503234",
"0.58439493",
"0.57655066",
"0.5752635",
"0.57413405",
"0.57342136",
"0.57316685",
"0.5704269",
"0.5695355",
"0.56... | 0.54778445 | 61 |
Return the last_fetched user's contacts (lactic or other) | def lactic_contacts(id,lactic_contacts)
# PostgresUser.lactic_contacts(uid,lactic_contacts)
lactic_pg_contacts(id,lactic_contacts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_users_parsed\n return @last_parsed_userlist_data\n end",
"def recently_contacted_users\n Skype.find_users_of_type \"RECENTLY_CONTACTED_USERS\"\n end",
"def contacts\n\t\t@user = current_user\n\t\tcheck_if_myself\n\t\t@contacts = @user.contacts\n\tend",
"def getContacts\n messa... | [
"0.6290466",
"0.61316556",
"0.6113394",
"0.6011484",
"0.593495",
"0.59342337",
"0.5848762",
"0.58371156",
"0.5836697",
"0.56929094",
"0.5691906",
"0.56469727",
"0.56374496",
"0.56260425",
"0.5590778",
"0.55723155",
"0.55576",
"0.55576",
"0.55551463",
"0.55551463",
"0.55551463... | 0.58754605 | 6 |
Working Thread Compare commits curl " Could read through the number of lines there are and also get the file extension. Then we could collect meta data on languages/frameworks this way Look for +numbers's. This be an easy way to find the data. Then I should be able to look at all of the file extensions and give it loads of fun data. Get commits per hour RestClient.get(" Using git api compare response = HTTParty.get(" json = JSON.parse(repsonse.body) json["files"][i]["filename"] json["files"][i]["additions"] returns a string. Example "Ruby" | def what_language? filename
test = filename.partition(".").last
case test
when "rb", "ru", "erb", "slim", "haml"
"Ruby"
when "py"
"Python"
when "java", "jsp", "jsf"
"Java"
when "cpp"
"C++"
when "m"
"Obj-C"
when "c"
"C"
when "js", "coffee"
"Javascript"
when "html"
"Html"
when "cs"
"C#"
when "css", "scss", "less"
"CSS"
when "php"
"PHP"
when "md"
"Readme"
when "hs"
"Haskell"
when "pm", "pl"
"Perl"
when ".sh"
"Bash/Shell"
else
"Other"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def regex_process_commit(arr)\n message = \"\"\n filepaths = {}\n end_message_index = 0\n hash = Hash.new\n in_files = false # Have we gotten to the file portion yet? After the ;;; delimiter\n\n #index 5 should be the start\n #of the message\n (5..arr.size-1).each do |i|\n #add lines t... | [
"0.605789",
"0.60482985",
"0.60394806",
"0.5979286",
"0.5976605",
"0.589328",
"0.5879649",
"0.5863468",
"0.5856474",
"0.56922305",
"0.5683459",
"0.56424093",
"0.56207526",
"0.5609563",
"0.5565239",
"0.55471784",
"0.5511789",
"0.5498405",
"0.54980254",
"0.5480723",
"0.54794526... | 0.0 | -1 |
GET /bookings GET /bookings.json | def index
@bookings = smart_listing_create(:bookings, Booking.includes(:seat, :user).where(user_id: current_user.id), partial: "bookings/listing")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @bookings = Booking.all\n\n render json: @bookings\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n ... | [
"0.8231102",
"0.80365145",
"0.80220497",
"0.80220497",
"0.80220497",
"0.7619097",
"0.7607287",
"0.7501954",
"0.7473071",
"0.7473071",
"0.7473071",
"0.7473071",
"0.7473071",
"0.7473071",
"0.7473071",
"0.7473071",
"0.7473071",
"0.7473071",
"0.7473071",
"0.7473071",
"0.7473071",... | 0.64366347 | 83 |
GET /bookings/1 GET /bookings/1.jsons | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @bookings = Booking.all\n\n render json: @bookings\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n ... | [
"0.785726",
"0.77609533",
"0.773774",
"0.773774",
"0.773774",
"0.7406768",
"0.73387",
"0.73271865",
"0.73101413",
"0.7236247",
"0.722184",
"0.72217333",
"0.7209883",
"0.7209883",
"0.7209883",
"0.7209883",
"0.7209883",
"0.7209883",
"0.7209883",
"0.7209883",
"0.7209883",
"0.7... | 0.0 | -1 |
POST /bookings POST /bookings.json | def create
@booking = Booking.new(booking_params.merge(user_id: current_user.id))
respond_to do |format|
if @booking.save
format.html { redirect_to action: :index, notice: 'Booking was successfully created.' }
else
format.html { render :new }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n booking = Booking.create(booking_params)\n render json: booking\n end",
"def create\n\t\tbooking = Booking.new(booking_params)\n\n\t if booking.save\n\t \tPeekBooker.use_a_boat(booking.size, booking.timeslot_id)\n\t \tPeekBooker.delete_overlap_assignments(booking.timeslot_i... | [
"0.7352371",
"0.72278684",
"0.68597174",
"0.6782818",
"0.6782818",
"0.6766579",
"0.66423225",
"0.6640033",
"0.66245",
"0.65138423",
"0.65080756",
"0.65080756",
"0.65080756",
"0.648764",
"0.64313096",
"0.63776237",
"0.63463503",
"0.6324189",
"0.6297219",
"0.6288926",
"0.627832... | 0.59276396 | 93 |
PATCH/PUT /bookings/1 PATCH/PUT /bookings/1.json | def update
@booking.update_attributes(booking_params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @booking = Booking.find(params[:id])\n\n if @booking.update(booking_params)\n head :no_content\n else\n render json: @booking.errors, status: :unprocessable_entity\n end\n end",
"def update\n @booking = Booking.find(params[:id])\n @booking.update_attributes(params[:booki... | [
"0.70660025",
"0.7035505",
"0.6951961",
"0.69296867",
"0.69296867",
"0.69296867",
"0.6925516",
"0.68727815",
"0.67891777",
"0.6737531",
"0.67097384",
"0.66938263",
"0.66938263",
"0.66938263",
"0.66782904",
"0.66559863",
"0.66393423",
"0.66337067",
"0.6626812",
"0.6624749",
"0... | 0.0 | -1 |
DELETE /bookings/1 DELETE /bookings/1.json | def destroy
@booking.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |fo... | [
"0.7660707",
"0.7660707",
"0.7660707",
"0.7660707",
"0.7657568",
"0.7565737",
"0.75498253",
"0.75498253",
"0.739592",
"0.7359668",
"0.7359668",
"0.729106",
"0.72711414",
"0.724865",
"0.724865",
"0.724865",
"0.724865",
"0.724865",
"0.724865",
"0.724865",
"0.724865",
"0.72486... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_booking
@booking = Booking.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def booking_params
params.fetch(:booking, {}).permit(:user_id, :seat_id, :start_at, :end_at)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
Convert Markdown to HTML using the best available implementation and convert into a DocumentFragment. | def call
# mode = (context[:gfm] != false) ? :gfm : :markdown
# html = GitHub::Markdown.to_html(@text, mode)
# html.rstrip!
# html
options = context[:redcarpet_options] || {}
renderer = HtmlWithRouge.new(
filter_html: options.fetch(:filter_html, false),
hard_wrap: options.fetch(:hard_wrap, true)
)
options.reject! { |k, v| [:filter_html, :hard_wrap].include?(k) }
markdown = Redcarpet::Markdown.new(renderer, options)
html = markdown.render(@text)
html.rstrip!
html
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_markdown\n self.html_content = Raptor::Markdown.render(self.content)\n end",
"def convert_markdown\n # self.content_html = Kramdown::Document.new(content).to_html\n self.content_html = markdown(content)\n end",
"def to_html_fragment\n to_markdown_slices.map do |tagged_markdown|\n ... | [
"0.72599363",
"0.7212987",
"0.70050335",
"0.671624",
"0.6709958",
"0.6708382",
"0.66602504",
"0.6659621",
"0.664389",
"0.6614171",
"0.6587399",
"0.6575198",
"0.6575198",
"0.6528675",
"0.65085465",
"0.6494677",
"0.64903384",
"0.6483132",
"0.64438254",
"0.6427199",
"0.6414201",... | 0.0 | -1 |
Takes a hash of components | def installed? components = nil
Hash[(components || to_install).map{|k, args|[k, cmp_installed?(*args)]}]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def params=(hash); end",
"def params=(hash); end",
"def hash=(_arg0); end",
"def inject(hash); end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash(*) end... | [
"0.61854196",
"0.61854196",
"0.60572964",
"0.6051908",
"0.59705013",
"0.59705013",
"0.59705013",
"0.59705013",
"0.59705013",
"0.59705013",
"0.59705013",
"0.59705013",
"0.59705013",
"0.59705013",
"0.590681",
"0.5885476",
"0.58484966",
"0.58472466",
"0.58472466",
"0.58472466",
... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_business
@business = Business.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def business_params
params.require(:business).permit(:name, :address, :city)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.71230334",
"0.70530915",
"0.69479465",
"0.6902122",
"0.67367256",
"0.67172784",
"0.6689043",
"0.66784793",
"0.6660117",
"0.6555213",
"0.6528485",
"0.6458438",
"0.6452378",
"0.6451654",
"0.64478326",
"0.6433326",
"0.6413599",
"0.6413599",
"0.63907677",
"0.63787645",
"0.6378... | 0.0 | -1 |
Returns the Dot label for the object. | def dot_label x
@dot_label[x] ||=
_dot_label x
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot_label x, opts = EMPTY_HASH\n @dot_label[[x, opts]] ||=\n case x\n when Cabar::Component\n # * name and version\n # * directory\n # * facets (optional)\n str = ''\n\n if show_component_name\n str << \"#{x.name}\"\n ... | [
"0.6645834",
"0.6621758",
"0.6618855",
"0.65489244",
"0.64943224",
"0.64486957",
"0.64289665",
"0.63742244",
"0.6331173",
"0.62375253",
"0.6218592",
"0.6146182",
"0.6093772",
"0.6090563",
"0.6084557",
"0.60368735",
"0.6014525",
"0.601225",
"0.6010103",
"0.5991288",
"0.5949476... | 0.7634909 | 0 |
Renders object as Dot syntax. | def render x = @stateMachine
case x
when Machine
@machine = x
options[:history] ||=
x.history
options[:highlight_states] ||=
[ x.state ].compact
options[:highlight_transitions] ||=
(
x.transition_queue.map{|e| e.first} <<
x.transition
).compact
render x.stateMachine
when StateMachine
render_root x
when State
render_State x
when Transition
render_Transition x
else
raise ArgumentError, x.inspect
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot\n end",
"def do_dot\n message = pop\n object = pop\n\n\t\t# defer error handling for now\n\t\tcase object[:type]\n when :integer\n m = message[:value]\n\t\t\t@integer_msgs[m].call( object )\n when :string\n # ditto :integer\n when :frame # user defined object\n\t\t\t@fst... | [
"0.68863046",
"0.68085873",
"0.64318633",
"0.63968164",
"0.6376793",
"0.6350934",
"0.6165895",
"0.6122331",
"0.6103763",
"0.6096252",
"0.6081692",
"0.60542107",
"0.60432225",
"0.59109175",
"0.59109175",
"0.5891754",
"0.57279897",
"0.57066077",
"0.56896585",
"0.56192935",
"0.5... | 0.0 | -1 |
Renders the StateMachine as Dot syntax. | def render_StateMachine sm, dot_opts = nil
return if @rendered[sm]
@rendered[sm] = true
dot_opts ||= { }
hide_decomposition = dot_opts.delete(:hide_decomposition)
stream.puts "\n// {#{sm.inspect}"
name = dot_opts.delete(:_node_name) || dot_name(sm)
type = "subgraph #{name}"
dot_opts[:label] ||= dot_label(sm.superstate)
dot_opts[:shape] = :box
dot_opts[:style] = 'filled,rounded'
dot_opts[:fillcolor] ||= :white
dot_opts[:fontcolor] ||= :black
dot_opts = dot_opts_for sm, dot_opts
if hide_decomposition && false
dot_opts[:label] += "\\r o-o"
end
stream.puts "#{type} {"
stream.puts %Q{ #{render_opts(dot_opts, ";\n ")}}
yield if block_given?
unless hide_decomposition
start_name = dot_name(sm, :start)
@rendered[start_name] = true
stream.puts "\n// Implicit :start Pseudostate"
stream.puts %Q{ node [ shape="circle", label="", style=filled, fillcolor=black ] #{start_name}; }
sm.states.each { | s | render(s) }
end
stream.puts "}"
stream.puts "// } #{sm.inspect}\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dot(options = {})\r\n Dot::Digraph.new(:fontsize => 10, :shape => :box, :size => 5) do |g|\r\n states.each do |state|\r\n g.node(state, :label => state.items.values.collect{|item| item.to_s(options)}.join(\"\\n\"))\r\n @transitions[state].each do |symbol, dest_state|\r\n ... | [
"0.67595047",
"0.65789276",
"0.64541173",
"0.6320492",
"0.6315098",
"0.62033975",
"0.6202185",
"0.6199375",
"0.6190483",
"0.61005193",
"0.60155636",
"0.5951069",
"0.5931403",
"0.588383",
"0.588383",
"0.588383",
"0.58591586",
"0.5856718",
"0.57959205",
"0.5767704",
"0.5762307"... | 0.69742304 | 0 |
Renders the State object as Dot syntax. | def render_State s
return if @rendered[s]
@rendered[s] = true
stream.puts "\n// #{s.inspect}"
sequence = [ ]
if options[:history]
options[:history].each_with_index do | hist, i |
if hist[:new_state] && s.is_a_superstate_of?(hist[:new_state])
sequence << i + 1
end
end
end
dot_opts = {
:label => dot_label(s),
:shape => :box,
:style => "filled",
}
case
when s.end_state?
dot_opts[:label] = "" # DONT BOTH LABELING END STATES.
dot_opts[:shape] = :doublecircle
end
dot_opts = dot_opts_for s, dot_opts
hide_decomposition = dot_opts.delete(:hide_decomposition)
stream.puts " // hide_decomposition = #{hide_decomposition.inspect}"
if (hs = options[:highlight_states]) && hs.include?(s)
dot_opts[:style] += ',bold'
end
unless sequence.empty?
if options[:highlight_state_history] && (s.submachine ? hide_decomposition : true)
dot_opts[:fillcolor] = :grey
end
if options[:show_state_sequence]
dot_opts[:label] += "\\n(#{sequence_to_s(sequence)})\\r"
end
else
if options[:highlight_state_label_history]
dot_opts[:fontcolor] = :grey
end
if options[:highlight_state_border_history]
dot_opts[:color] = :grey
end
end
dot_opts[:color] ||= :black
dot_opts[:fontcolor] ||= :black
dot_opts[:fillcolor] ||= :white
# Dont label FinalStates, it causes too much clutter.
# Invert the colors to be more like UML.
case
when s.end_state?
dot_opts[:label] = ""
dot_opts[:fillcolor], dot_opts[:fontcolor] =
dot_opts[:fontcolor], dot_opts[:fillcolor]
end
if ssm = s.submachine
# Composite States are rendered as
# a subgraph cluster with a target and source "connection point" for external connections.
# This is where the dot_name(s, :source || :target) is defined.
# Subsequence Transitions edges will used these connnection points.
implicit_dot_opts = dot_opts.dup
dot_opts[:hide_decomposition] = hide_decomposition
render_StateMachine(ssm, dot_opts) do
dot_opts = implicit_dot_opts
dot_opts[:shape] = :point
dot_opts[:label] = "[]"
stream.puts %Q'\n subgraph cluster_#{dot_name(s, :source)} {'
stream.puts %Q{ color=none;}
stream.puts %Q{ fillcolor=none;}
stream.puts %Q{ fontcolor=none;}
stream.puts %Q{ label="";}
stream.puts %Q{ shape="plaintext";}
stream.puts %Q{ style="none";}
dot_opts[:color] = :black
dot_opts[:fillcolor] = :black
stream.puts "\n// Implicit target point for State #{s.to_s}"
stream.puts %Q{ node [ #{render_opts(dot_opts)} ] #{dot_name(s, :target)};}
dot_opts[:color] = :black
dot_opts[:fillcolor] = :white
stream.puts "\n// Implicit source point for State #{s.to_s}"
stream.puts %Q{ node [ #{render_opts(dot_opts)} ] #{dot_name(s, :source)};}
stream.puts "\n }\n"
end
return self
end
# Non-composite States are rendered as simple nodes.
# In this case dot_name(s, :source || :target) == dot_name(s).
dot_opts[:style] += ',rounded'
stream.puts %Q{ node [ #{render_opts(dot_opts)} ] #{dot_name(s, [:source, :target])};}
return self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dot(options = {})\r\n Dot::Digraph.new(:fontsize => 10, :shape => :box, :size => 5) do |g|\r\n states.each do |state|\r\n g.node(state, :label => state.items.values.collect{|item| item.to_s(options)}.join(\"\\n\"))\r\n @transitions[state].each do |symbol, dest_state|\r\n ... | [
"0.6585954",
"0.6584424",
"0.625206",
"0.6133405",
"0.6100282",
"0.60859656",
"0.60828495",
"0.6012448",
"0.5981349",
"0.59612155",
"0.59532315",
"0.5949806",
"0.5942158",
"0.5941734",
"0.5939078",
"0.59364545",
"0.592749",
"0.592196",
"0.5915447",
"0.59081256",
"0.5907804",
... | 0.6983836 | 0 |
Renders the Dot syntax for the Transition. | def render_Transition t
return if @rendered[t]
@rendered[t] = true
# Do not render Transition if source and target States are both rendered.
return unless @rendered[t.target] && @rendered[t.source]
sequence = [ ]
if options[:history]
# $stderr.puts "\n trans = #{t.inspect}, sm = #{t.stateMachine.inspect}"
options[:history].each_with_index do | hist, i |
if hist[:transition] === t
# $stderr.puts " #{i} hist = #{hist.inspect}"
sequence << i
end
end
end
stream.puts "\n// #{t.inspect}"
# $stderr.puts " #{t.inspect}\n #{options.inspect}"
dot_opts = {
:label => dot_label(t),
}
dot_opts = dot_opts_for t, dot_opts
if (ht = options[:highlight_transitions]) && ht.include?(t)
dot_opts[:style] = 'bold'
end
source_name = "#{dot_name(t.source, :source)}"
target_name = "#{dot_name(t.target, :target)}"
unless sequence.empty?
if options[:show_transition_sequence]
dot_opts[:label] = "(#{sequence_to_s(sequence)}) #{dot_opts[:label]}"
end
else
if options[:highlight_transition_history]
dot_opts[:color] = :grey
dot_opts[:fontcolor] = :grey
end
end
dot_opts[:color] ||= :black
dot_opts[:fontcolor] ||= :black
return if dot_opts[:visible] == false
stream.puts "#{source_name} -> #{target_name} [ #{render_opts(dot_opts)} ];"
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot\n end",
"def to_dot(options = {})\r\n Dot::Digraph.new(:fontsize => 10, :shape => :box, :size => 5) do |g|\r\n states.each do |state|\r\n g.node(state, :label => state.items.values.collect{|item| item.to_s(options)}.join(\"\\n\"))\r\n @transitions[state].each do |symbol, ... | [
"0.72868466",
"0.693596",
"0.65800244",
"0.656877",
"0.64173573",
"0.6409262",
"0.6397377",
"0.63806903",
"0.6358959",
"0.6352495",
"0.6350572",
"0.63445705",
"0.6341929",
"0.6237227",
"0.6196156",
"0.6196156",
"0.6196156",
"0.6117147",
"0.610647",
"0.6054811",
"0.5959403",
... | 0.5028269 | 72 |
Returns SVG data of the graph, using a temporary file. | def render_graph_svg_data machine, opts = { }
require 'tempfile'
tmp = Tempfile.new("red_steak_dot")
self.file_dot = tmp.path + ".dot"
self.file_svg = nil
render_graph(machine, opts)
result = File.open(self.file_svg, "r") { | fh | fh.read }
if opts[:xml_header] == false || options[:xml_header] == false
result.sub!(/\A.*?<svg /m, '<svg ')
end
# puts "#{result[0..200]}..."
result
ensure
tmp.unlink rescue nil
File.unlink(self.file_dot) rescue nil
File.unlink(self.file_svg) rescue nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def svg\n # Only recompile the SVG if it doesn't already exist\n unless File.exist? self.svg_name\n File.open(\"#{@name}.tex\", 'w') { |f| f.write document }\n # TODO Catch pdflatex errors\n system \"lib/latex2svg #{@name}\"\n end\n # Unless latex2svg was successful, use a placeholder SV... | [
"0.6770629",
"0.64702153",
"0.63917065",
"0.6349254",
"0.59822357",
"0.59413344",
"0.5889963",
"0.5875585",
"0.58580434",
"0.5775845",
"0.5728519",
"0.5686561",
"0.5671862",
"0.56661004",
"0.556634",
"0.5539929",
"0.5539929",
"0.5527675",
"0.5497888",
"0.54803985",
"0.5468873... | 0.72526675 | 0 |
go to edit page | def click_edit(the_name)
response.should contain the_name
click_link_within "div[id*=\""+to_html_tag(the_name)+"\"]", "Edit"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\r\n end",
"def edit\r\n \r\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def ed... | [
"0.82043284",
"0.81699467",
"0.81546557",
"0.81546557",
"0.81546557",
"0.81546557",
"0.81546557",
"0.81546557",
"0.81546557",
"0.81546557",
"0.81546557",
"0.81546557",
"0.81546557",
"0.81546557",
"0.81546557",
"0.8130884",
"0.81210005",
"0.8103098",
"0.8063825",
"0.8063825",
... | 0.0 | -1 |
noch nicht fertig! Shop Versandbedingungen fehlen noch! | def edeka_1
@edeka = Shop.find_or_initialize_by(id: 5, name: "Edeka",shop_logo: "edeka24.jpg")
@edeka.save
vintage = []
prod_desc = []
price = []
prod_title =[]
taste =[]
category = []
prod_mhd = []
name = []
product_url = []
image_url = []
inhalt = []
price_per_litre_string = []
$check2 = 0
#deutsche weine
url ="https://www.edeka24.de/Getraenke/Deutsche+Weine/?force_sid=l2tep3m7uche07igtpfio7sh47&ldtype=&_artperpage=100&pgNr=0&cl=alist&searchparam=&cnid=d4b674347abffda7caa0e3f4d813c631"
page = Nokogiri::HTML(open(url))
p "h1"
page.css('.productImage a').each do |line|
product_url << line['href']
end
p "h2"
$check2 = 0
page.css('div.product-top-box h2 a span').each do |line|
name << line.text
line = line.text
if line.scan(/\b\d{4}\b/)
line = line.scan(/\b\d{4}\b/).first
if !line.nil? and line != "" and line.include? "20"
p line
$check2 = 1
vintage << line
else
vintage << "n/a"
end
else
vintage << "n/a"
end
end
counter = name.length
p "h3"
#page.css('.productImage a').each do |i|
#mainContent > div.teaserContainer.clearfix > div:nth-child(2) >
#mainContent > div.teaserContainer.clearfix > div:nth-child(9) > div.productImage > a > img
# image_url << i
#end
p "h4"
page.css('.price.roundCorners').each do |preis|
price_converted = preis.text.gsub(" ", "")
price2 = price_converted.gsub(',', '.')
#price2 = price2.sub("€*","")
price << price2
end
page.css('.package').each do |line|
line = line.text
line = line.gsub!("Inhalt: ","")
line = line.gsub!(" ltr","")
line = line.gsub!(" ", "")
line = line.gsub!("\n", "")
inhalt << line
end
# page.css('pricePerUnit').each do |line|
# line = line.text
# line = line.gsub!(" €/1 ltr", "")
# line = line.gsub!(" ", "")
# price_per_litre_string << line
#end
p "h5"
# name.length.times do |line|
# category << 'Rotwein'
# prod_mhd << 'https://cdn-1.vetalio.de/media/catalog/product/cache/1/logo/150x100/9df78eab33525d08d6e5fb8d27136e95/e/d/edeka24.png'
# end
#vintage
product_url.each do |y|
page = Nokogiri::HTML(open(y))
page.xpath('//*[@id="zoom1"]').each do |line|
line = line['href']
image_url << line
end
page.xpath('//*[@id="productPriceUnit"]').each do |line|
line = line.text
line = line.gsub!("(","")
line = line.gsub!(")","")
price_per_litre_string << line
end
end
count = product_url.length
count.times do |i|
delinero_wein = @edeka.bottles.find_or_initialize_by(product_url: product_url[i])
delinero_wein.name = name[i]
delinero_wein.image_url = image_url[i]
delinero_wein.product_url = product_url[i]
delinero_wein.price = price[i]
delinero_wein.vintage = vintage[i]
delinero_wein.inhalt = inhalt[i]
delinero_wein.category = "Rotwein"
delinero_wein.price_per_litre_string = price_per_litre_string[i]
delinero_wein.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zuruecksetzen()\n end",
"def show\n @basket.set_price\n if params[:st]\n if @basket.address || @basket.type_of_delivery == '2'\n\n if params[:st]==1\n p=0\n @basket.cart_items.each do |c|\n if c.amount.to_i > c.dvd.amount\n p=1\n end\n ... | [
"0.6181749",
"0.60252625",
"0.59844",
"0.5921406",
"0.5884634",
"0.58758175",
"0.58221114",
"0.57967144",
"0.578709",
"0.5779732",
"0.57390225",
"0.5708931",
"0.56822044",
"0.565482",
"0.5639756",
"0.5637342",
"0.56196386",
"0.55873334",
"0.55761176",
"0.55605537",
"0.5544404... | 0.0 | -1 |
noch nicht fertig! Shop Versandbedingungen fehlen noch! | def edeka_2
@edeka = Shop.find_or_initialize_by(id: 5, name: "Edeka",shop_logo: "edeka24.jpg")
@edeka.save
vintage = []
prod_desc = []
price = []
prod_title =[]
taste =[]
category = []
prod_mhd = []
name = []
product_url = []
image_url = []
inhalt = []
price_per_litre_string = []
$check2 = 0
url ="https://www.edeka24.de/index.php?force_sid=939nd3t7dv6il37sat0anbc694&"
page = Nokogiri::HTML(open(url))
p "h1"
page.css('.productImage a').each do |line|
product_url << line['href']
end
p "h2"
$check2 = 0
page.css('div.product-top-box h2 a span').each do |line|
name << line.text
line = line.text
if line.scan(/\b\d{4}\b/)
line = line.scan(/\b\d{4}\b/).first
if !line.nil? and line != "" and line.include? "20"
p line
$check2 = 1
vintage << line
else
vintage << "n/a"
end
else
vintage << "n/a"
end
end
counter = name.length
p "h3"
#page.css('.productImage a').each do |i|
#mainContent > div.teaserContainer.clearfix > div:nth-child(2) >
#mainContent > div.teaserContainer.clearfix > div:nth-child(9) > div.productImage > a > img
# image_url << i
#end
p "h4"
page.css('.price.roundCorners').each do |preis|
price_converted = preis.text.gsub(" ", "")
price2 = price_converted.gsub(',', '.')
#price2 = price2.sub("€*","")
price << price2
end
page.css('.package').each do |line|
line = line.text
line = line.gsub!("Inhalt: ","")
line = line.gsub!(" ltr","")
line = line.gsub!(" ", "")
line = line.gsub!("\n", "")
inhalt << line
end
# page.css('pricePerUnit').each do |line|
# line = line.text
# line = line.gsub!(" €/1 ltr", "")
# line = line.gsub!(" ", "")
# price_per_litre_string << line
#end
p "h5"
# name.length.times do |line|
# category << 'Rotwein'
# prod_mhd << 'https://cdn-1.vetalio.de/media/catalog/product/cache/1/logo/150x100/9df78eab33525d08d6e5fb8d27136e95/e/d/edeka24.png'
# end
#vintage
product_url.each do |y|
page = Nokogiri::HTML(open(y))
page.xpath('//*[@id="zoom1"]').each do |line|
line = line['href']
image_url << line
end
page.xpath('//*[@id="productPriceUnit"]').each do |line|
line = line.text
line = line.gsub!("(","")
line = line.gsub!(")","")
price_per_litre_string << line
end
end
count = product_url.length
count.times do |i|
delinero_wein = @edeka.bottles.find_or_initialize_by(product_url: product_url[i])
delinero_wein.name = name[i]
delinero_wein.image_url = image_url[i]
delinero_wein.product_url = product_url[i]
delinero_wein.price = price[i]
delinero_wein.vintage = vintage[i]
delinero_wein.inhalt = inhalt[i]
delinero_wein.category = "Rotwein"
delinero_wein.price_per_litre_string = price_per_litre_string[i]
delinero_wein.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zuruecksetzen()\n end",
"def show\n @basket.set_price\n if params[:st]\n if @basket.address || @basket.type_of_delivery == '2'\n\n if params[:st]==1\n p=0\n @basket.cart_items.each do |c|\n if c.amount.to_i > c.dvd.amount\n p=1\n end\n ... | [
"0.61836284",
"0.60251665",
"0.5986222",
"0.5920735",
"0.58869344",
"0.58781284",
"0.5825195",
"0.57975036",
"0.57860315",
"0.578054",
"0.5738529",
"0.57088864",
"0.5681119",
"0.56549674",
"0.5640281",
"0.56369823",
"0.5618708",
"0.5587755",
"0.55751187",
"0.55608016",
"0.554... | 0.0 | -1 |
Language Methods These methods are not very specific and will probably need to be overridden in the concrete classes. Instructions for turning on the thermocycler | def turn_on
"Turn on the #{model}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def language_aware!\n\t\traise_if_error C.glyr_opt_lang_aware_only(to_native, true)\n\tend",
"def tongue_twister; end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def add_language_terminology(t)\n t.language(:path=>\... | [
"0.5968121",
"0.551319",
"0.55014163",
"0.55014163",
"0.55014163",
"0.55014163",
"0.5484887",
"0.5457335",
"0.5456323",
"0.54071784",
"0.5346292",
"0.53420174",
"0.53420174",
"0.53420174",
"0.53420174",
"0.5335767",
"0.5335767",
"0.5311437",
"0.53070587",
"0.5282506",
"0.5281... | 0.0 | -1 |
Instructions for placing a plate in the instrument | def place_plate_in_instrument(plate:)
"Place plate #{plate} in the thermocycler"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_make_antibiotic_plate op\n #getting the media sample required to plate this yeast strain\n antibiotic_hash = { \"nat\" => \"clonNAT\", \"kan\" => \"G418\", \"hyg\" => \"Hygro\", \"ble\" => \"Bleo\", \"5fo\" => \"5-FOA\" }\n full_marker = op.input(\"Genetic Material\").sample.properties[\"Y... | [
"0.6942283",
"0.64879876",
"0.61009043",
"0.6096458",
"0.60674155",
"0.60674155",
"0.60674155",
"0.60674155",
"0.6026777",
"0.59748775",
"0.59718204",
"0.5958743",
"0.59585935",
"0.59481514",
"0.5920313",
"0.58685595",
"0.5801084",
"0.57991534",
"0.5776358",
"0.57531667",
"0.... | 0.7599828 | 2 |
Instructions for confirming the orientation of a plate in the instrument | def confirm_plate_orientation
'MAKE SURE THAT THE PLATE IS IN THE CORRECT ORIENTATION'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_plate_orientation()\n \"MAKE SURE THAT THE PLATE IS IN THE CORRECT ORIENTATION\"\n end",
"def place_plate_in_instrument(plate:)\n \"Place plate #{plate} in the thermocycler\"\n end",
"def place_plate_in_instrument(plate:)\n \"Place plate #{plate} in the thermocycler\"\n end",
"def pla... | [
"0.8160834",
"0.60162157",
"0.60162157",
"0.60162157",
"0.5978708",
"0.5851275",
"0.5802398",
"0.57700443",
"0.56774205",
"0.5616263",
"0.56112385",
"0.55316675",
"0.5486473",
"0.5423526",
"0.54189897",
"0.5417088",
"0.5391417",
"0.53603524",
"0.53197634",
"0.53178656",
"0.53... | 0.8118967 | 2 |
Instructions for selecting the PCR program template | def select_program_template(program:)
file = program_template_file(program: program)
"Choose the program template <b>#{file}</b>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def program_template_file(program:)\n template_file(\n template_name: program.program_template_name,\n extension: :PROGRAM_EXT\n )\n end",
"def select_layout_template(program:)\n file = layout_template_file(program: program)\n \"Choose the layout template <b>#{file}</b>\"\n end",
"def s... | [
"0.5921452",
"0.5792563",
"0.5792563",
"0.5756914",
"0.558119",
"0.55104923",
"0.5504259",
"0.55035883",
"0.5481071",
"0.5431782",
"0.54145294",
"0.5328151",
"0.5320709",
"0.5311426",
"0.5306174",
"0.52413887",
"0.5228297",
"0.5195293",
"0.5186276",
"0.51830405",
"0.51774436"... | 0.70982546 | 1 |
Instructions for opening the lid | def open_lid
'Click the <b>Open Lid</b> button'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_lid()\n \"Click the <b>Open Lid</b> button\"\n end",
"def open\n\t \texec 'open '+@params[0]\n\t end",
"def open_article(article_id)\n Launchy.open(Article.find(article_id).url)\nend",
"def la\n send_command \"la\"\n end",
"def open url\r\n command 'open', url_arg(url)\r\n e... | [
"0.7099696",
"0.5964588",
"0.57755613",
"0.57684386",
"0.55949026",
"0.55949026",
"0.5536304",
"0.5536304",
"0.5536304",
"0.54686815",
"0.54686815",
"0.5456305",
"0.5439724",
"0.5430725",
"0.542582",
"0.54175514",
"0.54089785",
"0.53694594",
"0.536925",
"0.53591824",
"0.53483... | 0.69823945 | 2 |
Instructions for closing the lid | def close_lid
'Click the <b>Close Lid</b> button'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\r\n command 'close'\r\n end",
"def close\r\n command 'close'\r\n end",
"def close_lid()\n \"Click the <b>Close Lid</b> button\"\n end",
"def shut_down\n end",
"def closeOverlay _args\n \"closeOverlay _args;\" \n end",
"def close_cmd()\n\tend",
"def close\n # NOOP\n... | [
"0.72494537",
"0.72494537",
"0.7074303",
"0.6456688",
"0.6308452",
"0.62582725",
"0.62033784",
"0.62033784",
"0.617972",
"0.61678773",
"0.61536044",
"0.61523724",
"0.6139749",
"0.6099724",
"0.6085043",
"0.60554165",
"0.6046329",
"0.6005288",
"0.5996589",
"0.59921616",
"0.5992... | 0.6954054 | 4 |
Instructions for starting the run | def start_run
'Click the <b>Start Run</b> button'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_run; end",
"def start\n configure\n run\n end",
"def start(options = {})\n setup options\n run!\n end",
"def start\n ucommand(:start)\n end",
"def run_main\n end",
"def startup\n end",
"def startup\n end",
"def startup\n end",
"def start\n ... | [
"0.7559201",
"0.73204046",
"0.713566",
"0.6851551",
"0.68159944",
"0.67981887",
"0.67981887",
"0.67981887",
"0.6786553",
"0.6786553",
"0.6786553",
"0.6786553",
"0.6786553",
"0.6786553",
"0.6786553",
"0.6786553",
"0.6774334",
"0.67727196",
"0.67727196",
"0.67727196",
"0.677271... | 0.0 | -1 |
Image Methods These probably should NOT be overridden in the concrete classes Image for opening the lid | def open_lid_image
image_path(image_name: params[:open_lid_image])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image; end",
"def image\n end",
"def image\n end",
"def image\n end",
"def image\n end",
"def img(*) # :nodoc:\n raise \"no!\"\n end",
"def image\n\n end",
"def software_image\n super\n end",
"def images; end",
"def lnbPicture _obj, _args\n \"_obj lnbPicture _arg... | [
"0.658728",
"0.6332638",
"0.6332638",
"0.63191813",
"0.63191813",
"0.62466085",
"0.6234033",
"0.6117571",
"0.61137795",
"0.59641474",
"0.5951442",
"0.59288824",
"0.5893418",
"0.58625954",
"0.58527726",
"0.58515096",
"0.5824615",
"0.5768901",
"0.5768901",
"0.57505876",
"0.5736... | 0.6672793 | 0 |
Image for closing the lid | def close_lid_image
image_path(image_name: params[:close_lid_image])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_image\n @p.close_image(self)\n end",
"def unload_image(image_handle)\n end",
"def log_out\n @image.each do |row|\n Useditor::Log.ok row.join('')\n end\n end",
"def close_lid()\n \"Click the <b>Close Lid</b> button\"\n end",
"def close_lid\n 'Click the <b>... | [
"0.69690794",
"0.6879279",
"0.6075848",
"0.59752357",
"0.59243983",
"0.59243983",
"0.5857775",
"0.5681803",
"0.56230766",
"0.5590997",
"0.55268186",
"0.5516993",
"0.549218",
"0.548369",
"0.5475284",
"0.5454886",
"0.5454886",
"0.54181063",
"0.5398258",
"0.53867817",
"0.5373282... | 0.7274951 | 0 |
Image for selecting the PCR program template in the software | def setup_program_image
image_path(image_name: params[:setup_program_image])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_program_template(program:)\n file = program_template_file(program: program)\n \"Choose the program template <b>#{file}</b>\"\n end",
"def select_program_template(program:)\n file = program_template_file(program: program)\n \"Choose the program template <b>#{file}</b>\"\n end",
"def sof... | [
"0.60788125",
"0.60788125",
"0.556871",
"0.54451555",
"0.54415506",
"0.5328105",
"0.53133774",
"0.5303961",
"0.53003573",
"0.52788794",
"0.52770424",
"0.52766293",
"0.5274809",
"0.5228553",
"0.5195393",
"0.5193483",
"0.51827306",
"0.5167994",
"0.5164604",
"0.5134665",
"0.5101... | 0.6028714 | 2 |
Image for starting the run | def start_run_image
image_path(image_name: params[:start_run_image])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_run; end",
"def S(args)\n puts \"\\n=>\\n\"\n @image.show\n end",
"def start_run()\n \"Click the <b>Start Run</b> button\"\n end",
"def run_sketch\n ensure_exists(filename)\n spin_up('run.rb', filename, argc)\n end",
"def run_sketch\n ensure_exists(filename)\n ... | [
"0.6666087",
"0.6606987",
"0.64159364",
"0.6324118",
"0.6324118",
"0.6310767",
"0.6298047",
"0.62764716",
"0.62764716",
"0.62551796",
"0.62311065",
"0.62242466",
"0.6207501",
"0.6207501",
"0.6207501",
"0.6207501",
"0.6207501",
"0.6207501",
"0.6207501",
"0.6207501",
"0.6174432... | 0.6864887 | 0 |
Template File Methods These probably should NOT be overridden in the concrete classes | def program_template_file(program:)
template_file(
template_name: program.program_template_name,
extension: :PROGRAM_EXT
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def templates; end",
"def template_source\n raise NotImplementedError\n end",
"def template() false end",
"def implementation; end",
"def ... | [
"0.72262436",
"0.72262436",
"0.72262436",
"0.72262436",
"0.72262436",
"0.72262436",
"0.72262436",
"0.7084784",
"0.67786413",
"0.65801907",
"0.6579898",
"0.6579898",
"0.65321594",
"0.65321594",
"0.64671254",
"0.64495146",
"0.6384129",
"0.6384129",
"0.63770205",
"0.6364216",
"0... | 0.0 | -1 |
Getter Methods These should NOT be overridden in the concrete classes The model of the thermocycler | def model
self.class.const_get(:MODEL)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getters; end",
"def model\n self\n end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def get()\n \n end",
"def model\n self::... | [
"0.64142674",
"0.6403084",
"0.6393537",
"0.6393537",
"0.6393537",
"0.6393537",
"0.6393537",
"0.6393537",
"0.6393537",
"0.6393537",
"0.6393537",
"0.6393537",
"0.6380317",
"0.62452114",
"0.6233067",
"0.6179576",
"0.6176737",
"0.6176737",
"0.6176737",
"0.6176737",
"0.6149099",
... | 0.5659006 | 45 |
Language Methods These methods are not very specific and will probably need to be overridden in the concrete classes. Instructions for opening the software that controls the thermocycler | def open_software
"Open #{software_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def language_client; end",
"def language_server; end",
"def language; end",
"def language; end",
"def language; end",
"def language; end",
"def language_aware!\n\t\traise_if_error C.glyr_opt_lang_aware_only(to_native, true)\n\tend",
"def opening; end",
"def opening; end",
"def opening; end",
"d... | [
"0.5554205",
"0.5531507",
"0.5474292",
"0.5474292",
"0.5474292",
"0.5474292",
"0.54408497",
"0.5364562",
"0.5364562",
"0.5364562",
"0.5311518",
"0.5298796",
"0.52980787",
"0.52980787",
"0.52980787",
"0.52484435",
"0.5234043",
"0.5228399",
"0.5219629",
"0.5218267",
"0.5193766"... | 0.52057725 | 21 |
Instructions for setting the dye channel on a qPCR thermocycler | def set_dye(composition: nil, dye_name: nil)
dye_name = composition.dye.try(:input_name) || dye_name
"Choose <b>#{dye_name}</b> as the dye"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eth_gpu_rst; eth_ctrl_bit(5); end",
"def set_dye(composition: nil, dye_name: nil)\n dye_name = composition.dye.try(:input_name) || dye_name\n \"Click on the <b>PrimePCR</b> and choose <b>#{dye_name}</b> as the dye\"\n end",
"def eth_gpu_en; eth_ctrl_bit(1); end",
"def set_channel(bone, channel, th... | [
"0.5202646",
"0.5113817",
"0.50442976",
"0.50344515",
"0.4999838",
"0.49956214",
"0.4969963",
"0.49381548",
"0.4934172",
"0.49185178",
"0.48618808",
"0.47010097",
"0.46952066",
"0.46912545",
"0.4668492",
"0.4653934",
"0.46184403",
"0.4609799",
"0.46014768",
"0.45806268",
"0.4... | 0.44556937 | 35 |
Instructions for selecting the plate layout template in the software | def select_layout_template(program:)
file = layout_template_file(program: program)
"Choose the layout template <b>#{file}</b>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rit_plate!(layout_name, instance_name, plate_name)\n Rit::Plate.get(layout_name, instance_name, plate_name, session[:preview_time])\n end",
"def select_program_template(program:)\n file = program_template_file(program: program)\n \"Choose the program template <b>#{file}</b>\"\n end",
"def se... | [
"0.5981433",
"0.59103215",
"0.59103215",
"0.5826337",
"0.57864827",
"0.5761337",
"0.5741535",
"0.5670217",
"0.5623198",
"0.5589102",
"0.55701387",
"0.55457544",
"0.5529409",
"0.5521252",
"0.5429765",
"0.5416005",
"0.539734",
"0.5386494",
"0.53474295",
"0.53448063",
"0.5324138... | 0.654298 | 1 |
Instructions for saving an experiment file | def save_experiment_file(filename:)
"Save the experiment as #{filename} in #{params[:experiment_filepath]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(filename)\n writeln(\"save '#{filename}'\")\n end",
"def save fname, options={}\n File.open(fname,\"wb\"){ |f| f << export(options) }\n end",
"def cmd_save argv\n setup argv\n e = @hash['elements']\n filepath = @hash['filepath'] || \"config.json\"\n response = @api.save(e, ... | [
"0.6622182",
"0.6557741",
"0.6496792",
"0.6463734",
"0.6424857",
"0.6406966",
"0.6372905",
"0.63271034",
"0.63140875",
"0.62960327",
"0.62960327",
"0.62960327",
"0.62904435",
"0.6282151",
"0.625785",
"0.625785",
"0.625785",
"0.625785",
"0.625785",
"0.6221952",
"0.621788",
"... | 0.7985602 | 1 |
Instructions for exporting measurements from a qPCR run | def export_measurements
'Click <b>Export</b><br>' \
'Select <b>Export All Data Sheets</b><br>' \
'Export all sheets as CSV<br>' \
"Save files to the #{params[:export_filepath]} directory"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_qpcr(outname, ops, program, test_str, stamp_columns)\n coll = ops.first.output(outname).collection\n\n display_plate = display_plate(outname, ops, stamp_columns)\n stub = upload_stub(program, test_str)\n\n show do\n title \"Place #{test_str} stripwells in qPCR machine... | [
"0.6492593",
"0.5956255",
"0.55697757",
"0.5546272",
"0.5504028",
"0.546954",
"0.5425705",
"0.54102397",
"0.5407541",
"0.5350876",
"0.5330845",
"0.5322113",
"0.5316655",
"0.52645886",
"0.5239193",
"0.5228244",
"0.5185301",
"0.5158852",
"0.5106913",
"0.5087722",
"0.5075559",
... | 0.58852 | 3 |
Image Methods These probably should NOT be overridden in the concrete classes Image for launching the software that controls the thermocycler | def open_software_image
image_path(image_name: params[:open_software_image])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def software_image\n super\n end",
"def reboot\n img = ['blue_flower', 'red_flower', 'white_flower', 'pink_flower'].sample\n @image = Gosu::Image.new window, 'images/flowers/' + img +'.png', true\n @drawing = true\n end",
"def software_image_list\n super\n end",
"def main\n Image... | [
"0.6526638",
"0.61238545",
"0.61190623",
"0.61119646",
"0.6084903",
"0.60072345",
"0.5991658",
"0.59695816",
"0.59314173",
"0.588643",
"0.58222395",
"0.5780527",
"0.577099",
"0.5770415",
"0.5707553",
"0.57036203",
"0.57036203",
"0.57034665",
"0.56973034",
"0.5678858",
"0.5635... | 0.0 | -1 |
Image for setting up the software workspace | def setup_workspace_image
image_path(image_name: params[:setup_workspace_image])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def software_image\n super\n end",
"def setup\n \n\t# The size function is a statement that tells the computer \n\t# how large to make the window.\n\t# Each function statement has zero or more parameters. \n\t# Parameters are data passed into the function\n\t# and used as values for specifying what the ... | [
"0.62298185",
"0.59079564",
"0.5849817",
"0.5832239",
"0.5625588",
"0.5610854",
"0.5549253",
"0.5538865",
"0.5517123",
"0.54581565",
"0.54345095",
"0.5427078",
"0.5419188",
"0.5403232",
"0.5342143",
"0.53417796",
"0.531983",
"0.5312845",
"0.53070337",
"0.53043455",
"0.5285931... | 0.67364115 | 0 |
Image for selecting the plate layout template in the software | def setup_plate_layout_image
image_path(image_name: params[:setup_plate_layout_image])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rit_plate!(layout_name, instance_name, plate_name)\n Rit::Plate.get(layout_name, instance_name, plate_name, session[:preview_time])\n end",
"def display_plate(outname, ops, stamp_columns=false)\n plate = Array.new(8) { Array.new(12, \"-\") }\n if stamp_columns\n ops.each do |... | [
"0.62516433",
"0.61311",
"0.59882915",
"0.57847077",
"0.5745068",
"0.5744303",
"0.5673395",
"0.5671538",
"0.56513345",
"0.56513345",
"0.56241345",
"0.5583765",
"0.5580931",
"0.55490214",
"0.55105335",
"0.545998",
"0.5439056",
"0.540604",
"0.540604",
"0.5346053",
"0.53329927",... | 0.65077204 | 0 |
Image for exporting measurements from a qPCR run | def export_measurements_image
image_path(image_name: params[:export_measurements_image])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embed_info(input_file, qr, label, x_coord, y_coord)\n img_template = ChunkyPNG::Image.from_file(input_file)\n img_label = ChunkyPNG::Image.from_file(label)\n img_template.compose!(qr, x_coord, y_coord)\n img_template.compose!(img_label, x_coord + 255, y_coord)\n rename_file = input_file[5..-1]\n img_temp... | [
"0.62913877",
"0.58467627",
"0.57310295",
"0.57072043",
"0.56303775",
"0.56195545",
"0.5594459",
"0.55676186",
"0.55500966",
"0.5475249",
"0.5435469",
"0.53684217",
"0.52764076",
"0.52743936",
"0.5233696",
"0.5222552",
"0.5213078",
"0.521233",
"0.5182502",
"0.5171544",
"0.516... | 0.56409127 | 4 |
Template File Methods These probably should NOT be overridden in the concrete classes | def layout_template_file(program:)
template_file(
template_name: program.layout_template_name,
extension: :LAYOUT_EXT
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def templates; end",
"def template_source\n raise NotImplementedError\n end",
"def implementation; end",
"def implementation; end",
"def t... | [
"0.72259814",
"0.72259814",
"0.72259814",
"0.72259814",
"0.72259814",
"0.72259814",
"0.72259814",
"0.7084837",
"0.67788833",
"0.6580237",
"0.6580237",
"0.65798527",
"0.6531995",
"0.6531995",
"0.6468493",
"0.6451004",
"0.6384926",
"0.6384926",
"0.6376782",
"0.6364708",
"0.6346... | 0.0 | -1 |
Getter Methods These should NOT be overridden in the concrete classes The name of the software that controls the thermocycler | def software_name
self.class.const_get(:SOFTWARE_NAME)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_name; end",
"def class_name; end",
"def system_name\n self.name\n end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end... | [
"0.64199996",
"0.64199996",
"0.6346704",
"0.62954015",
"0.62954015",
"0.62954015",
"0.62954015",
"0.62954015",
"0.62954015",
"0.62954015",
"0.62954015",
"0.62954015",
"0.62954015",
"0.62954015",
"0.62954015",
"0.62954015",
"0.62954015",
"0.62954015",
"0.62954015",
"0.62954015",... | 0.65451866 | 0 |
Run block with spinner by default if all, or when using verbose. Do not use spinner if silent. | def maybe_spinner(msg, &block)
if (all? || verbose?) && !silent?
spinner(msg, &block)
else
yield
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spinner(title, &block)\n return yield unless ui_enabled?\n\n results = concurrently do |actions|\n actions.await(title, &block)\n end\n\n results[title]\n end",
"def spinner; end",
"def spinner\n spinner = Enumerator.new do |e|\n loop do\n e.yield '|'\n ... | [
"0.6790666",
"0.6763934",
"0.65852416",
"0.64971924",
"0.62405556",
"0.61833227",
"0.6161981",
"0.6105399",
"0.5904148",
"0.5759274",
"0.5719988",
"0.56380135",
"0.5634144",
"0.5574754",
"0.5569722",
"0.5542122",
"0.55204594",
"0.5489452",
"0.54360396",
"0.539193",
"0.5368920... | 0.81976056 | 0 |
Version 3 general attr_accessor | def my_attr_accessor(*attributes)
attributes.each do |attribute|
# for each attribute, use String interpolation
# to generate the methods, and set attr_methods
# equal to the generated string
attr_methods = %Q{
def #{attribute}
@#{attribute}
end
def #{attribute}=(val)
@#{attribute} = val
end
}
# call class_eval and pass in attr_methods
class_eval(attr_methods)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_accessor(sym, *more) end",
"def attr_accessor(*args)\n attr_reader(*args)\n attr_writer(*args)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def bits_attr_accessor name\n class_eval \"def #{name}; self.attributes[#{name.inspect}]; end;\", __FI... | [
"0.7517434",
"0.7383521",
"0.73681265",
"0.73030406",
"0.7268946",
"0.72402763",
"0.72402763",
"0.72402763",
"0.715917",
"0.7133599",
"0.7132844",
"0.7124043",
"0.70797944",
"0.7068077",
"0.70117146",
"0.69569534",
"0.6934462",
"0.69134676",
"0.6910899",
"0.68043226",
"0.6761... | 0.0 | -1 |
RSpec.configure do |config| end | def sign_up_new_user
user = User.make
visit "/"
find('#join_now_link').click
click_link 'Sign up with Email'
fill_in 'Full name', with: user.full_name
fill_in 'Email', with: user.email
find('#user_password').set user.password
find('#user_password_confirmation').set user.password
click_button 'Sign up'
user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_test\n super\n\n # Need local variables for access within the scoped blocks below.\n logger = @logger\n config_manager = @config_manager\n # Configure RSpec.\n RSpec.configure do |c|\n # Need access to framework methods from within the RSpec examples.\n c.incl... | [
"0.7154168",
"0.68713355",
"0.66880614",
"0.65272653",
"0.6517114",
"0.6435687",
"0.6421041",
"0.6406674",
"0.6387055",
"0.6337266",
"0.6318659",
"0.6309044",
"0.6309044",
"0.62514645",
"0.62438804",
"0.6226592",
"0.6222333",
"0.6181554",
"0.6181554",
"0.61793154",
"0.6175456... | 0.0 | -1 |
temporary until we have game.rb | def render
@display = Display.new(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game_setup\n end",
"def loadGame()\n\nend",
"def load_game\n require './game/setup.rb'\n end",
"def game_mode; end",
"def game_loop\n end",
"def play\n #ca... | [
"0.73038083",
"0.73038083",
"0.73038083",
"0.73038083",
"0.73038083",
"0.73031163",
"0.73031163",
"0.7131175",
"0.6948143",
"0.6887849",
"0.6665989",
"0.6609538",
"0.65759206",
"0.6471909",
"0.6441593",
"0.64267904",
"0.6413904",
"0.63567764",
"0.6238974",
"0.6238974",
"0.623... | 0.0 | -1 |
add custom params for devise | def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: %i[pseudo email password password_confirmation])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: custom_parameters)\n end",
"def configure_sign_in_params\n # devise_parameter_sanitizer.for(:sign_in) << :attribute\n devise_parameter_sanitizer.permit(:sign_in, keys: [:user, :password])\n end",
"def configure_sign_in_... | [
"0.7017494",
"0.6895326",
"0.6883693",
"0.6872567",
"0.68681574",
"0.6862797",
"0.6852751",
"0.6846426",
"0.6839435",
"0.683419",
"0.6806807",
"0.6782254",
"0.6773923",
"0.6756554",
"0.67417514",
"0.67369956",
"0.6732237",
"0.67236006",
"0.6721076",
"0.6709655",
"0.669336",
... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_lead
@lead = Lead.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def lead_params
params.require(:lead).permit(:customer, :sales, :area, :opp, :order)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
GET /absences/1 GET /absences/1.json | def show
@absence = Absence.find(params[:id])
@title = "User #{@absence.user_id} Absence"
respond_to do |format|
format.html # show.html.erb
format.json { render json: @absence }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @absences = Absence.all\n end",
"def index\n @absences = Absence.all\n end",
"def show\n @absence = Absence.where(id: params[:id], user_id: params[:user_id])\n @title = \"User #{@absence.user_id} Absence\" \n respond_to do |format|\n format.html { render :file => \"absences/... | [
"0.71313965",
"0.71313965",
"0.70430654",
"0.67361826",
"0.6651391",
"0.6524554",
"0.638",
"0.6261243",
"0.6261243",
"0.6208609",
"0.61487675",
"0.6148269",
"0.6148269",
"0.6148269",
"0.6030816",
"0.5988195",
"0.5967427",
"0.59229034",
"0.59157246",
"0.5904734",
"0.5886846",
... | 0.6677229 | 4 |
GET /absences/new GET /absences/new.json | def new
@absence = Absence.new
@title = "New Absence"
respond_to do |format|
format.html # new.html.erb
format.json { render json: @absence }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @absence = Absence.new\n @member = Member.find(params[:member_id])\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @absence }\n end\n end",
"def new\n @attendence = Attendence.new\n\n respond_to do |format|\n format.html # new.h... | [
"0.7155519",
"0.71454966",
"0.70242625",
"0.69607604",
"0.6881329",
"0.6860444",
"0.68438476",
"0.68144476",
"0.6806807",
"0.6793683",
"0.6791644",
"0.67862946",
"0.67815584",
"0.67811006",
"0.67811006",
"0.67811006",
"0.67760485",
"0.67666113",
"0.67657375",
"0.6743591",
"0.... | 0.79217684 | 0 |
POST /absences POST /absences.json | def create
@absence = Absence.new(params[:absence])
@title = "New Absence"
respond_to do |format|
if @absence.save
format.html { redirect_to @absence, notice: 'Absence was successfully created.' }
format.json { render json: @absence, status: :created, location: @absence }
else
format.html { render action: "new" }
format.json { render json: @absence.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @absence = Absence.new(absence_params)\n\n respond_to do |format|\n if @absence.save\n format.html { redirect_to absences_url, notice: 'Отсутствие успешно создано.' }\n format.json { render :edit, status: :created, location: @absence }\n end\n end\n end",
"def creat... | [
"0.71037537",
"0.688124",
"0.62361616",
"0.59671444",
"0.5900795",
"0.58727753",
"0.57875025",
"0.57371867",
"0.5678947",
"0.5603889",
"0.5603889",
"0.5587193",
"0.5547098",
"0.5528626",
"0.5527029",
"0.54670244",
"0.5432372",
"0.54175895",
"0.54175895",
"0.5396893",
"0.53486... | 0.67813945 | 2 |
PUT /absences/1 PUT /absences/1.json | def update
@absence = Absence.find(params[:id])
respond_to do |format|
if @absence.update_attributes(params[:absence])
format.html { redirect_to @absence, notice: 'Absence was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @absence.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @absence.update(absence_params)\n format.html { redirect_to @absence, notice: 'Absence was successfully updated.' }\n format.json { render :show, status: :ok, location: @absence }\n else\n format.html { render :edit }\n format.json {... | [
"0.673988",
"0.63281626",
"0.6126415",
"0.61207175",
"0.6088544",
"0.6088544",
"0.6030452",
"0.59950113",
"0.59950113",
"0.59950113",
"0.59755456",
"0.59593606",
"0.5880443",
"0.5872303",
"0.5852316",
"0.58421165",
"0.58198327",
"0.5800365",
"0.5791689",
"0.5760923",
"0.57560... | 0.6931707 | 0 |
DELETE /absences/1 DELETE /absences/1.json | def destroy
@absence = Absence.find(params[:id])
@absence.destroy
respond_to do |format|
format.html { redirect_to absences_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @absence.destroy\n respond_to do |format|\n format.html { redirect_to absences_url, notice: 'Отсутствие успешно удалено.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @absence.destroy\n respond_to do |format|\n format.html { redirect_to absences_u... | [
"0.71855885",
"0.7158314",
"0.711689",
"0.69589007",
"0.69473207",
"0.6840893",
"0.68064064",
"0.6739354",
"0.67037237",
"0.6648273",
"0.66268414",
"0.6621664",
"0.6621664",
"0.6615619",
"0.6605322",
"0.65750706",
"0.6563305",
"0.6555502",
"0.6535823",
"0.65335476",
"0.652619... | 0.74988055 | 0 |
GET /bandas/1 GET /bandas/1.xml | def show
@banda = Banda.find_by_atalho(params[:banda])
if !@banda
flash[:notice] = "Não existe essa banda aqui. Adicione!"
redirect_to("/")
return
else
@page_title = @banda.nome
end
@banda_albuns = Album.find_all_by_banda_id(@banda.id, :order=>"ano")
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @banda }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @band = Band.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @band }\n end\n end",
"def show\n @band = Band.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render js... | [
"0.75296164",
"0.67585856",
"0.6680852",
"0.66213346",
"0.65520906",
"0.65014565",
"0.6483828",
"0.6483444",
"0.6417882",
"0.6394058",
"0.6386666",
"0.6334725",
"0.6303772",
"0.6303314",
"0.6294853",
"0.6262899",
"0.62379366",
"0.62169147",
"0.62034255",
"0.61734456",
"0.6171... | 0.6512695 | 5 |
GET /bandas/new GET /bandas/new.xml | def new
@banda = Banda.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @banda }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @band = Band.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @band }\n end\n end",
"def new\n @bands = Band.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @venue }\n end\n end"... | [
"0.7781639",
"0.7585077",
"0.70602906",
"0.7034137",
"0.69205695",
"0.6918481",
"0.6870744",
"0.68522644",
"0.6804117",
"0.67506343",
"0.66630876",
"0.6642369",
"0.6631867",
"0.656169",
"0.6539684",
"0.6515332",
"0.65061045",
"0.65051293",
"0.6497788",
"0.64974594",
"0.648973... | 0.7614722 | 1 |
POST /bandas POST /bandas.xml | def create
@banda = Banda.new(params[:banda])
@banda.user_id = session[:user]
respond_to do |format|
if @banda.save
flash[:notice] = "A nova banda foi adicionada."
format.html { redirect_to("/#{@banda.atalho}/novo_album", :banda=>@banda) }
else
format.html { render :action => "new" }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @band = Band.new(band_params)\n\n respond_to do |format|\n if @band.save\n format.html { redirect_to @band, notice: 'Band was successfully created.' }\n format.json { render :show, status: :created, location: @band }\n else\n format.html { render :new }\n fo... | [
"0.6416471",
"0.63599795",
"0.5998923",
"0.59687006",
"0.5965512",
"0.5937532",
"0.5867744",
"0.58591586",
"0.5831494",
"0.5789859",
"0.5768295",
"0.576734",
"0.5709725",
"0.5692593",
"0.569035",
"0.5682324",
"0.56771827",
"0.56178147",
"0.5567586",
"0.55325437",
"0.55000675"... | 0.530421 | 35 |
GET /traffics GET /traffics.json | def index
@traffics = Traffic.order(:state, monday_start: :desc)
@traffics.each { |traffic|
if traffic.state == "published"
begin
traffic.planed_dates = Calendar.planed_dates(30, :traffic, traffic.id)
rescue Exception => e
traffic.planed_dates = []
end
else
traffic.planed_dates = []
end
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @traffics = Traffic.all\n end",
"def index\n @traffics = Traffic.find(:all, :order => \"created_at\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traffics }\n end\n end",
"def trades\n Client.current.get(\"#{resource_url}/tr... | [
"0.70034146",
"0.67238194",
"0.61969715",
"0.6035365",
"0.5915713",
"0.5892292",
"0.58693904",
"0.58354455",
"0.58106065",
"0.5803437",
"0.57738143",
"0.5735023",
"0.57328355",
"0.5715188",
"0.570751",
"0.56991637",
"0.56809133",
"0.5654262",
"0.5621689",
"0.56147885",
"0.561... | 0.0 | -1 |
GET /traffics/1 GET /traffics/1.json | def show
if @traffic.state == "published"
begin
@traffic.planed_dates = Calendar.planed_dates(30, :traffic, @traffic.id)
rescue Exception => e
@traffic.planed_dates = []
end
else
@traffic.planed_dates = []
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @traffics = Traffic.all\n end",
"def index\n @traffics = Traffic.find(:all, :order => \"created_at\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traffics }\n end\n end",
"def show\n @travel_chart = Travel::Chart.find(params[:... | [
"0.69723177",
"0.67214423",
"0.6088091",
"0.5891818",
"0.58801514",
"0.5861678",
"0.5853617",
"0.5843993",
"0.58351845",
"0.5819221",
"0.5819221",
"0.57854176",
"0.5758974",
"0.5754437",
"0.57528144",
"0.57470435",
"0.5744043",
"0.5723258",
"0.57027465",
"0.5699805",
"0.56873... | 0.0 | -1 |
POST /traffics POST /traffics.json | def create
params[:traffic][:website_id] = params[:website_selected]
params[:traffic][:count_weeks] = params[:count_weeks_selected]
@traffic = Traffic.new(traffic_params)
begin
@traffic.save!
rescue Exception => e
respond_to do |format|
format.html {
@websites = Website.all
@statistics = Statistic.all
@website = @traffic.website
redirect_to new_traffic_path, alert: e.message and return
}
end
end
if @traffic.statistic_type == "custom"
begin
@statistic = @traffic.create_custom_statistic!({:statistic_id => params[:statistic_selected],
:policy_id => @traffic.id,
:policy_type => @traffic.class.name})
rescue Exception => e
# on remet le type par defaut et on le sauve car si l'utilisateur s'en va san terminer la creation alors il manque une custom static et cela entraineenra une erruer dans index
@traffic.update_attribute(:statistic_type, "default")
respond_to do |format|
format.html {
@websites = Website.all
@statistics = Statistic.all
@website = @traffic.website
@traffic.monday_start = Traffic.next_monday(Date.today + @traffic.max_duration_scraping)
redirect_to edit_traffic_path(@traffic), alert: e.message and return
}
end
end
end
render_after_create_ok_or_update_ok("Traffic n°#{@traffic.id} was successfully created.")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @trac = Trac.new(trac_params)\n\n respond_to do |format|\n if @trac.save\n format.html { redirect_to @trac, notice: 'Trac was successfully created.' }\n format.json { render :show, status: :created, location: @trac }\n else\n format.html { render :new }\n fo... | [
"0.6214081",
"0.5795744",
"0.57690364",
"0.57664543",
"0.57651585",
"0.57627326",
"0.57467175",
"0.5710359",
"0.57070464",
"0.5692368",
"0.56803745",
"0.56788397",
"0.5657104",
"0.5641894",
"0.5627291",
"0.56267506",
"0.562471",
"0.56167984",
"0.56029737",
"0.5585184",
"0.557... | 0.0 | -1 |
PATCH/PUT /traffics/1 PATCH/PUT /traffics/1.json | def update
params[:traffic][:website_id] = params[:website_selected]
@traffic = Traffic.find_by_id(params[:id])
begin
@traffic.update!(traffic_params)
rescue Exception => e
respond_to do |format|
format.html {
@websites = Website.all
@statistics = Statistic.all
@website = @traffic.website
redirect_to edit_traffic_path(@traffic), alert: e.message and return
}
end
end
if @traffic.statistic_type == "custom"
begin
if (@statistic = @traffic.custom_statistic).nil?
@statistic = @traffic.create_custom_statistic!({:statistic_id => params[:statistic_selected],
:policy_id => @traffic.id,
:policy_type => @traffic.class.name})
else
@statistic.update_attributes!({:statistic_id => params[:statistic_selected]})
end
rescue Exception => e
# on remet le type par defaut et on le sauve car si l'utilisateur s'en va san terminer la creation alors il manque une custom static et cela entraineenra une erruer dans index
@traffic.update_attribute(:statistic_type, "default")
respond_to do |format|
format.html {
@websites = Website.all
@statistics = Statistic.all
@website = @traffic.website
@traffic.monday_start = Traffic.next_monday(Date.today + @traffic.max_duration_scraping)
redirect_to edit_traffic_path(@traffic), alert: e.message and return
}
end
end
else # statistic_type = ga ou default
@traffic.custom_statistic.delete unless @traffic.custom_statistic.nil?
end
render_after_create_ok_or_update_ok("Traffic n°#{@traffic.id} was successfully update.")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @trac.update(trac_params)\n format.html { redirect_to @trac, notice: 'Trac was successfully updated.' }\n format.json { render :show, status: :ok, lo... | [
"0.6066775",
"0.6008371",
"0.58044595",
"0.5791964",
"0.5791382",
"0.576393",
"0.5747545",
"0.5742798",
"0.57384443",
"0.57376885",
"0.56860745",
"0.568475",
"0.56807876",
"0.5676008",
"0.56714326",
"0.5651108",
"0.5642152",
"0.56300926",
"0.5629314",
"0.56175107",
"0.5616354... | 0.0 | -1 |
DELETE /traffics/1 DELETE /traffics/1.json | def destroy
begin
@traffic.destroy
rescue Exception => e
notice = e.message
else
notice = 'Traffic was successfully destroyed.'
end
respond_to do |format|
format.html { redirect_to traffics_url, notice: notice }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @traffic = Traffic.find(params[:id])\n @traffic.destroy\n\n respond_to do |format|\n format.html { redirect_to traffics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @traffic = Traffic.find(params[:id])\n @traffic.destroy\n\n respond_to do |fo... | [
"0.70923054",
"0.6854811",
"0.68487245",
"0.6770015",
"0.6614432",
"0.6535633",
"0.6518131",
"0.65169156",
"0.65118194",
"0.64960843",
"0.64620495",
"0.6443421",
"0.6437988",
"0.6379921",
"0.6364386",
"0.63226336",
"0.63136744",
"0.63088375",
"0.63059205",
"0.62963855",
"0.62... | 0.66716623 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_traffic
@traffic = Traffic.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 traffic_params
params.require(:traffic).permit(:statistic_selected,
:count_visits_per_day,
:hourly_daily_distribution,
:percent_new_visit,
:visit_bounce_rate,
:avg_time_on_site,
:statistic_type,
:page_views_per_visit,
:website_id,
:statistic_id,
:monday_start,
:count_weeks,
:change_count_visits_percent,
:change_bounce_visits_percent,
:direct_medium_percent,
:organic_medium_percent,
:referral_medium_percent,
:advertising_percent,
:advertisers,
:max_duration_scraping,
:min_count_page_advertiser,
:max_count_page_advertiser,
:min_duration_page_advertiser,
:max_duration_page_advertiser,
:percent_local_page_advertiser,
:duration_referral,
:min_count_page_organic,
:max_count_page_organic,
:min_duration_page_organic,
:max_duration_page_organic,
:min_duration,
:max_duration,
:min_duration_website,
:min_pages_website,
:execution_mode)
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.69780594",
"0.678054",
"0.6742781",
"0.67387927",
"0.67346025",
"0.6590683",
"0.6501642",
"0.6495788",
"0.6479752",
"0.64763314",
"0.645457",
"0.6437739",
"0.6377168",
"0.6372484",
"0.6363871",
"0.63179374",
"0.62981373",
"0.6297456",
"0.62916917",
"0.6290227",
"0.628954",... | 0.0 | -1 |
Define a method that makes hash create a new list item, quantity | def new_list(item, quantity)
groceries_list = {item => quantity}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_qty(list, item, qty)\n list[item] = qty\n return list\nend",
"def add_item(hash_list, new_item, quantity = 1)\n hash_list[new_item] = quantity\n p hash_list\nend",
"def add_to_list(list_hash, item, qty)\r\n\tlist_hash[item] = qty\r\n\tlist_hash\t\r\nend",
"def list_add(hash_items, item_name, quan... | [
"0.8083257",
"0.80292845",
"0.7974392",
"0.7936787",
"0.78322953",
"0.78252417",
"0.78235435",
"0.78122985",
"0.7789598",
"0.7770929",
"0.77674854",
"0.77666646",
"0.7763107",
"0.7755968",
"0.7739844",
"0.7732639",
"0.7709712",
"0.77030945",
"0.7678646",
"0.7676254",
"0.76714... | 0.7548714 | 40 |
pseudocode define a method that adds an item to our list add a key/value pair to our existing list output updated grocery list | def add_item(item, quantity, groceries_list)
groceries_list[item] = quantity
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_grocery_list(grocery_list, item_name, quantity=1)\n # steps: add item to hash and set quantity\n grocery_list[item_name.to_sym] = quantity\n # output: explicit return updated hash\n grocery_list\nend",
"def add_item(grocery_list, item, qty)\n grocery_list[item] = qty \n grocery_list\nend",
"d... | [
"0.83824754",
"0.8300347",
"0.82836217",
"0.82620114",
"0.8194396",
"0.81779486",
"0.8164623",
"0.81621295",
"0.81105345",
"0.8103866",
"0.8083293",
"0.8072043",
"0.80711144",
"0.8046",
"0.80235547",
"0.8015308",
"0.8015308",
"0.7973455",
"0.7959445",
"0.7951248",
"0.79368746... | 0.74081564 | 68 |
psuedocode define method that remoces item from list remove item from groceries list output update list | def remove_item(items, groceries_list)
groceries_list.delete(items)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_item(groceries_list, item_to_remove)\n\t# remove item from list\n\tgroceries_list.delete(item_to_remove)\n\t# return updated list\n\tgroceries_list\nend",
"def remove_item(grocery_list, item)\r\n\tgrocery_list.delete(item)\r\n\tgrocery_list\r\nend",
"def remove_item_from_list(grocery_list, item) \n ... | [
"0.7932899",
"0.7868345",
"0.77573794",
"0.77104795",
"0.7689352",
"0.7668525",
"0.76387864",
"0.76387864",
"0.76131606",
"0.7584837",
"0.753534",
"0.753534",
"0.75050735",
"0.74758095",
"0.74758095",
"0.7463809",
"0.745401",
"0.74512774",
"0.7448878",
"0.7407783",
"0.7407783... | 0.802964 | 0 |
pseudocode define a method that updates the quantities for items in groceries_list update quantity output updated groceries_list | def update_quantity(item, quantity, groceries_list)
groceries_list[item] = quantity
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_quantity(grocery_list, item_to_update, qty)\n grocery_list[item_to_update] = qty\n grocery_list\nend",
"def update_qty(grocery_list, item, qty)\n grocery_list[item] = qty\n grocery_list\nend",
"def update_quantity(grocery_list, item_name, quantity)\n\tadd_item(grocery_list, item_name, quantity)\... | [
"0.831808",
"0.8193134",
"0.8124504",
"0.8051816",
"0.8045623",
"0.8045038",
"0.80172306",
"0.8003595",
"0.8003595",
"0.80034715",
"0.798681",
"0.7981079",
"0.79737353",
"0.7960213",
"0.79327357",
"0.792873",
"0.7888591",
"0.78861636",
"0.7858827",
"0.78580713",
"0.78390515",... | 0.8507145 | 0 |
psuedocode make method that prints out list make list neat and readable output printed list | def print_do(groceries_list)
groceries_list.each {|item, quantity| puts "#{item} : #{quantity}" }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_list; end",
"def pretty_list(list)\n # new_list = \"\"\n # list.each { |item, quantity| new_list << \"You want #{quantity} #{item}\\n\" }\n # return new_list\n list.each { |item, quantity| puts \"You want #{quantity} #{item}\\n\" }\nend",
"def lister(list)\n\tlist.each do |item|\n\t\tputs \"* #{i... | [
"0.801073",
"0.72937435",
"0.72832114",
"0.7249223",
"0.72143286",
"0.7159428",
"0.71229535",
"0.70943016",
"0.7065394",
"0.7054355",
"0.7053778",
"0.70313627",
"0.70313627",
"0.7021241",
"0.70156485",
"0.7000496",
"0.69481677",
"0.6940811",
"0.6940811",
"0.69324124",
"0.6927... | 0.0 | -1 |
Retourne la valeur du qcm | def value
return 3*level
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qvaluestring\n\t\t# 3 digit precision, trim excess zeros\n\t\treturn sprintf( \"q=%0.3f\", self.qvalue ).gsub(/0{1,2}$/, '')\n\tend",
"def fdr_q_value\n @fdr_q_value ||= @fields[6].to_f\n end",
"def celcius\n self.to_c\n end",
"def getvalue(str)\r\n value = 0\r\n ... | [
"0.67574394",
"0.64557827",
"0.63543075",
"0.61780745",
"0.6104419",
"0.60713375",
"0.6056929",
"0.6013736",
"0.594821",
"0.5910549",
"0.5904575",
"0.5889297",
"0.5889297",
"0.5854658",
"0.5834566",
"0.58151835",
"0.58065087",
"0.57615936",
"0.57602674",
"0.57586503",
"0.5757... | 0.0 | -1 |
peak: message (a string) is optional: | def cancelout(message = "Received negative number; canceling...", rc=0)
$stderr.print(message + "\n" ) if message
Process.exit(rc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message(message) end",
"def msg(message)\n end",
"def message() end",
"def message( message )\n\tend",
"def message; end",
"def message; end",
"def message; end",
"def message; end",
"def message; end",
"def message; end",
"def pbTrainerSpeak(msg, bgm = nil, index = 0)\n # in case t... | [
"0.6413145",
"0.63333666",
"0.63331753",
"0.62663984",
"0.61696106",
"0.61696106",
"0.61696106",
"0.61696106",
"0.61696106",
"0.61696106",
"0.61487657",
"0.60261035",
"0.59628874",
"0.59496075",
"0.59496075",
"0.59476936",
"0.59283423",
"0.58777374",
"0.584798",
"0.58333933",
... | 0.0 | -1 |
photo will come in with sender_id, receiver_id, photo | def create
receiver_id = params[:receiver_id]
sender_id = params[:sender_id]
photo = params[:photo]
puts request.format
if request.format != :json
render :status=>406, :json=>{:message=>"The request must be json"}
return
end
if receiver_id.nil? or sender_id.nil? or photo.blank?
render :status=>400, :json=>{:message=>"The request must contain the receiver_id, sender_id, and photo."}
return
end
r = User.find(receiver_id)
s = User.find(sender_id)
if r.nil? or s.nil?
render :status=>401, :json=>{:message=>"Sender or receiver doesn't exist with that ID."}
return
end
@postcard = Postcard.new(:receiver_id => receiver_id, :sender_id => sender_id, :sender_name => s.displayName)
@postcard.photo = photo
if @postcard.save
render :status=>200, :json=>{:postcard=>@postcard}
else
puts @postcard.errors.inspect
render :status=>400, :json=>{:message=>"Error saving photo"}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receiver_picture\n user = users.select { |user| !user.id.eql?(sent_by) }.first\n user.avatar_url\n end",
"def sender_picture\n user = User.find_by_id(sent_by)\n user.avatar_url\n end",
"def initialize_photos(telegram_message)\n return [] unless telegram_message[:photo]\n\n photo = Photo... | [
"0.69158983",
"0.69098645",
"0.65774",
"0.64389724",
"0.636584",
"0.6353217",
"0.63310826",
"0.6307352",
"0.6304468",
"0.62790704",
"0.6266383",
"0.62411547",
"0.6215281",
"0.61780804",
"0.6171618",
"0.61694515",
"0.61694515",
"0.6158711",
"0.61342686",
"0.6116217",
"0.606761... | 0.6183778 | 13 |
given a user_id, return a count of unviewed photos | def num_new_photos
user_id = params[:user_id]
# if request.format != :json
# render :status=>406, :json=>{:message=>"The request must be json"}
# return
# end
if user_id.nil?
render :status=>400, :json=>{:message=>"The request must contain a user_id."}
return
end
count = Postcard.where("receiver_id = ? AND viewed = ?", user_id, false).count
render :status=>200, :json => {:num_new_photos => count}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_unviewed_ids(user); end",
"def missed_answers_count(user)\n answers.where('answers.created_at > ?', latest_profile_view(user))\n .where.not(answers: { id: user.viewed_answers.ids }).count\n end",
"def get_user_tag_count(owner_user_id)\n count = USER_TAGS.where(owner_user_id: owner_user... | [
"0.69725084",
"0.66770416",
"0.6536266",
"0.62331814",
"0.6231103",
"0.62043285",
"0.61953264",
"0.6180939",
"0.61220324",
"0.60758746",
"0.60401505",
"0.6034242",
"0.5928755",
"0.59164304",
"0.58941805",
"0.58730865",
"0.58436304",
"0.5835657",
"0.5789464",
"0.57615155",
"0.... | 0.67354274 | 1 |
given a user_id, return all postcards | def all_photos
user_id = params[:user_id]
if user_id.nil?
render :status=>400, :json=>{:message=>"The request must contain the user_id."}
return
end
u = User.find(user_id)
if u.nil?
logger.info("User with email #{email} failed signin: user cannot be found.")
render :status=>401, :json=>{:message=>"User cannot be found."}
return
end
render :status=>200, :json => u.postcards.order('created_at desc')
u.postcards.where("viewed = ?", false).each do |p|
p.viewed = true
p.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_cards_of_player_with_user_id(user_id)\n go_fish.list_cards_of_player_with_user_id(user_id)\n end",
"def cardsByUser\n results = HTTParty.get(\"http://192.168.99.104:3003/credit_cards/user?id=\"+ @current_user[\"id\"].to_s)\n render json: results.parsed_response, status: results.code\n ... | [
"0.6973872",
"0.68046874",
"0.6749347",
"0.65473783",
"0.637469",
"0.637469",
"0.63692075",
"0.6273093",
"0.62598234",
"0.62426883",
"0.6115687",
"0.6106763",
"0.60288644",
"0.60135865",
"0.5964224",
"0.5964068",
"0.5939525",
"0.5916632",
"0.5909937",
"0.5904797",
"0.5851408"... | 0.6208967 | 10 |
disable source for now | def source_required?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_ExcludeSource(value)\n set_input(\"ExcludeSource\", value)\n end",
"def source?\n false\n end",
"def source_required?\n false\n end",
"def disable\n end",
"def exclude_paths\n @source_paths ||= []\n end",
"def disable!\n @enabled = false\n ... | [
"0.70023715",
"0.6930084",
"0.6558295",
"0.6488691",
"0.64652735",
"0.6427138",
"0.63244027",
"0.63209164",
"0.6319916",
"0.6238741",
"0.6233104",
"0.6227137",
"0.62124413",
"0.62064576",
"0.6203636",
"0.6203636",
"0.6203636",
"0.6203636",
"0.6203636",
"0.6203636",
"0.6203636... | 0.65947604 | 3 |
This function finds refining parameters via ConstraintBlocks/ConstraintElements from the given VerificationElement. It highlights elements that have no expressions for constraints and missing units. Params: +requirement+:: A Requirement element to look for refining parameters. | def findRefinedParameters(element)
for relation in element.get_relationshipOfRelatedElement()
if StereotypesHelper.hasStereotype(relation, $veRelationshipStereotype)
req = ModelHelper.getSupplierElement(relation)
for relation in req.get_relationshipOfRelatedElement()
if StereotypesHelper.hasStereotype(relation, $refineStereotype)
ce = ModelHelper.getClientElement(relation)
if StereotypesHelper.hasStereotype(ce, $ceStereotype)
badval = false
constraint = ce.get_constraintOfConstrainedElement().get(0)
expression = constraint.getSpecification().getBody().get(0)
paramUnit = StereotypesHelper.getStereotypePropertyFirst(ce, $ceStereotype, "unit")
unless paramUnit.respond_to?(:name)
$logger.log(ce.getName() + ": Missing unit")
badval = true
end
unless expression != nil
$logger.log(ce.getName() + ": No expression found!")
badval = true
end
if badval
reqId = StereotypesHelper.getStereotypePropertyFirst(req, $requirementStereotype, 'Id')
$logger.log("Requirement Id: " + reqId.to_s)
end
end
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findOrCreateRefinedParameters(element)\n $logger.log(element.getName())\n refinedParams = []\n for relation in element.get_relationshipOfRelatedElement()\n if StereotypesHelper.hasStereotype(relation, $veRelationshipStereotype)\n req = ModelHelper.getSupplierElement(relation)\n ... | [
"0.5749455",
"0.44763222",
"0.44315758",
"0.4352625",
"0.4322531",
"0.43136698",
"0.43060756",
"0.43060756",
"0.42866355",
"0.4275223",
"0.42378175",
"0.42247254",
"0.42140144",
"0.41912305",
"0.41748738",
"0.41725275",
"0.41723344",
"0.416857",
"0.4160564",
"0.4095127",
"0.4... | 0.6318507 | 0 |
This function executes the function looking for all refining parameters for a VerficationElement and then parses through all owned elements from the given one. Params: +element+:: SysML element from the containment tree. | def recursiveTreeTraversal(element)
if StereotypesHelper.hasStereotype(element, $veStereotype)
findRefinedParameters(element)
end
for child in element.getOwnedElement()
recursiveTreeTraversal(child)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findRefinedParameters(element)\n for relation in element.get_relationshipOfRelatedElement()\n if StereotypesHelper.hasStereotype(relation, $veRelationshipStereotype)\n req = ModelHelper.getSupplierElement(relation)\n for relation in req.get_relationshipOfRelatedElement()\n ... | [
"0.6251317",
"0.5669195",
"0.56206685",
"0.55190295",
"0.54181707",
"0.5233958",
"0.5215337",
"0.5130344",
"0.50303537",
"0.48875755",
"0.485756",
"0.48551494",
"0.48365498",
"0.47645643",
"0.47489664",
"0.4689144",
"0.46206036",
"0.46146134",
"0.4564588",
"0.45195627",
"0.45... | 0.5862605 | 1 |
encoding: utf8 Function creates a paragraph from string p and writes them out to file f | def paragraph(p,f)
# Replaces everything that has <b>, </b>, etc.
value = p.gsub(/<b>|<\/b>|<a>|<\/a>/, "")
arr = value.split(/</)
# Gets rid of anything else from .* to >
# and fixes spaces between numbers
arr.each {|x| x.gsub!(/.*>\d*/, "");
x.gsub!(/\&\#\d*\;/, " "); }
arr.each {|x|
if x == arr[0] && x != ""
f.write("\t" + x)
elsif x != "" && x != "[" && x != "]"
f.write(x)
end
}
f.write("\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utf8write(str,f)\n File.open(f,\"wb:utf-8\"){|ff|\n ff.write(str)\n }\nend",
"def body_text(fp,text)\n\t\tfp.puts text\n\tend",
"def mapf_format_paragraph(text, max_width = contents_width)\n text = text.clone\n # Create a Dummy Contents - I wanted to boost compatibility by using the \n # def... | [
"0.61327845",
"0.56369334",
"0.5628283",
"0.561192",
"0.55925214",
"0.55839455",
"0.5569195",
"0.5524371",
"0.55093324",
"0.5389055",
"0.5369106",
"0.5335553",
"0.5329922",
"0.5271824",
"0.5261514",
"0.5216091",
"0.51790136",
"0.51734936",
"0.5169409",
"0.514829",
"0.51154953... | 0.6710374 | 0 |
Function opens url and extracts data from it | def get_info(w)
require 'open-uri'
paragraph = []
contents = open('http://en.wikipedia.org/wiki/' + w) {|f|
f.readlines.each {|x|
if x =~ /<p>(.*)<\/p>/
paragraph.push($1)
end
}}
# If a file name was passed in to be stored somewhere
# Otherwise, Temp.doc will be created and modified
if(ARGV[0] != nil)
file = File.open(ARGV[0], 'a')
else
file = File.open("Temp.doc", 'a')
end
# Writes to file what is being searched for
file.write(w.upcase + ":\n")
# Uses regular expression to grab first two paragraph
paragraph.each {|p| paragraph(p,file)}
file.write("\n")
file.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_url_data(url)\n open(url).read\n end",
"def fetch_url_data(url)\n open(url).read\n end",
"def get_url_data(url)\n Nokogiri::HTML(open(url))\n end",
"def get_url_data(url)\n Nokogiri::HTML(open(url))\n end",
"def fetchURL(url)\n open(url) {|response| response.r... | [
"0.79000145",
"0.79000145",
"0.76809233",
"0.766574",
"0.7399678",
"0.7049258",
"0.7002691",
"0.69545346",
"0.687522",
"0.6812831",
"0.6812831",
"0.6782144",
"0.67641157",
"0.6755721",
"0.6703199",
"0.6673281",
"0.6673281",
"0.66638935",
"0.6587836",
"0.65628326",
"0.655896",... | 0.0 | -1 |
This function keeps loop going until "DONE" is seen Otherwise, function get_info will be called to use To extract first two paragraphs from Wikipedia | def get_info_loop file
loop do
line = file.gets
if line == nil then break end
words = line.scan(/\S+/)
words.each{ |word|
case word
when /DONE/
return
else
get_info(word)
end
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_info(w)\n\trequire 'open-uri'\n\tparagraph = []\n\tcontents = open('http://en.wikipedia.org/wiki/' + w) {|f| \n\t\tf.readlines.each {|x| \n\t\t\tif x =~ /<p>(.*)<\\/p>/\n\t\t\tparagraph.push($1)\n\t\t\tend\n\t}}\n\n\t# If a file name was passed in to be stored somewhere\n\t# Otherwise, Temp.doc will be cre... | [
"0.6863866",
"0.646372",
"0.60471344",
"0.60028046",
"0.59979093",
"0.59979093",
"0.59979093",
"0.59979093",
"0.5923486",
"0.5832639",
"0.5690334",
"0.5682024",
"0.56792265",
"0.5672313",
"0.5624293",
"0.5579209",
"0.5571328",
"0.55658877",
"0.5555031",
"0.5525902",
"0.551827... | 0.6730045 | 1 |
Takes a Transaction ready to be signed. Returns an Array of signature dictionaries. | def signatures(transaction, names: [:primary])
transaction.inputs.map do |input|
path = input.output.metadata[:wallet_path]
node = self.path(path)
sig_hash = transaction.sig_hash(input, node.script)
node.signatures(sig_hash, names: names)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signatures\n parsed {\n @signatures \n }\n end",
"def sign(wallet)\n tx = Arweave::Transaction.new(data: @commit.message.to_s)\n @commit.to_tags.each do |name, value|\n tx.add_tag(name: name, value: value)\n end\n tx.sign(wallet)\n end",
"def transactions\n\t\treturn M... | [
"0.6689318",
"0.6305804",
"0.6164084",
"0.6159831",
"0.6077063",
"0.606096",
"0.604645",
"0.6042075",
"0.5902153",
"0.58294094",
"0.57881963",
"0.5778881",
"0.577542",
"0.57421714",
"0.57016987",
"0.5696778",
"0.56844485",
"0.5684061",
"0.5680799",
"0.56645614",
"0.5657761",
... | 0.7225957 | 0 |
Takes a Transaction and any number of Arrays of signature dictionaries. Each sig_dict in an Array corresponds to the Input with the same index. Uses the combined signatures from all the signers to generate and set the script_sig for each Input. Returns the transaction. | def authorize(transaction, *signers)
transaction.set_script_sigs *signers do |input, *sig_dicts|
node = self.path(input.output.metadata[:wallet_path])
signatures = combine_signatures(*sig_dicts)
node.script_sig(signatures)
end
transaction
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signatures(transaction, names: [:primary])\n transaction.inputs.map do |input|\n path = input.output.metadata[:wallet_path]\n node = self.path(path)\n sig_hash = transaction.sig_hash(input, node.script)\n node.signatures(sig_hash, names: names)\n end\n end",
"def crea... | [
"0.6639156",
"0.612882",
"0.58752424",
"0.57744056",
"0.5283584",
"0.5280524",
"0.5243925",
"0.5218904",
"0.51741624",
"0.5125728",
"0.50553656",
"0.49807802",
"0.4972517",
"0.4966449",
"0.49388856",
"0.48918334",
"0.4776902",
"0.4749058",
"0.47110122",
"0.46888185",
"0.46682... | 0.62909025 | 1 |
Takes any number of "signature dictionaries", which are Hashes where the keys are tree names, and the values are base58encoded signatures for a single input. Returns an Array of the signatures in binary, sorted by their tree names. | def combine_signatures(*sig_dicts)
combined = {}
sig_dicts.each do |sig_dict|
sig_dict.each do |tree, signature|
decoded_sig = decode_base58(signature)
low_s_der_sig = Bitcoin::Script.is_low_der_signature?(decoded_sig) ?
decoded_sig : Bitcoin::OpenSSL_EC.signature_to_low_s(decoded_sig)
combined[tree] = Bitcoin::OpenSSL_EC.repack_der_signature(low_s_der_sig)
end
end
# Order of signatures is important for validation, so we always
# sort public keys and signatures by the name of the tree
# they belong to.
combined.sort_by { |tree, value| tree }.map { |tree, sig| sig }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signatures(transaction, names: [:primary])\n transaction.inputs.map do |input|\n path = input.output.metadata[:wallet_path]\n node = self.path(path)\n sig_hash = transaction.sig_hash(input, node.script)\n node.signatures(sig_hash, names: names)\n end\n end",
"def sign... | [
"0.65369296",
"0.60533875",
"0.56763816",
"0.5333135",
"0.51653075",
"0.51449525",
"0.51133287",
"0.5111311",
"0.5094485",
"0.5030817",
"0.5017331",
"0.500569",
"0.5000744",
"0.4992892",
"0.49517483",
"0.49517483",
"0.49464738",
"0.4941667",
"0.4897451",
"0.48931602",
"0.4889... | 0.6638893 | 0 |
GET /percentual_gorduras GET /percentual_gorduras.json | def index
@percentual_gorduras = PercentualGordura.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percentual_gordura_params\n params.require(:percentual_gordura).permit(:triceps, :supra_f, :supra_m, :abdomen, :coxa, :subescapular, :aluno_id)\n end",
"def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.... | [
"0.62293714",
"0.6123777",
"0.6120381",
"0.6110766",
"0.6083583",
"0.60833114",
"0.60608304",
"0.5996981",
"0.59409225",
"0.5912513",
"0.5906495",
"0.5892862",
"0.5881434",
"0.58792657",
"0.58535",
"0.5851153",
"0.583435",
"0.5825544",
"0.5820827",
"0.5817334",
"0.58156675",
... | 0.72092944 | 0 |
GET /percentual_gorduras/1 GET /percentual_gorduras/1.json GET /percentual_gorduras/new | def new
@percentual_gordura = PercentualGordura.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @percentual_gordura = PercentualGordura.new(percentual_gordura_params)\n\n respond_to do |format|\n if @percentual_gordura.save\n format.html { redirect_to @percentual_gordura, notice: 'Percentual gordura was successfully created.' }\n format.json { render action: 'show', stat... | [
"0.73144186",
"0.718344",
"0.7113081",
"0.70378065",
"0.70282924",
"0.6991537",
"0.69895655",
"0.69735026",
"0.6972975",
"0.6971929",
"0.69666976",
"0.69528383",
"0.6947008",
"0.6947008",
"0.69383025",
"0.6930364",
"0.69276536",
"0.6905504",
"0.6898198",
"0.6888249",
"0.68777... | 0.73092353 | 1 |
POST /percentual_gorduras POST /percentual_gorduras.json | def create
@percentual_gordura = PercentualGordura.new(percentual_gordura_params)
respond_to do |format|
if @percentual_gordura.save
format.html { redirect_to @percentual_gordura, notice: 'Percentual gordura was successfully created.' }
format.json { render action: 'show', status: :created, location: @percentual_gordura }
else
format.html { render action: 'new' }
format.json { render json: @percentual_gordura.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percentual_gordura_params\n params.require(:percentual_gordura).permit(:triceps, :supra_f, :supra_m, :abdomen, :coxa, :subescapular, :aluno_id)\n end",
"def create\n @percentage = Percentage.new(percentage_params)\n\n respond_to do |format|\n if @percentage.save\n format.html { redi... | [
"0.7150448",
"0.62979126",
"0.6180992",
"0.6161287",
"0.61237556",
"0.6109472",
"0.6044457",
"0.6028358",
"0.59720045",
"0.58923197",
"0.5858864",
"0.58372694",
"0.58051026",
"0.57812005",
"0.5759819",
"0.57506216",
"0.57377195",
"0.5720735",
"0.5710153",
"0.57080644",
"0.569... | 0.7277088 | 0 |
PATCH/PUT /percentual_gorduras/1 PATCH/PUT /percentual_gorduras/1.json | def update
respond_to do |format|
if @percentual_gordura.update(percentual_gordura_params)
format.html { redirect_to @percentual_gordura, notice: 'Percentual gordura was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @percentual_gordura.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @percentage.update(percentage_params)\n format.html { redirect_to @percentage, notice: 'Percentage was successfully updated.' }\n format.json { render :show, status: :ok, location: @percentage }\n else\n format.html { render :edit }\n ... | [
"0.6449922",
"0.6418719",
"0.6373279",
"0.63250875",
"0.6314283",
"0.6263335",
"0.6250542",
"0.62065995",
"0.6191897",
"0.61912084",
"0.6182195",
"0.61621815",
"0.61554587",
"0.61468124",
"0.613154",
"0.6119767",
"0.61173636",
"0.61115474",
"0.6108085",
"0.6104613",
"0.610128... | 0.7079142 | 0 |
DELETE /percentual_gorduras/1 DELETE /percentual_gorduras/1.json | def destroy
@percentual_gordura.destroy
respond_to do |format|
format.html { redirect_to percentual_gorduras_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @gran_unidad.destroy\n respond_to do |format|\n format.html { redirect_to gran_unidad_index_url }\n format.json { head :no_content }\n end\n end",
"def d... | [
"0.70852894",
"0.6984501",
"0.6965684",
"0.6944373",
"0.6895366",
"0.6895366",
"0.6893692",
"0.6875281",
"0.68725795",
"0.68618196",
"0.682656",
"0.6819026",
"0.68109673",
"0.6802638",
"0.6800843",
"0.67951196",
"0.67933226",
"0.67906606",
"0.6790544",
"0.6779892",
"0.6776726... | 0.76227844 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_percentual_gordura
@percentual_gordura = PercentualGordura.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def percentual_gordura_params
params.require(:percentual_gordura).permit(:triceps, :supra_f, :supra_m, :abdomen, :coxa, :subescapular, :aluno_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.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 |
Prints a detailed report of the tests failures. | def report
tests_executed_string = @executed_count == 1 ? "test" : "tests"
tests_failed_string = @failed_count == 1 ? "failure" : "failures"
tests_retried_string = @retried_count == 1 ? "retry" : "retries"
if @failed_count > 0
fail("Executed #{@executed_count}(#{@total_count}) #{tests_executed_string}, with **#{@failed_count}** #{tests_failed_string} 🚨")
@failures.each do |failure|
fail("`[#{failure.content.split("/").last}] [#{failure.parent['name']}] #{failure['message']}`")
end
elsif @retried_count > 0
message("Executed #{@executed_count}(#{@total_count}) #{tests_executed_string}, with #{@failed_count} #{tests_failed_string} and #{@retried_count} #{tests_retried_string} 🎉")
else
message("Executed #{@executed_count}(#{@total_count}) #{tests_executed_string}, with #{@failed_count} #{tests_failed_string} 🎉")
end
return @failed_count <= 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report\n\t\t\tputs \"Tests: #{@ok} ok, #{@fail} failures.\"\n\t\t\tif (@fail > 0)\n\t\t\t\tputs \"*** THERE WERE FAILURES *** \"\n\t\t\telse \n\t\t\t\tputs \"*** ALL TESTS PASSED ***\"\n\t\t\tend\n\t\tend",
"def print_results\n if !@failures.empty?\n @failures.each do |test|\n pout \"\\nFailed: #{te... | [
"0.76661044",
"0.7546229",
"0.7342739",
"0.7153604",
"0.7092292",
"0.708316",
"0.70522356",
"0.70522356",
"0.6904949",
"0.68224376",
"0.68224376",
"0.678986",
"0.6789238",
"0.6782796",
"0.6771875",
"0.67206526",
"0.6700093",
"0.6700093",
"0.6621579",
"0.6566587",
"0.6538722",... | 0.7043414 | 8 |
GET /producers/1 GET /producers/1.json | def show
@producer = Finder.find_producer_by_id params[:id]
@producer ||= KiWi.show_producer params[:id]
render json: @producer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @producers = Producer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @producers }\n end\n end",
"def index\n @producers = Producer.all\n end",
"def show\n @producer = Producer.find(params[:id])\n\n respond_to do |format|\n ... | [
"0.73423797",
"0.6970938",
"0.6558059",
"0.6389291",
"0.6196757",
"0.6192715",
"0.6106496",
"0.60447097",
"0.59469765",
"0.5862189",
"0.58150387",
"0.5775174",
"0.56869",
"0.5685969",
"0.5605616",
"0.55810684",
"0.5483181",
"0.54580307",
"0.54444385",
"0.54179543",
"0.5385933... | 0.64722854 | 3 |
POST /producers POST /producers.json | def create
@producer = Pusher.create_producer(params[:producer])
if @producer.valid?
render json: @producer, status: :created, location: @producer
else
render json: @producer.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @producer = Producer.new(producer_params)\n\n respond_to do |format|\n if @producer.save\n format.html { redirect_to @producer, notice: \"Producer was successfully created.\" }\n format.json { render :show, status: :created, location: @producer }\n else\n format.ht... | [
"0.64211977",
"0.6359898",
"0.632868",
"0.62813336",
"0.6151703",
"0.6080644",
"0.602942",
"0.57641",
"0.5659043",
"0.5625165",
"0.55608875",
"0.5547983",
"0.548863",
"0.5449561",
"0.54396296",
"0.54346067",
"0.54153997",
"0.5385405",
"0.5384478",
"0.53835094",
"0.5378103",
... | 0.66820544 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.