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
Returns only the Races with +results+
def races_with_results races.select(&:any_results?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_results(race)\n Result.all(\n :include => [:race, {:person => :team}, :team, {:race => [:event, :category]}],\n :conditions => [%Q{\n members_only_place between 1 AND #{point_schedule.size - 1}\n and results.person_id is not null\n ...
[ "0.72392356", "0.70322144", "0.69340986", "0.69137114", "0.6877534", "0.67981076", "0.6605429", "0.6552044", "0.64661694", "0.633136", "0.6317928", "0.62822217", "0.62274146", "0.6181003", "0.61339587", "0.59963137", "0.5985405", "0.5925433", "0.5776336", "0.5770774", "0.5759...
0.7977516
0
Helper method for as_json
def sorted_races races.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_json arg\n as_json.to_json\n end", "def as_json(*)\n to_h\n end", "def json_serialize\n end", "def as_json\n to_s.as_json\n end", "def to_json_raw_object()\n #This is a stub, used for indexing\n end", "def to_json\n\n end", "def as_json...
[ "0.76731", "0.76194453", "0.75528324", "0.7465485", "0.7444888", "0.738793", "0.7385769", "0.73484665", "0.733767", "0.73314923", "0.7330415", "0.73260325", "0.7314121", "0.72811514", "0.72662497", "0.72452545", "0.723151", "0.7207924", "0.7207924", "0.7199949", "0.71953446",...
0.0
-1
Load the next page of artists
def load_page respond_to do |format| format.html do load_artists_page render '_artist_rows' , layout: false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @next_artwork = get_next\n @previous_artwork = get_previous\n @fbLink = \"http://helenafogelberg.se/artworks/{@artwork.id}\"\n end", "def next_page\n\t\t\tFeed.parse_url(next_page_url,@browser)\n\t\tend", "def next_page(params = {})\n @items = load_page(params)\n end", "def next_...
[ "0.6552908", "0.647686", "0.6459508", "0.6339101", "0.63343966", "0.6294901", "0.62870866", "0.62775105", "0.625857", "0.62326616", "0.62267804", "0.6150444", "0.61068887", "0.6098317", "0.60848147", "0.6070348", "0.604677", "0.6037689", "0.6029649", "0.6014574", "0.6009815",...
0.65125763
2
Load the next page of albums
def load_page respond_to do |format| format.html do load_albums_page render '_album_rows' , layout: false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_page(params = {})\n @items = load_page(params)\n end", "def next_page\n url = @entity[:next]\n return unless url\n\n query = URI.decode_www_form(URI(url).query).to_h\n query = query.to_h { |k, v| [k.to_sym, v] }\n self.class.list(**query)\n end...
[ "0.6880548", "0.6715651", "0.6683551", "0.6676448", "0.6644789", "0.6635166", "0.6634454", "0.6629374", "0.6588594", "0.65644765", "0.6555333", "0.65095913", "0.65001845", "0.64515525", "0.64515525", "0.64515525", "0.64515525", "0.64504355", "0.6434916", "0.64340585", "0.6433...
0.61821866
37
Action to suggest names on the filter
def suggest suggest_classes( [ Album , Artist ] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suggest\n end", "def named_filter; end", "def autocomplete_on\n\t\tconditions = if params[:name]\n [\"name LIKE :name\", { :name => \"%#{params['name']}%\"} ]\n else\n {}\n end\n\t\t @objects = params[:model_name].classify.constantize.find(:all, :conditions => conditions)\n\t\t render ...
[ "0.70022655", "0.6608478", "0.65723145", "0.63832057", "0.63699627", "0.62765175", "0.6245165", "0.62160397", "0.62155634", "0.6190264", "0.6174676", "0.6166369", "0.6155536", "0.60924155", "0.6084375", "0.6057311", "0.6053701", "0.6035973", "0.6030637", "0.6016009", "0.60001...
0.5699424
44
Get available song ids from the request parameters. (Overrides def on MusicBaseController) [+returns+] Array of songs ids
def get_selected_song_ids return get_songs_column( 'songs.id' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_songs_ids\n if @song_ids\n return @song_ids\n else\n return get_songs.map { |x| x[IDX_SONG_ID] }\n end\n end", "def song_ids\n @song_ids ||= input[\"songs\"].map{|song| song[\"id\"]}\nend", "def get_play_list_song_ids\n return [] if !@play_list\n\n if @play_list_song_ids\n ...
[ "0.7265411", "0.701385", "0.6784159", "0.67386943", "0.6480067", "0.6397592", "0.61705416", "0.61416066", "0.612541", "0.6064909", "0.6058923", "0.60139734", "0.5964355", "0.593254", "0.593254", "0.593254", "0.593254", "0.593254", "0.593254", "0.593254", "0.593254", "0.5932...
0.68085366
2
Returns an array with the relative path of the selected songs (Overrides def on MusicBaseController)
def get_selected_paths return get_songs_column( :path ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_selected_paths\n return get_songs_relation.pluck( :path )\n end", "def song_plays\n SongPlay.where(:song_path => path)\n end", "def path\n File.expand_path File.join(songs.first.path, '..').gsub(' ','\\ ')\n end", "def path # getter method \n # - this method will get the path passe...
[ "0.7602469", "0.6756914", "0.6566635", "0.6497871", "0.64439666", "0.64439666", "0.6416481", "0.6416481", "0.6416481", "0.6416481", "0.6416481", "0.6416481", "0.6416481", "0.6416481", "0.6416481", "0.6416481", "0.6335312", "0.63043845", "0.62646556", "0.6229565", "0.6189326",...
0.7722529
0
NOTE do not pattern your production application after this (refer to test_should_create_customer_profile_transaction_auth_only_and_then_prior_auth_capture_requests instead as the correct way to do an auth then capture). capture_only "is used to complete a previously authorized transaction that was not originally submitted through the payment gateway or that required voice authorization" and can in some situations perform an auth_capture leaking the original authorization.
def test_should_create_customer_profile_transaction_auth_only_and_then_capture_only_requests @gateway.expects(:ssl_post).returns(successful_create_customer_profile_transaction_response(:auth_only)) assert response = @gateway.create_customer_profile_transaction( transaction: { customer_profile_id: @customer_profile_id, customer_payment_profile_id: @customer_payment_profile_id, type: :auth_only, amount: @amount } ) assert_instance_of Response, response assert_success response assert_equal response.authorization, response.params['direct_response']['transaction_id'] assert_equal 'This transaction has been approved.', response.params['direct_response']['message'] assert_equal 'auth_only', response.params['direct_response']['transaction_type'] assert_equal 'Gw4NGI', approval_code = response.params['direct_response']['approval_code'] @gateway.expects(:ssl_post).returns(successful_create_customer_profile_transaction_response(:capture_only)) assert response = @gateway.create_customer_profile_transaction( transaction: { customer_profile_id: @customer_profile_id, customer_payment_profile_id: @customer_payment_profile_id, type: :capture_only, amount: @amount, approval_code: approval_code } ) assert_instance_of Response, response assert_success response assert_equal 'This transaction has been approved.', response.params['direct_response']['message'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authorization_and_capture\n return if Base.mode == :test # only tests in production mode\n assert_equal Base.mode, :production\n assert authorization = @gateway.authorize(@amount, @credit_card, @options)\n assert_success authorization\n \n assert capture = @gateway.capture(@amount, authori...
[ "0.6622601", "0.66165835", "0.66148984", "0.64050114", "0.6402435", "0.62876874", "0.6284776", "0.62716687", "0.6201491", "0.6200618", "0.61151105", "0.6092354", "0.606081", "0.6026894", "0.6023429", "0.601596", "0.5996501", "0.5947878", "0.59419584", "0.5903622", "0.5870499"...
0.6712602
0
USER MANAGEMENT GET api/v1/manage_users
def index @users = User.all render json: { messages: "Request Successfull!", is_success: true, data: { users: @users } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manage_users\n \t@users = User.all\n\n \trespond_to do |format|\n format.json {\n render :json => @users.as_json(:only => [:id, :username, :firstname, :lastname, :email], :methods => [:avatar_url])\n }\n format.html {\n render 'manage_users'\n }\n end\n end", "def mana...
[ "0.6842748", "0.6697969", "0.65239626", "0.6460605", "0.6460221", "0.64282465", "0.6415475", "0.63891375", "0.63671637", "0.63598704", "0.63145244", "0.62974435", "0.62907994", "0.6290356", "0.6220003", "0.6179132", "0.6170376", "0.61573213", "0.61503494", "0.6143398", "0.614...
0.0
-1
CHAT MANAGEMENT GET api/v1/manage_chats/[chat_id]
def show_chat @chat = Chat.find(params[:id]) render json: { messages: "Request Successfull!", is_success: true, data: { user: @chat } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_chat\n @chat = @application.chats.find_by!(number: params[:id])\n end", "def set_chat_messages\n @chat_messages = ChatMessage.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def ...
[ "0.7156667", "0.6678865", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.65957135", "0.6489892", "0.64431465", "0.6411493", "0.63193405", "0.6253278", "0.6218891", "0...
0.577841
56
MESSAGE MANAGEMENT PUT api/v1/manage_messages/[message_id]
def censor_message message_params = params.require(:message).permit(:body) @message = Message.find(params[:id]) respond_to do |format| if @message.update(censored: true) @censored_message = Censoredmessage.new(user_id: @current_user.id, message_id: @message.id, body: message_params["body"]) if @censored_message.save format.json { render json: { messages: "Request Successfull!", is_success: true, data: { message: @message, censored_message: @censored_message } } } else format.json { render json: { messages: "Message marked as censored but censored message not saved!", is_success: false, data: { } } } end else format.json { render json: { messages: "Bad Request!", is_success: false, data: { } } } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_message(display_id, message_id, opts = {})\n put \"commandcenter/displays/#{display_id}/messages/#{message_id}\", opts\n end", "def set_message\n @message = message.find(params[:id])\n end", "def set_message\n @message = Message.friendly.find(params[:id])\n end", ...
[ "0.6924212", "0.6915829", "0.6903889", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def authenticate_and_load_user authentication_token = nil if request.headers["Authorization"] authentication_token = request.headers["Authorization"].split[1] end if authentication_token user = JWT.decode(authentication_token, nil, false, algorithms: 'RS256') username = user[0]["nickname"] email = user[0]["name"] if user[0]['sub'].include? 'google-oauth2' email = username + '@gmail.com' end @current_user = User.find_by(email: email, username: username) if !@current_user.present? user = User.new(email: email, username: username, password: '000000', password_confirmation: '000000', auth_token: authentication_token) if user.save @current_user = user end end end return if @current_user.present? render json: { messages: "Can't authenticate user", is_success: false, data: {} }, status: :bad_request 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
Get an strategy by its id
def get(id) self.class.strategies.select { |strategy| strategy.id == strategy.id } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_strategy\n @strategy = Strategy.find(params[:id])\n end", "def set_strategy\n if params[:id]\n @strategy = Strategy.find(params[:id])\n else \n @strategy = Strategy.find_by(uuid: params[:uuid])\n end\n end", "def _fetch_strategy(name, scope)\n @strategies[sc...
[ "0.687599", "0.6719225", "0.61248964", "0.60925907", "0.603201", "0.59219956", "0.58672255", "0.57997185", "0.5797541", "0.5793163", "0.57907176", "0.57891375", "0.57810223", "0.5767059", "0.5754778", "0.5749873", "0.5743043", "0.5742503", "0.5708508", "0.5689515", "0.5684819...
0.854905
0
GET /connectors GET /connectors.json
def index @connectors = Connector.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @url_connectors = UrlConnector.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @url_connectors }\n end\n end", "def connectors_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorAp...
[ "0.7183864", "0.6952489", "0.6812904", "0.6781967", "0.6781967", "0.67060775", "0.6682356", "0.6656026", "0.6548709", "0.6500327", "0.6481767", "0.6481767", "0.6391897", "0.5988778", "0.59599704", "0.57967764", "0.5756998", "0.56902015", "0.5659863", "0.558622", "0.5573435", ...
0.69453174
2
GET /connectors/1 GET /connectors/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @url_connectors = UrlConnector.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @url_connectors }\n end\n end", "def show\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb...
[ "0.697967", "0.6883859", "0.67637634", "0.6751273", "0.6407257", "0.6312264", "0.62816614", "0.6275105", "0.6224756", "0.62198097", "0.6180519", "0.61611736", "0.61611736", "0.60824645", "0.60824645", "0.57934695", "0.5753963", "0.5657765", "0.5597659", "0.5579664", "0.555214...
0.0
-1
POST /connectors POST /connectors.json
def create @connector = Connector.new(connector_params) respond_to do |format| if @connector.save format.html { redirect_to @connector, notice: 'Connector was successfully created.' } format.json { render :show, status: :created, location: @connector } else format.html { render :new } format.json { render json: @connector.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connectors_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_post ...\"\n end\n \n # resource path\n path = \"/connectors\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_par...
[ "0.72071993", "0.6536202", "0.64566696", "0.6264675", "0.6264675", "0.6186751", "0.6156597", "0.5947391", "0.5875985", "0.5864708", "0.57912225", "0.5660581", "0.5622291", "0.551319", "0.544815", "0.544497", "0.54416513", "0.54387206", "0.5408554", "0.5313349", "0.5309515", ...
0.6866876
1
PATCH/PUT /connectors/1 PATCH/PUT /connectors/1.json
def update respond_to do |format| if @connector.update(connector_params) format.html { redirect_to @connector, notice: 'Connector was successfully updated.' } format.json { render :show, status: :ok, location: @connector } else format.html { render :edit } format.json { render json: @connector.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n if @url_connector.update_attributes(params[:url_connector])\n format.html { redirect_to @url_connector, notice: 'Url connector was successfully updated.' }\n format.json { head :no_content }\n el...
[ "0.64440304", "0.6419161", "0.6087523", "0.5842914", "0.5832763", "0.5822447", "0.58125496", "0.57372296", "0.57372296", "0.573005", "0.5663236", "0.56514657", "0.56498235", "0.5607775", "0.55426246", "0.55426246", "0.55426246", "0.55426246", "0.55341756", "0.55136704", "0.54...
0.6629357
0
DELETE /connectors/1 DELETE /connectors/1.json
def destroy @connector.destroy respond_to do |format| format.html { redirect_to connectors_url, notice: 'Connector was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @url_connector = UrlConnector.find(params[:id])\n @url_connector.destroy\n\n respond_to do |format|\n format.html { redirect_to url_connectors_url }\n format.json { head :no_content }\n end\n end", "def connectors_id_delete(id, opts = {})\n if Configuration.debugging\n ...
[ "0.74248743", "0.6949447", "0.6913631", "0.67478865", "0.6603385", "0.65876436", "0.65615493", "0.6534312", "0.65047103", "0.6491685", "0.64342993", "0.6429", "0.63927054", "0.63927054", "0.63890564", "0.63669485", "0.63462245", "0.632686", "0.632686", "0.6267603", "0.6237204...
0.73246616
1
Use callbacks to share common setup or constraints between actions.
def set_connector @connector = Connector.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def connector_params params.require(:connector).permit(:box_id, :aws_conn_id, :code, :url, :power, :voltage, :i_max, :price_per_kWh, :current_user, :frequency, :status, :tag_uid, :tag_token) 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.6978086", "0.6780264", "0.6742658", "0.6738813", "0.67338693", "0.65908474", "0.6501793", "0.6495506", "0.64796513", "0.64755446", "0.6454826", "0.6437561", "0.6377127", "0.63722163", "0.6364058", "0.63178706", "0.62979764", "0.62968165", "0.62913024", "0.6289789", "0.6289...
0.0
-1
this could be optimized a tiny bit by only calling superclass.build_kiln but i am le tired
def build_kiln @build_kiln ||= begin retval = Hash.new { |hash,key| hash[key] = {} } klasses = [] klass = self while klass && klass <= UIView klasses.unshift(klass) klass = klass.superclass end klasses.each do |klass| kiln_props = klass.kiln kiln_props && kiln_props.each do |key,values| values.keys.each do |check_unique| retval.each do |section, editors| editors.delete(check_unique) end end retval[key].merge!(values) end end # clean out nil-editors and empty sections retval.each do |section, editors| editors.each do |property, editor| editors.delete(property) unless editor end retval.delete(section) if editors.length == 0 end retval end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build; end", "def build\r\n raise \"Not implemented\"\r\n end", "def build_internal_nodes\n names.each do |tmp_geo_area|\n recurse_nodes(tmp_geo_area.parent_names, tmp_geo_area)\n end\n end", "def build\r\n end", "def build\r\n end", "def kid_generato...
[ "0.574302", "0.5575132", "0.55477244", "0.5443314", "0.5443314", "0.54090065", "0.54090065", "0.54090065", "0.540197", "0.53540945", "0.5332637", "0.53148705", "0.5303159", "0.5303159", "0.5293818", "0.52841735", "0.5257594", "0.5257594", "0.5257594", "0.523665", "0.5226283",...
0.68418276
0
factory method to create game instances for testing
def make_game(board=nil) # create a game and connect it to two DummyPlayerInterfaces g = Game.new(DummyPlayerInterface.new, DummyPlayerInterface.new) # initialize the game's board to the given state board ||= boards[:empty] (0..2).each do |y| (0..2).each do |x| g.set_cell(x, y, board[y][x]) if board[y][x] =~ /[XO]/ end end # keep the tests tidy by suppressing output to the terminal g.send_output_to_terminal = false return g end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_game\n player1 = @players[0]\n player2 = @players[1]\n @game = Game.new(player1, player2, best_of, rules)\n game.play\n end", "def generate_new_game\n Game.new(Array.new(10, 'X'), 0, rand())\nend", "def start_new_game\n x = create_player_x\n o = create_player_o\n \n @game = Ga...
[ "0.720984", "0.7127582", "0.67822444", "0.6775214", "0.674209", "0.6692038", "0.6667009", "0.65911585", "0.6582407", "0.6580021", "0.6536516", "0.6522807", "0.64648324", "0.6392518", "0.63782775", "0.63707006", "0.6350667", "0.63463604", "0.6343919", "0.63395053", "0.63395053...
0.70379865
2
helper: run a block and ignore any errors it raises
def suppress_errors begin yield rescue end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ignore &block\n begin; block.call; rescue; end\n end", "def safely(&block)\r\n begin\r\n yield\r\n rescue Exception => e\r\n if e.message =~ /connection was aborted/\r\n puts \" [yp searcher] Error: #{e} #{e.message}. Continuing.\"\r\n end\r\n end\r\n end", "def regardle...
[ "0.731524", "0.7236683", "0.71931976", "0.7156799", "0.70394874", "0.6993102", "0.69054455", "0.6795646", "0.67560405", "0.667052", "0.66597193", "0.66359603", "0.6604494", "0.6596517", "0.6593758", "0.65557575", "0.6550964", "0.6534305", "0.6511649", "0.650602", "0.64880806"...
0.65282816
18
GET /companies GET /companies.json
def index @companies = Company.search(params[:search]) @companies = @companies.where(suscription: params[:suscription]) if params[:suscription] && %w[0 1].include?(params[:suscription]) @companies end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end", "def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end...
[ "0.7902303", "0.7858561", "0.7774042", "0.7774042", "0.7774042", "0.7774042", "0.7595257", "0.75136745", "0.7443538", "0.7433297", "0.7311967", "0.7278466", "0.7264634", "0.72469735", "0.724456", "0.72012216", "0.7155448", "0.7151627", "0.71487916", "0.7133825", "0.71279407",...
0.0
-1
GET /companies/1 GET /companies/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end", "def index\n @companie...
[ "0.7808709", "0.76832056", "0.76499087", "0.76414454", "0.76414454", "0.76414454", "0.76414454", "0.75729924", "0.75324935", "0.74126863", "0.74126863", "0.74126863", "0.74126863", "0.74126863", "0.74126863", "0.73355657", "0.7306839", "0.73025626", "0.7289219", "0.7240604", ...
0.0
-1
POST /companies POST /companies.json
def create @company = Company.new(company_params) respond_to do |format| if @company.save @company.visit.each do |visit| @visit = Visit.new(visit.attributes) @visit.companyId=@company.id daysFromNow = Frecuency.find(visit.frecuencyTypeId).days nextVisitDate = visit.visitDate + daysFromNow.day while nextVisitDate < (Date.today + 365.day) @nextVisit = Visit.new(visit.attributes) @nextVisit.visitDate = nextVisitDate @nextVisit.id = nil @nextVisit.companyId=@company.id @nextVisit.save nextVisitDate = nextVisitDate + daysFromNow.day end end if @company.save @company.expiration.each do |expiration| @expiration = Expiration.new(expiration.attributes) @expiration.companyId=@company.id end end format.html { redirect_to @company, notice: 'Cliente creado con exito' } format.json { render :show, status: :created, location: @company } else format.html { render :new } format.json { render json: @company.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n render json: Company.create(params[\"company\"])\n end", "def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully ...
[ "0.75086176", "0.7454409", "0.7148216", "0.7067736", "0.69924504", "0.6992177", "0.6991816", "0.6991816", "0.6991816", "0.6991816", "0.692276", "0.69189334", "0.69189334", "0.69189334", "0.69189334", "0.69189334", "0.69163394", "0.690428", "0.6899169", "0.68933874", "0.684762...
0.0
-1
PATCH/PUT /companies/1 PATCH/PUT /companies/1.json
def update respond_to do |format| if @company.update(company_params) format.html { redirect_to @company, notice: 'Cliente actualizado con exito' } format.json { render :show, status: :ok, location: @company } else format.html { render :edit } format.json { render json: @company.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n @company = Company.find(company_params[:id])\n\n if @company.update(company_params)\n head :no_content\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end", ...
[ "0.7636508", "0.7152674", "0.7055599", "0.7044559", "0.7037746", "0.7037746", "0.7037746", "0.7037746", "0.7037746", "0.7037746", "0.7032013", "0.7018044", "0.70124805", "0.6974244", "0.6946986", "0.6919841", "0.6919841", "0.6879891", "0.6875187", "0.6837392", "0.68369305", ...
0.6475512
58
DELETE /companies/1 DELETE /companies/1.json
def destroy @company.destroy respond_to do |format| format.html { redirect_to companies_url, notice: 'Cliente eliminado con exito' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format....
[ "0.8019891", "0.7862878", "0.76938766", "0.76938766", "0.76938766", "0.76938766", "0.76938766", "0.76938766", "0.76938766", "0.76938766", "0.76938766", "0.76938766", "0.76433545", "0.76246405", "0.76226014", "0.76226014", "0.76226014", "0.75703335", "0.7548862", "0.75414675", ...
0.73295957
56
Use callbacks to share common setup or constraints between actions.
def set_company @company = Company.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.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.533122...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def company_params params.require(:company).permit(:id, :industryTypeId, :industryTypeId2, :employeeId, :name, :email, :localidad, :partido, :addressDirection, :addressNumber, :cuit, :comment, :suscription, :fantasy_name, :postal_code, :companyType, :tlf, :cellphone, :internal_tlf, :contact, :floor, :departament, :search, :visitqty_min, :visitqty_max, :visit_attributes => [:id, :companyId, :visitTypeId, :frecuencyTypeId, :employeeId, :nextVisit, :visitDate, :aproved, :aprovalDate, :_destroy, :_update, :_save, :_create] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
false O(N + N) = O(N)
def unique_a?(string) # O(N) string = string.split('') # O(N) string == string.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "def canBeSum(n, array, cache)\n\ti = 0\n\twhile array[i] <= n / 2\n\t\tif cache[n-array[i]] # array.include?(n-array[i]) is OK, but very slow\n\t\t\treturn true\n\t\tend\n\n\t...
[ "0.67565906", "0.6702543", "0.6613357", "0.6567477", "0.64635956", "0.64581907", "0.64401364", "0.6365695", "0.616527", "0.6042195", "0.6039725", "0.6036338", "0.6022691", "0.60194224", "0.60131353", "0.6003689", "0.60026765", "0.59930795", "0.5990014", "0.5977022", "0.595435...
0.0
-1
without uniq O(N + N) = O(N)
def unique_b?(string) # O(N) string = string.split('') characters = {} # O(N) string.each do |character| return false if characters[character] characters[character] = true end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniq() end", "def uniq!() end", "def using_uniq(array)\n\n \nend", "def uniq\n end", "def uniq\n end", "def uniq(array)\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq()\nend", "def using_uniq(array)\n ...
[ "0.8110045", "0.78938305", "0.77674484", "0.7644031", "0.7644031", "0.7542324", "0.74677557", "0.74677557", "0.74163395", "0.7414721", "0.7414721", "0.7414721", "0.7414721", "0.7414721", "0.7414721", "0.7387269", "0.73717135", "0.73663557", "0.73663557", "0.7299427", "0.72962...
0.0
-1
without a hash O(N)
def unique_d?(string) # assums all characters are letters alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] count = 0 # O(N) while count < string.length character = string[count] # O(1) because alphabet is a constant size return false if !alphabet.include?(character) # O(1) because alphabet is a constant size alphabet.delete(character) count += 1 end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "def rehash() end", "def hash() end", "def hash() end", "def hash() end", "def...
[ "0.6504625", "0.64225435", "0.63155615", "0.62428355", "0.62428355", "0.62428355", "0.62428355", "0.62428355", "0.62428355", "0.62428355", "0.61674774", "0.61622703", "0.61504877", "0.6127353", "0.6115558", "0.6080133", "0.60714984", "0.60689265", "0.60091203", "0.5999503", "...
0.0
-1
Creates a new array
def square self.map {|x| x ** 2} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_array_new(size)\n Array.new(size) { Array.new(size) { '0' } }\nend", "def instantiate_new_array\n<<<<<<< HEAD\n Array.new\nend", "def array_array(rn, cn, iv = 1)\n Array.new(rn) { Array.new(cn, iv) }\nend", "def create_new_players_moves_array\n player_moves = Array.new(2) { Array.new }\n ...
[ "0.74652296", "0.6970988", "0.69395626", "0.69199824", "0.69199246", "0.68641895", "0.67733884", "0.67700714", "0.67660755", "0.6763177", "0.6754282", "0.6748965", "0.6645105", "0.6630614", "0.6614212", "0.6545823", "0.6503649", "0.6487088", "0.64827317", "0.6474626", "0.6406...
0.0
-1
Replaces existing array because of !
def square! self.map! {|x| x ** 2} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_to_no_change(array)\n return array\nend", "def update_arr2(var)\n\tvar.uniq!\nend", "def replace_without_hooks( other_array )\n \n @without_hooks = true\n\n replace( other_array )\n \n @without_hooks = false\n \n return self\n \n end", "def add_bang(array)\n\tarray.map {|str...
[ "0.65128976", "0.6384678", "0.62718666", "0.62189436", "0.61562175", "0.6131723", "0.6110143", "0.59053826", "0.5897488", "0.5897488", "0.5897488", "0.58891726", "0.5811728", "0.58056056", "0.58044577", "0.58044577", "0.5753077", "0.57413214", "0.57382417", "0.572978", "0.571...
0.0
-1
Contstructor method Parameters String name_player1 Name for player 1 String name_player2 Name for player 2
def initialize(name_player1, name_player2) @current_player = :player1 @player1 = Player.new(name_player1, PLAYER_MARKS[:player1], 1) @player2 = Player.new(name_player2, PLAYER_MARKS[:player2], 2) @game_array = [[nil, nil, nil], [nil, nil, nil], [nil, nil, nil]] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n @player1 = get_player_name('1')\n @player2 = get_player_name('2')\n @current_player = @player1\n end", "def initialize(player_1=nil, player_2=nil)\n @player_1 = player_1\n @player_2 = player_2\n end", "def second_player_name(player)\n player == 1 ? @player_2_name : @player_1_...
[ "0.7432191", "0.7303798", "0.7163091", "0.7133529", "0.709381", "0.70699525", "0.7061218", "0.70389044", "0.69731706", "0.69149226", "0.6907445", "0.6729348", "0.66706604", "0.66637665", "0.66632074", "0.6650754", "0.664396", "0.6643723", "0.6638365", "0.66375405", "0.6637297...
0.68276936
11
Represents the pick of some user and chosen coordinates String player Player picking a coordinate Integer x X coordinate Integer y Y coordinate Exceptions Throws InvalidPickException if player is not valid or if coordinate is out of boundaries
def pick(player, x, y) fail InvalidPickException.new('Invalid pick') unless valid_pick?(x, y) && valid_player?(player) @game_array[x][y] = PLAYER_MARKS[player.to_sym] @current_player = if @current_player == :player1 :player2 else :player1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_pick?(x, y)\n @game_array[x][y] == nil\n rescue\n fail InvalidPickException.new\n end", "def player_select_coordinates\n parse_response(get_a_valid_destination)\n end", "def invalid_user_shot\n \"Please enter a valid coordinate:\\n> \"\n end", "def player_select_valid_piece_destinat...
[ "0.6357382", "0.6326895", "0.59886116", "0.59806776", "0.5870088", "0.5845969", "0.58289963", "0.5804468", "0.5748903", "0.57455456", "0.5734839", "0.55847925", "0.55539936", "0.55123425", "0.55029684", "0.5471036", "0.54590845", "0.5450844", "0.54354054", "0.5429965", "0.539...
0.6759482
0
Returns a hash containing the current state of the game, the current user able to do the next pick. If the last pick resulted in a winner the player is returned.
def current_state result = { current_state: @game_array, current_player: @current_player } mark = winner_mark if mark result.merge!(winner: player_by_mark(mark).name) end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner\n store_person = winner_function\n store_combo = won?\n if store_combo == false\n return nil\n elsif store_person == \"X\"\n return \"X\"\n elsif store_person == \"O\"\n return \"O\"\n else\n return false\n end\n end", "def winner\n case\n when in_ch...
[ "0.6421932", "0.633145", "0.6323206", "0.62890625", "0.6282806", "0.6246933", "0.62404686", "0.61526936", "0.6102675", "0.60710114", "0.6065517", "0.6040621", "0.60367024", "0.60008126", "0.59787446", "0.5972528", "0.5962908", "0.5958537", "0.5951555", "0.593951", "0.59276766...
0.6818288
0
Gets player based on his mark
def player_by_mark(mark) player = if PLAYER_MARKS.key(mark) == :player1 @player1 else @player2 end player end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_player_by_marker(marker)\r\n @players.find { |player| player.marker == marker }\r\n end", "def find_player(name)\n for footballer in @players\n return footballer if @players.include?(name)\n end\n end", "def player\n fetch('football.players')\n end", "def player_by_nam...
[ "0.7634937", "0.6722426", "0.6719397", "0.6598804", "0.6564673", "0.65433323", "0.65272146", "0.64467496", "0.6410199", "0.64043903", "0.63966817", "0.6336073", "0.63250595", "0.6319834", "0.63119364", "0.6310581", "0.6298843", "0.6285358", "0.62699217", "0.6233654", "0.61808...
0.8405265
0
Checks if the player passed is allowed to play
def valid_player?(player) @current_player == player.to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_play?( player_id )\n player = Player.find(player_id) if player_id\n return true if not restricted or (player and player.admin)\n found = RestrictedGamePlayerList.find( :first, :conditions => ['fk_game_id = ? and fk_player_id = ?', id, player.id ]) if player\n found ? true : false\n end", "de...
[ "0.7887071", "0.7616827", "0.7137509", "0.69422543", "0.6933388", "0.6924123", "0.68694174", "0.6862092", "0.6848318", "0.6805023", "0.6784429", "0.6766935", "0.67457587", "0.6692774", "0.66658586", "0.6661943", "0.66613704", "0.6645179", "0.65789646", "0.65653706", "0.651538...
0.73155165
2
Checks if coordinate is valid
def valid_pick?(x, y) @game_array[x][y] == nil rescue fail InvalidPickException.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_coordinate?(coord)\n if coord.size == 2 && coord[0].between?(0, 7) && coord[1].between?(0, 7)\n true\n else\n false\n end\n end", "def coordinate_valid?(x, y)\n (x >= 0) && (y >= 0) && (x < @width) && (y < @height)\n end", "def coordinate_valid?(x, y)\n (x >= 0) && (y >= 0)...
[ "0.82979584", "0.8192852", "0.8192852", "0.7826597", "0.76703984", "0.76703984", "0.76449007", "0.76235414", "0.7591091", "0.7516829", "0.7498058", "0.7442862", "0.741248", "0.7405246", "0.7370985", "0.7362539", "0.73473847", "0.7329087", "0.73235327", "0.7300762", "0.7291391...
0.0
-1
Returns the mark of the winner if there' one.
def winner_mark check_columns || check_rows || check_left_diagonal || check_right_diagonal end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner\n if current_player.marker == \"X\"\n return \"O\"\n else\n return \"X\"\n end\n end", "def detect_winner\n winning_marker = nil\n\n WINNING_LINES.each do |line|\n line_markers = squares.values_at(*line).map(&:marker)\n next if line_markers.include?(Square::INITIAL_...
[ "0.72931373", "0.7159105", "0.7120302", "0.7116167", "0.7069459", "0.7044866", "0.7042786", "0.70193595", "0.6972146", "0.6940247", "0.69343424", "0.6909656", "0.69010454", "0.6862981", "0.6847705", "0.6845852", "0.68334943", "0.68204415", "0.68136674", "0.6807911", "0.679957...
0.64696664
64
Check if the values in the columns match and returns the mark
def check_columns for column in 0..2 if @game_array[0][column] == @game_array[1][column] && @game_array[0][column] == @game_array[2][column] && !@game_array[0][column].nil? result = @game_array[0][column] end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains_mine?(row, col)\n false\n end", "def contains_mine?(row, col)\n false\n end", "def win_col?(mark)\n @grid.transpose.any? do |row|\n row.all? {|char| char == mark}\n end\n end", "def contains_two_marks(values)\n\t\tif( (values.count(:X) == 2) || (values.count(:...
[ "0.6491086", "0.6491086", "0.6376026", "0.6355763", "0.6245685", "0.6240209", "0.62333274", "0.6158803", "0.61553764", "0.6153156", "0.6077127", "0.60412014", "0.6024577", "0.5898749", "0.5871368", "0.58528405", "0.5838406", "0.58351827", "0.5804053", "0.57812333", "0.5778949...
0.52624106
71
Check if the values in the rows match and returns the mark
def check_rows for row in 0..2 if @game_array[row][0] == @game_array[row][1] && @game_array[row][0] == @game_array[row][2] && !@game_array[row][0].nil? result = @game_array[row][0] end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def win_row?(mark)\n @grid.any? do |row|\n row.all? {|char| char == mark}\n end\n end", "def contains_mine?(row, col)\n false\n end", "def contains_mine?(row, col)\n false\n end", "def contains_two_marks(values)\n\t\tif( (values.count(:X) == 2) || (values.count(:O) == 2) )...
[ "0.6576819", "0.64427215", "0.64427215", "0.63887995", "0.63436323", "0.63322115", "0.6248598", "0.6242804", "0.6214553", "0.6196654", "0.6159198", "0.614876", "0.61060923", "0.6044447", "0.60108215", "0.6001716", "0.5980675", "0.59525764", "0.5928814", "0.584666", "0.584071"...
0.5362152
60
Check if the values in the right diagonal match and returns the mark
def check_right_diagonal if @game_array[0][2] == @game_array[1][1] && @game_array[0][2] == @game_array[2][0] && !@game_array[0][2].nil? @game_array[0][2] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def win_diagonal?(mark)\n a = (0...@grid.length).all? {|i| self[[i,i]] == mark }\n b = (0...@grid.length).all? {|i| self[[i, @grid.length - 1 - i]] == mark }\n a || b\n end", "def win_diagonal?(mark)\n ltr_diagonal = []\n rtl_diagonal = []\n @grid.each.with_index do...
[ "0.7571535", "0.7216157", "0.7054185", "0.6841443", "0.6765728", "0.67306817", "0.66725546", "0.6565866", "0.65572274", "0.6421982", "0.6392166", "0.63188857", "0.630378", "0.6287454", "0.6260397", "0.62586176", "0.6256932", "0.6245273", "0.6194855", "0.61873436", "0.6178742"...
0.66039675
7
Check if the values in the right diagonal match and returns the mark
def check_left_diagonal if @game_array[0][0] == @game_array[1][1] && @game_array[0][0] == @game_array[2][2] && !@game_array[0][0].nil? @game_array[0][0] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def win_diagonal?(mark)\n a = (0...@grid.length).all? {|i| self[[i,i]] == mark }\n b = (0...@grid.length).all? {|i| self[[i, @grid.length - 1 - i]] == mark }\n a || b\n end", "def win_diagonal?(mark)\n ltr_diagonal = []\n rtl_diagonal = []\n @grid.each.with_index do...
[ "0.7571101", "0.72156817", "0.7053456", "0.6840885", "0.6764872", "0.67310846", "0.6671904", "0.6603409", "0.6565683", "0.6556923", "0.6420631", "0.63915753", "0.6303198", "0.62870777", "0.625943", "0.6259062", "0.62556356", "0.6244905", "0.61952555", "0.6186897", "0.61778545...
0.6318227
12
creating a new user session when a user logs in
def create user = User.find_by :email => params[:email] if user.present? && user.authenticate(params[:password]) session[:user_id] = user.id redirect_to root_path else redirect_to login_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if user = User.find_by_login(params[:login])\n # Save the user ID in the session so it can be used in subsequent requests\n session[:current_user_id] = user.id\n redirect_to root_url\n end\n end", "def create\n\t\tuser = User.from_sso(cookies[:UTEP_SE], cookies[:UTEP_SA])\n\t\t...
[ "0.78682065", "0.7765376", "0.7755039", "0.7751684", "0.77149665", "0.7664976", "0.7584501", "0.75626665", "0.7562176", "0.75556874", "0.7549905", "0.75333136", "0.7526666", "0.7524522", "0.75129265", "0.7506285", "0.7475791", "0.74708873", "0.7445654", "0.7434086", "0.743240...
0.7132709
83
deleting a user session when the current user logs out
def destroy session[:user_id] = nil redirect_to root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_out\n session.delete(:user_id)\n @current_user = nil\nend", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil \n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n\n end"...
[ "0.8683788", "0.86628985", "0.86496997", "0.8622274", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", ...
0.0
-1
Sets the provided values on the thread object.
def update(opts = {}) result = self.class.post('/update_thread', :query => opts.merge(:forum_api_key => forum.key)) return result["succeeded"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n thread = args.first\n options.merge!(:thread => thread) if ([:ident, :link] & options.keys).empty?\n response = get('threads/set', options)\n end", "def set_Thread(value)\n set_input(\"Thread\", value)\n end...
[ "0.6643675", "0.6589539", "0.6589539", "0.6282379", "0.6186762", "0.6064623", "0.603919", "0.6023701", "0.59913737", "0.5866703", "0.58465093", "0.58465093", "0.58374023", "0.578899", "0.57770485", "0.5770627", "0.57376516", "0.5704353", "0.56845194", "0.56845194", "0.5684519...
0.0
-1
Get the result for this query, executing it once
def result if @validate && validation_errors.any? return { "errors" => validation_errors } end @result ||= Executor.new(self, @operation_name).result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_result\n\t\texecute unless @result\n\t\treturn @result\n\tend", "def get_data\n\t\texecute unless @result\n\t\treturn get_data_from_result(@result)\n\tend", "def result_for_query(query)\n results_for_query(query).first\n end", "def fetch\n @result = Result.new(data, :query => self)\n ...
[ "0.7989895", "0.75469774", "0.73600304", "0.721126", "0.71226263", "0.6939527", "0.6915568", "0.6903006", "0.6810766", "0.67813563", "0.673584", "0.6719721", "0.67006934", "0.66852725", "0.6667897", "0.66523206", "0.6639016", "0.663607", "0.663607", "0.66189426", "0.66166306"...
0.0
-1
Run will validate all inputs; returning on input failures, resolving declared dependencies, then delegate to the handlers call method with its valid inputs and resolved dependencies. Finally it ensure every response is a Response object.
def run(inputs = {}, container = Dry::Container.new) response = resolve_inputs(inputs) return response if response.failure? valid_inputs = response.ok resolve_dependencies(container) handler = self.new(container) result = handler.call(valid_inputs) result = create_response(result) unless response?(result) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute!\n validate_request!\n\n build_response!\n end", "def run\n @response ||= build_response catch_halt{ @handler.run }\n end", "def run\n response = nil\n @error_procs.each do |error_proc|\n result = nil\n begin\n result = error_proc.call(@exceptio...
[ "0.6401441", "0.6194236", "0.5995736", "0.5994623", "0.59863234", "0.5978597", "0.5978597", "0.5967187", "0.554513", "0.5527933", "0.54612654", "0.5442071", "0.5414022", "0.5346584", "0.53319234", "0.5307139", "0.5282684", "0.52293", "0.52106726", "0.51954174", "0.5194625", ...
0.6806065
0
Getting the description of the character from the awoiaf Wiki page.
def char_description(character) html = open("https://awoiaf.westeros.org/index.php/#{character}") doc = Nokogiri::HTML(html) if doc.css("div.hatnote:first-child").empty? #|| doc.css(".mw-parser-output .hatnote:nth-child(2)").empty? description = doc.css(".mw-parser-output > p:nth-child(2)").text.gsub!(/[^A-Za-z ,.]/,'') else description = doc.css(".mw-parser-output > p:nth-child(3)").text.gsub!(/[^A-Za-z ,.]/,'') end if character == "Walder_Frey" description = doc.css(".mw-parser-output > p:nth-child(3)").text.gsub!(/[^A-Za-z ,.]/,'') end if character == "Viserys_Targaryen" description = doc.css(".mw-parser-output > p:nth-child(3)").text.gsub!(/[^A-Za-z ,.]/,'') end if character == "Tywin_Lannister" description = doc.css(".mw-parser-output > p:nth-child(2)").text.gsub!(/[^A-Za-z ,.]/,'') end description end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description\n text_get(7, @id)\n end", "def description\n page.render_part('description') rescue ''\n end", "def description\n page.render_part('description') rescue ''\n end", "def description\n 'Bibita'\n end", "def description\n info[\"Description\"]\n end", "def descri...
[ "0.6682648", "0.66258216", "0.66258216", "0.65930414", "0.6577313", "0.65666497", "0.6555209", "0.6518555", "0.6463491", "0.6460054", "0.6452097", "0.63818514", "0.63511336", "0.6347177", "0.6339787", "0.6339787", "0.631929", "0.6305004", "0.6283876", "0.6206441", "0.6206441"...
0.74901074
0
Checking to see if the character is still alive in the series by scraping the gameofthrones fandom site.
def char_alive?(user, result, character) html = open("https://gameofthrones.fandom.com/wiki/#{character}") doc = Nokogiri::HTML(html) words = doc.css(".pi-item .pi-font a").text.split /(?=[A-Z])/ if words.include?("Alive") puts "You are still alive!" else death = doc.css("div[data-source='Death'] .pi-font").text.split /(?=[A-Z])/ puts "You died in #{death.join(' ').gsub(/ +/, ' ')}" end end_menu(user, result) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checks_passed?\n if blacklisted_wifi?\n puts \"Blacklisted Network; Won't go online\"\n return false\n end\n\n # we don't want to spam himawari's site more than once every 10 minutes while running on a schedule\n return false if by_schedule && now.min % 10 != 1\n\n if `fi...
[ "0.57888335", "0.5785615", "0.5683552", "0.5643582", "0.5605951", "0.5599776", "0.5587042", "0.5574685", "0.5573726", "0.557045", "0.55326396", "0.5531032", "0.5499714", "0.5486322", "0.5474931", "0.546841", "0.5452214", "0.54515773", "0.54392844", "0.5418807", "0.538266", ...
0.7387033
0
GET /dependences GET /dependences.json
def index @dependences = Dependence.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dependencies = Dependency.all\n end", "def dependents(options: {})\n\n Collection.new(parse(client.get(\"/tasks/#{gid}/dependents\", options: options)), type: self.class, client: client)\n end", "def index\n find_dependencias\n respond_to do |format|\n format.htm...
[ "0.6282729", "0.60833704", "0.59941137", "0.5974323", "0.59449285", "0.59378165", "0.59243274", "0.5912404", "0.58951056", "0.5886674", "0.5882696", "0.5862524", "0.5808963", "0.580879", "0.57879496", "0.57823074", "0.57759726", "0.5769148", "0.5765001", "0.5753374", "0.57489...
0.6963232
0
GET /dependences/1 GET /dependences/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dependences = Dependence.all\n end", "def index\n @dependencies = Dependency.all\n end", "def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :c...
[ "0.67252254", "0.6272436", "0.61390907", "0.61349386", "0.58568966", "0.56583935", "0.5623044", "0.5592996", "0.55657125", "0.5530453", "0.5511917", "0.55063176", "0.54625285", "0.54616165", "0.5455603", "0.54492867", "0.54349375", "0.54132295", "0.5410608", "0.54065967", "0....
0.0
-1
POST /dependences POST /dependences.json
def create @dependence = Dependence.new(dependence_params) respond_to do |format| if @dependence.save format.html { redirect_to @dependence, notice: 'Dependence was successfully created.' } format.json { render :show, status: :created, location: @dependence } else format.html { render :new } format.json { render json: @dependence.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @dependency = Dependency.new(dependency_params)\n\n respond_to do |format|\n if @dependency.save\n format.html { redirect_to @dependency, notice: 'Dependency was successfully created.' }\n format.json { render :show, status: :created, location: @dependency }\n else\n ...
[ "0.64044064", "0.63350475", "0.6292813", "0.60891604", "0.5951529", "0.58912903", "0.5664114", "0.5624033", "0.55461735", "0.5545093", "0.5450989", "0.54363513", "0.5417349", "0.53924245", "0.5355601", "0.53362", "0.5328065", "0.5320065", "0.5274545", "0.52613074", "0.5252346...
0.6279234
3
PATCH/PUT /dependences/1 PATCH/PUT /dependences/1.json
def update respond_to do |format| if @dependence.update(dependence_params) format.html { redirect_to @dependence, notice: 'Dependence was successfully updated.' } format.json { render :show, status: :ok, location: @dependence } else format.html { render :edit } format.json { render json: @dependence.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @dependency.update(dependency_params)\n format.html { redirect_to @dependency, notice: 'Dependency was successfully updated.' }\n format.json { render :show, status: :ok, location: @dependency }\n else\n format.html { render :edit }\n ...
[ "0.6390631", "0.6224466", "0.61112934", "0.6054959", "0.57782483", "0.5775834", "0.57725656", "0.57609737", "0.5743465", "0.5743465", "0.57022905", "0.56478083", "0.56073374", "0.5593561", "0.5573444", "0.5565894", "0.5545862", "0.55452067", "0.5525841", "0.55212086", "0.5492...
0.59566593
4
DELETE /dependences/1 DELETE /dependences/1.json
def destroy @dependence.destroy respond_to do |format| format.html { redirect_to dependences_url, notice: 'Dependence was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @service_dependance = ServiceDependance.find(params[:id])\n @service_dependance.destroy\n\n respond_to do |format|\n format.html { redirect_to service_dependances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dependency.destroy\n respond_to do |...
[ "0.7124551", "0.6988", "0.69567114", "0.65602773", "0.65151024", "0.64572155", "0.64501333", "0.6430625", "0.6378849", "0.63708097", "0.63564163", "0.6339734", "0.63146865", "0.630427", "0.62699413", "0.62500405", "0.6242513", "0.6217482", "0.62140095", "0.62140095", "0.62140...
0.71797246
0
Use callbacks to share common setup or constraints between actions.
def set_dependence @dependence = Dependence.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def dependence_params params.require(:dependence).permit(:name, :description, :state) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
create a new listing
def create @listing = Listing.new(listing_params) @listing.save render json: @listing redirect_to listings_path # redirect to home page end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n # allow user to create a new todo item\n @listing = Listing.new\n end", "def new\n @listing = Listing.new\n end", "def new\n @listing = Listing.new\n end", "def new\n @listing = Listing.new\n end", "def new\n @listing = Listing.new\n end", "def create\n\t\t@listing = List...
[ "0.75198406", "0.7462081", "0.7462081", "0.7462081", "0.7462081", "0.7412452", "0.741167", "0.73827076", "0.7351366", "0.73413545", "0.7224459", "0.719841", "0.7191148", "0.7191148", "0.71910566", "0.71910566", "0.7113601", "0.69330555", "0.69318336", "0.69288546", "0.6927619...
0.68771195
24
State transition tables end reduce 0 omitted
def _reduce_1(val, _values, result) self.lexer.lex_state = :expr_beg result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transitions; end", "def closure! \n cstart = new_state\n cend = new_state\n\n add_transition(cstart, cend, \"\")\n add_transition(cend, cstart, \"\")\n\n add_transition(cstart, @start, \"\")\n @final.keys.each { |key| add_transition(key, cend, \"\")}\n\n set_start(cstart)\n...
[ "0.64042956", "0.6064393", "0.60386634", "0.6007729", "0.5946686", "0.59351325", "0.59351325", "0.5909589", "0.58873314", "0.58676314", "0.58676314", "0.57807076", "0.5779571", "0.5710219", "0.56961817", "0.5655912", "0.55736065", "0.55026084", "0.54936284", "0.5481873", "0.5...
0.0
-1
reduce 4 omitted reduce 5 omitted
def _reduce_6(val, _values, result) result = self.block_append val[0], val[2] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); en...
[ "0.6742373", "0.65648335", "0.654707", "0.654707", "0.6541003", "0.6525085", "0.6525085", "0.6521839", "0.6508959", "0.64965284", "0.64932734", "0.6476861", "0.6471889", "0.64710945", "0.64710945", "0.64671123", "0.6461539", "0.64605373", "0.6456827", "0.6451995", "0.6449653"...
0.0
-1
reduce 13 omitted reduce 14 omitted
def _reduce_15(val, _values, result) result = self.block_append val[0], val[2] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_13(val, _values, result); end", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_612(val, _values, result)\n ...
[ "0.71051943", "0.66943073", "0.66871536", "0.666146", "0.6659532", "0.6659532", "0.6639964", "0.6634204", "0.6625384", "0.6612673", "0.6612673", "0.6604862", "0.660372", "0.660372", "0.6600507", "0.65962356", "0.6593521", "0.656864", "0.656864", "0.6563033", "0.65618736", "...
0.0
-1
reduce 50 omitted reduce 51 omitted reduce 52 omitted
def _reduce_53(val, _values, result) result = new_call val[0], val[2].to_sym, val[3] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_50(val, _values, result); end", "def _reduce_50(val, _values, result); end", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _redu...
[ "0.7231666", "0.7231666", "0.705069", "0.698978", "0.69892716", "0.6960059", "0.6960059", "0.6946955", "0.6946955", "0.6919635", "0.6919635", "0.6895957", "0.68615067", "0.68517286", "0.68404305", "0.6838037", "0.6820792", "0.68158424", "0.6803077", "0.6796269", "0.678944", ...
0.0
-1
reduce 112 omitted reduce 113 omitted reduce 114 omitted
def _reduce_115(val, _values, result) lexer.lex_state = :expr_end result = val[0] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n ...
[ "0.72261244", "0.7170795", "0.71659356", "0.7153915", "0.7153915", "0.7145793", "0.71369666", "0.7093935", "0.7092436", "0.70770705", "0.70655614", "0.7050231", "0.7045222", "0.7037273", "0.7025315", "0.7024112", "0.69941646", "0.69941646", "0.69867796", "0.6986567", "0.69815...
0.0
-1
reduce 117 omitted reduce 118 omitted
def _reduce_119(val, _values, result) result = s(:lit, val[0].to_sym) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n ...
[ "0.75232965", "0.7501169", "0.74861604", "0.74763745", "0.74594957", "0.7454648", "0.7454648", "0.7452275", "0.7448948", "0.74446094", "0.7437094", "0.74164826", "0.74164826", "0.7414841", "0.7404361", "0.7404354", "0.7397454", "0.73704857", "0.7363599", "0.7361894", "0.73600...
0.0
-1
reduce 124 omitted reduce 125 omitted reduce 126 omitted reduce 127 omitted reduce 128 omitted reduce 129 omitted reduce 130 omitted reduce 131 omitted reduce 132 omitted reduce 133 omitted reduce 134 omitted reduce 135 omitted reduce 136 omitted reduce 137 omitted reduce 138 omitted reduce 139 omitted reduce 140 omitted reduce 141 omitted reduce 142 omitted reduce 143 omitted reduce 144 omitted reduce 145 omitted reduce 146 omitted reduce 147 omitted reduce 148 omitted reduce 149 omitted reduce 150 omitted reduce 151 omitted reduce 152 omitted reduce 153 omitted reduce 154 omitted reduce 155 omitted reduce 156 omitted reduce 157 omitted reduce 158 omitted reduce 159 omitted reduce 160 omitted reduce 161 omitted reduce 162 omitted reduce 163 omitted reduce 164 omitted reduce 165 omitted reduce 166 omitted reduce 167 omitted reduce 168 omitted reduce 169 omitted reduce 170 omitted reduce 171 omitted reduce 172 omitted reduce 173 omitted reduce 174 omitted reduce 175 omitted reduce 176 omitted reduce 177 omitted reduce 178 omitted reduce 179 omitted reduce 180 omitted reduce 181 omitted reduce 182 omitted reduce 183 omitted reduce 184 omitted reduce 185 omitted reduce 186 omitted reduce 187 omitted reduce 188 omitted reduce 189 omitted reduce 190 omitted reduce 191 omitted reduce 192 omitted reduce 193 omitted reduce 194 omitted
def _reduce_195(val, _values, result) result = new_assign val[0], val[2] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _r...
[ "0.6616578", "0.66102123", "0.6526495", "0.6508312", "0.65080327", "0.6476919", "0.64315206", "0.642066", "0.6405221", "0.6398721", "0.6385419", "0.6385419", "0.6379499", "0.6367299", "0.6358225", "0.63544124", "0.63018304", "0.63018304", "0.63018304", "0.63018304", "0.629429...
0.0
-1
reduce 245 omitted reduce 246 omitted
def _reduce_247(val, _values, result) result = val[0] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_240(val, _values, result); end", "def _reduce_240(val, _values, result); end", "def _reduce_605(val, _values, result)\n result = nil\n \n result\n...
[ "0.7197583", "0.7119136", "0.7119136", "0.7059211", "0.703871", "0.70321167", "0.70061857", "0.70061857", "0.6989519", "0.6969411", "0.69565684", "0.69565684", "0.6954753", "0.6954753", "0.69323236", "0.69178504", "0.69175476", "0.69124126", "0.6895392", "0.6888817", "0.68813...
0.0
-1
reduce 271 omitted reduce 272 omitted reduce 273 omitted reduce 274 omitted reduce 275 omitted reduce 276 omitted reduce 277 omitted reduce 278 omitted reduce 279 omitted reduce 280 omitted
def _reduce_281(val, _values, result) result = new_call nil, val[0].to_sym result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n ...
[ "0.69745237", "0.69344467", "0.6848337", "0.6848337", "0.6845225", "0.68212914", "0.68208015", "0.68128026", "0.6781618", "0.67804587", "0.6769622", "0.6763261", "0.6740749", "0.67387", "0.67387", "0.6730542", "0.6723775", "0.6723775", "0.6721119", "0.67136776", "0.6705349", ...
0.0
-1
reduce 337 omitted reduce 338 omitted reduce 339 omitted reduce 340 omitted reduce 341 omitted reduce 342 omitted reduce 343 omitted reduce 344 omitted reduce 345 omitted reduce 346 omitted reduce 347 omitted reduce 348 omitted reduce 349 omitted reduce 350 omitted reduce 351 omitted reduce 352 omitted reduce 353 omitted
def _reduce_354(val, _values, result) result = s(:if, val[1], val[3], val[4]) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \...
[ "0.7302384", "0.7271871", "0.7251981", "0.72448146", "0.7236824", "0.7234191", "0.7220784", "0.7203808", "0.71949077", "0.7174049", "0.7170608", "0.7170608", "0.71532893", "0.71523434", "0.7146084", "0.7132896", "0.7131156", "0.71279335", "0.7125316", "0.7122396", "0.7117376"...
0.0
-1
reduce 435 omitted reduce 436 omitted
def _reduce_437(val, _values, result) _, klasses, var, _, body, rest = val klasses ||= s(:array) klasses << new_assign(var, s(:gvar, :"$!")) if var result = new_resbody(klasses, body) result << rest if rest # UGH, rewritten above result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_464(val, _values, result); end", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, resul...
[ "0.7493616", "0.74461585", "0.7432118", "0.7417895", "0.74140906", "0.7410223", "0.73852074", "0.73852074", "0.73734444", "0.73727995", "0.7368928", "0.7368928", "0.7368682", "0.7364385", "0.7362744", "0.7362744", "0.7362077", "0.73469955", "0.73256177", "0.73253495", "0.7310...
0.0
-1
reduce 440 omitted reduce 441 omitted
def _reduce_442(val, _values, result) result = val[1] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _...
[ "0.721731", "0.7207867", "0.7207867", "0.71946424", "0.71946424", "0.71691567", "0.7132406", "0.71301144", "0.7117591", "0.71081376", "0.7101896", "0.70869297", "0.7084891", "0.7081589", "0.7076122", "0.7068256", "0.70642483", "0.7060014", "0.7045039", "0.70378476", "0.703443...
0.0
-1
reduce 492 omitted reduce 493 omitted reduce 494 omitted reduce 495 omitted
def _reduce_496(val, _values, result) lexer.lex_state = :expr_end result = val[1] result ||= s(:str, "") case result[0] when :dstr then result[0] = :dsym when :str then result = s(:lit, result.last.to_sym) when :evstr then result = s(:dsym, "", result) else debug20 26, val, result end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n ...
[ "0.75097454", "0.7456488", "0.7453151", "0.7452182", "0.74509937", "0.7449296", "0.7429766", "0.7429766", "0.7377436", "0.7362899", "0.7362899", "0.7348039", "0.73479766", "0.73470247", "0.7342043", "0.7338333", "0.73360884", "0.7334733", "0.73183364", "0.73132885", "0.731065...
0.0
-1
reduce 499 omitted reduce 500 omitted reduce 501 omitted reduce 502 omitted reduce 503 omitted reduce 504 omitted reduce 505 omitted reduce 506 omitted reduce 507 omitted
def _reduce_508(val, _values, result) result = s(:nil) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_502(val, _values, result); end", "def _reduce_502(val, _values, result); end", "def _reduce_599(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_400(val, _values, result); end", "def _reduce_498(val, _values, result)\n r...
[ "0.73070264", "0.73070264", "0.7209698", "0.6852134", "0.6849404", "0.68453383", "0.6807395", "0.6803921", "0.67729086", "0.67563933", "0.67563933", "0.67313653", "0.67259413", "0.6720832", "0.6714344", "0.67038786", "0.6702849", "0.66887444", "0.66887444", "0.66871655", "0.6...
0.0
-1
reduce 554 omitted reduce 555 omitted
def _reduce_556(val, _values, result) result = val[1] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n ...
[ "0.7639912", "0.7624237", "0.76109076", "0.7593957", "0.75898474", "0.7565212", "0.7564991", "0.75638", "0.75493157", "0.7546152", "0.7531048", "0.7525904", "0.7525904", "0.75245637", "0.75129205", "0.7506199", "0.7503602", "0.7497428", "0.74846476", "0.7484332", "0.74837697"...
0.0
-1
reduce 568 omitted reduce 569 omitted
def _reduce_570(val, _values, result) result = :"**#{val[1]}" result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n ...
[ "0.75575966", "0.7545057", "0.75303096", "0.7526122", "0.75243783", "0.7501205", "0.7498465", "0.74536043", "0.7431872", "0.74164504", "0.7407575", "0.7400734", "0.73968315", "0.7394537", "0.7394537", "0.7391179", "0.738703", "0.738703", "0.7379894", "0.7379049", "0.73724675"...
0.0
-1
reduce 578 omitted reduce 579 omitted
def _reduce_580(val, _values, result) # TODO: differs from parse.y - needs tests name = val[1].to_sym self.assignable name result = :"*#{name}" result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n ...
[ "0.7599051", "0.75874794", "0.75836533", "0.75740296", "0.7572463", "0.75642824", "0.752806", "0.75032425", "0.7493244", "0.74769664", "0.7473332", "0.7473332", "0.747073", "0.7463626", "0.74627143", "0.7450868", "0.7450868", "0.74423456", "0.7436391", "0.7431159", "0.7431159...
0.0
-1
reduce 582 omitted reduce 583 omitted
def _reduce_584(val, _values, result) identifier = val[1].to_sym self.env[identifier] = :lvar result = "&#{identifier}".to_sym result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \...
[ "0.765219", "0.7616411", "0.75855094", "0.7566106", "0.7554131", "0.75505245", "0.7540417", "0.7539315", "0.75309104", "0.7521423", "0.75186825", "0.75186825", "0.75089955", "0.74809426", "0.74774647", "0.74774647", "0.7470855", "0.74699783", "0.74690396", "0.74625146", "0.74...
0.0
-1
reduce 599 omitted reduce 600 omitted reduce 601 omitted reduce 602 omitted reduce 603 omitted reduce 604 omitted reduce 605 omitted reduce 606 omitted reduce 607 omitted reduce 608 omitted reduce 609 omitted reduce 610 omitted reduce 611 omitted reduce 612 omitted reduce 613 omitted reduce 614 omitted reduce 615 omitted reduce 616 omitted reduce 617 omitted reduce 618 omitted reduce 619 omitted reduce 620 omitted reduce 621 omitted
def _reduce_622(val, _values, result) yyerrok result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_600(val, _values, result)\n yyerrok\n \n result\nend",...
[ "0.7408907", "0.7345242", "0.7305247", "0.7295564", "0.724144", "0.72382057", "0.72326", "0.7221786", "0.71949935", "0.7176622", "0.7176622", "0.7173267", "0.7169518", "0.7157755", "0.7150136", "0.71356404", "0.7134896", "0.71301156", "0.71276844", "0.7123717", "0.71201277", ...
0.0
-1
reduce 623 omitted reduce 624 omitted
def _reduce_625(val, _values, result) yyerrok result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n ...
[ "0.73625827", "0.7355341", "0.7353996", "0.7340223", "0.7313028", "0.7277766", "0.72613597", "0.72607875", "0.7251472", "0.72353256", "0.72184694", "0.72163934", "0.72160876", "0.72160876", "0.72157085", "0.7202236", "0.72007257", "0.71992266", "0.71928775", "0.71748614", "0....
0.0
-1
before_filter :validate_password, :only => ['edit','update','destroy'], :unless => is_admin?(User.find(params[:id])) GET /users GET /users.json
def index @users = User.all respond_to do |format| format.html # index.html.erb format.json { render json: @users } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_self\n if @user && !current_user.can_edit?(@user)\n respond_to do |format|\n format.html {\n render :nothing => true, :status => 403\n }\n format.json {\n render :json => {:status => 'failure'}, :status => 403\n }\n end\n end\n end", "def ...
[ "0.73334926", "0.69194674", "0.68577206", "0.66831225", "0.66797537", "0.6679477", "0.66706556", "0.66619486", "0.66526407", "0.6649092", "0.66412044", "0.6609014", "0.65936595", "0.659035", "0.6571135", "0.6564993", "0.65550196", "0.6552278", "0.65502024", "0.6504417", "0.65...
0.0
-1
GET /users/1 GET /users/1.json
def show @user = User.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ...
[ "0.81046426", "0.7703556", "0.77011716", "0.76262826", "0.7582106", "0.74818", "0.7461394", "0.7446168", "0.730656", "0.7300699", "0.72902125", "0.72781444", "0.72358584", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.722...
0.0
-1
GET /users/new GET /users/new.json
def new @user = User.new respond_to do |format| format.html # new.html.erb format.json { render json: @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n ...
[ "0.8287397", "0.8169197", "0.8155916", "0.80483407", "0.8022376", "0.8021751", "0.8009459", "0.7950995", "0.793078", "0.793078", "0.7873476", "0.7873476", "0.7873476" ]
0.7860956
92
POST /users POST /users.json
def create @user = User.new(params[:user]) respond_to do |format| if @user.save flash.keep[:success] = 'User was successfully Created.' flash.keep[:notice] = 'A confirmation email has been sent to your email box. Click on the confirmation link to complete registration.' format.html { redirect_to login_path } #format.json { render json: @user, status: :created, location: @user } else format.html { render action: "new" } #format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post b...
[ "0.77179813", "0.75206673", "0.73831296", "0.72405374", "0.719841", "0.7140812", "0.71038526", "0.7058827", "0.7041636", "0.70236504", "0.7003128", "0.70021695", "0.70021695", "0.70021695", "0.69936967", "0.6990463", "0.6980393", "0.6979075", "0.69788617", "0.69788617", "0.69...
0.0
-1
PUT /users/1 PUT /users/1.json
def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) flash.keep[:success] = 'User was successfully updated.' format.html { redirect_to @user } format.json { head :no_content } else format.html { redirect_to action: "edit" } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "de...
[ "0.74114245", "0.73920554", "0.73041475", "0.7254177", "0.7202618", "0.70756376", "0.70535713", "0.7029043", "0.70075685", "0.69883573", "0.6983195", "0.694263", "0.69409895", "0.692315", "0.6909438", "0.687742", "0.68486536", "0.6834162", "0.6821841", "0.6801179", "0.6770304...
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @user = User.find(params[:id]) @user.destroy flash.keep[:success] = 'User was successfully destroyed.' flash.keep[:warn] = 'You will not be able to login using the deleted account' respond_to do |format| format.html { redirect_to users_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\...
[ "0.78750724", "0.77518034", "0.7713981", "0.7610077", "0.747295", "0.74073994", "0.74073994", "0.7369968", "0.7346072", "0.7340465", "0.7328618", "0.7309635", "0.73095363", "0.7306841", "0.7297868", "0.72917855", "0.7291585", "0.7289111", "0.7284347", "0.7250935", "0.7250935"...
0.0
-1
Check active state condition id : skill ID
def skill_state_on(id) if Skill_State_On[id]['include'] != nil for i in Skill_State[id]['include'] return true if @state.include?(i) end end if Skill_State[id]['set'] != nil for i in Skill_State[id]['set'] return false unless @state.include?(i) end return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guard_skill_id\r\n return 2\r\n end", "def won?\n @state.id == 14\n end", "def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end", "def check_current_status(id, model)\n status = model.find(id)\n status.is_active? ? \"Deactivate\" : \"Activate\"\n ...
[ "0.63264453", "0.61316097", "0.610519", "0.6038598", "0.59788126", "0.5957334", "0.59418553", "0.58565557", "0.58250123", "0.58119106", "0.5799493", "0.5785257", "0.5733393", "0.565602", "0.5633138", "0.56328356", "0.5630677", "0.56222636", "0.5603394", "0.5603394", "0.559539...
0.68436116
0
Check inactive state condition id : skill ID
def skill_state_off(id) if Skill_State_On[id]['include'] != nil for i in Skill_State[id]['include'] return false if @state.include?(i) end end if Skill_State[id]['set'] != nil for i in Skill_State[id]['set'] return true unless @state.include?(i) end return false end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skill_state_on(id)\n if Skill_State_On[id]['include'] != nil\n for i in Skill_State[id]['include']\n return true if @state.include?(i)\n end\n end\n if Skill_State[id]['set'] != nil\n for i in Skill_State[id]['set']\n return false unless @state.include?(i)\n end\n ...
[ "0.64750046", "0.6253902", "0.6251744", "0.6189769", "0.60342383", "0.6016555", "0.598371", "0.59776497", "0.5961252", "0.59382606", "0.59132606", "0.5871623", "0.58465505", "0.58208114", "0.58152235", "0.5798878", "0.5773359", "0.5750117", "0.5748668", "0.57402015", "0.57293...
0.66303855
0
Check active swithc condition id : skill ID
def skill_sw_on(id) if Skill_Sw_On[id]['include'] != nil for i in Skill_Sw_On[id]['include'] return true if $game_switches[i] end end if Skill_Sw_On[id]['set'] != nil for i in Skill_Sw_On[id]['set'] return false unless $game_switches[i] end return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guard_skill_id\r\n return 2\r\n end", "def attack_skill_id\r\n return 1\r\n end", "def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end", "def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end", "def skill_conditions_met?(skill)\r\n ...
[ "0.65793777", "0.62702954", "0.6269415", "0.61987203", "0.59673107", "0.5870263", "0.5865037", "0.5766478", "0.57550406", "0.5745022", "0.57190704", "0.57019264", "0.56955755", "0.56949335", "0.55814713", "0.5574198", "0.5557739", "0.5557588", "0.5540415", "0.5540138", "0.550...
0.66491723
0
Check inactive swithc condition id : skill ID
def skill_sw_off(id) if Skill_Sw_Off[id]['include'] != nil for i in Skill_Sw_Off[id]['include'] return true if $game_switches[i] == false end end if Skill_Sw_Off[id]['set'] != nil for i in Skill_Sw_Off[id]['set'] return false unless $game_switches[i] == false end return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skill_sw_on(id)\n if Skill_Sw_On[id]['include'] != nil\n for i in Skill_Sw_On[id]['include']\n return true if $game_switches[i]\n end\n end\n if Skill_Sw_On[id]['set'] != nil\n for i in Skill_Sw_On[id]['set']\n return false unless $game_switches[i]\n end\n return...
[ "0.6513623", "0.63832504", "0.62420905", "0.609231", "0.60493565", "0.59335893", "0.5884933", "0.58252317", "0.57625985", "0.5760204", "0.5743918", "0.57438433", "0.5717868", "0.57051104", "0.5704478", "0.5699243", "0.5688466", "0.568029", "0.5677594", "0.564959", "0.562893",...
0.6482905
1
Check variable condition id : skill ID
def skill_var(id) for var in Skill_Var[id] return true if eval("$game_variables[#{var[0]}] #{var[1]}") end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guard_skill_id\r\n return 2\r\n end", "def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end", "def attack_skill_id\r\n return 1\r\n end", "def garbage_check(id)\n\t return @skills.include?(id)\n\tend", "def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).incl...
[ "0.6881555", "0.640917", "0.6312202", "0.6262951", "0.6088578", "0.59307754", "0.585379", "0.5847933", "0.58142793", "0.5772137", "0.57471144", "0.57029593", "0.5673212", "0.5632115", "0.55788827", "0.55694836", "0.5538258", "0.55244523", "0.5510854", "0.54874116", "0.5475369...
0.70595515
0
Check HP condition id : skill ID
def skill_hp(id) if Skill_Hp[id]['integer'] != nil return true if eval("self.hp #{Skill_Hp[id]['integer']}") end if Skill_Hp[id]['rate'] != nil return true if eval("(self.hp * 100 / self.maxhp) #{Skill_Hp[id]['rate']}") end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guard_skill_id\r\n return 2\r\n end", "def attack_skill_id\r\n return 1\r\n end", "def skill_effect_scope(skill)\r\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\r\n # or skill scope is for ally with 0, and your own HP = 1 or more\r\n return (((skill.scope == 3 or s...
[ "0.6695021", "0.66221845", "0.6189036", "0.6120013", "0.60196644", "0.6017671", "0.59831667", "0.5981362", "0.5961391", "0.5950628", "0.59329593", "0.58321065", "0.5809862", "0.5766323", "0.5749785", "0.5739937", "0.5737943", "0.57009745", "0.5615313", "0.55593765", "0.555358...
0.66674626
1
Check SP condition id : skill ID
def skill_sp(id) if Skill_Sp[id]['integer'] != nil return true if eval("self.sp #{Skill_Sp[id]['integer']}") end if Skill_Sp[id]['rate'] != nil return true if eval("(self.sp * 100 / [self.maxsp, 1].max) #{Skill_Sp[id]['rate']}") end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guard_skill_id\r\n return 2\r\n end", "def attack_skill_id\r\n return 1\r\n end", "def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end", "def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end", "def skill_conditions_met?(skill)\r\n ...
[ "0.67911553", "0.61708826", "0.5986448", "0.59855115", "0.57566106", "0.5730158", "0.57211494", "0.57147837", "0.5537426", "0.5523886", "0.5490673", "0.5383702", "0.5371006", "0.53443813", "0.5343247", "0.53366303", "0.53366303", "0.53366303", "0.53366303", "0.5327093", "0.53...
0.6455193
1
is following a user?
def following?(other) following.include?(other) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def following?(user)\n following.include?(user)\n end", "def following?\n user.present?\n end", "def following_user?(other_user)\n following.include?(other_user)\n end", "def following?(user)\n following.include? user\n end", "def following?(other_user)\n\t following.include?(other_user)...
[ "0.89001584", "0.8830123", "0.882131", "0.87999135", "0.87602615", "0.874472", "0.874303", "0.8741129", "0.8740429", "0.8733352", "0.8731709", "0.87241656", "0.87241656", "0.87241656", "0.87241656", "0.8718604", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221",...
0.0
-1
display menu for user
def display_menu puts "1. Scrapp townhalls' emails from web" puts "2. Send massive emails to townhalls" puts "3. Follow towhalls on Twitter" puts "4. Print me the JSON" puts "5. Exit program" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def displaymenu # Console only\r\n\t\t @output.puts \"Menu: (1) Play | (2) New | (3) Analysis | (9) Exit\"\r\n\t\t end", "def display_menu\n system('clear')\n arr = ['My List', 'Recommendations', 'Playlist', 'Account Details', 'Exit']\n @prompt.select(\"》 MAIN MENU 《\\n\".colorize(:li...
[ "0.7902932", "0.78420234", "0.76964", "0.76650155", "0.7606996", "0.7556225", "0.7528223", "0.7430219", "0.7378243", "0.7367225", "0.73633116", "0.7339624", "0.7335255", "0.7326372", "0.7320413", "0.7289805", "0.7270864", "0.7270673", "0.72700286", "0.72683805", "0.7258747", ...
0.69467837
59
This function writes out a hash or an array (list) to a file.
def write_data(filename, data) file = File.open(filename, "w") file.puts(data) file.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_out_list list, list_path\n output = File.new list_path, \"w\"\n if list.class == Array\n list.each do\n |app|\n output.puts \"#{app[0]} #{app[1]}\"\n end\n elsif list.class == Hash\n list.each do\n |app,count|\n output.puts \"#{app} #{count}\"\n end\n end\n output.flu...
[ "0.7586484", "0.70758814", "0.6679203", "0.66621524", "0.66294396", "0.657567", "0.652697", "0.65226865", "0.6500102", "0.64164585", "0.6384565", "0.63591415", "0.62808913", "0.6209778", "0.61841905", "0.6154234", "0.61539054", "0.61402965", "0.61230516", "0.6095582", "0.6058...
0.56971234
69
function that takes the name of a file and loads in the stop words from the file. You could return a list from this function, but a hash might be easier and more efficient. (Why? Hint: think about how you'll use the stop words.)
def load_stopwords_file(file) stop_words = {} # Looping through the file and adding each word to a hash table after chomping them File.open(file, "r").each_line do |line| stop_words[line.chomp] = 1 end return stop_words end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_stopwords_file(file)\n f = File.open(file, \"r\")\n stopwordH = {}\n f.each_line do |stopword|\n stopwordH[stopword] = 0\n end\n return stopwordH\nend", "def get_stopword_list\n list = []\n \n begin\n File.open(\"stopwords.txt\", \"r\") do |file|\n file.each_line { |...
[ "0.7985723", "0.7368552", "0.7265786", "0.72610134", "0.7143473", "0.70698315", "0.70198655", "0.70190686", "0.6995447", "0.68674725", "0.6856073", "0.6821236", "0.67191386", "0.6646942", "0.66306347", "0.6599554", "0.65971243", "0.6593243", "0.6484252", "0.6483898", "0.64471...
0.8104293
0
function that takes the name of a directory, and returns a list of all the filenames in that directory.
def list_files(dir) # Getting all the files names in the directory file_names = Dir[dir + "*"] return file_names end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_files(dir)\n# Getting all the files names in the directory\n file_names = Dir[dir + \"*\"]\n return file_names\nend", "def list_files_from_dir(path)\n Dir[path + \"/*/\"].map { |file| File.basename(file) }\n end", "def list_files_in_directory dir\n files = Dir.glob File.join(dir, \"*\...
[ "0.80133253", "0.78187627", "0.7615698", "0.74597514", "0.7405495", "0.73551685", "0.73167235", "0.720857", "0.72048825", "0.7196617", "0.71838427", "0.7153261", "0.7131933", "0.7131933", "0.711905", "0.7115317", "0.709747", "0.70915383", "0.7090699", "0.7077409", "0.7062205"...
0.80001473
1
CUSTOM FUNCTIONS parse_html takes the HTML code of a document and removes all the junk from it in order to return the text content on the page
def parse_html(html) doc = Nokogiri::HTML(html) # Removing style and script tag content such as Javascript tags in order to get rid of JUNK text doc.xpath("//script").remove doc.xpath("//style").remove begin text = doc.at('body').inner_text rescue NoMethodError puts "NoMethodError" # puts file_name #title = nil end return text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_html(html)\n cleaned = html.gsub(/\\n/, '').gsub(/>\\s*</m, '><').gsub /\\x00/, ''\n doc = Nokogiri::HTML(cleaned, nil, nil, Nokogiri::XML::ParseOptions.new.default_html.noblanks)\n # remove all 'script' and 'style' nodes from the document\n doc.css('style').each {|n| n.remove }\n ...
[ "0.7567121", "0.7501477", "0.7323203", "0.7323203", "0.7323203", "0.7320719", "0.72193927", "0.7167748", "0.71563166", "0.712633", "0.70980257", "0.7087345", "0.7078445", "0.70275867", "0.70126086", "0.6989239", "0.69694614", "0.69290084", "0.6917967", "0.68704647", "0.687046...
0.779717
0