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
GET /widgets GET /widgets.json
def index @widgets = Widget.all respond_to do |format| format.html # index.html.erb format.json { render json: @widgets } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @widget = Widget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @widget }\n end\n end", "def widget_data\n widget = WidgetService.widget(params[:widget_id])\n render json: {\n id: widget.id,\n dataset: widget....
[ "0.7177016", "0.7001222", "0.6949288", "0.6806375", "0.66883814", "0.6652928", "0.6529962", "0.65087163", "0.6492304", "0.6387974", "0.6324118", "0.63024807", "0.6256441", "0.62365276", "0.6211567", "0.61187756", "0.6062224", "0.60185045", "0.5998205", "0.5934863", "0.5862095...
0.75650525
0
DELETE /widgets/1 DELETE /widgets/1.json
def destroy @widget = Widget.find(params[:id]) @widget.destroy respond_to do |format| format.html { redirect_to widgets_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @simple_widget.destroy\n respond_to do |format|\n format.html { redirect_to simple_widgets_url, notice: 'Simple widget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @widget = Widget.find(params[:id])\n @widget.destroy\n r...
[ "0.7491588", "0.7396286", "0.7394976", "0.71619344", "0.7030359", "0.6919996", "0.6899113", "0.6899113", "0.6814794", "0.6786082", "0.6743239", "0.66606027", "0.66476583", "0.6640038", "0.66333085", "0.656067", "0.6553023", "0.6533894", "0.65147823", "0.6480145", "0.6480145",...
0.77379686
1
Setting up a Mock to simulate the requests.
def setup @requester = Rack::MockRequest.new(SampleApp) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_request( params, response_body )\n mock_post = {}\n mock_post.expects(:set_form_data).with(params)\n #mock.expects(:[]=).with('user-agent', anything)\n\n url = Smsinabox.uri\n Net::HTTP::Post.expects(:new).with( url.path ).returns(mock_post)\n\n response = Net::HTTPSuccess.new('1.1', 200, 'OK')\n r...
[ "0.7454988", "0.73365533", "0.6954197", "0.6949394", "0.6843992", "0.6829548", "0.6791436", "0.66415495", "0.6638607", "0.6506976", "0.64272404", "0.63936895", "0.6391782", "0.6391782", "0.63868284", "0.62820786", "0.6260012", "0.62329465", "0.62270343", "0.62055707", "0.6179...
0.7829217
0
Test if the main route is returning the expected message.
def test_settings # At the sample_app.rb we set a :config, lets check if it was injected into # the controller and if we can retrieve it back. For this, we created a # service, and here we will call that service. request = @requester.get URI.escape('/settingsTest') # The response should be OK (200) assert_equal 200, request.status # Content type should be JSON assert_equal 'application/json', request.content_type # Checking if the response contains the expceted text expected_body = 'This is just a settings test.' assert_contains expected_body, request.body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test? value\n actual_response = begin\n message.send_to value, publicly: publicly\n rescue\n # Methods that raise can't pass any test\n return false\n end\n \n response.test? actual_response\n end", "def test!\n begin\n send_message!(:recipient_number => '_', :b...
[ "0.62412435", "0.610836", "0.60953873", "0.6055863", "0.59984016", "0.59120303", "0.5897065", "0.58238727", "0.5786979", "0.57147366", "0.5694067", "0.56639355", "0.5643365", "0.5638906", "0.5635893", "0.5630261", "0.5574508", "0.55699563", "0.55440193", "0.55433464", "0.5520...
0.0
-1
This generates RSpec tests from the JSON test cases of the citeproctests suite. Filter applied to each test to decide whether we should run it. Use this to stay sane while the Processor is not featurecomplete!
def filter(file, fixture) # return ['affix_InterveningEmpty.json'].include?(File.basename(file)) # File.basename(file) =~ /bugreports_greek/i # File.basename(file) =~ /sort_stripmark/i # return File.basename(file) =~ /^date_rawparsesimpledate/i true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec_tests(&block)\n require 'onceover/testconfig'\n\n # Load up all of the tests and deduplicate them\n testconfig = Onceover::TestConfig.new(@onceover_yaml, @opts)\n testconfig.spec_tests.each { |tst| testconfig.verify_spec_test(self, tst) }\n tests = testconfig.run_filters(Onceover:...
[ "0.64630777", "0.6173405", "0.59937876", "0.59777164", "0.58224833", "0.5764137", "0.5728051", "0.57245797", "0.57183367", "0.5688263", "0.5656706", "0.5611224", "0.56076324", "0.55968714", "0.5587575", "0.55847114", "0.55438536", "0.5542112", "0.5476488", "0.54625565", "0.54...
0.0
-1
Examples: got_three? [1, 2, 2, 2, 3] => true got_three? ['a', 'a', 'b'] => false got_three? ['a', 'a', 'a'] => true got_three? [1, 2, 1, 1] => false
def got_three? nums nums.select.with_index {|n,i| n if nums[i] == nums[i+1] && nums[i] == nums[i+2]}.size > 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def got_three?(array)\n\tarray.each_with_index do |item, i|\n\t\tnext_item = array[i+1]\n\t\tnext_next_item = array[i+2]\n\t\treturn true if item == next_item && item == next_next_item\n\tend\n\tfalse\nend", "def got_three?(array)\n\tarray.each_cons 3 do |x, y, z|\n\t\treturn true if x == y && y == z\n\tend\n\tr...
[ "0.767272", "0.75537056", "0.74402785", "0.7432608", "0.74202883", "0.73590654", "0.7332149", "0.7306207", "0.7295782", "0.72500783", "0.70646054", "0.7059264", "0.70497346", "0.7029385", "0.7026653", "0.7019442", "0.70008224", "0.6906877", "0.6895376", "0.68645", "0.68620276...
0.64015144
36
created method copied from orders controllers
def create product_id = params [:product_id] product = Product.find_by(id: product_id) quantity = params[:quantity] carted_products = CartedProduct.create( :user_id current_user.id, :product_id params[:product_id], :quantity params [:quantity], :status "carted" ) flash [:success] = "Product added to cart" redirect_to "/" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @order = current_order\n @order_items = current_order.order_items\n @products = current_order.products\n end", "def index\n @order = Order.all\n @order_item = current_order.order_items.new\n end", "def get_orders\n orders\n end", "def orders\r\n @orders ||= OrdersControl...
[ "0.6964524", "0.6920195", "0.6870869", "0.6856147", "0.6799975", "0.6797019", "0.6772585", "0.6772585", "0.6760496", "0.67488563", "0.6729735", "0.6718411", "0.6714629", "0.6714629", "0.6712981", "0.6692532", "0.6692532", "0.665753", "0.6655762", "0.6651076", "0.66486585", ...
0.0
-1
Used by the search bar to query for student names
def names cached_json_for_searchbar = current_educator.student_searchbar_json if cached_json_for_searchbar render json: cached_json_for_searchbar else render json: SearchbarHelper.names_for(current_educator) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results\n @students = Student.where('name LIKE ?', \"%#{params[:q]}%\")\n end", "def fees_student_structure_search_logic # student search fees structure\n query = params[:query]\n unless query.length < 3\n @students_result = Student.find(:all,\n :conditions => [\"first_name LIKE ? OR mi...
[ "0.77691644", "0.70885986", "0.7067542", "0.7053378", "0.6966976", "0.69378936", "0.69339037", "0.69176066", "0.6900299", "0.68917316", "0.6811309", "0.6806033", "0.67982584", "0.6761124", "0.667696", "0.667419", "0.66474766", "0.66440314", "0.6641849", "0.66322756", "0.66012...
0.70174825
5
Admin only; get a sample of students for looking at data across the site
def sample_students_json raise Exceptions::EducatorNotAuthorized unless current_educator.can_set_districtwide_access? seed = params.fetch(:seed, '42').to_i n = params.fetch(:n, '40').to_i authorized_sample_students = authorized do Student.active.sample(n, random: Random.new(seed)) end sample_students_json = authorized_sample_students.as_json({ only: [:id, :grade, :first_name, :last_name], include: { school: { only: [:id, :name, :school_type] } } }) render json: { sample_students: sample_students_json } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end", "def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end", "def index\n @interesting_things = @student.interesting_things\n @other_interesting...
[ "0.701497", "0.6813282", "0.6725721", "0.6725324", "0.6707405", "0.6706399", "0.6561929", "0.646718", "0.6463248", "0.64573634", "0.64201087", "0.6418952", "0.6411673", "0.64110625", "0.63979673", "0.63894325", "0.6331304", "0.62793434", "0.62716544", "0.6265985", "0.6256011"...
0.7318946
0
The feed of mutable data that changes most frequently and is owned by Student Insights. restricted_notes: If false display nonrestricted notes, if true display only restricted notes.
def student_feed(student, restricted_notes: false) { event_notes: student.event_notes .select {|note| note.is_restricted == restricted_notes} .map {|event_note| EventNoteSerializer.dangerously_include_restricted_note_text(event_note).serialize_event_note }, transition_notes: student.transition_notes .select {|note| note.is_restricted == restricted_notes}, services: { active: student.services.active.map {|service| ServiceSerializer.new(service).serialize_service }, discontinued: student.services.discontinued.map {|service| ServiceSerializer.new(service).serialize_service } }, deprecated: { interventions: student.interventions.map { |intervention| DeprecatedInterventionSerializer.new(intervention).serialize_intervention } } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_for_restricted_notes(current_educator, params)\n authorization = current_educator.can_view_restricted_notes?\n intention = (params.fetch(:include_restricted_notes, 'false').downcase == 'true')\n if authorization && intention\n [true, false]\n else\n [false]\n end\n end", "def...
[ "0.65092534", "0.6358749", "0.61997056", "0.5780791", "0.57209456", "0.5720443", "0.57096505", "0.5693249", "0.5693249", "0.5693249", "0.5693249", "0.5645508", "0.56433904", "0.5620788", "0.56049854", "0.5557341", "0.5539582", "0.55262303", "0.54622674", "0.5405722", "0.54021...
0.62550634
2
GET /actionables GET /actionables.json
def index @actionables = Actionable.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def actions\n return @actions if @actions\n @actions = Client.get(\"/organizations/#{id}/actions\").json_into(Action)\n end", "def index\n @user_actions = UserAction.all\n render json: @user_actions\n end", "def abilities\n get('/ability/')\n end", "def accessories\n render jso...
[ "0.6987696", "0.6675143", "0.66332257", "0.6281451", "0.62372965", "0.6201639", "0.612287", "0.60770136", "0.6061981", "0.60551727", "0.60406095", "0.6033963", "0.60148203", "0.59778607", "0.5972194", "0.5968946", "0.59606934", "0.5938351", "0.5928417", "0.59201765", "0.58816...
0.75978374
0
GET /actionables/1 GET /actionables/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @actionables = Actionable.all\n end", "def actions\n return @actions if @actions\n @actions = Client.get(\"/organizations/#{id}/actions\").json_into(Action)\n end", "def show\n head :forbidden\n\n # @action = Action.find(params[:id])\n\n # render json: @action\n end", "...
[ "0.71377814", "0.6579138", "0.6454183", "0.64122903", "0.61221945", "0.60725254", "0.60469925", "0.60214025", "0.6020366", "0.59657323", "0.59524304", "0.59500164", "0.5922773", "0.59190243", "0.58986944", "0.58745486", "0.58651984", "0.5864266", "0.58069384", "0.58045906", "...
0.0
-1
POST /actionables POST /actionables.json
def create @actionable = Actionable.new(actionable_params) respond_to do |format| if @actionable.save format.html { redirect_to @actionable, notice: 'Actionable was successfully created.' } format.json { render :show, status: :created, location: @actionable } else format.html { render :new } format.json { render json: @actionable.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @actionables = Actionable.all\n end", "def create_actionable\n actionable_node = Neography::Node.create(\"object_id\" => self.id, \"object_type\" => self.class.to_s)\n actionable_node.add_to_index(\"actionables_nodes_index\", \"class0id\", \"#{self.class.to_s}0#{self.id}\")\n e...
[ "0.6378845", "0.59932905", "0.5918275", "0.5736906", "0.57261574", "0.5713055", "0.5677671", "0.5586333", "0.55838335", "0.5547208", "0.55451936", "0.55003744", "0.54988986", "0.5453329", "0.5431675", "0.53686136", "0.5320863", "0.53139377", "0.5297027", "0.5290968", "0.52830...
0.66605294
0
PATCH/PUT /actionables/1 PATCH/PUT /actionables/1.json
def update respond_to do |format| if @actionable.update(actionable_params) format.html { redirect_to @actionable, notice: 'Actionable was successfully updated.' } format.json { render :show, status: :ok, location: @actionable } else format.html { render :edit } format.json { render json: @actionable.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n head :forbidden\n\n #@action = Action.find(params[:id])\n\n #if @action.update_attributes(params[:action])\n # head :no_content\n # else\n # render json: @action.errors, status: :unprocessable_entity\n # end\n end", "def patch(action, **args); end", "def update\n @edita...
[ "0.6737716", "0.6182605", "0.61328727", "0.600249", "0.59972954", "0.5982557", "0.593613", "0.59163475", "0.5911129", "0.5909275", "0.58852", "0.58827823", "0.5874014", "0.58598995", "0.58342785", "0.58342785", "0.58342785", "0.58342785", "0.5832853", "0.58304155", "0.5822878...
0.68141884
0
DELETE /actionables/1 DELETE /actionables/1.json
def destroy @actionable.destroy respond_to do |format| format.html { redirect_to actionables_url, notice: 'Actionable was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end", "def delete(action, **args); end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def destroy\n @accessory_act = AccessoryAct.find(params[:id])\n @accessory_act.destroy\n\n respond_t...
[ "0.7239529", "0.685737", "0.6722556", "0.6682913", "0.6567606", "0.6560132", "0.655953", "0.655689", "0.6553568", "0.6549024", "0.653393", "0.65276504", "0.65073866", "0.6505469", "0.6480941", "0.64697516", "0.64576954", "0.64461267", "0.6445829", "0.6438733", "0.64309037", ...
0.7415544
0
Use callbacks to share common setup or constraints between actions.
def set_actionable @actionable = Actionable.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.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.533...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def actionable_params params.require(:actionable).permit(:student_requested_job, :employeer_requested_student_for_job, :student_approved_for_job, :appeared_at_job, :student_did_job_well, :job_id, :student_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.6980384", "0.6782743", "0.6746196", "0.6742575", "0.6736", "0.6594004", "0.65037984", "0.6496699", "0.64819324", "0.64791185", "0.6456292", "0.64403296", "0.63795286", "0.6375975", "0.6365291", "0.63210756", "0.6300542", "0.6299717", "0.62943304", "0.6292561", "0.6290683",...
0.0
-1
generates playes and sets default first player to player in array position 0
def initialize(p1, p2) @players = [p1, p2] @current_player = @players[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_starting_player\n @current_player_index = rand(0..num_players - 1)\n puts \"Looks like #{@players[@current_player_index].name} will be going first!\"\n @players[@current_player_index]\n end", "def first_player_plays \n\t@choice_player1 = first_player.ask_play \n\tunless first_player.verif...
[ "0.71329635", "0.67810935", "0.6665624", "0.65446174", "0.65112907", "0.6508821", "0.64856106", "0.6457072", "0.6442371", "0.6433342", "0.64264965", "0.64178556", "0.6414918", "0.63896406", "0.6382427", "0.63591194", "0.63272417", "0.63211435", "0.62899673", "0.6274553", "0.6...
0.58241224
92
manages method for removing one life on wrong answer
def lose_life puts "Sorry, that is the wrong answer!" @current_player.life -= 1 if @current_player.life == 0 puts "#{current_player.name} loses! Game Over!" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrong_answer\n @score -= 1\n end", "def remove_item\n if !@question.many_answers && @item.ok && @question.items.count > 1\n # No more good answer\n # We put one in random to true\n @item.destroy\n @item2 = @question.items.last\n @item2.ok = true\n @item2.save\n flash...
[ "0.6724293", "0.6559344", "0.65317655", "0.65178406", "0.64450353", "0.6414005", "0.6358155", "0.6325719", "0.6311025", "0.61898583", "0.61567426", "0.6032602", "0.60241467", "0.60200757", "0.60190964", "0.60117006", "0.5905089", "0.5888338", "0.58614767", "0.5844508", "0.583...
0.5376419
100
method showing lives remaining
def show_lives puts "Lives remaining: #{@players[0].name}: #{@players[0].life}/3 - #{@players[1].name}: #{@players[1].life}/3" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_lives(lives)\n puts \"#{lives} Lives left\"\n end", "def take_life\n @lives -= 1\n end", "def looses_life\n @lives -= 1\n end", "def show_state\n if @life_points <= 0\n puts \"#{@name} is dead... \\n...Monde de merde...\"\n else\n puts \"#{@name} has #{@life_points} life ...
[ "0.75132436", "0.7385032", "0.73500735", "0.730432", "0.7229958", "0.72146595", "0.7208545", "0.708957", "0.708957", "0.708957", "0.708957", "0.68156254", "0.67217946", "0.67131567", "0.66743046", "0.66627496", "0.6622638", "0.66155505", "0.66103446", "0.65931404", "0.6589625...
0.7464693
1
method which switches between players each round
def switch_player if @current_player == @players[0] @current_player = @players[1] else @current_player = @players[0] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_players\n temp = @current_player\n @current_player = @opposing_player\n @opposing_player = temp\n end", "def switch_players\n @player1_turn = !@player1_turn\n end", "def switch_players!\n if current_player==player1\n @current_player=player2\n else\n @current_player=play...
[ "0.79595894", "0.79312795", "0.7870784", "0.7730949", "0.77302736", "0.7607129", "0.76000977", "0.75590426", "0.7522271", "0.7512322", "0.74809647", "0.745435", "0.74015576", "0.7390399", "0.7384308", "0.73823", "0.7358186", "0.7358186", "0.7332286", "0.73045486", "0.72800547...
0.74996066
10
Parse the uploaded file. Resulting data will be in data
def parse(uploaded_file) parser_class = case uploaded_file.content_type when "application/vnd.ms-excel" ExcelParser when "text/csv", "application/octet-stream", "text/plain" CSVParser else self.errors << "Do not know how to parse #{uploaded_file.original_filename}. " + "Expects .csv or .xls (Excel) files." nil end if parser_class @data = parser_class.new(self).parse(uploaded_file) end self.valid? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_file(file)\n if file && !file.instance_of?(String)\n parse_contents(file)\n elsif file.instance_of?(String)\n data = File.read(file)\n parse_contents(data)\n else\n self.load_errors = \"No file was selected to upload.\"\n end\n end", "def uploaded_data...
[ "0.7450316", "0.68234205", "0.6747816", "0.6613368", "0.6561181", "0.6537654", "0.65263605", "0.64798194", "0.64629877", "0.63639116", "0.6350962", "0.63383764", "0.6289999", "0.6227038", "0.6218328", "0.62134504", "0.62112314", "0.6200922", "0.61911684", "0.6182405", "0.6147...
0.718122
1
Was the parse successful?
def valid? @data && @errors.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parsing_succeeded\n return @parsing_succeeded\n end", "def parsed?\n self.parsed == 1\n end", "def success?\n unparser.success? && missing.empty? && unexpected.empty?\n end", "def parsed?\n @parsed\n end", "def parse_error?\n @parse_error ? true : ...
[ "0.7961036", "0.7335571", "0.7261637", "0.713443", "0.70891905", "0.6956753", "0.6836915", "0.6764742", "0.6585268", "0.65151787", "0.65151787", "0.6443959", "0.643199", "0.63956785", "0.63935846", "0.63513523", "0.6335524", "0.63048214", "0.62647265", "0.6260507", "0.6257834...
0.0
-1
Returns array of keys that do not have value in the hash Given +required_keys+ should be an array of +string+
def missing_keys_from(required_keys) required_keys.select{ |k| self.get(k).to_s.empty? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reject_keys *keys\n reject{|k, _| keys.include? k}\n end", "def reject_keys!(hash, keys)\n hash.reject { |k, _| keys.include?(k) }\n end", "def arg_hash_keys_required(required_keys, *args)\n args.each do |h|\n missing = required_keys - h.keys\n raise ArgumentError, ...
[ "0.7145525", "0.71454954", "0.70673525", "0.6754895", "0.6680012", "0.6556928", "0.6548558", "0.6508701", "0.6506007", "0.64663833", "0.6448933", "0.6435034", "0.6412506", "0.6409251", "0.6377574", "0.6377338", "0.6374554", "0.6373801", "0.6331329", "0.6328221", "0.63118696",...
0.81626594
0
Returns Hash of Hash attr_values["attr_name"][":"] = attr_value
def make_expression_attribute_values(event) attr_values = make_hoh event.each do |k,v| if k == "start_time" puts "Found start time: methods: #{v.methods}, methods contain strftime? #{v.methods.include?(:strftime)}" end attr_values[k][make_expression_key(k,)] = v end return attr_values end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes= hsh\n conv_hsh = {}\n hsh.each do |k,v|\n k = k.to_s.gsub(/:/,'_') if k =~ /:/\n conv_hsh[k] = v\n end\n super hsh\n end", "def convert_attr_hash(attrs = [])\n h = {}\n attrs.each do |v|\n # v is Nokogiri::XML::SAX::Parser::Attribute\n ...
[ "0.66263604", "0.6540327", "0.63845205", "0.6137079", "0.6099234", "0.6099234", "0.6070037", "0.60513324", "0.60105413", "0.597682", "0.5966348", "0.5957069", "0.592394", "0.58955926", "0.5883498", "0.58814657", "0.588119", "0.5866515", "0.5864777", "0.58646214", "0.5859974",...
0.0
-1
Remove the first hash ["attr_name"] from make_expression_attribute_values
def clean_up(attr_values_hash_of_hash) attr_values = Hash.new attr_values_hash_of_hash.each do |bad_key,good_hash| attr_values.merge!(good_hash) end return attr_values end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_attributes(attributes)\n attributes.reduce([{}, {}]) do |memo, attr_val|\n attribute, value = attr_val\n if attribute.to_s.start_with?('+')\n memo[1][attribute[1..-1].to_sym] = value\n else\n memo[0][attribute] = value\n end\n memo\n end\n ...
[ "0.63046414", "0.62480664", "0.60744774", "0.6049843", "0.5967913", "0.59644175", "0.5959419", "0.59232926", "0.59214556", "0.58586043", "0.5847415", "0.5822893", "0.5767844", "0.5746209", "0.5661682", "0.5636758", "0.56321937", "0.55865186", "0.55667365", "0.55667365", "0.55...
0.5786511
12
Make Update expression 'SET = :' : points to a value from the expression_attribute_value
def make_update_expression_values(event,attr_values) update_string = 'SET ' event.each do |k,v| update_string += "#{make_expression_key(k,"names")} = #{attr_values[k].key(v)}, " end return update_string[0...-2] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_expression_value\n @expression_value = ExpressionValue.find(params[:id])\n end", "def update!(**args)\n @sql_expression = args[:sql_expression] if args.key?(:sql_expression)\n end", "def update!(**args)\n @sql_expression = args[:sql_expression] if args.key?(:sql_expression)...
[ "0.6285116", "0.62565255", "0.62565255", "0.6079802", "0.6028029", "0.6019261", "0.6008429", "0.5959494", "0.5922933", "0.5892387", "0.587297", "0.5806208", "0.5790991", "0.57007587", "0.5645627", "0.5605947", "0.55957127", "0.5564535", "0.5555585", "0.5554237", "0.555319", ...
0.723983
0
create a new archive by merging this and another archive
def merge(other) assert_archive other data = deep_clone(@data) merge_data data, other.as_json, other.uri self.class.new data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge!(other)\n assert_archive other\n clear_caches\n\n merge_data @data, other.as_json, other.uri\n nil\n end", "def merge(other); end", "def merge(other)\n self.merge_actors(other)\n self.compress_history()\n end", "def merge(source); end", "def merge_with other\n ...
[ "0.7187005", "0.61873007", "0.6131283", "0.6020542", "0.59257907", "0.59120613", "0.5880315", "0.5879201", "0.5868103", "0.5865944", "0.5838", "0.57779586", "0.57763475", "0.577431", "0.5706385", "0.56874985", "0.5685824", "0.56599903", "0.5657604", "0.56480783", "0.5635691",...
0.7257923
0
destructively merge this with the given archive
def merge!(other) assert_archive other clear_caches merge_data @data, other.as_json, other.uri nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(other)\n assert_archive other\n\n data = deep_clone(@data)\n merge_data data, other.as_json, other.uri\n\n self.class.new data\n end", "def merge!; end", "def merge!(with); end", "def restore_archive\n end", "def archive!\n archive\n save!(validate: fal...
[ "0.66228884", "0.62758654", "0.6235372", "0.62330544", "0.6205354", "0.62046945", "0.6178792", "0.6118874", "0.60017157", "0.60017157", "0.60017157", "0.59287244", "0.5926497", "0.5888809", "0.5877875", "0.5868271", "0.58376217", "0.5812669", "0.58084846", "0.5777846", "0.576...
0.7215412
0
TODO Code to be reviewed
def get_streams partial_path = "streams/unread_items" if params[:scope] == "brands" || params[:scope] == "companies" partial_path = "streams/brands/unread_items" @brand = Brand.find(params[:brand_id]) brand = @brand if params[:scope] == "companies" brand = @brand.company end get_company_feeds_from_services(brand) @stream_count = brand.streams.not_displayed_for_brands.count #if @no_post_panel.blank? @unread_items = brand.streams.unread_items.count else get_feeds_from_services @stream_count = current_user.streams.not_displayed.count if @no_post_panel.blank? @unread_items = current_user.streams.unread_items.count end if params[:is_in_play_mode] == "true" redirect_to :controller => :streams, :action => :get_stream_from_db else render :update do |page| page.replace_html "socialInboxIco", "Social Inbox (#{@stream_count})" if @stream_count > 0 && params[:stream_type] != 'social_inbox' # page.replace_html "unread_items_count", :partial => partial_path, :locals => {:current_user => current_user} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def refutal()\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def operations; end", "def operations; end", "def weber; end", "def run; end", "def run; end", "def run; end", "def run; end...
[ "0.7630427", "0.6686791", "0.65778285", "0.64986455", "0.6235747", "0.6235747", "0.6235747", "0.6235747", "0.6113018", "0.6113018", "0.6104528", "0.60800743", "0.60800743", "0.60800743", "0.60800743", "0.60800743", "0.60800743", "0.60800743", "0.60800743", "0.60800743", "0.60...
0.0
-1
TODO Code to be reviewed
def get_company_feeds_from_services(brand) @messages_hash, errors = UserSession.get_twitter_messages(brand) if brand.has_twitter_service #TODO: Move all the queries to model UserSession.get_flickr_messages(brand) if brand.has_flickr_service UserSession.get_facebook_messages(brand) if brand.has_facebook_service UserSession.get_vimeo_videos(brand) if brand.has_vimeo_service UserSession.get_youtube_videos(brand) if brand.has_youtube_service UserSession.get_tumblr_messages(brand) if brand.has_tumblr_service UserSession.get_delicious_messages(brand) if brand.has_delicious_service UserSession.get_stumbleupon_messages(brand) if brand.has_stumbleupon_service return errors end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def refutal()\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def operations; end", "def operations; end", "def weber; end", "def run; end", "def run; end", "def run; end", "def run; end...
[ "0.7630302", "0.6685449", "0.65777683", "0.6498087", "0.62351793", "0.62351793", "0.62351793", "0.62351793", "0.61114025", "0.61114025", "0.61041707", "0.60799235", "0.60799235", "0.60799235", "0.60799235", "0.60799235", "0.60799235", "0.60799235", "0.60799235", "0.60799235", ...
0.0
-1
Metodos Composite Pattern, debe implementarse en la clase Composite
def add(menu_component) raise UnssoportedOperationError, "this operation must be implemented in subclasses" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def composite?; self[:composite]; end", "def composite?; @composite; end", "def composite!; self[:composite] = true; self; end", "def composite(*components)\n [:composite, components, Reader::Position.caller(2)]\n end", "def composite_class\n Command::Composite\n end", "def compose\n ...
[ "0.7033753", "0.68594503", "0.68151736", "0.6432141", "0.6201741", "0.61867356", "0.61589366", "0.6085571", "0.58576995", "0.57957995", "0.5789823", "0.5641363", "0.55706114", "0.5565378", "0.5533577", "0.5495722", "0.54502153", "0.5439057", "0.5426689", "0.5392588", "0.53794...
0.0
-1
How would we present a classification in the history summary?
def show_compact(classification) curi = classification.complianceClassification.uri image_description = image_compact(curi) if CLASSIFICATION_IMAGES.key?(curi) image = image_description && "<img src='#{image_description[:src]}' alt='#{image_description[:alt]}'></img>" "#{classification.year} #{image} #{classification.complianceClassification.name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classification\n @line1[07]\n end", "def train\n run_aggregation\n run_syntetics\n run_values_to_ranges\n run_reverse\n\n [name, classifier]\n end", "def analyze_human_history(history)\n move_count = Hash.new(0)\n # Every move object i...
[ "0.59846663", "0.5837875", "0.5659145", "0.5619961", "0.55832857", "0.5577075", "0.5419695", "0.5419695", "0.5419695", "0.5419695", "0.54122114", "0.5368415", "0.53660685", "0.5345161", "0.5336046", "0.5336046", "0.53346", "0.53112805", "0.5295775", "0.5293207", "0.5286591", ...
0.0
-1
Gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
def additional_data return @additional_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[]
[]
0.0
-1
Sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
def additional_data=(value) @additional_data = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[]
[]
0.0
-1
Instantiates a new win32LobAppRestartSettings and sets the default values.
def initialize() @additional_data = Hash.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_default_settings!\n self.class.default_settings.dup.each do |var, vals|\n setting_objects.detect { |s| s.var == var.to_s } || setting_objects.create(var: var.to_s, value: vals, target: self)\n end\n end", "def reset_to_defaults!\n @allowlist_regexp = nil\n @cust...
[ "0.5677274", "0.5496078", "0.5455873", "0.5455873", "0.5435116", "0.54043627", "0.53806263", "0.53736943", "0.5325208", "0.5321597", "0.53078824", "0.5269786", "0.52443665", "0.5219328", "0.5207854", "0.5186338", "0.5170751", "0.51225865", "0.51161003", "0.5106178", "0.510543...
0.0
-1
Gets the countdownDisplayBeforeRestartInMinutes property value. The number of minutes before the restart time to display the countdown dialog for pending restarts.
def countdown_display_before_restart_in_minutes return @countdown_display_before_restart_in_minutes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countdown_display_before_restart_in_minutes=(value)\n @countdown_display_before_restart_in_minutes = value\n end", "def restart_notification_snooze_duration_in_minutes\n return @restart_notification_snooze_duration_in_minutes\n end", "def restart_count\n ...
[ "0.77445376", "0.5822122", "0.58177066", "0.5649487", "0.561191", "0.55909705", "0.55909705", "0.55469835", "0.54971653", "0.5386674", "0.53762263", "0.53762263", "0.5256719", "0.5256719", "0.51962405", "0.51962405", "0.5191844", "0.51666063", "0.5147846", "0.5135285", "0.513...
0.82854724
0
Sets the countdownDisplayBeforeRestartInMinutes property value. The number of minutes before the restart time to display the countdown dialog for pending restarts.
def countdown_display_before_restart_in_minutes=(value) @countdown_display_before_restart_in_minutes = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countdown_display_before_restart_in_minutes\n return @countdown_display_before_restart_in_minutes\n end", "def restart_notification_snooze_duration_in_minutes=(value)\n @restart_notification_snooze_duration_in_minutes = value\n end", "def restart_count=(v...
[ "0.7300913", "0.5887486", "0.5757111", "0.5319283", "0.52962637", "0.5211868", "0.5211868", "0.51519156", "0.51368046", "0.51368046", "0.5113679", "0.5015245", "0.49272695", "0.49153465", "0.49153465", "0.49071556", "0.49071556", "0.4846544", "0.4619251", "0.45845246", "0.457...
0.8163413
0
The deserialization information for the current model
def get_field_deserializers() return { "countdownDisplayBeforeRestartInMinutes" => lambda {|n| @countdown_display_before_restart_in_minutes = n.get_number_value() }, "gracePeriodInMinutes" => lambda {|n| @grace_period_in_minutes = n.get_number_value() }, "@odata.type" => lambda {|n| @odata_type = n.get_string_value() }, "restartNotificationSnoozeDurationInMinutes" => lambda {|n| @restart_notification_snooze_duration_in_minutes = n.get_number_value() }, } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end", "def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },...
[ "0.6509998", "0.63227415", "0.6322392", "0.6309548", "0.62951833", "0.6238928", "0.6232376", "0.62152934", "0.61999905", "0.6199392", "0.61739326", "0.6173496", "0.61706567", "0.6162942", "0.6162062", "0.61583054", "0.6155537", "0.61427283", "0.61399007", "0.6137798", "0.6120...
0.0
-1
Gets the gracePeriodInMinutes property value. The number of minutes to wait before restarting the device after an app installation.
def grace_period_in_minutes return @grace_period_in_minutes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grace_period\n config['grace_period'] || 60\n end", "def grace_period_in_minutes=(value)\n @grace_period_in_minutes = value\n end", "def grace_period\n Integer(ENV[\"BUDDY_CHECK_GRACE_PERIOD\"].presence || \"4\").hours\n end", "def grace_period\n (ENV[...
[ "0.7927201", "0.7733176", "0.75255436", "0.7262469", "0.6507338", "0.62577146", "0.5999537", "0.59116185", "0.5834151", "0.57465625", "0.57101595", "0.5709149", "0.5608274", "0.55790067", "0.5444113", "0.53648925", "0.53648925", "0.53526986", "0.53356713", "0.53356713", "0.53...
0.852647
0
Sets the gracePeriodInMinutes property value. The number of minutes to wait before restarting the device after an app installation.
def grace_period_in_minutes=(value) @grace_period_in_minutes = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grace_period\n config['grace_period'] || 60\n end", "def grace_period_in_minutes\n return @grace_period_in_minutes\n end", "def grace_period\n Integer(ENV[\"BUDDY_CHECK_GRACE_PERIOD\"].presence || \"4\").hours\n end", "def grace_period\n (ENV[\"BUDDY_C...
[ "0.72385937", "0.6891492", "0.63716114", "0.6176589", "0.5830609", "0.54698396", "0.53761536", "0.5191597", "0.51391387", "0.50907636", "0.5034328", "0.49405888", "0.4938738", "0.48332992", "0.4831327", "0.48058861", "0.47441655", "0.47361067", "0.46910712", "0.4637752", "0.4...
0.7802341
0
Gets the restartNotificationSnoozeDurationInMinutes property value. The number of minutes to snooze the restart notification dialog when the snooze button is selected.
def restart_notification_snooze_duration_in_minutes return @restart_notification_snooze_duration_in_minutes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart_notification_snooze_duration_in_minutes=(value)\n @restart_notification_snooze_duration_in_minutes = value\n end", "def minutes\n _nudge[1]\n end", "def countdown_display_before_restart_in_minutes\n return @countdown_display_before_restart_in_minutes\n ...
[ "0.80405897", "0.58074635", "0.57878417", "0.57857066", "0.5722918", "0.5672198", "0.56698054", "0.5646157", "0.55132204", "0.5461743", "0.5448392", "0.54086286", "0.54086286", "0.54074484", "0.54024965", "0.54024965", "0.5375624", "0.53550667", "0.535254", "0.53249764", "0.5...
0.86595196
0
Sets the restartNotificationSnoozeDurationInMinutes property value. The number of minutes to snooze the restart notification dialog when the snooze button is selected.
def restart_notification_snooze_duration_in_minutes=(value) @restart_notification_snooze_duration_in_minutes = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart_notification_snooze_duration_in_minutes\n return @restart_notification_snooze_duration_in_minutes\n end", "def countdown_display_before_restart_in_minutes=(value)\n @countdown_display_before_restart_in_minutes = value\n end", "def restart_count=(v...
[ "0.7709535", "0.54065514", "0.5065944", "0.50300866", "0.48830426", "0.48774555", "0.48566982", "0.48280942", "0.48192656", "0.47637227", "0.47637227", "0.47322124", "0.46878687", "0.46627617", "0.46418434", "0.45728937", "0.45712686", "0.45511588", "0.45501104", "0.45446718", ...
0.84445095
0
Serializes information the current object
def serialize(writer) raise StandardError, 'writer cannot be null' if writer.nil? writer.write_number_value("countdownDisplayBeforeRestartInMinutes", @countdown_display_before_restart_in_minutes) writer.write_number_value("gracePeriodInMinutes", @grace_period_in_minutes) writer.write_string_value("@odata.type", @odata_type) writer.write_number_value("restartNotificationSnoozeDurationInMinutes", @restart_notification_snooze_duration_in_minutes) writer.write_additional_data(@additional_data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize\n end", "def serialize(object) end", "def serialize; end", "def serialize; end", "def serialize\n \n end", "def serialize\n raise NotImplementedError\n end", "def serialize\n raise NotImplementedError\n end", "def dump\r\n super + to_s\r\n end", ...
[ "0.7951372", "0.7645999", "0.7579812", "0.7579812", "0.7440032", "0.720861", "0.720861", "0.7207583", "0.7016516", "0.70007193", "0.6992252", "0.69838214", "0.69723576", "0.69666415", "0.69666415", "0.6942002", "0.69417155", "0.6933786", "0.6913977", "0.6891677", "0.68810964"...
0.0
-1
belongs_to :user belongs_to :logo, class_name: "Upload" , foreign_key: :pyr_upload_id belongs_to :logo, class_name: "Upload" , foreign_key: :upload_id
def created_at object.created_at.in_time_zone.iso8601 if object.created_at end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logo_params\n params.require(:logo).permit(:name, :belongs_to)\n end", "def upload_params\n params.require(:upload).permit(:title, :upload, :user_id)\n end", "def set_upload_logo\n @upload_logo = UploadLogo.find(params[:id])\n end", "def set_upload\n\n\n @upload = Upload.find(par...
[ "0.66150653", "0.64066476", "0.6385146", "0.62939334", "0.6274697", "0.6152687", "0.61321497", "0.6098173", "0.6042074", "0.6042074", "0.5981241", "0.5913107", "0.58974385", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5868643"...
0.0
-1
Set authorization codes and go to index
def oauth2callback @g_cal_api.oauth2callback end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @authorize_codes = AuthorizeCode.all\n end", "def index\n head :unauthorized\n end", "def index\n\t\tredirect_to oauth_applications_path\n\tend", "def index\n @access_codes = AccessCode.all\n end", "def set_authorize_code\n @authorize_code = AuthorizeCode.find(params[:id])\n ...
[ "0.6984273", "0.6526871", "0.6475551", "0.6322765", "0.6171734", "0.61640507", "0.615604", "0.60372543", "0.6015449", "0.6014099", "0.6014099", "0.5959635", "0.5945048", "0.5905424", "0.58806235", "0.58806235", "0.587843", "0.587843", "0.58746034", "0.5850359", "0.58481234", ...
0.0
-1
Produces a sensible friendly name for this payload, shown in UIs. Must be inferred from serialized job parameters or else won't be shown properly in remote jobs. Should be unique but does not need to be. Has no operational effect. Abstract, your job should override.
def name application_job_overrides_method!(__method__) # default implementation for framework jobs job_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def long_name\n if @description\n @name + ' ' + @description\n else\n @name\n end\n end", "def readable_name\n \"(#{@type}) #{@name}\"\n end", "def to_s; @name || self; end", "def to_s; @name || self; end", "def to_s\n self.name || super\n end", "def to_s\n...
[ "0.6755389", "0.66901404", "0.66427547", "0.66427547", "0.6612011", "0.6612011", "0.657596", "0.6556003", "0.65279055", "0.65095", "0.65082246", "0.65019745", "0.65019745", "0.6493959", "0.6493959", "0.64901716", "0.6482224", "0.6466556", "0.64630014", "0.645534", "0.6447452"...
0.66230166
4
Job ID for this job.
def job_id=(value) @job_id = value.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_id\n @gapi.job_reference.job_id\n end", "def job_id\n raise NotImplementedError\n end", "def job_id\n async && async.job_id\n end", "def getJobId()\n return @helper.getJobId()\n end", "def getJobId()\n return...
[ "0.8665632", "0.8343201", "0.80267394", "0.7953702", "0.7953702", "0.7953702", "0.7953702", "0.7953702", "0.7953702", "0.7953702", "0.78767943", "0.7573737", "0.7429571", "0.7276197", "0.7128654", "0.70065093", "0.69203395", "0.69159067", "0.68273455", "0.6780553", "0.6714613...
0.82318074
2
Optionally produces a unique key to ensure uniqueness of this job. See the Generators module methods for example job_id generators you can use.
def create_job_id application_job_overrides_method!(__method__) # default implementation for framework jobs Generators.generate_uuid(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_key\n @unique_key ||= section.identifier\n end", "def job_identity(args)\n Digest::SHA1.hexdigest([ Time.now.to_f, rand, self, args ].join)\n end", "def job_key\n Digest::MD5.hexdigest(path)\n end", "def key(name)\n @unique_key = name\n end", "def generate...
[ "0.69451106", "0.67873806", "0.6724584", "0.6546879", "0.65102255", "0.6479524", "0.62474793", "0.6236482", "0.621921", "0.620373", "0.61658543", "0.6165188", "0.6146043", "0.61419886", "0.6134388", "0.6120992", "0.60996795", "0.6059127", "0.6036548", "0.6024705", "0.60245883...
0.69101393
1
This is our hook into ActiveJob::Base. we hook like this to make sure we modify the job_id as soon on as possible, before any callbacks get the chance to use it.
def initialize(...) super(...) # there's no point making a job id on deserialization # deserialize creates the instance without assigning anything, # https://github.com/rails/rails/blob/58b46e9440f3460e93b8164205614e3ab85784da/activejob/lib/active_job/core.rb#L61 return if @arguments.nil? # otherwise we assume we were called by `perform` # finally, the magic! new_id = create_job_id # spaces in particular mess with redis self.job_id = new_id.gsub(' ', '') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_id\n async && async.job_id\n end", "def ignored(job)\n @last_job_id = job.job_id\n end", "def id\n active_job_id\n end", "def job_id\n raise NotImplementedError\n end", "def create_job_id\n application_jo...
[ "0.6776416", "0.66619956", "0.65913486", "0.6571547", "0.6552382", "0.6353732", "0.63127846", "0.62516856", "0.6171758", "0.6131321", "0.61189544", "0.60998863", "0.6080193", "0.6059604", "0.60228765", "0.6009621", "0.5960613", "0.5923918", "0.5903697", "0.5870376", "0.586029...
0.66418654
2
Test if this job has a module named `/ApplicationJob/` in it's ancestors.
def application_job_class @application_job_class ||= self.class.ancestors.find { |ancestor| ancestor.name =~ /ApplicationJob/ } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_modules?\n m = @context.modules.find{|m| m.document_self}\n m ? true : false\n end", "def ancestor_exist?\n File.exist? @ancestor_path\n end", "def active?(submodule_name)\n active.select { |s| s[:name].to_s == submodule_name.to_s }.any?\n end", "def application?\n ...
[ "0.60064316", "0.59737045", "0.59465766", "0.5925363", "0.5925363", "0.581879", "0.5794968", "0.57911587", "0.5690794", "0.566401", "0.56617373", "0.56369597", "0.56278485", "0.5624307", "0.5622493", "0.56205124", "0.56189495", "0.55977505", "0.5572676", "0.5548406", "0.55435...
0.5610389
17
def handle_low_stock supplier.notify_low_stock(self) supplier.create_new_order(self) end Compare self with other_item and return true / false if they're equivalent
def ==(other_item) @id == other_item.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_stock_on_create\n # Update current Stock\n if !update_stock(product, store, quantity, true)\n return false\n end\n true\n end", "def reorder_stock?\n stock < 100 && !current_reorder ? true : false\n end", "def trade_item_with_party(new_item, old_item)\n return false if new_i...
[ "0.7001791", "0.66873336", "0.66342664", "0.66234076", "0.6552515", "0.6530507", "0.65024805", "0.6487422", "0.6400829", "0.63834864", "0.6342684", "0.6335373", "0.6317685", "0.6293064", "0.62658036", "0.62519425", "0.6234587", "0.62134993", "0.62090427", "0.61974424", "0.616...
0.0
-1
I may repeat myself at this point but this gives me the opportunity to add more elements in the quantity method
def quantity=(q) @quantity = q notify_observers unless @observers.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantity\n 1\n end", "def qty_to_add\n 0\n end", "def qty_to_add\n 0\n end", "def add_item(title, price, quantity=1)\n self.total += price * quantity #Think about this logically\n #you go into a store and buy and item. How do you get the total of the item.\n #you MULTIPLY BY THE PRIC...
[ "0.71410894", "0.7097543", "0.7097543", "0.7057663", "0.70555025", "0.7023739", "0.7018324", "0.7001784", "0.69785887", "0.69756186", "0.6960602", "0.69258606", "0.6915472", "0.6909458", "0.6852618", "0.68485457", "0.6841577", "0.6832404", "0.6825119", "0.6819864", "0.6816675...
0.0
-1
This is a very basic program
def helloWorld puts "Hello World!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main; end", "def main\n\n end", "def main\n end", "def program; end", "def main\n\nend", "def program() @program end", "def main\n puts \"computor\"\nend", "def main()\n puts(\"Hello, Ruby.\")\n\nend", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end",...
[ "0.76918614", "0.7553086", "0.7534648", "0.7285481", "0.6903553", "0.67122483", "0.6646864", "0.65999115", "0.65616244", "0.65616244", "0.65616244", "0.65616244", "0.65616244", "0.65616244", "0.65616244", "0.65616244", "0.65616244", "0.6470243", "0.64579564", "0.6451093", "0....
0.0
-1
As in qrcode/libqr/qr.h where QR_EM_AUTO and others are defined
def get_mode(key) case key when "S", "s" then -1 # AUTO when "N", "n" then 0 # NUMERIC when "A", "a" then 1 # ALNUM - British number: 0-9 A-Z SP $% * + - /.: when "8" then 2 # 8BIT when "K", "k" then 3 # KANJI end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qrgen\n end", "def qr!\n qr_private(true)\n end", "def create_qrcode\n\n end", "def create_qrcode\n\t\t@qr = RQRCode::QRCode.new( qr_code_params[:text], size: 4)\n\t\tbyebug \n\tend", "def get_default_qr(subscriber = nil)\n if !subscriber.nil? && !subscriber.broker.nil? && !subscriber...
[ "0.6680593", "0.6369212", "0.58728963", "0.5768988", "0.57662284", "0.55521315", "0.5543688", "0.55016404", "0.5436499", "0.5425199", "0.5403892", "0.5366494", "0.52558714", "0.5225098", "0.5211215", "0.51976705", "0.5127769", "0.5107308", "0.5097794", "0.50818354", "0.505780...
0.0
-1
As in qrcode/libqr/qr.h where QR_ECL_L and others are defined
def get_level(key) case key when "L", "l" then 0 # Level L when "M", "m" then 1 # Level M when "Q", "q" then 2 # Level Q when "H", "h" then 3 # Level H end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qr!\n qr_private(true)\n end", "def qrgen\n end", "def error_correction_level\n QRERRORCORRECTLEVEL.invert[@error_correct_level]\n end", "def qr(a, mode:\"reduce\")\n qr,tau, = Lapack.call(:geqrf, a)\n *shp,m,n = qr.shape\n r = (m >= n && %w[economic raw].include?(mode)) ?\...
[ "0.58929676", "0.56917536", "0.53126216", "0.5306257", "0.52803236", "0.50964993", "0.50866884", "0.5058369", "0.5021435", "0.50183284", "0.5000242", "0.49983957", "0.4944906", "0.4912101", "0.490266", "0.48873538", "0.48785958", "0.48675796", "0.486138", "0.4852858", "0.4847...
0.0
-1
As in qrcode/libqr/qr.h where QR_FMT_PNG and others are defined
def get_fmt(key) case key when "PNG" , "png" then 0 when "BMP" , "bmp" then 1 when "TIFF" , "tiff" then 2 when "PBM" , "pbm" then 3 when "SVG" , "svg" then 4 when "JSON" , "json" then 5 when "DIGIT", "digit" then 6 when "ASCII", "ascii" then 7 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qr_code_png\n data.qr_code_png\n end", "def qr\n require 'rqrcode'\n str = params[:str] || \"\"\n\n qr = RQRCode::QRCode.new(str)\n\n qr_img_stream = qr.as_png(\n border_modules: 2,\n color: \"24292e\"\n ).to_s\n\n send_data(qr_img_stream, type: 'image/png', dispositio...
[ "0.7304352", "0.63814193", "0.6361944", "0.6309719", "0.627624", "0.62594956", "0.6193855", "0.61348987", "0.6073656", "0.60207593", "0.6010622", "0.59499043", "0.59071636", "0.5876007", "0.58601093", "0.5725574", "0.57152325", "0.5713905", "0.56694376", "0.5660416", "0.56595...
0.5438848
29
def check_role return if current_user.admin? flash[:danger] = "You can not access this page" redirect_to "/" end
def check_logged_in return if current_user.present? redirect_to new_session_path and return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_role\n if current_user && current_user.has_role?(:admin)\n return\n else\n flash[:notice]= \"You are not authorised to access the page you sought.\"\n redirect_to root_path\n end\n end", "def check_admin_account\n if current_user.role != User::ROLES[:admin]\n ...
[ "0.9101603", "0.88891053", "0.8680809", "0.8555592", "0.8486647", "0.84440166", "0.8439981", "0.84281206", "0.84140724", "0.83931994", "0.8388361", "0.8388361", "0.83513", "0.83427006", "0.82368946", "0.82358104", "0.8231629", "0.8231629", "0.8220099", "0.8172039", "0.8172039...
0.0
-1
Write a method that can rotate the last n digits of a number. For example: input two integers : one integer to be rotated, and other is the number of digits output integer format string, array algorithm convert input num to string then to array of characters partition the array into two normal part and part to be rotated slice rot_array from second character to end add the second char to the back of slice above join the updated rot array to the non rot partition join the characters and convert to integers
def rotate_array(array) array.drop(1) + array.take(1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_rightmost_digits(array, n)\n input_array = array.to_s.chars\n start_index = input_array.length - n\n sub_array = input_array[start_index..-1]\n sub_array_rotated = rotate_array(sub_array)\n output = input_array[0...start_index] + sub_array_rotated\n output.join(\"\").to_i\nend", "def rotate_righ...
[ "0.849868", "0.83939755", "0.8272897", "0.8267768", "0.8226593", "0.8161139", "0.8154906", "0.8150445", "0.8144105", "0.807286", "0.8058883", "0.80575687", "0.80546373", "0.8018729", "0.7981977", "0.78909534", "0.7873332", "0.7853329", "0.78415793", "0.7829765", "0.7808221", ...
0.0
-1
Example: 34,592,129,909 => [3,4,5,9,2,1,2,9,9,0,9]
def num_to_array num array = [] div = 100000 while div >= 1 if (num / div) > 0 digit = num / div array << digit num = num - (div * digit) end div = div / 10 end return array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digit_list(num)\n arr = []\n divisor = 10**((num.to_s.length) - 1)\n \n while divisor >= 1\n digit = num/divisor\n arr << (num / divisor)\n num -= digit*divisor\n\n divisor = divisor / 10\n end\n \n arr\nend", "def given\n [6,5,3,1,8,7,2,3]\nend", "def cracklepop_numbers(from, to)\n (f...
[ "0.6796014", "0.67468256", "0.66053814", "0.658939", "0.65767604", "0.6517231", "0.6487109", "0.6483543", "0.64770216", "0.6473975", "0.64121974", "0.64044446", "0.6392021", "0.6385052", "0.6381544", "0.6380667", "0.63645804", "0.63514507", "0.63497907", "0.6341346", "0.63396...
0.67473537
1
Creates a new GetDecksResponse
def initialize(response) handle_errors(response) JSON.parse(response.body).each do |key, value| if key == 'decks' # Keep the API response count, it will differ when invalid decks are stripped @decks_count = value.size instance_variable_set( "@#{key}".to_sym, value.map { |deck| ZombieBattleground::Api::Models::Deck.new(deck) } ) else instance_variable_set("@#{key}".to_sym, value) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_factory(data)\n\t\t\t\t\t\treturn Response.new(data)\n\t\t\t\t\tend", "def create_response(request)\n response = Response.new\n end", "def initialize(response)\n handle_errors(response)\n\n @deck = ZombieBattleground::Api::Models::Deck.new(JSON.parse(response.body))\n ...
[ "0.5612215", "0.5533734", "0.5371256", "0.52257246", "0.5163544", "0.515944", "0.51577", "0.5107998", "0.5074359", "0.50703037", "0.50401974", "0.50234216", "0.5021981", "0.4982436", "0.49554443", "0.49522188", "0.49125293", "0.49082685", "0.48954833", "0.4892001", "0.4892001...
0.5753592
0
Validator for decks attribute
def decks_is_an_array_of_deck unless @decks.is_a?(Array) errors.add(:decks, 'Decks must be an array') return end if remove_invalid remove_invalid_decks else decks_contains_valid_decks end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_exclusion_of(attr); end", "def valid_attribute?( attroid )\n\t\treturn !self.valid_attribute_type( attroid ).nil?\n\tend", "def valid_attributes\n {:name => 'Test it!', \n :deck_id => 1}\n end", "def value_required?\n false\nend", "def is_attribute?; end", "def required_attribute(...
[ "0.7276079", "0.61786276", "0.6087367", "0.6049549", "0.604743", "0.597744", "0.59737676", "0.5950207", "0.59392685", "0.58715093", "0.5847882", "0.5847882", "0.58447707", "0.58327436", "0.5800344", "0.5771799", "0.57700604", "0.5767541", "0.57667875", "0.5763943", "0.5751139...
0.0
-1
Validator for decks in decks
def decks_contains_valid_decks @decks.each do |deck| next if deck.is_a?(ZombieBattleground::Api::Models::Deck) && deck.valid? && deck.errors.size.zero? errors.add(:decks, 'decks must be an array of Deck') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_invalid_decks\n @decks.select! do |deck|\n deck.is_a?(ZombieBattleground::Api::Models::Deck) &&\n deck.valid? &&\n deck.errors.size.zero?\n end\n end", "def decks_is_an_array_of_deck\n unless @decks.is_a?(Array)\n errors...
[ "0.6536624", "0.6467546", "0.6031117", "0.5980525", "0.57976454", "0.5779107", "0.57296395", "0.57295007", "0.5706486", "0.56935155", "0.56799835", "0.5678328", "0.56366324", "0.5572912", "0.553737", "0.55199265", "0.5515637", "0.5477121", "0.544545", "0.54299545", "0.5417221...
0.80109626
0
Removes invalid vards from deck
def remove_invalid_decks @decks.select! do |deck| deck.is_a?(ZombieBattleground::Api::Models::Deck) && deck.valid? && deck.errors.size.zero? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_invalid_codes(guess)\n @valid_codes.filter! { |code| code.check_code(guess) == [@black_pegs, @white_pegs] }\n puts \"#{@valid_codes.count} possible codes left\"\n end", "def find_unseen\n unseen.replace(full_deck)\n (my_hand + op_hand + my_lands.values +\n op_lands.values + discards....
[ "0.61292017", "0.6067254", "0.60121524", "0.5808344", "0.5545818", "0.5521131", "0.5516175", "0.55056226", "0.5500904", "0.5476033", "0.54756474", "0.5460172", "0.5446137", "0.5412514", "0.5403982", "0.53832686", "0.53735137", "0.5367933", "0.5349089", "0.5344778", "0.5327373...
0.6802469
0
get every test to pass before coding runner below
def runner welcome total = initial_round until (total > 21) do total=hit?(total) display_card_total(total) end end_game(total) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if no...
[ "0.7274132", "0.7200911", "0.71905994", "0.7134598", "0.7127439", "0.70358455", "0.6860759", "0.68229115", "0.68049264", "0.6790065", "0.6790065", "0.6768047", "0.65728307", "0.65551996", "0.65487796", "0.65460235", "0.65293026", "0.64595217", "0.6447049", "0.6447049", "0.644...
0.0
-1
Creates a thumbnail of the specified width. If you want to add a border later on, you want to pass in a slightly smaller width to accomodate that.
def thumbnail(width, input, output) profile_normalization_args=["--eprofile", srgb_profile_path, "--delete"] vips_jpg_params="[Q=#{@jpeg_q },interlace,optimize_coding,strip]" args = if width # The image will be resized to fit within a box # which is `width` wide and very, very very tall. # See: # https://github.com/libvips/libvips/issues/781 # https://github.com/libvips/ruby-vips/issues/150 [ vips_thumbnail_command, input.path, *profile_normalization_args, "--size", "#{width}x1000000", "-o", "#{output.path}#{vips_jpg_params}" ] else [ vips_command, "copy", input.path, *profile_normalization_args, "#{output.path}#{vips_jpg_params}" ] end @cmd.run(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_thumbnail\n return create_resized_pic(THUMBNAIL_HEIGHT, THUMBNAIL_WIDTH, SIZE_THUMBNAIL)\n end", "def create_thumbnail\n image = Image.from_blob(self.photo_image).first\n thumbnail = image.resize_to_fill(320,240, gravity=CenterGravity)\n thumbnail.to_blob\n end", "def create_thumbnail\...
[ "0.748874", "0.6964323", "0.6913624", "0.6889628", "0.6693401", "0.65814626", "0.6438554", "0.64294255", "0.6373394", "0.628498", "0.6252689", "0.61509806", "0.61287034", "0.60934186", "0.608831", "0.60692656", "0.6039962", "0.6027294", "0.5983646", "0.59438753", "0.59370196"...
0.6541785
6
Sharpen a thumbnail. A full description of the paramaters below can be found at
def sharpen(width, input, output) args = [ vips_command, "sharpen", input.path, output.path, "--sigma", ((width > 150) ? 3 : 1).to_s, "--x1", "2" , "--y2", "10" , # (don't brighten by more than 10 L*) "--y3", "10" , # (can darken by up to 20 L*) "--m1", "0" , # (no sharpening in flat areas) "--m2", "3" , # (some sharpening in jaggy areas) ] @cmd.run(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sharpen\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.sharpen(0.0, 1.0)\n img.write('public' + @photo.attachment_url)\n end", "def sharpen(h = {})\n params[:name] ||= @pictureName.gsub('.png', 'Sharpened.png')\n params[:sa...
[ "0.7219838", "0.70544755", "0.629227", "0.62538886", "0.6026511", "0.6013358", "0.59702706", "0.5906047", "0.5893951", "0.58047897", "0.57572883", "0.57541084", "0.5736656", "0.5730796", "0.5662211", "0.56321853", "0.56083924", "0.5537284", "0.5532628", "0.5509152", "0.550676...
0.646944
2
Return the height of an image in pixels.
def image_height(image) args = [vips_header_command, '-f', 'Ysize', image.path] @cmd.run(*args).out.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def height\n image.size\n end", "def height\n image_ptr[:sy]\n end", "def height\n @image.height\n end", "def height\n rmagick_image.rows\n end", "def image_height\n\t\t\t@data[\"image\"][\"height\"]\n\t\tend", "def image_height(image_handle)\n end", "def height\n ...
[ "0.840538", "0.83588284", "0.82243884", "0.80493534", "0.78731966", "0.7872541", "0.78029954", "0.7714455", "0.77050024", "0.76361006", "0.73214", "0.7191762", "0.71430886", "0.71018845", "0.7077689", "0.7043093", "0.6975227", "0.69310594", "0.68702257", "0.6746428", "0.67160...
0.82509464
2
column no + 9. 9times == array
def boxes(cell_index) box_column_index = (cell_index % 9) / 3 box_row_index = cell_index / 27 box_first = box_row_index * 27 + box_column_index * 3 # sum = [box_first,1,1,7,1,1,7,1,1].map {|index| index + index} sum = [1,1,7,1,1,7,1,1].inject([box_first]) {|indexes, offset| indexes << offset + indexes.last} sum.map { |index| @grid[index] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_col_cells col\n\t\treturn (col...9 ** 2).step(9).to_a\n\tend", "def column_index(slot)\n slot % 9\n end", "def column_of(range); end", "def get_row_cells row\n\t\treturn (row * 9...row * 9 + 9).to_a\n\tend", "def _get_board_columns()\n column_index = 0\n array_of_columns = []\n ...
[ "0.70424986", "0.66484493", "0.6530665", "0.6526589", "0.63949686", "0.63226736", "0.6296218", "0.62741035", "0.6255498", "0.6239319", "0.6210454", "0.6151495", "0.6115818", "0.60251474", "0.59775597", "0.59335655", "0.5925241", "0.59169173", "0.59075546", "0.58862156", "0.58...
0.0
-1
True if the event has already passed
def has_passed? Time.zone.at(starttime) < Time.zone.now end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event?\n @events_mutex.synchronize do\n !@events.empty?\n end\n end", "def eventless?\n ! @event\n end", "def evented\n @evented = true\n end", "def event_received(sequence)\n false # return true if we handled the event here\n end", "def performed?(event)\n ...
[ "0.7440245", "0.73332983", "0.7303605", "0.7271702", "0.7242666", "0.7242666", "0.72190714", "0.72174686", "0.7198475", "0.7172934", "0.71527994", "0.71440494", "0.7077931", "0.6946691", "0.68673426", "0.68347204", "0.68183887", "0.68033457", "0.6778147", "0.6777544", "0.6738...
0.0
-1
GET /projects or /projects.json
def index @projects = current_user.projects.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n get 'projects'\n end", "def listprojects\n get('listprojects.json')['projects']\n end", "def projects\n request(method: 'getAllProjects')\n end", "def projects(params = {})\n make_get_request('/account/projects', params)\n end", "def projects\n resource 'projects'\n e...
[ "0.8347259", "0.798982", "0.7920745", "0.7814874", "0.77544016", "0.770965", "0.74383014", "0.7373741", "0.7356232", "0.7333684", "0.73274547", "0.73206097", "0.7315391", "0.72966963", "0.72867036", "0.72863996", "0.72863996", "0.72863996", "0.72863996", "0.72863996", "0.7286...
0.0
-1
GET /projects/1 or /projects/1.json
def show project = Project.where(id: params[:id]).first if project.present? @tasks = project.tasks end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n get 'projects'\n end", "def listprojects\n get('listprojects.json')['projects']\n end", "def get\n CircleCi.request(conf, '/projects').get\n end", "def projects\n request(method: 'getAllProjects')\n end", "def show\n @project = @client.projects.find(params[:id])\n r...
[ "0.78086686", "0.75306284", "0.7333377", "0.7333045", "0.729723", "0.72843105", "0.72768533", "0.7254954", "0.7245274", "0.7242027", "0.72348636", "0.71435845", "0.71272165", "0.7118981", "0.71186686", "0.71186686", "0.71186686", "0.71186686", "0.71186686", "0.71186686", "0.7...
0.0
-1
POST /projects or /projects.json
def create @project = current_user.projects.new(project_params) respond_to do |format| if @project.save format.html {redirect_to "/projects", notice: "Project was successfully created."} format.json {render :show, status: :created, location: @project} else format.html {render :new, status: :unprocessable_entity} format.json {render json: @project.errors, status: :unprocessable_entity} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_should_create_project_via_API_JSON\r\n get \"/logout\"\r\n post \"/projects.json\", :api_key => 'testapikey',\r\n :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Pro...
[ "0.7134768", "0.71024853", "0.7024186", "0.7020876", "0.7006797", "0.69238055", "0.6899287", "0.68908757", "0.6807239", "0.6781449", "0.675678", "0.6754991", "0.675458", "0.6743632", "0.67409533", "0.67326033", "0.6710531", "0.6694772", "0.6690449", "0.6688386", "0.6681838", ...
0.6734336
15
PATCH/PUT /projects/1 or /projects/1.json
def update respond_to do |format| if @project.update(project_params) format.html {redirect_to @project, notice: "Project was successfully updated."} format.json {render :show, status: :ok, location: @project} else format.html {render :edit, status: :unprocessable_entity} format.json {render json: @project.errors, status: :unprocessable_entity} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end", "def update\n @project = Project.find(params[:id])\n\n if params[:name] == \"project_name\"\n project_name = pa...
[ "0.7226871", "0.7201011", "0.7144544", "0.71334213", "0.71198756", "0.71166897", "0.7107941", "0.71031785", "0.70998937", "0.70983905", "0.7094925", "0.70939213", "0.7086738", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.708290...
0.0
-1
DELETE /projects/1 or /projects/1.json
def destroy project=Project.find(params[:project_id]) project.destroy respond_to do |format| format.html {redirect_to projects_url, notice: "Project was successfully destroyed."} format.json {head :no_content} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(projects)\n project_ids = projects.collect { |project| project.id } \n args = {ids: project_ids.to_json}\n return @client.api_helper.command(args, \"project_delete\")\n end", "def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to pr...
[ "0.7736063", "0.76790005", "0.764256", "0.7580914", "0.75690496", "0.75549084", "0.7554458", "0.7554458", "0.7554458", "0.7554458", "0.7554458", "0.7552977", "0.75320613", "0.75320166", "0.7526476", "0.75191283", "0.75152", "0.75062424", "0.75062424", "0.75062424", "0.7506242...
0.72214997
97
Use callbacks to share common setup or constraints between actions.
def set_project @project = Project.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.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.533...
0.0
-1
Only allow a list of trusted parameters through.
def project_params params.require(:project).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
Problem 1 Return sum of subsequent sums of an array:
def sum_of_sums(numbers) sum = 0 numbers.size.times { |counter| sum += numbers[0..counter].sum } sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_sums(array)\n sum = 0\n array.length.times do |index|\n sum += array[0, index + 1].reduce(&:+)\n end\n sum\nend", "def sum_of_sums(array)\n n = 1\n running_total = 0\n while n <= array.size\n running_total += array.first(n).reduce(:+)\n n += 1\n end\n running_total\nend", "def sum_...
[ "0.8281554", "0.82208693", "0.8166877", "0.81170225", "0.8106525", "0.80838555", "0.80736846", "0.802728", "0.79922116", "0.7982901", "0.7920427", "0.7884447", "0.7881639", "0.7822368", "0.7818045", "0.78155273", "0.7815257", "0.7804419", "0.7793377", "0.7789122", "0.77867985...
0.0
-1
Problem 3 Returns an arrary of all substrings from the beginning:
def leading_substrings(str) result = [] str.size.times { |index| result << str[0..index] } result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substrings(str)\n str.chars.map.with_index do |subr,index|\n leading_substrings(str.slice(index..-1))\n end.flatten\nend", "def substrings(str)\n result = []\n 0.upto(str.size) do |number|\n result[number] = leading_substrings(str[number..str.size])\n end\n\n result.flatten\nend", "def substrin...
[ "0.7873322", "0.7789378", "0.77858406", "0.77588797", "0.7748362", "0.7724487", "0.7709579", "0.7698712", "0.76482326", "0.76441306", "0.7643576", "0.7633522", "0.7619047", "0.76157546", "0.7615237", "0.7606005", "0.7603573", "0.7603573", "0.7601993", "0.7596238", "0.7583669"...
0.7352886
68
== ['x', 'xy', 'xyz', 'xyzz', 'xyzzy'] Problem 4 Returns an array of all possible substrings:
def substrings(str) result = [] until str.empty? str.size.times { |index| result << str[0..index] } str[0] = '' end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arr_all_possible_substrings(str)\n substring_array = []\n i = 0\n while i < str.length\n j = 0\n while j < str.length\n substring_array << str[i, j]\n j += 1\n end \n i += 1\n end\n substring_array\nend", "def substrings(str)\n return_arr = []\n\n str.length.times {|i| return_arr...
[ "0.83117604", "0.78214234", "0.7605888", "0.7602336", "0.75585425", "0.7551785", "0.7514731", "0.75125253", "0.750901", "0.75076646", "0.7482837", "0.74283814", "0.74197704", "0.7387275", "0.7381062", "0.73805225", "0.73743063", "0.7340027", "0.73298144", "0.7313307", "0.7305...
0.70238173
45
Problem 5 Return an Array of all possible substrings that are full palindromes:
def palindrome?(str) matches = [] str.size.times { |index| matches << (str[index] == str[-(index+1)]) } matches.all?(true) && matches.size > 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def palindrome_substrings(str)\n palSub = []\n subStr = substrings(str)\n\n subStr.each do |ele|\n if palindrome?(ele) && ele.length > 1\n palSub << ele\n end\n end\n\n return palSub\n\nend", "def str_palindromes(str)\n arr_palindromes = arr_all_possible_substrings(str).s...
[ "0.804255", "0.80084914", "0.79666907", "0.79459494", "0.7927535", "0.79171115", "0.7913102", "0.79103935", "0.79059225", "0.78673655", "0.78275263", "0.7824925", "0.77850646", "0.7712527", "0.76719534", "0.76359624", "0.7621455", "0.75811666", "0.75699514", "0.74155515", "0....
0.6682646
47
Problem 7 Double every character in a string:
def repeater(string) result = '' string.each_char { |char| result << char * 2 } result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def double_characters(string)\n doubled_string = ''\n string.chars.each do |char|\n doubled_string << char * 2\n end\n doubled_string\nend", "def crunch(double_string)\n current_character = ''\n new_string = ''\n double_string.each_char do |character|\n if character != current_charact...
[ "0.7101016", "0.7025963", "0.7020939", "0.70161104", "0.68952066", "0.6847274", "0.67384106", "0.6737129", "0.668753", "0.6619752", "0.6591968", "0.65453845", "0.65288544", "0.65108997", "0.65024275", "0.649801", "0.6496632", "0.6492722", "0.64839554", "0.64764035", "0.647060...
0.6221431
52
Problem 9 Reverse digits in an integer:
def reversed_number(int) int.to_s.reverse.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_digits(int)\n \nend", "def reversed_number(int)\r\n int.digits.join.to_i\r\nend", "def reversed_number(integer)\n p integer.digits.join.to_i # .to_i automatically omit the leading 0s\n end", "def reversed_number_re(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.digits....
[ "0.84039575", "0.8104306", "0.79693216", "0.7907518", "0.7893917", "0.7881715", "0.7798595", "0.7794753", "0.775013", "0.7735869", "0.7705627", "0.769371", "0.7679189", "0.7659558", "0.7659558", "0.7659558", "0.76563615", "0.76505214", "0.76505214", "0.76384026", "0.76285136"...
0.76764
15
Problem 10 Return the middle one or two characters from an input string:
def center_of(string) middle = (string.size - 1) / 2.0 string[middle.floor..middle.ceil] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def middle_character(string)\n array = string.split('')\n middle_index = (array.size / 2.0).floor\n if array.size.odd?\n array.slice(middle_index)\n else\n array.slice((middle_index - 1), (middle_index)).join\n end\nend", "def get_middle(str)\n str.length.even? ? str.slice(str.length / 2 - 1, 2) : st...
[ "0.8088445", "0.8059844", "0.8052275", "0.7976995", "0.7835989", "0.7801084", "0.77518326", "0.7720265", "0.76894456", "0.76657164", "0.76598173", "0.7655968", "0.76338226", "0.7624497", "0.75902146", "0.75733304", "0.75604975", "0.7558836", "0.7534535", "0.75228256", "0.7501...
0.0
-1
Helper defining routes for tools Creates get and post methods and optional upload path
def tool(name, tools = []) get name => "#{name}#editor" if (!tools || tools.empty?) post name => "#{name}##{name}" else tools.each { |t| post "#{name}/#{t}" => "#{name}##{t}" } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rest_routes\n\t\t\t\t\t[\n\t\t\t\t\t\t{ method: :GET, path: '/', action: :index },\n\t\t\t\t\t\t{ method: :POST, path: '/', action: :create },\n\t\t\t\t\t\t{ method: :GET, path: '/', action: :show },\n\t\t\t\t\t\t{ method: :PUT, path: '/', action: :update },\n\t\t\t\t\t\t{ method: :DELETE...
[ "0.5917844", "0.57401776", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.5708758", "0.5701988", "0.5696045", "0.5664078", "0.559829", "0.55765873", "0.55240214", "0....
0.0
-1
Mock a crappy remote API call that could toss an exception on some upstream error. It also mocks a return value of ':pending' when it's not complete and returns ':happy' when it's complete.
def crappy_api_call $count += 1 # First two calls fail raise "OH SNAP" if $count < 3 # Next few calls say pending return :pending if $count < 5 # Then finally done return :happy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_WAPI_do_request_rest_client_error_417\n\n\n stub_request(:get, \"https://start/hey\").\n with(:headers => {'Accept' => 'application/json', 'Accept-Encoding' => 'gzip, deflate', 'Authorization' => 'Bearer sweet!'}).\n to_return(:status => 417, :body => \"\", :headers => {})\n\n a = Hash...
[ "0.6178254", "0.6141393", "0.60216916", "0.59456843", "0.5910256", "0.5890731", "0.5865106", "0.58541054", "0.5812357", "0.57681704", "0.57539564", "0.57478607", "0.57234883", "0.57191676", "0.56989217", "0.56568074", "0.56478715", "0.56476104", "0.5606398", "0.55973184", "0....
0.67977315
0
gives access only to admins
def admin_authorize unless admin? unauthorized_access end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end", "def admin_only\n logged_in_as_admin? || admin_only_access_denied\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_ac...
[ "0.86371636", "0.83459985", "0.82223135", "0.82223135", "0.82223135", "0.8175221", "0.8144395", "0.80259246", "0.8019694", "0.8017181", "0.80156016", "0.7998937", "0.78378737", "0.7828317", "0.78093797", "0.7798542", "0.77846724", "0.77846724", "0.7780404", "0.77686113", "0.7...
0.80476624
7
gives access only to site users who are logged in
def logged_in_authorize unless logged_in? unauthorized_access end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users_only\n deny_access(\"You must be signed in to access this page.\") unless signed_in?\n end", "def index\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n else \n redirect_to '/'\n end\n end", "def rest...
[ "0.730793", "0.7149087", "0.7117983", "0.70749795", "0.69553155", "0.69322926", "0.6916093", "0.69120735", "0.6886978", "0.68804616", "0.6854237", "0.6820669", "0.67882574", "0.67832416", "0.6763707", "0.6740942", "0.67242223", "0.6723324", "0.6716212", "0.66941446", "0.66939...
0.6344052
96
gives access only to the a specific member or admin helpfull for making sure that users can get at their own data
def owner_authorize(member_id) unless logged_in? and (current_member.id == member_id or admin?) unauthorized_access end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n #@members = member.all\n #@members = member.with_restricted_access_access\n @members = policy_scope(Member)\n end", "def require_admin\n grant_access?(\"index\", \"users\")\n #position?('admin')\n end", "def show\n \t@person = Person.find(params[:id])\n \t@is_admin = false\n \ta...
[ "0.6990862", "0.69782126", "0.69671196", "0.6959876", "0.69419694", "0.69389963", "0.6847647", "0.68387246", "0.6830375", "0.6826971", "0.67902064", "0.678618", "0.67756116", "0.67606384", "0.6757479", "0.6737181", "0.6736251", "0.6726605", "0.67249906", "0.6718217", "0.67171...
0.68640155
6
handles any unauthorized access
def unauthorized_access flash[:notice] = "Unauthorized access" redirect_to "/" return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_denied\n end", "def access_denied\n\n end", "def unauthorized\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def access_denied\n render status: 401, text: \"nice try\"\n end", "...
[ "0.8153234", "0.8111288", "0.8007728", "0.7906234", "0.7906234", "0.7815678", "0.7541762", "0.7495611", "0.7486655", "0.74267477", "0.73973364", "0.73643005", "0.73596156", "0.73589784", "0.7343593", "0.7312019", "0.7270852", "0.72624624", "0.7259183", "0.7242461", "0.7220076...
0.7126877
31
This sets up method which allows controllers to either assign a member_id param to a specific member_id or to current_member.id if none is supplied using a merge method on the param hash. Returns the hash that gets fed into the create method. Helps tests not fuck up...
def memberified_params(object) entry_params = params[object.to_sym] if current_member entry_params = {:member_id => current_member.id}.merge(entry_params) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_member\n if current_member \n @member = Member.find(current_member.id)\n else \n @member = Member.find(params[:id])\n end\n end", "def set_member\n member_id = params[:id]\n @member = Member.find(member_id)\n end", "def set_member\n @member = Member.find(params[:member_id...
[ "0.70346093", "0.6793235", "0.65289307", "0.6348152", "0.6348152", "0.6348152", "0.6348152", "0.6348152", "0.63186455", "0.63106835", "0.62819356", "0.6279582", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783"...
0.6534034
2
converts an array into an unordered list
def to_list(options = {}) css_class = options.delete(:class) || 'errors' list_items = self.inject("") do |items, error| items << "<li>#{error}</li>" end return '<ul class="%s">%s</ul>' % [css_class, list_items] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_to_html array, type\n '<ul> <li>' +\n array.join('</li><li>')\n + '</li> </ul>'\nend", "def make_list(array)\n\ty = []\n\tarray.each_with_index do |element, index|\n\t\ty << \"#{index+1}. #{element}\"\n\tend\n\ty\nend", "def make_list_a(array)\n\tstring_array = []\n\tarray.each do |eleme...
[ "0.75367564", "0.6981503", "0.68928045", "0.6551364", "0.6535587", "0.6497203", "0.6449394", "0.642377", "0.62411296", "0.6121402", "0.60963625", "0.6071792", "0.60167044", "0.59830135", "0.5947059", "0.5935377", "0.5882502", "0.5839958", "0.58238006", "0.5794239", "0.5794239...
0.0
-1
exercise_2 x = 2 => 2 puts x = 2 nil p name = "Joe" => "Joe" four = "four" => "four" print something = "nothing" nothing=> nil exercise_3
def multiply(num1, num2) num1 * num2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def praise_person(name, age)\n puts \"#{name} is amazing\"\n puts \"#{name} is charming\"\n puts \"#{name} is talented\"\n puts \"#{name} is #{age} years old\"\n puts \"In 5 years he is going to be #{age + 5}\"\nend", "def main\n\n #\n # In Ruby, everything is an expression, even the control structures.\n...
[ "0.64835894", "0.63050634", "0.6302982", "0.6074408", "0.5968881", "0.5822489", "0.58056784", "0.5795795", "0.5788402", "0.57811505", "0.5778462", "0.5766011", "0.5762608", "0.57476556", "0.5741858", "0.5726895", "0.57242477", "0.57239497", "0.5711015", "0.5696518", "0.568860...
0.0
-1
=begin Write a recursive method that computes the nth Fibonacci number, where nth is an argument to the method. =end
def fibonacci(nth) return 1 if nth <= 2 fibonacci(nth - 1) + fibonacci(nth - 2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nthFibonacci(n)\r\n if n == 1\r\n return 1\r\n\r\n elsif n == 2\r\n return 1\r\n\r\n else n > 2\r\n n = nthFibonacci(n-1) + nthFibonacci(n-2)\r\n end\r\nend", "def nth_fibonacci(n) \n if n == 1\n return 0\n elsif n == 2\n return 1\n end\n return nth_fibonacci(n-1) + nth_fibonacci(n-2)\...
[ "0.88453704", "0.87202966", "0.8685772", "0.86717737", "0.8661782", "0.86557686", "0.8654843", "0.8651081", "0.8637643", "0.86105245", "0.8604302", "0.8581592", "0.85796225", "0.85788125", "0.85763425", "0.8569461", "0.85639817", "0.8561878", "0.85530084", "0.85500234", "0.85...
0.86496305
10
Use callbacks to share common setup or constraints between actions.
def set_amiibo_character @amiibo_character = AmiiboCharacter.find(params[:name]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Only allow a trusted parameter "white list" through.
def amiibo_character_params params.require(:amiibo_character).permit(:name, :image_URL) 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.71217275", "0.7052942", "0.6947555", "0.6903013", "0.6735074", "0.67167085", "0.6687677", "0.66765445", "0.66602796", "0.65548825", "0.6524274", "0.6455697", "0.6451343", "0.645123", "0.64465624", "0.6433475", "0.64118403", "0.64118403", "0.6390524", "0.6378871", "0.637887...
0.0
-1
GET /publications/1 GET /publications/1.json
def show #@publication = Publication.find(params[:id]) #@issues = @publication.issues.where( :issue_states => {:name => 'released'}) #render json: @issues publication = Publication.find_by_product_code(params[:id]) state = IssueState.find_by_name('Released') issues = Issue.where(:publication_id => publication, :issue_state_id => state) render json: issues.as_json({:except => :pdf_zip}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if @author_id\n @publications = @author.publications\n else\n @publications = Publication.all\n end\n render json: @publications\n end", "def show\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js...
[ "0.7736908", "0.74060816", "0.7345839", "0.7342929", "0.7266342", "0.7266342", "0.7266342", "0.7266342", "0.7246774", "0.7091658", "0.7055921", "0.69800436", "0.6962401", "0.69450855", "0.69283414", "0.6888351", "0.6845632", "0.6840642", "0.68183666", "0.6756092", "0.6739041"...
0.6005596
83
Open the bookmarks and return an REXML::Document. If the cache option is provided, the document is loaded from the localpath specified.
def open require 'rexml/document' xml = if cache && File.exist?(cache) File.read(cache) else request :all end File.open(cache, 'wb') { |io| io.write(xml) } if cache REXML::Document.new(xml) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(path)\n document = parse(File.read(path))\n document.path = path\n document\n end", "def get_html\n print \"Getting doc...\"\n if File.size?(@cache)\n html = File.read(@cache)\n else\n html = open(URL).read\n IO.write(@cache, html)\n end\n puts \"d...
[ "0.5680514", "0.55620104", "0.54649127", "0.54545224", "0.5450304", "0.5341162", "0.5259545", "0.5218658", "0.5166951", "0.5152344", "0.51081336", "0.50645673", "0.50215924", "0.499534", "0.49784198", "0.49608606", "0.4945149", "0.49401587", "0.49323162", "0.49273184", "0.492...
0.72416097
0
The Time of the most recently updated bookmark on del.icio.us.
def last_updated_at if cache @last_updated_at ||= remote_last_updated_at else remote_last_updated_at end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bookmark_time\n @ole.BookmarkTime\n end", "def last_update\n Time._load(index_time_dbm_file['last']) rescue \"none\"\n end", "def last_update\n Time.parse(@record.SystemModstamp)\n end", "def last_updated\n self.dig_for_datetime(\"lastUpdateOn\")\n end", "def last_up...
[ "0.7913958", "0.6993065", "0.69735515", "0.6973531", "0.68950564", "0.68847346", "0.680392", "0.6698146", "0.66977865", "0.6677674", "0.6677674", "0.6677674", "0.6677674", "0.6674719", "0.6674719", "0.6674719", "0.66537464", "0.66537464", "0.66537464", "0.66537464", "0.663517...
0.6143404
89
Determine if any bookmarks have been updated since the time specified.
def updated_since?(time) time < last_updated_at end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stale?(time = Time.now)\n updated_at < time\n end", "def has_beeen_updated_recently?( update_time )\n now = Time.now.utc\n ( (! update_time.nil?) && (update_time.year == now.year) && (update_time.month == now.month) && (update_time.day == now.day) &&\n (update_time.hour == now.hour) && (up...
[ "0.70125854", "0.6957735", "0.68587834", "0.685865", "0.6844506", "0.6724337", "0.6705332", "0.6684811", "0.6628862", "0.6596946", "0.6590277", "0.653508", "0.6528973", "0.6457132", "0.6413472", "0.6410814", "0.6402752", "0.63746107", "0.6356492", "0.6343933", "0.6343933", ...
0.741279
0