query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
DELETE /user_feedbacks/1 DELETE /user_feedbacks/1.json | def destroy
@user_feedback.destroy
respond_to do |format|
format.html { redirect_to user_feedbacks_url, notice: 'User feedback was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @feedback_user.destroy\n respond_to do |format|\n format.html { redirect_to feedback_users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_url }\n format.json {... | [
"0.7646456",
"0.74407524",
"0.74407524",
"0.74407524",
"0.74407524",
"0.74407524",
"0.7436337",
"0.7419134",
"0.7404497",
"0.7404497",
"0.7404497",
"0.7317403",
"0.7217276",
"0.7196597",
"0.71620536",
"0.71620536",
"0.71620536",
"0.71620536",
"0.71620536",
"0.71620536",
"0.71... | 0.75921375 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_user_feedback
@user_feedback = UserFeedback.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 user_feedback_params
params.require(:user_feedback).permit(:email, :feedback)
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 |
GET /tables GET /tables.json | def index
@tables = Table.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(table)\n self.get(\"/#{table}\")\n end",
"def tables(key = nil)\n key ||= properties.key1\n response = table_response(key, nil, \"Tables\")\n JSON.parse(response.body)['value'].map{ |t| Table.new(t) }\n end",
"def get_table_list()\n resp = @dynamo_db.list_tables()\n put... | [
"0.7417299",
"0.71926457",
"0.6981287",
"0.68949974",
"0.6880546",
"0.6869846",
"0.6865105",
"0.68565875",
"0.68439966",
"0.68439966",
"0.68439966",
"0.6817224",
"0.6797951",
"0.6730955",
"0.6712856",
"0.671084",
"0.67091686",
"0.6660052",
"0.66558504",
"0.6652589",
"0.661552... | 0.6543897 | 26 |
GET /tables/1 GET /tables/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(table)\n self.get(\"/#{table}\")\n end",
"def show\n @table = Table.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @table }\n end\n end",
"def show\n @table = Table.find(params[:id])\n\n respond_to do |format|\n ... | [
"0.7235843",
"0.7151465",
"0.7151465",
"0.7151465",
"0.7149468",
"0.68648845",
"0.6818232",
"0.67270064",
"0.6709232",
"0.6679001",
"0.66551924",
"0.6633563",
"0.6619535",
"0.66109",
"0.66041124",
"0.65989536",
"0.65933305",
"0.65006363",
"0.64774156",
"0.6440329",
"0.6431183... | 0.0 | -1 |
POST /tables POST /tables.json | def create
@user = User.find(current_user.id)
@game = Game.find(params[:table][:game_id])
@table = @game.tables.new(table_params)
respond_to do |format|
if @table.save
format.html { redirect_to event_path(@table.event_id), notice: 'Table was successfully created.' }
format.json { ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_table(payload)\n make_request(payload, 'post')\n [status, body]\n end",
"def create\n @table = Table.new(params[:table].permit(:name, :notes, :x, :y, :table_type, :guest_ids => []))\n\n respond_to do |format|\n if @table.save\n format.html { redirect_to @table, not... | [
"0.71995825",
"0.6958537",
"0.6655367",
"0.65125805",
"0.6499782",
"0.64549243",
"0.6439488",
"0.6385627",
"0.63580495",
"0.6298258",
"0.6286155",
"0.62820345",
"0.6239249",
"0.6210801",
"0.61801195",
"0.6169144",
"0.61352414",
"0.60895765",
"0.6078686",
"0.604869",
"0.603800... | 0.6146693 | 16 |
PATCH/PUT /tables/1 PATCH/PUT /tables/1.json | def update
respond_to do |format|
if @table.update(table_params)
format.html { redirect_to events_path, notice: 'Table was successfully updated.' }
format.json { render :show, status: :ok, location: @table }
else
format.html { render :edit }
format.json { render json: @ta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @table = Table.find(params[:id])\n\n respond_to do |format|\n if @table.update_attributes(params[:table].permit(:name, :notes, :x, :y, :table_type, :guest_ids => []))\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { head :no_conte... | [
"0.6816116",
"0.674384",
"0.66043234",
"0.6570151",
"0.64851904",
"0.6425202",
"0.63592273",
"0.6310712",
"0.62451744",
"0.62374204",
"0.6188622",
"0.6178531",
"0.6142197",
"0.60903335",
"0.6089645",
"0.5991083",
"0.5986409",
"0.59807545",
"0.5945786",
"0.59210235",
"0.591895... | 0.6277489 | 8 |
DELETE /tables/1 DELETE /tables/1.json | def destroy
@event = @table.event_id
@table.destroy
respond_to do |format|
format.html { redirect_to event_path(@event), notice: 'Table was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @table = Table.find(params[:id])\n @table.destroy\n\n respond_to do |format|\n format.html { redirect_to tables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @table = Table.find(params[:id])\n @table.destroy\n\n respond_to do |format|\n f... | [
"0.7384237",
"0.7384237",
"0.7384237",
"0.73649436",
"0.732233",
"0.732233",
"0.7173863",
"0.71224856",
"0.71210665",
"0.7106029",
"0.7067059",
"0.7062703",
"0.7062703",
"0.6963951",
"0.6902412",
"0.68696797",
"0.68580693",
"0.68477505",
"0.68457747",
"0.68417656",
"0.6804647... | 0.6325063 | 81 |
Use callbacks to share common setup or constraints between actions. | def set_table
@table = Table.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 table_params
params.require(:table).permit(:name, :owner, :game_id, :user_id, :event_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 |
Creole/Mediawiki style headlines (e.g. == Headline ==) | def find_sections_creole(content)
find_sections_regexp(content, /((\A|\s*\n)=+(.*?))=*\s*$/)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def headline; end",
"def make_headline level, text\n super_headline([4, level + 1].min, text)\n end",
"def headliner\n @headliner ||= artists.detect {|a| a.name == headliner_raw }\n end",
"def top_headlines(start = @start, per_page = @per_page, topic = @custom_topic)\r\n headlines = ... | [
"0.7111319",
"0.6795751",
"0.6437661",
"0.638563",
"0.6315416",
"0.6299028",
"0.62526435",
"0.6243485",
"0.61805815",
"0.61164963",
"0.60863096",
"0.6067172",
"0.6030809",
"0.60223204",
"0.5991618",
"0.5991618",
"0.59668475",
"0.5960163",
"0.593575",
"0.59229803",
"0.5874294"... | 0.0 | -1 |
ATX/Markdown style headlines (e.g. Headline) | def find_sections_atx(content)
find_sections_regexp(content, /((\A|\s*\n)#+(.*))$/)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def headline; end",
"def to_markdown_heading\n heading = to_heading\n to_markdown heading\n end",
"def markdown_heading_parser(content)\n content.gsub(/^.*#.*/) { |heading| \"<h1>#{heading[2..-1]}</h1>\" }\nend",
"def markdown_with_heading(heading = 1)\n \"\\n\\n<h#{heading.to_s} id=\\\"#{@name}... | [
"0.7084778",
"0.6643347",
"0.6634287",
"0.6633104",
"0.6616628",
"0.6612622",
"0.6572121",
"0.6552141",
"0.65166074",
"0.6429076",
"0.6393354",
"0.6371248",
"0.63696843",
"0.62378633",
"0.6167271",
"0.6119498",
"0.6112623",
"0.6058085",
"0.60400534",
"0.60032606",
"0.60032606... | 0.0 | -1 |
Returns section array [[Section start, section end, Position to insert edit link, section text], ...] | def find_sections(mime, content)
case mime.to_s
when %r{^text/x-(creole|mediawiki)$}
find_sections_creole(content)
when %r{^text/x-markdown}
find_sections_atx(content)
else
raise "Mime type #{mime} not supported by editsection filter"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sections\n (1..section_size).inject([]) do |array, row_offset|\n (1..section_size).inject(array) do |array, column_offset|\n array << section_coordinates(row_offset - 1, column_offset - 1)\n end\n end\n end",
"def section_contents\n used_sections = {}\n\n each_method... | [
"0.68593895",
"0.66121817",
"0.64789116",
"0.6288135",
"0.61155885",
"0.60486996",
"0.603894",
"0.6013441",
"0.59900975",
"0.5983615",
"0.59727794",
"0.5952064",
"0.5938511",
"0.5916091",
"0.5886754",
"0.5879708",
"0.5866667",
"0.5822932",
"0.5815067",
"0.58124036",
"0.579919... | 0.52652925 | 83 |
GET /admin_mbooks/1 GET /admin_mbooks/1.xml | def show
@mbook = Mbook.get(params[:id])
if @mbook.file_size == nil
file_size = round_to(File.size(@mbook.zipfile) / (1000.0 * 1000.0), 1)
@mbook.file_size = file_size
@mbook.save
end
if @mbook != nil
@board = "mbook"
@section = "show"
@menu_on = para... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @mbook = Admin::Mbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mbook }\n end\n end",
"def index\n @boms = Bom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boms }\n ... | [
"0.63481605",
"0.5960264",
"0.58223563",
"0.5775708",
"0.57744855",
"0.5729887",
"0.5724788",
"0.57209384",
"0.57109714",
"0.57109714",
"0.5682718",
"0.56434566",
"0.56047",
"0.5583248",
"0.5567326",
"0.5566023",
"0.55603987",
"0.5519103",
"0.5514732",
"0.5506516",
"0.5491515... | 0.5592629 | 13 |
GET /admin_mbooks/new GET /admin_mbooks/new.xml | def new
@mbook = Admin::Mbook.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @mbook }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @book = Book.new :copies => 1\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def create\n @mbook = Admin::Mbook.new(params[:mbook])\n\n respond_to do |format|\n if @mbook.save\n flash[:notice] = 'Admin:... | [
"0.71931666",
"0.69573843",
"0.6790961",
"0.67355114",
"0.66816705",
"0.6641756",
"0.6635907",
"0.66329825",
"0.6595891",
"0.6595891",
"0.6595891",
"0.6595891",
"0.6595891",
"0.6595891",
"0.6595891",
"0.6595891",
"0.65943664",
"0.658952",
"0.6561641",
"0.65430015",
"0.6536804... | 0.75696003 | 0 |
POST /admin_mbooks POST /admin_mbooks.xml | def create
@mbook = Admin::Mbook.new(params[:mbook])
respond_to do |format|
if @mbook.save
flash[:notice] = 'Admin::Mbook was successfully created.'
format.html { redirect_to(@mbook) }
format.xml { render :xml => @mbook, :status => :created, :location => @mbook }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @mbook = Admin::Mbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mbook }\n end\n end",
"def create\n @book = Book.new(admin_book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to admin_bo... | [
"0.60720414",
"0.54655474",
"0.5464791",
"0.5464137",
"0.5220896",
"0.5220896",
"0.5220896",
"0.52157545",
"0.5209997",
"0.51720846",
"0.5142498",
"0.51344126",
"0.5132902",
"0.5061137",
"0.5052521",
"0.503652",
"0.5020305",
"0.5017324",
"0.50163496",
"0.4991049",
"0.49870774... | 0.6677867 | 0 |
PUT /admin_mbooks/1 PUT /admin_mbooks/1.xml | def deleteSelection
chk_ids = params[:ids]
chks = chk_ids.split(",")
chks.each do |chk|
@mbook = Mbook.get(chk.to_i)
mbook_id = @mbook.id
mbook = @mbook
if @mbook != nil
if File.exists?(@mbook.zipfile)
FileUtils.rm_rf @mbook.zipfile
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @ref_mkb = Ref::Mkb.find(params[:id])\n\n respond_to do |format|\n if @ref_mkb.update_attributes(params[:ref_mkb])\n format.html { redirect_to @ref_mkb, notice: 'Mkb was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edi... | [
"0.5723465",
"0.56558555",
"0.56368715",
"0.56368715",
"0.56368715",
"0.55622405",
"0.55148613",
"0.54987663",
"0.5443984",
"0.5424119",
"0.5395796",
"0.5386815",
"0.5365927",
"0.536348",
"0.5362947",
"0.5358617",
"0.5301287",
"0.5278466",
"0.5274097",
"0.526347",
"0.52490324... | 0.0 | -1 |
POST /attendees POST /attendees.xml | def create
@attendee = current_user.attendees.build( :paper => @paper )
respond_to do |format|
if @attendee.save
format.html do
flash[:notice] = 'Attendee was successfully created.'
redirect_to paper_path(@paper)
end
format.xml { render :xml => @attendee, :st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n inc_id = 1\n unless @event.attendees.blank?\n inc_id = @event.attendees.last.attendee_id.gsub(@event.token_for_id, \"\").to_i + 1\n end\n params[:attendee][:attendee_id] = @event.token_for_id + \"%04d\" % inc_id\n params[:attendee][:a_platform] = params[:attendee][:a_platform].join... | [
"0.6386224",
"0.6330148",
"0.6252791",
"0.6202708",
"0.6201102",
"0.6133933",
"0.6099734",
"0.60965353",
"0.6088836",
"0.6064018",
"0.6029798",
"0.60008955",
"0.5984972",
"0.58826905",
"0.5855817",
"0.5834502",
"0.58014166",
"0.5791868",
"0.57913935",
"0.578253",
"0.577214",
... | 0.5780776 | 20 |
DELETE /attendees/1 DELETE /attendees/1.xml | def destroy
@attendee = current_user.attendees.find_by_id!(params[:id])
@attendee.destroy
respond_to do |format|
format.html do
flash[:notice] = 'Attendee correctly deleted.'
redirect_to paper_path(@paper)
end
format.xml { head :ok }
format.js { render :partial =>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @attend = Attend.find(params[:id])\n @attend.destroy\n\n respond_to do |format|\n format.html { redirect_to(attends_url) }\n format.xml { head :ok }\n end\n end",
"def deleteAttendee(name)\n RSVP.delete(@id,name)\n end",
"def destroy\n @attender = Attender.find(para... | [
"0.7138772",
"0.691905",
"0.67493457",
"0.66860384",
"0.66769207",
"0.6674366",
"0.66552407",
"0.66552407",
"0.6565742",
"0.6506246",
"0.63938427",
"0.639229",
"0.635438",
"0.635438",
"0.63510656",
"0.63453317",
"0.6336975",
"0.6318117",
"0.62433696",
"0.6241043",
"0.62216675... | 0.6447044 | 10 |
Recreates the Styles hash from the current config. | def reload
colors = Config.colors
foreground = Config.foreground
background = Config.background
Styles[:clear] = Qt::TextCharFormat.new { |fmt|
fmt.foreground = Qt::Brush.new(foreground)
fmt.background = Qt::Brush.new(background)
fmt.font_weight = Qt::Font::Normal
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_styles(event)\n return {} if event.metadata[:name].nil?\n\n STYLES.fetch(event.metadata[:name].to_sym, {})\n .dup\n .merge!(@styles[event.metadata[:name].to_sym] || {})\n end",
"def styles\n @styles ||= Hash.new{ |h, k| h[k] = {} }\n en... | [
"0.68154156",
"0.6717835",
"0.63249487",
"0.61130446",
"0.60496885",
"0.5927229",
"0.57797223",
"0.5758192",
"0.5704106",
"0.5635848",
"0.555865",
"0.55258447",
"0.5523212",
"0.55145997",
"0.54977375",
"0.5465615",
"0.54627436",
"0.54544026",
"0.5452653",
"0.5440594",
"0.5438... | 0.6118633 | 3 |
Inserts a string at a cursor | def insert(cursor, string)
string.split(Pattern).each_with_index do |str, i|
if i.even?
cursor.insert_text str
else
enable_ansi_code(cursor, str)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(chars)\n self[@cursor] = chars\n end",
"def insert(chars)\n self[@cursor] = chars\n end",
"def insert_text_at_cursor(text) \n\t\tinsert_text(@cursor_row, @cursor_col, text)\n\t\n\t\tif text.include?(\"\\n\")\n\t\t\t#todo what about multiple \\n's\n\t\t\t@cursor_row += 1\n\t\t... | [
"0.7631038",
"0.7631038",
"0.71388054",
"0.7077585",
"0.70437104",
"0.6985718",
"0.69724303",
"0.6773092",
"0.67694396",
"0.67527646",
"0.66528666",
"0.6359385",
"0.635371",
"0.62832755",
"0.6251975",
"0.62267846",
"0.6145896",
"0.61446613",
"0.6125001",
"0.6121941",
"0.61107... | 0.80838126 | 0 |
Applies an ANSI code to change text style. | def enable_ansi_code(cursor, code)
return if code[-1] != "m" # only graphics related codes are supported
ids = code[(code.index("[") + 1)...-1].split(";").each
loop do
case val = ids.next.to_i
when 38
case ids.next.to_i
when 5
if style = Styles[:color]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colorize(text, color_code); \"#{color_code}#{text}\\033[0m\"; end",
"def colorize(text, color_code); \"\\e[#{color_code}m#{text}\\e[0m\"; end",
"def colorize(text, color_code)\n \"#{color_code}#{text}\\033[0m\"\n end",
"def ansi(string, *codes)\n return string unless $ansi\n s = \"\"\n ... | [
"0.72861266",
"0.698234",
"0.6931008",
"0.6891829",
"0.6871016",
"0.68607384",
"0.6852392",
"0.6831853",
"0.67939925",
"0.678974",
"0.678974",
"0.678974",
"0.6757803",
"0.6756046",
"0.6730041",
"0.66481376",
"0.66317564",
"0.6493602",
"0.6460759",
"0.64093536",
"0.64061695",
... | 0.61748403 | 38 |
Convert the model to a hash all of the way down. | def to_h
hash = {}
attributes.each_pair do |key, value|
hash[key] = deep_unwrap(value)
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n model.hash + key.hash\n end",
"def to_hash() end",
"def hash\n [model, pk.nil? ? @values.sort_by{|k,v| k.to_s} : pk].hash\n end",
"def hash\n self.to_f.hash\n end",
"def model_to_hash(model)\n return {} if model.nil?\n HashUtils.symbolize_keys(model.attributes)\n end",... | [
"0.7035207",
"0.6949715",
"0.694347",
"0.68958044",
"0.6877828",
"0.68093926",
"0.6729615",
"0.67052376",
"0.65869904",
"0.65869904",
"0.64507115",
"0.6405328",
"0.62282664",
"0.62270325",
"0.62270325",
"0.62270325",
"0.62270325",
"0.62270325",
"0.62270325",
"0.6176139",
"0.6... | 0.0 | -1 |
Looks through the possible headers with this data, and extracts the raw value of the header Returns nil if not found | def locate_timestamp
return nil unless headers
header = HEADERS.find { |candidate| headers[candidate] }
if header
data = headers[header]
data.to_s.gsub(/(t=|\.)/, '')
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header_value\n return @header_value\n end",
"def get_header(name)\n headers.each do |key,value|\n if key.casecmp(name) == 0\n return value\n end\n end\n nil\n end",
"def header name\n headers.each_pair do |header_name, header_value... | [
"0.7251761",
"0.71430993",
"0.69700193",
"0.6964641",
"0.66839737",
"0.6668011",
"0.6668011",
"0.6541639",
"0.65220356",
"0.6518848",
"0.6471163",
"0.64229053",
"0.6389803",
"0.63826156",
"0.6337096",
"0.6333942",
"0.62297314",
"0.621151",
"0.61693734",
"0.615524",
"0.6062594... | 0.6154585 | 20 |
Returns a timestamp in fractional seconds since epoch | def parse(time_string)
Time.at("#{time_string[0,10]}.#{time_string[10,13]}".to_f)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_f\n\t\tseconds_since_unix_epoch.to_f\n\tend",
"def get_timestamp\n # Appending integer timestamp including second decimals\n now = Time.now.to_f * 10\n return now.round.to_s\n end",
"def usec_epoch(ts=Time.now)\n case ts\n when nil, \"\"\n (Time.now.to_f * 1_000_000).to_i\... | [
"0.78942376",
"0.75136274",
"0.7340285",
"0.73034275",
"0.7291699",
"0.7142318",
"0.707467",
"0.7036107",
"0.69202137",
"0.69142467",
"0.6902348",
"0.688915",
"0.6820619",
"0.6811819",
"0.679561",
"0.67296827",
"0.67044765",
"0.6664897",
"0.6539457",
"0.65321916",
"0.6527253"... | 0.0 | -1 |
Neutralizer We wrote a neutralize method that removes negative words from sentences. However, it fails to remove all of them. What exactly happens? Answer: The neutralize method is mutating the words array whilst trying to iterate through it, causing unexpected results as items are being deleted from the array as the e... | def neutralize(sentence)
words = sentence.split(' ')
words.each do |word|
words.delete(word) if negative?(word)
end
words.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neutralize(sentence)\n words = sentence.split(' ')\n\n # bug fix: \n # words.each do |word|\n # words.delete(word) if negative?(word)\n # end\n #\n # Can't delete while iterating. Use this instead:\n words.reject! { |word| negative?(word) }\n\n words.join(' ')\nend",
"def neutralize(sentence)\n w... | [
"0.8410136",
"0.82568026",
"0.8235103",
"0.8214969",
"0.8177365",
"0.8061721",
"0.8061721",
"0.6510957",
"0.6492547",
"0.6352305",
"0.6268295",
"0.6215997",
"0.6214757",
"0.5983584",
"0.59688",
"0.59261394",
"0.57901186",
"0.5733611",
"0.5729965",
"0.5729663",
"0.57283205",
... | 0.8225499 | 3 |
Expected: These cards are part of a board game. Actual: These boring cards are part of a board game. Fixed below | def neutralize(sentence)
words = sentence.split(' ')
ok_words = words.select do |word|
!negative?(word)
end
ok_words.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_it_has_cards\n assert_equal [@card_generator.cards[0], @card_generator.cards[1], @card_generator.cards[2], @card_generator.cards[3]], @card_generator.cards\n end",
"def test_deck_has_cards\n assert_equal [@card_1, @card_2, @card_3], @deck.cards\n end",
"def test_cards_are_unique\n #build a... | [
"0.7083479",
"0.698525",
"0.6730785",
"0.6596587",
"0.65881395",
"0.6577029",
"0.65331036",
"0.64850765",
"0.64793736",
"0.64765817",
"0.644493",
"0.6421585",
"0.6421181",
"0.6419224",
"0.6416575",
"0.6413799",
"0.6402763",
"0.6384308",
"0.63633525",
"0.6358498",
"0.6325575",... | 0.0 | -1 |
def start end def stop end def running? end | def tips
''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stopped?(*) end",
"def running; end",
"def running; end",
"def started?; end",
"def stopped?; end",
"def stopped?; end",
"def stopped?; end",
"def stopped?; end",
"def running?; end",
"def start; end",
"def start; end",
"def start; end",
"def start; end",
"def start; end",
"def star... | [
"0.78508294",
"0.77718645",
"0.77718645",
"0.7708627",
"0.76634276",
"0.76634276",
"0.76634276",
"0.76634276",
"0.76598233",
"0.7580294",
"0.7580294",
"0.7580294",
"0.7580294",
"0.7580294",
"0.7580294",
"0.7580294",
"0.7580294",
"0.7580294",
"0.7580294",
"0.7580294",
"0.75802... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_tenant_location
@tenant_location = TenantLocation.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def tenant_location_params
params.fetch(:tenant_location, {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Initialize all Locations' paths (ABC size is pretty big, but can't get around it) | def init_paths(locations)
locations['Enumerable Canyon'].add_paths_to(locations['Duck Type Beach'],
locations['Monkey Patch City'])
locations['Duck Type Beach'].add_paths_to(locations['Enumerable Canyon'],
locations['M... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initial_paths; end",
"def assign_paths\n self.path = generate_path(self)\n end",
"def initialize\n @paths = []\n @trace = 0\n end",
"def initialize_fringe\n [{\n city: @initial,\n path: [@initial],\n depth: 1,\n cost: 0\n }]\n end",
"def init_all_... | [
"0.718052",
"0.66260207",
"0.65415597",
"0.646176",
"0.624809",
"0.61924726",
"0.6178047",
"0.6177357",
"0.60902745",
"0.60722214",
"0.6060632",
"0.5938226",
"0.5932059",
"0.5932059",
"0.58853376",
"0.58541924",
"0.5853303",
"0.5835092",
"0.5834391",
"0.5830519",
"0.58084047"... | 0.7959292 | 0 |
Start Running the simulation for a prospector | def run
puts "Rubyist #{@rubyist.id} starting in #{@current_location.name}."
(1..@turns).each { |current_turn| prospect_location(current_turn) }
# Print Results of run
finished
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n puts 'Start Simulator'\n set_map\n x = 1\n while x <= @num_prospectors\n joe = Prospector.new(@map, MapFinder.new)\n run_simulation(x, joe)\n joe.see_results(x)\n x += 1\n end\n 1\n end",
"def run_simulation(num_prospector, joe)\n num_prospector = num_prospec... | [
"0.8202915",
"0.68640035",
"0.6465138",
"0.61820155",
"0.6157023",
"0.61456686",
"0.6113561",
"0.60957384",
"0.6061416",
"0.6026376",
"0.59815115",
"0.59497106",
"0.59450954",
"0.59450954",
"0.5940791",
"0.59244776",
"0.59086335",
"0.58948475",
"0.58905196",
"0.58905196",
"0.... | 0.58494866 | 24 |
Method for Prospecting each location | def prospect_location(current_turn)
rubies_found = @current_location.find_rubies(@rndm)
@rubyist.new_day
# For each set of rubies found, print them out and increment amounts
while rubies_found != [0, 0]
_no_use = ruby_format_print(rubies_found)
@rubyist.rubies_found(rubies_found[0], rubies_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locations; end",
"def show_locations\n @all_encounters = PatientEncounter\n @all_locations = {}\n @all_encounters.each do |x|\n @all_locations[x.location.id] = x.location.name\n end\n end",
"def locations\n # blank\n end",
"def map_locs\n [location]\n end",
"def map_locs\n ... | [
"0.674523",
"0.6362335",
"0.6309138",
"0.6303504",
"0.6303504",
"0.6256392",
"0.6228616",
"0.61964846",
"0.619432",
"0.6156801",
"0.6147549",
"0.6114863",
"0.6101942",
"0.6099261",
"0.6064486",
"0.6036445",
"0.6028992",
"0.60192364",
"0.6003337",
"0.59896034",
"0.59885037",
... | 0.6291045 | 5 |
Prints found rubies with correct grammar | def ruby_format_print(rubies)
real_ruby_noun = (rubies[0] > 1 ? 'rubies' : 'ruby')
fake_ruby_noun = (rubies[1] > 1 ? 'fake rubies' : 'fake ruby')
pri = ''
if rubies[0] > 0 && rubies[1] > 0
pri += "\tFound #{rubies[0]} #{real_ruby_noun} and #{rubies[1]} #{fake_ruby_noun} in #{@current_location.name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_rubies_found(rubies_found, fake_rubies_found, town)\n raise 'Ruby and/or Fake Ruby counts can not be < 0!' if rubies_found < 0 || fake_rubies_found < 0\n\n name = town.name\n if rubies_found.zero? && fake_rubies_found.zero?\n puts \"\\tFound no rubies or fake rubies in #{name}.\"\n elsif... | [
"0.5964679",
"0.58972806",
"0.5699891",
"0.5578014",
"0.556682",
"0.5544835",
"0.5544317",
"0.5534701",
"0.54758257",
"0.5469532",
"0.54350793",
"0.54318786",
"0.5429675",
"0.54252523",
"0.5405284",
"0.5387879",
"0.5383238",
"0.537837",
"0.53482056",
"0.5321313",
"0.5316257",... | 0.67274666 | 0 |
Prints the finishing statistics of a Rubyist's prospecting journey | def finished
day_noun = (@rubyist.days > 1 ? 'days' : 'day')
real_noun = (@rubyist.real_ruby_count.zero? || @rubyist.real_ruby_count > 1 ? 'rubies' : 'ruby')
fake_noun = (@rubyist.fake_ruby_count.zero? || @rubyist.fake_ruby_count > 1 ? 'fake rubies' : 'fake ruby')
puts "After #{@rubyist.days} #{day_noun... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_report\n print \"#{@state} will lose #{predicted_deaths} people in this outbreak\"\n print \" and will spread across the state in #{speed_of_spread} months.\\n\\n\"\n end",
"def print_final_report\n puts; puts; puts \"=== FINAL DATABASE COUNTS ===\"\n puts; puts end_of_task_report\n p... | [
"0.65595746",
"0.6422197",
"0.6123142",
"0.6093991",
"0.60803324",
"0.60464156",
"0.60408926",
"0.60267156",
"0.6024792",
"0.6020724",
"0.5948503",
"0.5906666",
"0.59046584",
"0.5902351",
"0.5875681",
"0.58746254",
"0.5863733",
"0.5853749",
"0.5849525",
"0.58468133",
"0.58166... | 0.5975318 | 10 |
Returns the template to be used when it's displayed. Overridden by AuraSubtyped. | def template
'show'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_template\n self.template\n end",
"def show_template\n self.template\n end",
"def template\n @template\n end",
"def template\n return @template\n end",
"def _template\n @template\n end",
"def template\n @__template\n end",
"def template\n @_ren... | [
"0.76624614",
"0.76624614",
"0.76446116",
"0.75149804",
"0.74990237",
"0.7489901",
"0.747629",
"0.74441373",
"0.7376226",
"0.7352533",
"0.72315395",
"0.71826726",
"0.71612865",
"0.7136272",
"0.7133776",
"0.7038148",
"0.7038148",
"0.69555247",
"0.6914692",
"0.6908448",
"0.6908... | 0.66879606 | 26 |
Grab a CONTENTdm object URI from a record | def select_cdm_identifier(record, _context)
uri = record.xpath(ID_XPATH, NS).map(&:text).reject(&:blank?)
uri.first if uri.any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_datastream_url_from_content_md(fedora_obj, filename, file_asset_pid_fld, file_ds_id_fld)\n if filename.is_a?(Symbol)\n filename = get_values_from_datastream(fedora_obj, \"contentMetadata\", filename)\n end\n file_asset_pid = get_values_from_datastream(fedora_obj, \"contentMetadata\", file_ass... | [
"0.6224225",
"0.6218472",
"0.602614",
"0.602614",
"0.5997924",
"0.5939529",
"0.5939529",
"0.58972913",
"0.58325976",
"0.5771077",
"0.57175606",
"0.5700456",
"0.5700456",
"0.5678244",
"0.56520754",
"0.56430835",
"0.5635688",
"0.5607472",
"0.56015617",
"0.56015617",
"0.5582667"... | 0.52973926 | 72 |
Get a value for `agg_preview` from a record | def extract_cdm_preview(responsive: true)
lambda do |rec, acc, ctx|
acc << cdm_thumbnail(select_cdm_identifier(rec, ctx), responsive: responsive)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview_id\n @attributes[:preview_id]\n end",
"def column_value(rec, drawer)\n rec.inspect\n end",
"def preview\n return @preview\n end",
"def format_fancygrid_value(record, leaf, value=nil, &format_block)\n if block_given?\n if defined?(Haml:... | [
"0.59175277",
"0.55456054",
"0.5403352",
"0.5366729",
"0.5310545",
"0.51926345",
"0.51926345",
"0.5125008",
"0.5121115",
"0.5120139",
"0.50768244",
"0.49629653",
"0.49609447",
"0.4918777",
"0.48970786",
"0.48931304",
"0.48880067",
"0.4886185",
"0.48677146",
"0.48605603",
"0.4... | 0.43001053 | 97 |
Construct a thumbnail URI from a CONTENTdm object URI. This method assumes that it receives a URI as returned from CONTENTdm's OAIPMH provider. Adapted from | def cdm_thumbnail(uri, responsive: true)
return uri.gsub('cdm/ref', 'digital/api/singleitem') + '/thumbnail' if uri.include?('cdm/ref') && responsive
return uri.gsub('cdm/ref', 'utils/getthumbnail') if uri.include?('cdm/ref')
# if `digital` is in the URI it's already served in the responsive UI
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thumbnail_url\n @thubnail_url ||= url_for_format('thumbnail', 'png')\n end",
"def thumbnail_url\n result_hash['thb']\n end",
"def public_url_custom_thumbnail_from(title, custom_width)\n metadata_or_default_img_from(title) do |metadata|\n custom_thumbnail_image_for(metadata.thumb... | [
"0.59577864",
"0.5932264",
"0.59107596",
"0.5841155",
"0.583967",
"0.5835765",
"0.5800813",
"0.5789102",
"0.57682586",
"0.5761521",
"0.57406926",
"0.5728998",
"0.57247144",
"0.57142264",
"0.57064515",
"0.5702919",
"0.5687373",
"0.56850386",
"0.56839097",
"0.56593907",
"0.5652... | 0.67919385 | 0 |
`now` data only lives for one response cycle (only for the current view being rendered) and will not persist to the next request because it gets overwritten on every instantiation of `Flash`. `flash` data will persist for this request and the next | def initialize(req)
flash_cookie = req.cookies['_rails_lite_app_flash']
@now = flash_cookie ? JSON.parse(flash_cookie) : {}
@flash = {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def now\n @flash\n end",
"def now\n @now ||= FlashNow.new(self)\n end",
"def set_flash_now(action)\n if f = options_for(action).flash_now\n flash.now[:notice] = f.is_a?(Proc) ? instance_eval(&f) : options_for(action).flash_now\n end\n end",
"def kee... | [
"0.7922205",
"0.72254807",
"0.6883798",
"0.66644543",
"0.66483414",
"0.66325325",
"0.65883654",
"0.6559388",
"0.6493138",
"0.64897764",
"0.64186066",
"0.6395258",
"0.6393671",
"0.6364058",
"0.63552254",
"0.63418555",
"0.6300698",
"0.62925595",
"0.6262346",
"0.6250287",
"0.623... | 0.62091213 | 23 |
persisting the flash cookie but flushing the now data | def [](notice)
@now[notice.to_s] || @now[notice.to_sym] || @flash[notice.to_s]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_flash(res)\n update_flash\n res.cookies << WEBrick::Cookie.new(@cookie_key, @cookie.to_json)\n end",
"def store_flash(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app_flash', @persist.to_json)\n end",
"def store_flash(res)\n cookie = WEBrick::Cookie.new(\"_rails_li... | [
"0.790135",
"0.78808695",
"0.78328407",
"0.7802059",
"0.77730256",
"0.76919067",
"0.76791775",
"0.7609175",
"0.7598481",
"0.7575276",
"0.7265131",
"0.71931183",
"0.7135871",
"0.71200305",
"0.68445957",
"0.634144",
"0.6326606",
"0.6324642",
"0.63006616",
"0.6300071",
"0.626747... | 0.0 | -1 |
Undefine a previously defined throttle | def undefine_throttle(method_name)
rocket_job_throttles.delete_if { |throttle| throttle.method_name == method_name }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def undefine_batch_throttle(method_name)\n rocket_job_batch_throttles.delete_if { |throttle| throttle.method_name == method_name }\n end",
"def stop_throttling\n @timer.cancel\n @timer = nil\n end",
"def throttle=(_arg0); end",
"def throttle; end",
"def rate_limit_reset(throttl... | [
"0.7417651",
"0.70629364",
"0.6520869",
"0.6363322",
"0.5998425",
"0.5976458",
"0.5959866",
"0.5872846",
"0.58396995",
"0.58396995",
"0.57200164",
"0.57200164",
"0.5636079",
"0.56237805",
"0.5622783",
"0.56084245",
"0.55671436",
"0.55258816",
"0.54893696",
"0.5461762",
"0.545... | 0.7698915 | 0 |
Has a throttle been defined? | def throttle?(method_name)
rocket_job_throttles.any? { |throttle| throttle.method_name == method_name }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def throttle?\n false\n end",
"def throttled?\n @throttle >= params[:throttle].value\n end",
"def throttle?\n parser.throttle?\n end",
"def throttled?\n publisher.throttled?\n end",
"def can_throttle?\n [threshold, period].select(&:zero?).empty?\n end",
"de... | [
"0.8356666",
"0.818106",
"0.8018501",
"0.77560544",
"0.7749384",
"0.7686504",
"0.7386515",
"0.71155685",
"0.7098915",
"0.7022466",
"0.6868088",
"0.6595385",
"0.65743715",
"0.6553145",
"0.6537557",
"0.6410284",
"0.6369037",
"0.63556975",
"0.63513404",
"0.63463813",
"0.63038504... | 0.74553865 | 6 |
Default throttle to use when the throttle is exceeded. When the throttle has been exceeded all jobs of this class will be ignored until the next refresh. `RocketJob::Config::re_check_seconds` which by default is 60 seconds. | def throttle_filter_class
{:_type.nin => [self.class.name]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def throttle\n 5\n end",
"def default_options\n { throttle: 'throttle' }\n end",
"def throttle\n sleep @throttle if @@last_request + @throttle > Time.now\n @@last_request = Time.now\n end",
"def throttle\n elapsed = Time.now - self.last_call\n if elapsed < 0.4\n... | [
"0.6807202",
"0.6717991",
"0.6502066",
"0.6253111",
"0.62394977",
"0.619531",
"0.6167675",
"0.6088891",
"0.6023028",
"0.5967813",
"0.5927952",
"0.58939034",
"0.5877766",
"0.5869764",
"0.58656454",
"0.5840844",
"0.5816667",
"0.5816667",
"0.58142775",
"0.5750919",
"0.57402486",... | 0.0 | -1 |
Filter out only this instance of the job. When the throttle has been exceeded this job will be ignored by this server until the next refresh. `RocketJob::Config::re_check_seconds` which by default is 60 seconds. | def throttle_filter_id
{:id.nin => [id]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def undefine_throttle(method_name)\n rocket_job_throttles.delete_if { |throttle| throttle.method_name == method_name }\n end",
"def rocket_job_evaluate_throttles\n rocket_job_throttles.each do |throttle|\n # Throttle exceeded?\n next unless send(throttle.method_... | [
"0.59408826",
"0.59393185",
"0.5821178",
"0.5785145",
"0.5751656",
"0.56957734",
"0.56138176",
"0.5610896",
"0.5601052",
"0.5524264",
"0.5468362",
"0.5409279",
"0.52661645",
"0.52329344",
"0.52303326",
"0.52024734",
"0.5187192",
"0.51768875",
"0.5172892",
"0.5121801",
"0.5100... | 0.5035253 | 22 |
Returns the matching filter, or nil if no throttles were triggered. | def rocket_job_evaluate_throttles
rocket_job_throttles.each do |throttle|
# Throttle exceeded?
next unless send(throttle.method_name)
logger.debug { "Throttle: #{throttle.method_name} has been exceeded. #{self.class.name}:#{id}" }
filter = throttle.filter
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_filter\n filters[1..-1].inject(filters.first){|a,b| @object.send(b[1].to_sym) ? b : a }[1]\n end",
"def get_filter\n if params[:jobfilter] && filters.any? { |f| f.filter_id == params[:jobfilter] }\n params[:jobfilter]\n end\n end",
"def current_filter\n filters[@proce... | [
"0.6035591",
"0.5929905",
"0.58916986",
"0.5728971",
"0.55748385",
"0.5572995",
"0.5433629",
"0.5289145",
"0.52822304",
"0.5274103",
"0.52196175",
"0.5210759",
"0.5210184",
"0.5209999",
"0.52080977",
"0.5181908",
"0.5154295",
"0.5136659",
"0.51122594",
"0.5111912",
"0.5110895... | 0.60002816 | 1 |
GET /actividades/new GET /actividades/new.xml | def new
@actividad = current_usuario.institucion.actividades.new
@instituciones = current_usuario.institucion.familia_activa
respond_to do |format|
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @actividad = Actividad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @actividad }\n end\n end",
"def new\n @activo = Activo.new\n @marcas = Marca.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n form... | [
"0.76491123",
"0.7244155",
"0.7187598",
"0.7169669",
"0.7107931",
"0.7100721",
"0.7095062",
"0.70809233",
"0.70705557",
"0.70687455",
"0.7067727",
"0.7067727",
"0.7053901",
"0.70526946",
"0.7046739",
"0.7041818",
"0.7041522",
"0.7040581",
"0.7040501",
"0.70404243",
"0.7034229... | 0.0 | -1 |
POST /actividades POST /actividades.xml | def create
@actividad = @solicitud.actividades.new(params[:actividad])
@actividades = @solicitud.actividades
respond_to do |format|
if @actividad.save
flash[:success] = 'Asignacion creada con exito.'
format.js
else
@actividad.institucion_id = current_usuario.institucion_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @actividad = Actividad.new(params[:actividad])\n\n respond_to do |format|\n if @actividad.save\n format.html { redirect_to(@actividad, :notice => 'Actividad was successfully created.') }\n format.xml { render :xml => @actividad, :status => :created, :location => @actividad }\... | [
"0.6367071",
"0.5967194",
"0.5868254",
"0.58353895",
"0.5720643",
"0.57090026",
"0.56868756",
"0.56548834",
"0.56173563",
"0.561643",
"0.5597291",
"0.5588733",
"0.5570968",
"0.55690736",
"0.55601346",
"0.5541746",
"0.5537945",
"0.55222005",
"0.55201733",
"0.5507053",
"0.55036... | 0.54903406 | 21 |
PUT /actividades/1 PUT /actividades/1.xml | def update
@actividad = Actividad.find(params[:id])
respond_to do |format|
if @actividad.update_attributes(params[:actividad])
flash[:notice] = 'Actividad was successfully updated.'
format.html { redirect_to(@actividad) }
format.xml { head :ok }
else
format.html { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @activo = Activo.find(params[:id])\n \n respond_to do |format|\n if @activo.update_attributes(params[:activo])\n format.html { redirect_to(@activo, :notice => 'Activo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action ... | [
"0.6639048",
"0.6606544",
"0.65221363",
"0.63619184",
"0.6337493",
"0.62946504",
"0.6286842",
"0.6284782",
"0.62187254",
"0.61948156",
"0.6187404",
"0.6160893",
"0.61532503",
"0.61303663",
"0.6083168",
"0.6069596",
"0.6065959",
"0.6037455",
"0.60211414",
"0.6016216",
"0.60116... | 0.6610421 | 1 |
DELETE /actividades/1 DELETE /actividades/1.xml | def destroy
@actividad = @institucion.actividades.find(params[:id])
@actividad.destroy
flash[:success] = 'La asignación ha sido removida con exito.'
respond_to do |format|
format.html { redirect_to(laip_solicitud_url(@solicitud)) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @actividad = Actividad.find(params[:id])\n @actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to(actividads_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activo = Activo.find(params[:id])\n @activo.destroy\n\n respond_to do |form... | [
"0.69808227",
"0.683834",
"0.6833843",
"0.67360413",
"0.67191774",
"0.6715068",
"0.66877717",
"0.6632401",
"0.663195",
"0.6608042",
"0.65801996",
"0.65789837",
"0.6573913",
"0.65584326",
"0.6548141",
"0.6533755",
"0.6533755",
"0.6533755",
"0.65293413",
"0.65259534",
"0.652431... | 0.6575187 | 12 |
cambia estado de actividad | def marcar_como_completada
@actividad = Actividad.find(params[:id])
respond_to do |format|
if @actividad.marcar_como_terminada
flash[:success] = 'Asignacion marcada como Completada.'
else
c_errores = "Asignacion no pudo ser actualizada. "
@actividad.errors.full_messages.each... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activate\n @status = true\n end",
"def activate\n self.status = \"Active\"\n end",
"def active; end",
"def active; end",
"def activate\n self.status = 'current'\n self.save\n end",
"def activate!\n self.status = 'Active'\n nil\n end",
"def activate\n self.... | [
"0.6976901",
"0.69724596",
"0.6896288",
"0.6896288",
"0.68327236",
"0.6675393",
"0.6645323",
"0.6629916",
"0.6629557",
"0.6617901",
"0.661614",
"0.6594226",
"0.6592127",
"0.6589145",
"0.65863603",
"0.65578187",
"0.6555647",
"0.6547253",
"0.6512197",
"0.6512197",
"0.6508675",
... | 0.0 | -1 |
put hash or string redirection that you normally expect | def setup
@controller = InvoicesController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@first = Invoice.find(:first)
@request.user_agent = 'Firefox'
@request.host = "quentin.#{DOMAIN_NAME}"
login_as :quentin
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect(uri, verb = T.unsafe(nil)); end",
"def redirects; end",
"def redirect_ok=(_arg0); end",
"def redirect_ok=(follow); end",
"def follow_redirection(&block); end",
"def follow_get_redirection(&block); end",
"def redirect(url); end",
"def redirection_history=(_arg0); end",
"def permanent_re... | [
"0.61593276",
"0.6094225",
"0.5911103",
"0.5898328",
"0.58767384",
"0.5812884",
"0.57611",
"0.5758048",
"0.5750756",
"0.57231957",
"0.567381",
"0.567381",
"0.5667744",
"0.56318015",
"0.562606",
"0.55961543",
"0.55852264",
"0.5581992",
"0.5543837",
"0.55402386",
"0.55402386",
... | 0.0 | -1 |
Could be put in a Helper library and included at top of test class | def check_attrs(attr_list)
attrs = []
attr_list.each do |attr_sym|
attr = assigns(attr_sym.to_sym)
assert_not_nil attr, "Attribute @#{attr_sym} should not be nil"
assert !attr.new_record?, "Should have saved the @#{attr_sym} obj" if attr.class == ActiveRecord
attrs << attr
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def testing\n # ...\n end",
"def test_case; end",
"def my_tests\n end",
"def tests; end",
"def tests; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
... | [
"0.6830563",
"0.6830563",
"0.6830563",
"0.68087536",
"0.6676323",
"0.6641809",
"0.6631596",
"0.6631596",
"0.66196847",
"0.66196847",
"0.66196847",
"0.66196847",
"0.66196847",
"0.66196847",
"0.66196847",
"0.66196847",
"0.66196847",
"0.66196847",
"0.66196847",
"0.66196847",
"0.... | 0.0 | -1 |
GET /liquidacions/1 GET /liquidacions/1.json | def show
@liquidacion = Liquidacion.find(params[:id])
#Obtengo todos los conceptos de la liquidacion
@concepto_liquidacion = ConceptoLiquidacion.select("*")
.joins('LEFT JOIN liquidacions ON liquidacions.id = concepto_liquidacions.liquidacion_id')
.joins('RIGHT JOIN conceptos ON conceptos.id = conc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @liquidacion = Liquidacion.new\n\n #Levanto de conceptos, todos los conceptos que son requeridos para liquidacion de auxiliares \n @conceptos = Concepto.where(:anhomes => 201407).order(:codigo_concepto) \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { r... | [
"0.61642355",
"0.59398663",
"0.581509",
"0.5808415",
"0.580835",
"0.5790863",
"0.57516676",
"0.57415247",
"0.573233",
"0.57305306",
"0.57187116",
"0.5717739",
"0.57056385",
"0.5692411",
"0.5691347",
"0.5688036",
"0.5688036",
"0.5688036",
"0.56825626",
"0.56792146",
"0.5677172... | 0.6511267 | 0 |
GET /liquidacions/new GET /liquidacions/new.json | def new
@liquidacion = Liquidacion.new
#Levanto de conceptos, todos los conceptos que son requeridos para liquidacion de auxiliares
@conceptos = Concepto.where(:anhomes => 201407).order(:codigo_concepto)
respond_to do |format|
format.html # new.html.erb
format.json { render json: @... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @lift = Lift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lift }\n end\n end",
"def new\n @pot = Pot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pot }\n end\n end",
"def ... | [
"0.67714447",
"0.6688525",
"0.66879463",
"0.6663442",
"0.6621081",
"0.6619738",
"0.6608888",
"0.66002256",
"0.659491",
"0.65879154",
"0.6561539",
"0.6559988",
"0.6551639",
"0.65327114",
"0.65325356",
"0.6522426",
"0.65142554",
"0.6497515",
"0.6496903",
"0.64948326",
"0.648098... | 0.71781516 | 0 |
POST /liquidacions POST /liquidacions.json | def create
@liquidacion = Liquidacion.new(params[:liquidacion])
respond_to do |format|
if @liquidacion.save
calcular_conceptos(@liquidacion)
format.html { redirect_to @liquidacion, notice: 'Se ha creado una nueva liquidacion' }
format.json { render json: @liquidacion, st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @liquidacion = Liquidacion.new\n\n #Levanto de conceptos, todos los conceptos que son requeridos para liquidacion de auxiliares \n @conceptos = Concepto.where(:anhomes => 201407).order(:codigo_concepto) \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { r... | [
"0.5773237",
"0.54383534",
"0.54383534",
"0.54383534",
"0.54161125",
"0.533626",
"0.5318888",
"0.5228889",
"0.52061653",
"0.5145017",
"0.51440054",
"0.51081836",
"0.51081836",
"0.5101947",
"0.5096067",
"0.50667423",
"0.50415945",
"0.50291914",
"0.4997373",
"0.49967286",
"0.49... | 0.6419794 | 0 |
PUT /liquidacions/1 PUT /liquidacions/1.json | def update
@liquidacion = Liquidacion.find(params[:id])
@liquidacion.update_attributes(params[:liquidacion])
#Elimino todos los conceptos incluidos en la liquidacion
@conceptos_liquidacion = ConceptoLiquidacion.where(:liquidacion_id => @liquidacion.id)
@conceptos_liquidacion.each do |co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @fatura.update(fatura_params)\n format.html { redirect_to @fatura, notice: 'Fatura alterada com sucesso.' }\n format.json { render :show, status: :ok, location: @fatura }\n else\n if @fatura.errors.full_messages_for(:liquidacao).present?\n ... | [
"0.6063718",
"0.56537664",
"0.5552012",
"0.544306",
"0.5430368",
"0.5420028",
"0.54089063",
"0.53910387",
"0.53781235",
"0.536388",
"0.53562325",
"0.53522956",
"0.5347088",
"0.5337188",
"0.5333866",
"0.5331946",
"0.53275377",
"0.53251195",
"0.53186595",
"0.5304596",
"0.529601... | 0.6470307 | 0 |
DELETE /liquidacions/1 DELETE /liquidacions/1.json | def destroy
@liquidacion = Liquidacion.find(params[:id])
#Elimino todos los conceptos incluidos en la liquidacion
@conceptos_liquidacion = ConceptoLiquidacion.where(:liquidacion_id => @liquidacion.id)
@conceptos_liquidacion.each do |concepto|
concepto.destroy
end
@liquidacion.destroy
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @dynamique = Dynamique.find(params[:id])\n @dynamique.destroy\n\n respond_to do |format|\n format.html { redirect_to dynamiques_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete\n clie... | [
"0.6958415",
"0.67803067",
"0.67203045",
"0.6715074",
"0.67050886",
"0.66979396",
"0.6683931",
"0.66786236",
"0.6664312",
"0.66642636",
"0.66595054",
"0.66542315",
"0.6650587",
"0.6649117",
"0.663971",
"0.66190827",
"0.6614226",
"0.66130465",
"0.66116244",
"0.6607451",
"0.660... | 0.737746 | 0 |
Calculo el total de la sumatoria de los elementos contenidos en el hash | def calcular_total hash
p hash.inject(0) { |sum, tuple| sum += tuple[1] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(hash)\n result = 0\n hash.each do |k, v|\n result += k * v\n end\n result\n end",
"def total_students(hash)\n\ttotal = 0\n\thash.each { |key, value| total += value }\n\treturn total\nend",
"def hash_sum\n total = 0\n places_hash.each do |k, v|\n total = total + v\n end\n return... | [
"0.7499845",
"0.74953955",
"0.74671084",
"0.72928995",
"0.72469693",
"0.7224386",
"0.71335655",
"0.71109974",
"0.70319974",
"0.69062275",
"0.68620104",
"0.68588114",
"0.68511087",
"0.68228626",
"0.68179345",
"0.680873",
"0.680273",
"0.67844254",
"0.67683077",
"0.67503434",
"0... | 0.83247536 | 0 |
affichage d'une calendrier pour un logement | def index
calendriers = Calendrier.find_by(logement_id:params[:logement_id])
promotion = Promotion.where(logement_id:params[:logement_id])
delaimin = calendriers.delaimin
nuitmin =calendriers.nuitmin
ouvrir = calendriers.ouvrir
tarif = calendriers.tarif
debut = calendriers.startDate
fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apport_calorique(repas)\n @calrep = 0\n #on fait la somme des calories acquises ce jour\n repas.each do |r|\n @calrep += r.calories\n end\n @calrep.round\n end",
"def gregorian\n # super doesn't call #new_start on MRI, so each method has to be\n # individually overridden.\n ... | [
"0.5915089",
"0.58996445",
"0.5822096",
"0.5643483",
"0.54465795",
"0.5446421",
"0.541169",
"0.5402946",
"0.5375385",
"0.5373419",
"0.53572917",
"0.53531736",
"0.5335251",
"0.5326464",
"0.53231937",
"0.5313202",
"0.5295402",
"0.5279343",
"0.5277727",
"0.52742946",
"0.5267729"... | 0.5199225 | 25 |
affichage des calendrier pour tous les logements avec le tarif | def tout
#propriétaire
# Block execution if there is no current user
if(current_user.blank?)
return render json:{
errors: "true",
message: "User not connected"
}, status: 401
end
user = current_user
logements = Logement.where(user_id: user)
tarif = []
#=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apport_calorique(repas)\n @calrep = 0\n #on fait la somme des calories acquises ce jour\n repas.each do |r|\n @calrep += r.calories\n end\n @calrep.round\n end",
"def index\n calendriers = Calendrier.find_by(logement_id:params[:logement_id])\n promotion = Promotion.where(logement... | [
"0.66258895",
"0.57975477",
"0.5709297",
"0.5666658",
"0.5627156",
"0.5602912",
"0.5565931",
"0.555258",
"0.5546203",
"0.55352676",
"0.5522148",
"0.55199",
"0.5498905",
"0.5497959",
"0.5433296",
"0.5426134",
"0.540469",
"0.53726214",
"0.53455615",
"0.5343032",
"0.533622",
"... | 0.0 | -1 |
For uploading pages we want to select a default layout to apply to it, which can later be overridden by the user in the CMS UI. This is to allow automated upload of new pages found locally where we have no idea of layout to us | def find_default_layout_name(default_layout)
default_layout_path = nil
if default_layout
layout_entries = list.detect { | cms_entry |
cms_entry[1][:system_name] == default_layout
}
else
layout_entries = list.detect { | cms_entry |
cms_entry[1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_layout\n 'default' if html?\n end",
"def default_layout\n @user = User.current\n # remove block in all groups\n @user.pref[:my_page_layout] = nil\n @user.pref.save\n redirect_to :action => 'page_layout'\n end",
"def set_layout\n if %w( print plain ).include? params[:layout]\... | [
"0.7467339",
"0.7449194",
"0.73963624",
"0.72940373",
"0.72468",
"0.70873916",
"0.7032923",
"0.70079917",
"0.69570976",
"0.6917626",
"0.6887942",
"0.6830059",
"0.6806061",
"0.6767568",
"0.6767529",
"0.6750019",
"0.6714437",
"0.6714437",
"0.6708276",
"0.6681889",
"0.66507596",... | 0.7274994 | 4 |
Some keys are system_names and they can have a '/' in them that causes creation of folders that are not sections in the CMS. Track the list of these folders so we can avoid false negatives on diff and upload | def build_implicit_folders_list(cms_list)
folder_list = {}
STDERR.puts "\n"
cms_list.each do |key, entry|
if key.include?(File::SEPARATOR)
Pathname.new(key).dirname.descend { |directory|
directory_name = directory.to_s
if directory_name =~ /[A-Z... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subdirectory_keys(key)\n raise \"subclass responsibility\"\n end",
"def check_directories\n new_file_names = {}\n DirmonEntry.enabled.each do |entry|\n entry.each do |pathname|\n # BSON Keys cannot contain periods\n key = pathname.to_s.tr('.', ... | [
"0.6352474",
"0.61548835",
"0.6153175",
"0.614881",
"0.6059033",
"0.60078365",
"0.5949466",
"0.59097683",
"0.59097683",
"0.58644223",
"0.58611816",
"0.58417153",
"0.5805861",
"0.5802662",
"0.5796629",
"0.5769162",
"0.57405186",
"0.56959635",
"0.56890565",
"0.56886613",
"0.567... | 0.7114729 | 0 |
Load savedata from the file (Return nil if the file does not exist) | def read
return nil if FileTest.exist?(@fname)==false
open(@fname,"rb") do |file| #Read & Binary mode
@data = Marshal.load(file)
end
@data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_file\n @data_file ||= FileData.new(\"data.yml\")\n end",
"def load(file_path); end",
"def load(file_path); end",
"def load\n return unless @file_path && File.exist?(@file_path)\n File.open(@file_path, 'rb') do |file|\n return Marshal.load(file)\n end\n end",
... | [
"0.6826245",
"0.67768794",
"0.67768794",
"0.67651075",
"0.6737643",
"0.67076886",
"0.66448826",
"0.66448826",
"0.6635154",
"0.66265327",
"0.6600475",
"0.6582969",
"0.6557101",
"0.6505198",
"0.6499113",
"0.6498349",
"0.6442965",
"0.6439414",
"0.643694",
"0.643477",
"0.64295655... | 0.5776993 | 96 |
Write savedata to file | def write
open(@fname,"wb") do |file|
Marshal.dump(@data,file)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save!; File.write @path, @data end",
"def save\n pathname.open('w') { |file| file.write(data) }\n end",
"def write_save_data(file)\r\n write_characters(file)\r\n write_frame(file)\r\n write_setup(file)\r\n write_data(file)\r\n end",
"def save(data)\n File.open(@local_file_pa... | [
"0.81523746",
"0.8133248",
"0.7858473",
"0.7771996",
"0.77117366",
"0.77094",
"0.75518996",
"0.75518996",
"0.73413867",
"0.73222816",
"0.7262999",
"0.722902",
"0.7217229",
"0.7186309",
"0.7186309",
"0.71812373",
"0.71478766",
"0.7118577",
"0.70869535",
"0.70702887",
"0.706973... | 0.7645683 | 6 |
fixed new in rides, params were wrong | def new
@all_NY_counties = Ride.all_NYcounties
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_ride_info \n @color = params[:car_color] \n @model = params[:car_model] \n @number = params[:car_number] \n @seats = params[:seats] \n @smoking = params[:smoking] \n @air_conditioner = params[:air_conditioner]\n @trunk = params[:trunk] \n @name = params[:name] \n @girls = para... | [
"0.6717018",
"0.64571565",
"0.6435552",
"0.6348021",
"0.631423",
"0.63071597",
"0.629658",
"0.6225816",
"0.62249315",
"0.6208903",
"0.6187306",
"0.6180523",
"0.6177462",
"0.61311877",
"0.60933256",
"0.60658973",
"0.5888083",
"0.5887554",
"0.5882711",
"0.58818066",
"0.58818066... | 0.5469456 | 48 |
The factory's root certificate. | def ca_cert
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def certificate_path\n\t\t\tFile.join(@root, \"#{@hostname}.crt\")\n\t\tend",
"def certificate\n _get_certificate\n end",
"def create_root_certificate(info = {})\n root_key = OpenSSL::PKey::RSA.new(RSA_KEY_SIZE)\n root_ca = create_certificate_skeleton(info)\n\n root_ca.issuer = root_ca.subject... | [
"0.68226045",
"0.64995056",
"0.6479654",
"0.64719313",
"0.6455775",
"0.6455775",
"0.6366748",
"0.6366748",
"0.6366748",
"0.63660324",
"0.63660324",
"0.62955326",
"0.62782586",
"0.6263951",
"0.625539",
"0.61689055",
"0.6130343",
"0.61207765",
"0.61207765",
"0.6105428",
"0.6096... | 0.5853192 | 33 |
GET /image_libraries GET /image_libraries.json | def index
@image_libraries = ImageLibrary.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end",
"def index\n @libraries = Library.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json... | [
"0.6449989",
"0.63024956",
"0.6231106",
"0.611764",
"0.608297",
"0.6063031",
"0.6062393",
"0.60546213",
"0.59245473",
"0.5920742",
"0.5870702",
"0.5866154",
"0.5825273",
"0.5807308",
"0.57570887",
"0.5755676",
"0.5743743",
"0.57307434",
"0.5702289",
"0.57006216",
"0.5682636",... | 0.7224387 | 0 |
GET /image_libraries/1 GET /image_libraries/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @image_libraries = ImageLibrary.all\n end",
"def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end",
"def show\n @photo_library = PhotoLibrary.find(params[:id])... | [
"0.71120566",
"0.64439666",
"0.63363355",
"0.6319165",
"0.6305216",
"0.61458224",
"0.61457217",
"0.60627764",
"0.60258144",
"0.59981567",
"0.5987163",
"0.5983232",
"0.59763044",
"0.5966184",
"0.5964287",
"0.5957972",
"0.5955795",
"0.5952288",
"0.59232706",
"0.59224856",
"0.59... | 0.0 | -1 |
POST /image_libraries POST /image_libraries.json | def create
@image_library = ImageLibrary.new(image_library_params)
respond_to do |format|
if @image_library.save
format.html { redirect_to @image_library, notice: 'Image library was successfully created.' }
format.json { render action: 'show', status: :created, location: @image_library }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @photo_library = PhotoLibrary.new(params[:photo_library])\n\n respond_to do |format|\n if @photo_library.save\n format.html { redirect_to @photo_library, notice: 'Photo library was successfully created.' }\n format.json { render json: @photo_library, status: :created, location... | [
"0.62153643",
"0.6148437",
"0.613905",
"0.59547",
"0.58786935",
"0.5869966",
"0.5836115",
"0.58258003",
"0.5818778",
"0.57976615",
"0.5770429",
"0.5769253",
"0.5763346",
"0.57471675",
"0.57262784",
"0.57200223",
"0.5641246",
"0.5630938",
"0.5551778",
"0.5547323",
"0.55385816"... | 0.70130515 | 0 |
PATCH/PUT /image_libraries/1 PATCH/PUT /image_libraries/1.json | def update
respond_to do |format|
if @image_library.update(image_library_params)
format.html { redirect_to @image_library, notice: 'Image library was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @library.update(library_params)\n format.html { redirect_to api_ver_library_path(id: @library.red_id), notice: 'Library was successfully updated.' }\n format.json { render json: @library, status: :ok }\n else\n format.html { render edit_api... | [
"0.6163557",
"0.61364394",
"0.6073882",
"0.5928294",
"0.59063613",
"0.588945",
"0.5859643",
"0.5842944",
"0.58349663",
"0.5823173",
"0.5818192",
"0.5770534",
"0.5764082",
"0.5610684",
"0.55946726",
"0.55858874",
"0.5577346",
"0.55681133",
"0.55668086",
"0.5547278",
"0.5516022... | 0.6724263 | 0 |
DELETE /image_libraries/1 DELETE /image_libraries/1.json | def destroy
@image_library.destroy
respond_to do |format|
format.html { redirect_to image_libraries_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @photo_library = PhotoLibrary.find(params[:id])\n @photo_library.destroy\n\n respond_to do |format|\n format.html { redirect_to photo_libraries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_reference.destroy\n respond_to do |format|\n ... | [
"0.68763024",
"0.6731855",
"0.6666491",
"0.6656578",
"0.6587071",
"0.65857816",
"0.6564611",
"0.6562229",
"0.65459406",
"0.6540996",
"0.6489187",
"0.6463902",
"0.6456332",
"0.6451373",
"0.64388835",
"0.64342827",
"0.6430519",
"0.64245886",
"0.64229023",
"0.6417479",
"0.641497... | 0.7501946 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_image_library
@image_library = ImageLibrary.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 image_library_params
params.require(:image_library).permit(:name)
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 |
Create a Hash representing the Solr doc to be written to Solr, based on MODS and public_xml | def doc_hash
@doc_hash ||= begin
doc_hash = GDor::Indexer::SolrDocHash.new id: resource.bare_druid, modsxml: smods_rec.to_xml
hash_from_mods = doc_hash_from_mods # defined in gdor_mods_fields
doc_hash.merge!(hash_from_mods) if hash_from_mods
doc_hash
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_solr(solr_doc = Hash.new())\n super(solr_doc) # Run the default solrization behavior\n\n # Extract a creation year field\n if self.origin_info.copyright.any? && !self.origin_info.copyright.first.blank?\n creation_date = self.origin_info.copyright.first\n solr_doc[\"creation_year... | [
"0.6948389",
"0.68179613",
"0.677989",
"0.6752075",
"0.66725373",
"0.6552453",
"0.65127313",
"0.64686334",
"0.64319426",
"0.63577837",
"0.63156265",
"0.63100374",
"0.6261471",
"0.62515634",
"0.6239855",
"0.6226685",
"0.6186607",
"0.61778706",
"0.6171326",
"0.61452323",
"0.614... | 0.77454156 | 0 |
return the MODS for the druid as a Stanford::Mods::Record object | def smods_rec
@smods_rec ||= begin
mods_rec = resource.smods_rec
mods_rec.druid = druid # why?
mods_rec
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_mods(fn, druid)\n FileUtils.mkdir_p File.dirname(fn)\n File.open(fn, 'w') { |f| f << Dor::Item.find(\"druid:#{druid}\").descMetadata.ng_xml.to_xml }\n end",
"def retrieve_mods(fn, druid)\n FileUtils.mkdir_p File.dirname(fn)\n File.open(fn, 'w') { |f| f << D... | [
"0.6226671",
"0.6226671",
"0.54228127",
"0.52328545",
"0.5162835",
"0.5052762",
"0.49973944",
"0.49721175",
"0.496321",
"0.49351898",
"0.49327978",
"0.48074952",
"0.47625446",
"0.475581",
"0.47333512",
"0.4725672",
"0.47150818",
"0.47077206",
"0.46707824",
"0.46652126",
"0.46... | 0.5890014 | 2 |
the public_xml for the druid as a Nokogiri::XML::Document object | def public_xml
resource.public_xml
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def document\n @doc ||= Nokogiri::XML(@xml)\n end",
"def document\n return nil if @document.nil?\n @document.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)\n end",
"def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n xml\n end",
"def volume ... | [
"0.6986484",
"0.6753747",
"0.65272164",
"0.6488743",
"0.6461501",
"0.64249665",
"0.6393967",
"0.6355256",
"0.62830555",
"0.6267869",
"0.6263913",
"0.62610954",
"0.62608504",
"0.62608504",
"0.622284",
"0.61785644",
"0.6178411",
"0.6174941",
"0.61375713",
"0.6119868",
"0.609126... | 0.70300585 | 0 |
Phase I First, write a function that compares each element to every other element of the list. Return the element if all other elements in the array are larger. What is the time complexity for this function? | def my_min(arr) #O(n2)
min = arr.first
arr.each_with_index do |el_1 , i|
(i+1...arr.length).each do |el_2|
if arr[el_2] < el_1 && arr[el_1] < min
min = arr[el_2]
end
end
end
min
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slow_compare(arr)\n max = arr.first\n arr.each do |el1|\n arr.each do |el2|\n max = (el1 < max ? el1 : max)\n end\n end\n max\n end",
"def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n en... | [
"0.6962158",
"0.6768909",
"0.67546135",
"0.6721169",
"0.6693085",
"0.6629368",
"0.6556653",
"0.6549049",
"0.6520075",
"0.6519271",
"0.6515211",
"0.64931476",
"0.64785016",
"0.6473846",
"0.6453007",
"0.64066595",
"0.6394742",
"0.6392993",
"0.63810843",
"0.6371435",
"0.63702494... | 0.0 | -1 |
Phase II Now rewrite the function to iterate through the list just once while keeping track of the minimum. What is the time complexity? | def my_min_2(arr) #O(N)
min_num = arr.first
arr.each { |num| min_num = num if num < min_num }
min_num
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min ... | [
"0.8457615",
"0.84027773",
"0.83179766",
"0.81133217",
"0.8078084",
"0.8039133",
"0.80317754",
"0.79864234",
"0.79475397",
"0.7944365",
"0.7939771",
"0.7915958",
"0.7914765",
"0.79115427",
"0.78981775",
"0.7898102",
"0.7876623",
"0.78542066",
"0.78371125",
"0.7828834",
"0.782... | 0.765603 | 31 |
Phase II Let's make a better version. Write a new function using O(n) time with O(1) memory. Keep a running tally of the largest sum. To accomplish this efficient space complexity, consider using two variables. One variable should track the largest sum so far and another to track the current sum. We'll leave the rest t... | def better_subsum(arr) # o(n)
largest = 0
sum = 0
i = 0
j = 0
while i != arr.length-1
largest += arr[j]
sum = largest if largest > sum
if j == arr.length-1
i+=1
j =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def largest_sum_better(arr)\n largest_sum = arr.first\n current = arr.first\n\n (1...arr.length).each do |idx|\n if current < 0\n current = 0\n end\n\n current += arr[idx]\n \n if current > largest_sum\n largest_sum = current\n end\n end\n\n largest_sum\nend",
"def optimized_larg... | [
"0.78437567",
"0.77218294",
"0.77153045",
"0.7654002",
"0.7631556",
"0.75884616",
"0.7559616",
"0.7553336",
"0.74579525",
"0.7431565",
"0.7407984",
"0.7358932",
"0.7348072",
"0.7337691",
"0.73287725",
"0.7304175",
"0.72695833",
"0.726365",
"0.7255362",
"0.72352177",
"0.723007... | 0.6964858 | 59 |
Collection resource methods here gets involved from index when the user has requested to associate pictures with specific trees uses a hidden field called selected_tree to hold the tree id. | def selected_trees
Rails.logger.info(">>>Selected Tree #{params.inspect}")
if Pictureandmeta.add_assigned_pics(params['selected_tree'], params['add_to'])
flash[:notice] = "Successfully added sslected pictures."
else
flash[:notice] = "Pictures not added due to error."
end
redirect_to :con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_tree\n @tree = Tree.with_attached_images.find(params[:id])\n end",
"def set_tree\n\t\t@tree = Tree.find(params[:id])\n\tend",
"def current_main_pictures # teaser \n self.pictures.where(:is_deleted => false,:is_feature_picture => false, :is_main_picture => true).order(\"name ASC\")\n end",
"de... | [
"0.71152127",
"0.5930529",
"0.5803327",
"0.5794894",
"0.5794374",
"0.5794374",
"0.5794374",
"0.5794374",
"0.57750374",
"0.566053",
"0.56470203",
"0.5613209",
"0.56059915",
"0.5583506",
"0.555813",
"0.55328774",
"0.5520588",
"0.5495306",
"0.5482741",
"0.54782164",
"0.5477493",... | 0.64634824 | 1 |
A PUT Resource that is called, currently, to remove a tree reference from a Picture. IN: id of picture, id of tree | def assignedtrees
@pictureandmeta = Pictureandmeta.find(params)
@pictureandmeta.delete_assigned_pics(params[:tree])
redirect_to :controller => 'trees', :action => 'show', :id => params[:tree]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n #If image has parent, update children and vice versa\n if image.root_version? then\n newroot = image.child_versions.order(:created_at).last\n image.child_versions.delete(newroot)\n image.child_versions.each do |v| v.parent_image = newroot and v.save end\n else\n image.chi... | [
"0.59725213",
"0.5863832",
"0.5825317",
"0.5730988",
"0.57280016",
"0.5726012",
"0.57014894",
"0.5667926",
"0.56603795",
"0.56115437",
"0.5607104",
"0.5602352",
"0.5575923",
"0.555342",
"0.5539825",
"0.55382913",
"0.5506518",
"0.5465151",
"0.54397166",
"0.5439637",
"0.5427264... | 0.5995351 | 0 |
This is basically an algorithm resource GET kinds/search | def search
# if the user has selected to clear the search, or there is no search params, start from the top
Rails.logger.info("Pic Search: #{params.inspect}")
if params[:clear] || params[:q] == ""
redirect_to pictures_path
else
@picturesandmeta = Pictureandmeta.search(params[:q])
#@p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search\n # if the user has selected to clear the search, or there is no search params, start from the top\n if params[:clear] || params[:q] == \"\"\n Rails.logger.info(\"Kind: #{params.inspect}\")\n redirect_to kinds_path\n else \n @kinds = Kind.search(params[:q]).page params[:page]\n ... | [
"0.6865253",
"0.65866494",
"0.65806264",
"0.6490875",
"0.6475986",
"0.6458402",
"0.64196545",
"0.64196545",
"0.64196545",
"0.64196545",
"0.64196545",
"0.64196545",
"0.64196545",
"0.64196545",
"0.64196545",
"0.64196545",
"0.64186764",
"0.6411387",
"0.64080954",
"0.6403896",
"0... | 0.0 | -1 |
sanitize the select options for insert select | def sanitize_select_options(options)#:nodoc:
o = options.dup
select = o.delete :select
o[:override_select] = select ? select_column_sql(select) : ' * '
o
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_select_options(options)\n [].tap do |array|\n options.each_with_index do |object, position|\n array << { name: object, position: position }\n end\n end\n end",
"def gather_insert_options(options)#:nodoc:\n into_options = va... | [
"0.72099906",
"0.6812717",
"0.6676139",
"0.6563878",
"0.6493321",
"0.63223606",
"0.6065539",
"0.6038831",
"0.5994348",
"0.59866416",
"0.59377646",
"0.5915653",
"0.5905086",
"0.58712655",
"0.5860508",
"0.58452296",
"0.58225536",
"0.5773164",
"0.57640135",
"0.57640135",
"0.5727... | 0.7399418 | 0 |
move all the insert options to a seperate map | def gather_insert_options(options)#:nodoc:
into_options = valid_insert_select_options.inject(:command => 'INSERT') do |map, o|
v = options.delete(o)
map[o] = v if v
map
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_add_options(options)\n {\n \"id\" => options.delete(\"id\"),\n \"default\" => options.delete(\"default\") || false,\n \"next_style_id\" => options.delete(\"next_style\") || nil,\n \"base_style_id\" => options.delete(\"base_style\") || nil,\n \"assign_handle\" => ... | [
"0.6273046",
"0.592602",
"0.58026415",
"0.5672656",
"0.5541074",
"0.54972285",
"0.54955935",
"0.54758894",
"0.5449134",
"0.5418439",
"0.5357062",
"0.5249463",
"0.52424055",
"0.52422124",
"0.5235885",
"0.5235885",
"0.5222638",
"0.52079415",
"0.52072215",
"0.5200401",
"0.518913... | 0.82920456 | 0 |
p rps("Rock") => "Paper, Lose" p rps("Scissors") => "Scissors, Draw" p rps("Scissors") => "Paper, Win" | def remix pairs
col1, col2 = pairs.transpose
new_col2 = col2.shuffle
while new_col2.zip(col2).any? { |newer,original| newer == original }
new_col2 = col2.shuffle
end
col1.zip(new_col2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rps(p1, p2)\n if p1 == \"scissors\" && p2 == \"paper\"\n return \"Player 1 won!\"\n elsif p1 == \"scissors\" && p2 == \"rock\"\n return \"Player 2 won!\"\n elsif p1 == \"scissors\" && p2 == \"scissors\"\n return \"Draw!\"\n end\n\n if p1 == \"paper\" && p2 == \"paper\"\n return \"Draw!\"\n el... | [
"0.79424286",
"0.7857816",
"0.7730029",
"0.76786",
"0.74641275",
"0.74342066",
"0.74342066",
"0.74342066",
"0.74342066",
"0.74342066",
"0.74342066",
"0.74342066",
"0.74342066",
"0.74342066",
"0.74342066",
"0.74342066",
"0.74342066",
"0.74342066",
"0.7414081",
"0.7397924",
"0.... | 0.0 | -1 |
control for capitals and spaces | def palindrome?(string)
string = string.downcase
string = string.gsub(' ', '')
if string == string.reverse
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wordcap\n self.split(\" \").each{|word| word.capitalize!}.join(\" \")\n end",
"def capitalize() end",
"def capitals(string)\n if string.length > 10\n puts string.upcase\n else\n puts string\n end\n end",
"def capitalize!() end",
"def conditional_caps(phrase)\n if phrase.len... | [
"0.73793185",
"0.71744376",
"0.71391547",
"0.69765687",
"0.6832587",
"0.679146",
"0.67537874",
"0.67508096",
"0.67415845",
"0.674039",
"0.6704188",
"0.67039394",
"0.6693943",
"0.6680735",
"0.66637325",
"0.66528344",
"0.6607398",
"0.6577435",
"0.6569968",
"0.6548182",
"0.65481... | 0.0 | -1 |
GET /states GET /states.json | def index
@states = State.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state\n @states = State.find_state(params[:id])\n respond_to do |format|\n format.json { render :json => @states }\n end\n end",
"def get_states\n perform(:get, 'enum/states', nil, nonauth_headers).body\n end",
"def index\n @states = State.all\n \n render js... | [
"0.80725306",
"0.7909885",
"0.7671574",
"0.7336725",
"0.7216245",
"0.71103203",
"0.6982456",
"0.69544065",
"0.69543046",
"0.69543046",
"0.69141996",
"0.68116975",
"0.68055975",
"0.6730165",
"0.6659908",
"0.6655693",
"0.65999115",
"0.65609944",
"0.64774644",
"0.64472586",
"0.6... | 0.70236224 | 9 |
GET /states/1 GET /states/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state\n @states = State.find_state(params[:id])\n respond_to do |format|\n format.json { render :json => @states }\n end\n end",
"def index\n @states = State.all\n \n render json: @states\n end",
"def show\n @state = State.find(params[:id])\n\n respond_to do ... | [
"0.81401557",
"0.73951244",
"0.7326553",
"0.7326553",
"0.71313214",
"0.70827955",
"0.7078011",
"0.6953117",
"0.6837184",
"0.6801448",
"0.6792741",
"0.67743254",
"0.67565864",
"0.67565864",
"0.67565864",
"0.67565864",
"0.67565864",
"0.65724915",
"0.656232",
"0.65618545",
"0.65... | 0.0 | -1 |
POST /states POST /states.json | def create
@state = State.new(state_params)
respond_to do |format|
if @state.save
format.html { redirect_to @state, notice: 'State was successfully created.' }
format.json { render json:{message:'State was successfully created.'}, status: :created, location: @state }
else
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @state = State.new(state_params)\n\n if @state.save\n render json: @state, status: :created, location: @state\n # 'state was successfully created.'\n else\n render json: @state.errors, status: :unprocessable_entity\n end\n end",
"def create\n @state = State.new(params[... | [
"0.70445883",
"0.6841776",
"0.6841776",
"0.67906576",
"0.6770631",
"0.6737208",
"0.6713754",
"0.6629719",
"0.6593797",
"0.65363383",
"0.64432395",
"0.6426342",
"0.6421175",
"0.6330146",
"0.63256145",
"0.6315179",
"0.62741953",
"0.6255429",
"0.62408495",
"0.6229109",
"0.622699... | 0.66295123 | 8 |
PATCH/PUT /states/1 PATCH/PUT /states/1.json | def update
respond_to do |format|
if @state.update_attributes(state_params)
format.html { redirect_to @state, notice: 'State was successfully updated.' }
format.json { render json:{message:'State was successfully updated.'} }
else
format.html { render action: 'edit' }
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @state = State.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.6871788",
"0.6871788",
"0.6871788",
"0.6848737",
"0.68296736",
"0.6793042",
"0.6619484",
"0.6619484",
"0.6596323",
"0.65681845",
"0.6491891",
"0.6421681",
"0.635824",
"0.6230228",
"0.6223938",
"0.6191293",
"0.6137096",
"0.60909075",
"0.607714",
"0.60641104",
"0.6056406",
... | 0.6686376 | 6 |
DELETE /states/1 DELETE /states/1.json | def destroy
@state.destroy
respond_to do |format|
format.html { redirect_to states_url }
format.json { head :no_content }
format.js { render json:{message:'State has been deleted.', status: :ok}}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @state = State.find(params[:id])\n @state.destroy\n\n respond_to do |format|\n format.html { redirect_to states_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @state = State.find(params[:id])\n @state.destroy\n\n respond_to do |format|\n f... | [
"0.7784802",
"0.7784802",
"0.7752451",
"0.74837947",
"0.7465082",
"0.7465082",
"0.7440087",
"0.73724574",
"0.7303953",
"0.72783744",
"0.7156933",
"0.71122503",
"0.7109984",
"0.70977324",
"0.70915776",
"0.7070321",
"0.70579624",
"0.7013425",
"0.7013299",
"0.6926353",
"0.692336... | 0.72542137 | 10 |
Use callbacks to share common setup or constraints between actions. | def set_state
@state = State.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 state_params
params.require(:state).permit(:country_id, :name, :short_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /unapproved_projects GET /unapproved_projects.xml | def index
@unapproved_projects = Project.unapproved
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @unapproved_projects }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @unapproved_project }\n end\n end",
"def index\n @projects = Project.all(:conditions => {:visibility => \"Public\"})\n\n respond_to do |format|\n format.html # index.html.erb\n format.x... | [
"0.6847913",
"0.64268446",
"0.6348112",
"0.6322357",
"0.6313877",
"0.623031",
"0.62296635",
"0.62235165",
"0.62149084",
"0.62105477",
"0.61654603",
"0.6154292",
"0.613544",
"0.613544",
"0.6120256",
"0.6104084",
"0.60909355",
"0.604892",
"0.6043917",
"0.6043873",
"0.6035385",
... | 0.8169892 | 0 |
GET /unapproved_projects/1 GET /unapproved_projects/1.xml | def show
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @unapproved_project }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @unapproved_projects = Project.unapproved\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @unapproved_projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html\n format.xml { ... | [
"0.7983721",
"0.67258203",
"0.6704646",
"0.66718847",
"0.6507994",
"0.6507994",
"0.64935035",
"0.6480096",
"0.6474475",
"0.64571285",
"0.6413624",
"0.6387009",
"0.6326204",
"0.63196695",
"0.63142425",
"0.62784344",
"0.62539494",
"0.6245711",
"0.6222892",
"0.6220869",
"0.62015... | 0.7163578 | 1 |
PUT /unapproved_projects/1 PUT /unapproved_projects/1.xml | def update
respond_to do |format|
if @unapproved_project.approve
flash[:notice] = 'Project has been approved.'
format.html { redirect_to(unapproved_projects_path) }
format.xml { head :ok }
else
format.html { render :action => "show" }
format.xml { render :xml =>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :descrip... | [
"0.7112815",
"0.66161996",
"0.6385597",
"0.63166946",
"0.6312947",
"0.6301116",
"0.6290049",
"0.6286331",
"0.62151396",
"0.6206344",
"0.6199807",
"0.6193307",
"0.6192376",
"0.61910415",
"0.6189709",
"0.6177182",
"0.6177182",
"0.6177182",
"0.6177182",
"0.6177182",
"0.6177182",... | 0.70467085 | 1 |
storage plugins has only 'close' and 'terminate' stop: used in helper to stop autosave shutdown: used in helper to call save finally if needed | def close; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispose_keep\n @savename = nil\n @saveindex = nil\n @saveghost = nil\n @saveswap = nil\n @saveflip = nil\n end",
"def close\n persist\n end",
"def do_close; end",
"def close; true; end",
"def close; true; end",
"def close\n save\n end",
"def close!\n storages.each... | [
"0.67396885",
"0.66286564",
"0.6568756",
"0.65171504",
"0.65171504",
"0.64285755",
"0.63752913",
"0.636171",
"0.636171",
"0.636171",
"0.636171",
"0.6359451",
"0.6321728",
"0.6316566",
"0.62810785",
"0.62735677",
"0.62593067",
"0.6212585",
"0.61868423",
"0.61868423",
"0.618684... | 0.6189072 | 42 |
:callseq: starts_as(initial_state) > state_machine Put the +state_machine+ into the +initial_state+. | def starts_as(initial_state)
@current_state = initial_state
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initial_state *args, &block\n valid_unless_nested()\n machine.initial_state= state( *args, &block)\n end",
"def initial_state=(new_initial_state); end",
"def start\n @state_machine.startup\n end",
"def state_machine=(value)\n @state_machine = value.dup\n end",
"def state_ma... | [
"0.71469533",
"0.6870294",
"0.66017133",
"0.65339285",
"0.65339285",
"0.64251494",
"0.62337226",
"0.6227743",
"0.619982",
"0.6197096",
"0.61627054",
"0.61151725",
"0.61106014",
"0.6106681",
"0.6089729",
"0.6082026",
"0.60633075",
"0.60574967",
"0.6033948",
"0.6031986",
"0.600... | 0.7678482 | 0 |
Push a dummy item into the database for editing. | def sample_for_edit(src = :edit_example)
current = edit_id && Manifest.find_by(id: edit_id)
current&.delete
new_record(src).tap do |record|
self.edit_id = record.id if record.save!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item\n\t\tcurrent_user.saved.items.push(Item.find(params[:item]))\n\t\tredirect_to :back\n\tend",
"def add(todo)\n @items << Item.new(todo)\n save\n @items.last\n end",
"def add_item(item)\n fail \"An items id should initially be nil, but was #{item.id}\" unless (item.id == nil)\n f... | [
"0.6363338",
"0.63606846",
"0.63359183",
"0.6275816",
"0.6247824",
"0.6193329",
"0.6129203",
"0.610564",
"0.6101146",
"0.6098359",
"0.6083628",
"0.6069263",
"0.60190016",
"0.60035205",
"0.5997594",
"0.59962857",
"0.5982086",
"0.59554654",
"0.59504676",
"0.5943972",
"0.5943835... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.