query_id stringlengths 32 32 | query stringlengths 7 6.75k | positive_passages listlengths 1 1 | negative_passages listlengths 88 101 |
|---|---|---|---|
97fb85039590b89c98e9664877bfc4ba | Top games sold by Sony Computer Entertainment | [
{
"docid": "1a454a5c45bbb60f1c585018c66fc143",
"score": "0.0",
"text": "def query2\n @data1 = VideoGame.select(:name, 'na_sales+eu_sales+jp_sales+other_sales+global_sales AS global').joins(:sale).where(\"publisher = 'Sony Computer Entertainment'\").order(global: :desc).limit(10)\n end",
"title":... | [
{
"docid": "ad9fe4535fd457c24055e0f5b81df923",
"score": "0.70192844",
"text": "def top_games(limit=10)\n placeholder = SecureRandom.uuid.downcase.gsub('-', '')\n games = Event.connection.execute(\n <<-SQL\n select * from (\n select\n regexp_replace(initcap(regexp_re... |
c2175533a04b50c6add00840cd67ad78 | GET /data_cleaning_algorithms/1 GET /data_cleaning_algorithms/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "06e9428864f549a73a0c593141dbfcd1",
"score": "0.67035544",
"text": "def index\n @data_cleaning_algorithms = DataCleaningAlgorithm.all\n end",
"title": ""
},
{
"docid": "17ee82683aab2adc5db4c112a0081853",
"score": "0.57562226",
"text": "def hecto\n # extract factor f... |
14a140566e30871745865958067bc811 | don't look at corporate holdings, only players | [
{
"docid": "1e7fe3db172724d28d73a4fa2510ef41",
"score": "0.0",
"text": "def can_dump?(entity, bundle)\n return true unless bundle.presidents_share\n\n sh = bundle.corporation.player_share_holders\n (sh.reject { |k, _| k == entity }.values.max || 0) >= bundle.presidents_s... | [
{
"docid": "5055318f779c0e74b189c530c8ac329c",
"score": "0.6636163",
"text": "def active_players\n super.reject { |player| player == @union_bank }\n end",
"title": ""
},
{
"docid": "9b21527baa75e3a174501de99cc3e899",
"score": "0.65076363",
"text": "def still_to_play\n... |
0c850f2d39f26c5f08c6a30b980cd78e | define combine method that comines the two arrays | [
{
"docid": "6303ed0da73e15715aa2d533087ac1e7",
"score": "0.0",
"text": "def combine\n\t\t@name_catalog.each_with_index do |name, rating| \n\t\t\t@full_catalog[name] = @rating_catalog[rating]\n\t\tend\n\tend",
"title": ""
}
] | [
{
"docid": "4e557c5544e1118643573f1c5ab03466",
"score": "0.7993656",
"text": "def combine(array1, array2)\n array1.zip(array2).flatten\nend",
"title": ""
},
{
"docid": "23aaec15126c6be1a6568b12f51c1925",
"score": "0.76956344",
"text": "def merge(array1, array2)\n array1 | array2\n... |
0626bfccc8b08b18d9c9905d61f42a2d | Specifies an autorequire relationship. | [
{
"docid": "5b6feb70ef76d70246a1c35e5865d276",
"score": "0.5645901",
"text": "def autorequire(name = nil, &block)\n # Not needed to describe the type\n nil\n end",
"title": ""
}
] | [
{
"docid": "44101fede29c7b2ffc805745531f0c7b",
"score": "0.6913232",
"text": "def autorequire(rel_catalog = nil)\n reqs = super\n\n [\n @parameters[:prior_to].value,\n @parameters[:resource].value,\n ].flatten.each do |rel|\n reqs << Puppet::Relationship.new(self, catalog.resourc... |
42ea3b6e336f89295dad55383c36d8e3 | init brush data and brush image | [
{
"docid": "2224ad0b702628ef5279f0fbaf6f91ce",
"score": "0.6624973",
"text": "def init(size_enable = true)\r\n unless size_enable\r\n @size = 1\r\n end\r\n @w, @h = @size, @size\r\n\r\n cname = get_chr_set_name\r\n @brush_data = MapData.new(@w, @h, $fg_color, $bg_color, cname, $chr_i... | [
{
"docid": "c3070fcbbb31fba0b98f44e5d0e70871",
"score": "0.5845732",
"text": "def set_carbon_brush\n @carbon_brush = CarbonBrush.find(params[:id])\n end",
"title": ""
},
{
"docid": "af21cbc891080aa33acb880ab48278ff",
"score": "0.58397686",
"text": "def brush(*args)\n c... |
04a5c6e325c08d09f58125ae135484dc | Public: Initialize the collection. parent The object that owns this collection. as The name of the relationship between the collection's items and the parent. model_class The class of the model this collection represents. service The service that implements remote calls. | [
{
"docid": "22260eae9a23105a7014437ad9568e90",
"score": "0.6013313",
"text": "def initialize(parent, as, model_class, service)\n @parent = parent\n @as = as\n @model_class = model_class\n @service = service\n end",
"title": ""
}
] | [
{
"docid": "f07238122535a65937ab99c7a7a9aef0",
"score": "0.6780549",
"text": "def initialize\n @coll=self.class.collection\n end",
"title": ""
},
{
"docid": "f07238122535a65937ab99c7a7a9aef0",
"score": "0.6780549",
"text": "def initialize\n @coll=self.class.collection\n end",... |
3b24c6fb53ce39438434db260268d735 | GET /sliders/new GET /sliders/new.json | [
{
"docid": "004132cf2f9ae0042775f4ed7bce3ea8",
"score": "0.8056779",
"text": "def new\n @slider = Slider.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slider }\n end\n end",
"title": ""
}
] | [
{
"docid": "15a8aa221ad102fd40dc343478ccdc02",
"score": "0.7739046",
"text": "def new\n @slider = Slider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=>@slider}\n end\n end",
"title": ""
},
{
"docid": "7f2c4f3b862a3e8f7150b92a79c... |
ae12b1a41b55e3a82302dec7b46d230c | Capitalizes all the words and replaces some characters in the string to create a nicer looking title. Titleize is meant for creating pretty output. It is not used in the Rails internals. titleize is also aliased as as titlecase Examples "man from the boondocks".titleize => "Man From The Boondocks" "xmen: the last stand... | [
{
"docid": "2f1ce9b88e367a44668d21f3b0a63d89",
"score": "0.7725214",
"text": "def titleize(word)\n humanize(underscore(word)).gsub(/\\b([a-z])/) { $1.capitalize }\n end",
"title": ""
}
] | [
{
"docid": "f93c755a2b21399d06a91f84a224962f",
"score": "0.84019774",
"text": "def titleize string\n string.gsub(/\\w+/) do |word|\n word.capitalize\n end\n end",
"title": ""
},
{
"docid": "02ecb972c5549ac304dae18fa492cc59",
"score": "0.8178111",
"text": "... |
4105f6e955715c5429f4c06207f9335c | creates transcription line metadata file, returns location of the file | [
{
"docid": "3763ebab16d6de044db495535614ac91",
"score": "0.6950242",
"text": "def write_line_metadata_to_file\n file = Tempfile.new([\"transcription_line_metadata_#{@transcription.id}-\", '.csv'])\n\n CSV.open(file.path, 'wb') do |csv|\n transcription_line_metadata.each do |csv_line|\n ... | [
{
"docid": "395beb53f7fecf420e02c8398be300c4",
"score": "0.60642195",
"text": "def transcription_line_metadata\n csv_lines = []\n csv_lines << line_metadata_csv_headers\n\n frame_regex = /^frame/\n frames = @transcription.text.filter { |key, _value| frame_regex.match(key) }\n if... |
231a646e06ef088d6889017f300f9530 | DELETE /home_configurations/1 DELETE /home_configurations/1.json | [
{
"docid": "c8187d677944528e1c039b3c8dbc7840",
"score": "0.7240707",
"text": "def destroy\n @home_configuration = HomeConfiguration.find(params[:id])\n @home_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to home_configurations_url }\n format.json { head :no... | [
{
"docid": "ab7b8c6dbb9cd3a3a11f2294c8b1bc82",
"score": "0.69235146",
"text": "def destroy\n @am_configuration = AmConfiguration.find(params[:id])\n @am_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to am_configurations_url }\n format.json { head :ok }\n ... |
ab13daee93b33519efa7f6181a9f5308 | Get the canonic type name, for type comparison. | [
{
"docid": "65dca294ddafb98a174ca54726299117",
"score": "0.82153815",
"text": "def canonic_type\n t = type.to_s.downcase.to_sym\n CANONIC_TYPES[ t ] || t\n end",
"title": ""
}
] | [
{
"docid": "0fc5c930754903b194097657314a72cd",
"score": "0.7761256",
"text": "def readable_type_name(type)\n return TYPE_MAPPING.fetch(type, type)\n end",
"title": ""
},
{
"docid": "66b76296f234eb7aca36146b211cb10b",
"score": "0.7651721",
"text": "def type_name\n @ty... |
aa30c52471e615993e886c7f13ae1ecc | DELETE /deals/1 DELETE /deals/1.json | [
{
"docid": "480457959003f480464d119f33482f4c",
"score": "0.6965093",
"text": "def destroy\n @deal = Deal.find(params[:id])\n @deal.destroy\n\n respond_to do |format|\n format.html { redirect_to deals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] | [
{
"docid": "c8dac8b47666fe727f4c94208d8ed6b5",
"score": "0.741138",
"text": "def destroy\n @deal = Deal.find(params[:id])\n @deal.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_deals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},... |
f00a7644c50c339c865d249f953ebccc | DELETE /billing_infos/1 DELETE /billing_infos/1.xml | [
{
"docid": "6fbfb6194c9d84565f99bde01acd6aea",
"score": "0.7474267",
"text": "def destroy\n @billing_info = BillingInfo.find(params[:id])\n @billing_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(billing_infos_url) }\n format.xml { head :ok }\n end\n rescue... | [
{
"docid": "fdcca1bbca199c6c90dca71de1fdb797",
"score": "0.72502524",
"text": "def destroy\n @billing_info = BillingInfo.find(params[:id])\n @billing_info.destroy\n\n respond_to do |format|\n format.html { redirect_to billing_infos_url }\n format.json { head :no_content }\n end\n ... |
b239ff1c25fdd6fe151a4cb23c866f5f | creation de methode caverne | [
{
"docid": "74dfd66739d440d87ebb4cfe9f622695",
"score": "0.0",
"text": "def caverne\n self.class.get('/monstre_caverne.json')\n end",
"title": ""
}
] | [
{
"docid": "40769f9969d33ad71cb2389a7e574114",
"score": "0.7542297",
"text": "def institucional\n\t\t\n\tend",
"title": ""
},
{
"docid": "c4c797f4e170e07198b939f09207cad2",
"score": "0.7537907",
"text": "def construct; end",
"title": ""
},
{
"docid": "fdd8f361e27003effc27... |
5b8cc642b7baf9c627346b7274b70285 | Create URLs for uploading and downloading source. Deprecated in favor of `POST /sources` | [
{
"docid": "2eb300169937c1f0e854ae188c341ef0",
"score": "0.0",
"text": "def create_deprecated(app_id_or_app_name)\n @client.source.create_deprecated(app_id_or_app_name)\n end",
"title": ""
}
] | [
{
"docid": "61faf833abc8b61a55dee8e9e534683f",
"score": "0.76066417",
"text": "def generate_sources_endpoints\n response = HTTPClient.post @heroku_app_sources_endpoint, nil, HerokuApiHelpers.default_headers\n data = JSON.parse response.body\n @heroku_get_url = data[\"source_blob\"][\"get_url\"]... |
1ccf474702afef6f76b67bf7b38af8cb | Important words from a string | [
{
"docid": "303f2488637f408e26cfedd932332f03",
"score": "0.7373642",
"text": "def important_words\n str = self\n str = str.gsub(/ +/, ' ').strip\n parts = str.split(' ')\n parts.reject { |p| p.length <= 3 }.join(' ')\n end",
"title": ""
}
] | [
{
"docid": "dc6689717172447558178555416d9d21",
"score": "0.7688285",
"text": "def words\n unless @words\n @words = @string.gsub( /[,\\\"\\\\]/, \"\" ).gsub( /\\+/, \" \" ).split.select do |word|\n case word\n # Ignore really common words.\n when \"a\", \"of\", \"the\", \"to\... |
96f6a3d193e8feace6982734c5ff01fe | method for saving posted image locally | [
{
"docid": "94c8395a3697bc468e0c74b5ea9640e8",
"score": "0.5761403",
"text": "def upload_image\n uploaded_image = params[:image_id]\n image_size = uploaded_image.size\n filename = uploaded_image.original_filename\n @user = User.find(params[:id])\n\n # gets the type of image and saves rele... | [
{
"docid": "9d740ced620df8f881711dfd9a04507f",
"score": "0.69373304",
"text": "def picture_save \n \tuploader = ImageUploader.new\n \tuploader.store!(image)\n \timage = uploader.store_dir\n \tsave\n end",
"title": ""
},
{
"docid": "d8c552776fefeff760ba232285a15c38",
"score": "0.6933... |
f0ca37e303c60140d93783cf2aaca8d4 | Returns true if this is a set. | [
{
"docid": "cd2480cb50a4e8872fed00cef175d869",
"score": "0.6614646",
"text": "def set?\n complete_value.is_a?(Hash)\n end",
"title": ""
}
] | [
{
"docid": "aeaa5ab7c671402d775cbfea3f18c335",
"score": "0.8309839",
"text": "def is_set?\n object.kind == 'set'\n end",
"title": ""
},
{
"docid": "77d9bfa23e9a41756ce67201e36d40d4",
"score": "0.79170316",
"text": "def set?\n start_set_kind? :set\n end",
"title": ""
... |
e8a497166f79ebc7e7577a457d136055 | Returns compiled mappings hash for current type | [
{
"docid": "946c4655f679a7bf4d5fcd75f773531b",
"score": "0.6374174",
"text": "def mappings_hash\n root.mappings_hash\n end",
"title": ""
}
] | [
{
"docid": "e3298c7541d63056c2e8996ae81ab680",
"score": "0.73702693",
"text": "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend",
"title": ""
},
{
"docid": "65a12432c9aef57143a1c44b65561904",
"score": "0.71571946",
"text": "def hash\n @type.hash\n end",
"ti... |
e5488f68f69f310e4ddd15eebbb370e2 | Returns the `mtime` of the most recent nondot file found in the requested directory hierarchy. | [
{
"docid": "590b90d516cc756181a276a6f64100d4",
"score": "0.7249839",
"text": "def get_max_mtime(dir)\n max_mtime = Dir.glob(\"#{dir}/**/*\").max_by do |f|\n File.symlink?(f) ? Time.new(1900) : File.mtime(f)\n end\n if max_mtime.to_s.empty?\n Time.now\n else\n File.mtime(max_mtime)\n end\ne... | [
{
"docid": "ccfe4031b67aa4be7e88e63c5700162f",
"score": "0.73904675",
"text": "def latest_modification_time_in(directory)\n %x{find #{directory} -print0 | xargs -0 stat -f %m | sort -r | head -n1}.to_i\n end",
"title": ""
},
{
"docid": "77fa1e36a70ef6221e11d66fd9f7a2b8",
"score": "0.... |
0ad7f48c598c80ab73127ee9b2368aaa | a user has left | [
{
"docid": "d8753845986a9152752aad37d8e2b28e",
"score": "0.0",
"text": "def terminate_session\n puts \"starting termination....\"\n \tuser = User.find_by(email: session[:user][:email])\n lobby = Lobby.find_by id: user.lid\n chan = user.lid.to_s\n\n user.update(race_status: \"not in lobby\",... | [
{
"docid": "d22c40385cf39c4ae7bec266f21d98f3",
"score": "0.7194447",
"text": "def user_left channel, user\n cache[:names].delete user.nick\n end",
"title": ""
},
{
"docid": "317191e23c922f6356eee7b9a51a2415",
"score": "0.6989783",
"text": "def leave!(reason = 'Logout')\n self.... |
69e7edc033f5cc2a00f9972e971605a6 | Returns a specific document by ID and version id ID of document version Version of the document | [
{
"docid": "8abbd66de5d5544bdea9e3285ac4868a",
"score": "0.8091933",
"text": "def get_document_by_id( id, version = nil )\n if version\n get( '/records/' + @record_id + '/documents/' + id + '/versions/' + version ).xpath('//api:document').first\n else\n get( '/records/' + @record... | [
{
"docid": "06ed1f7198150419bbb4cec25d1f9f66",
"score": "0.75874966",
"text": "def get_document_versions( id )\n get( '/records/' + @record_id + '/documents/' + id + '/versions' ).xpath('//api:document')\n end",
"title": ""
},
{
"docid": "30a65cde481f0fd3669b4df13bfdddc6",
"score... |
7777b258cfe39cfecf6b04aefcc48ff5 | Add a new space with a given address and size. | [
{
"docid": "43bd9507619e2a6f476a3d2a515452bd",
"score": "0.87063086",
"text": "def add_space(address, size)\n if size <= 0\n PEROBS.log.fatal \"Size (#{size}) must be larger than 0.\"\n end\n # The following check is fairly costly and should never trigger unless\n # there is a... | [
{
"docid": "139c4784ad308a7b108fc3bb9b3924f2",
"score": "0.66609997",
"text": "def add_size (size)\n @size << size\n end",
"title": ""
},
{
"docid": "77ccf11660b0970cfe004b52f0a4496e",
"score": "0.65572554",
"text": "def add_size( size )\n\n @size << size\n\n end",
"title... |
69beaa3e957d1fc356539d0314d703e1 | Custom attribute writer method checking allowed values (enum). | [
{
"docid": "641b474c48fd793e6fdc43ee7af71ccb",
"score": "0.0",
"text": "def license_type=(license_type)\n validator = EnumAttributeValidator.new('String', [\"Base\", \"Essential\", \"Standard\", \"Advantage\", \"Premier\", \"IWO-Essential\", \"IWO-Advantage\", \"IWO-Premier\"])\n unless valida... | [
{
"docid": "af6d0e33773bc681443214ce777b13e1",
"score": "0.7088127",
"text": "def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end",
"title": ""
},
{
"docid": "85eec95603dc239e3d18923b2c672b31",
"score": "0.6482... |
4dac0b00fc2d07dd5587eb323f2360db | GET /collections/new GET /collections/new.xml | [
{
"docid": "4bd6d0e6423dd8369debcb485d3c1871",
"score": "0.6786406",
"text": "def new\n if !current_user.is_editor\n redirect_to ('/')\n return\n end\n\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @c... | [
{
"docid": "86d7e5001304b2ec899dc066855630ce",
"score": "0.77337784",
"text": "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end",
"title": ""
},
{
"docid": "86d7e5001304... |
b65029a3e5e708269f8b6ae4d0328803 | GET /ciclos/1 GET /ciclos/1.xml | [
{
"docid": "338731e69bb49d9cd6c76976bfe9b047",
"score": "0.5997165",
"text": "def show\n @ciclo = Ciclo.find(params[:id])\n @tab = :recursos\n @nav = @ciclo\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ciclo }\n end\n end",
"t... | [
{
"docid": "5dee9270c0db382a1a71cd1c05a49094",
"score": "0.65111655",
"text": "def index\n @convenios = Convenio.where(:clinica_id => session[:clinica_id])\n respond_to do |format|\n format.html\n format.xml {render :xml => @convenios}\n format.json {render :json => @convenios... |
aaf44a5ddf4d6c44cf5bcf07728f403f | put focus on previous field will cycle by default, unless navigation policy not :CYCLICAL in which case returns :NO_PREV_FIELD. | [
{
"docid": "5b7f2be3238ca5ed61acd2b3f90148b3",
"score": "0.74152845",
"text": "def select_prev_field\n return :UNHANDLED if @focusables.nil? or @focusables.empty?\n index = nil\n if @_focussed_widget\n index = @focusables.index @_focussed_widget\n else\n index = @focusables.le... | [
{
"docid": "11c5a5391cd4513d96b8b1f1810cb429",
"score": "0.72269404",
"text": "def goto_prev_component\n if @current_component != nil \n leave_current_component\n if on_first_component?\n @_entered = false\n return :UNHANDLED\n end\n @current_index = @c... |
f34c62663c63f901a62724f04d23daff | Instantiate the referenced class and run the perform action | [
{
"docid": "60281f72c76f69cfa736a833a8f0f473",
"score": "0.0",
"text": "def perform_with(delegatee, *args)\n handler = delegatee.new\n raise InvalidDelegatee, \"#{delegatee} does not have a #perform method defined\" unless handler.respond_to?(:perform)\n handler.perform *args\n end",
... | [
{
"docid": "bd69fa9e9a24542cd03f07f4d1c5f865",
"score": "0.7008578",
"text": "def perform(*args)\n new(*args).call\n end",
"title": ""
},
{
"docid": "65dba056d32de9c861cc379ba7a95a1d",
"score": "0.68496054",
"text": "def run; new.run; end",
"title": ""
},
{
"d... |
38e581ba70f5c1d947489e29d0862a45 | PATCH/PUT /el_sockets/1 PATCH/PUT /el_sockets/1.json | [
{
"docid": "4b8ce747b52bc2c8a44e9515b472c017",
"score": "0.7164548",
"text": "def update\n respond_to do |format|\n if @el_socket.update(el_socket_params)\n format.html { redirect_to @el_socket, notice: 'El socket was successfully updated.' }\n format.json { render :show, status: :... | [
{
"docid": "7a77109188b574e6a88f97a6bd2188d1",
"score": "0.6443891",
"text": "def update\n @socket_gem = SocketGem.find(params[:id])\n\n respond_to do |format|\n if @socket_gem.update_attributes(params[:socket_gem])\n format.html { redirect_to @socket_gem, notice: 'Socket gem was succe... |
18e488c509d7b1f824e9fbeff6e494db | Returns "Test Acct Continue" button | [
{
"docid": "440ba2ec9467b1ec936d097eebe7375c",
"score": "0.7484411",
"text": "def paypal_test_acct_continue_button\n\t\t$tracer.trace(__method__)\n\t\t# return ToolTag.new(input.id(\"continue\"), __method__, self)\n return ToolTag.new(input.className(\"/continueButton/\"), __method__, self)\n\tend",
... | [
{
"docid": "0c3744669a591f818b76e389fb960c6e",
"score": "0.7716119",
"text": "def click_continue_button\n click_button(@continue_button_text)\n end",
"title": ""
},
{
"docid": "0c3744669a591f818b76e389fb960c6e",
"score": "0.7716119",
"text": "def click_continue_button\n click_... |
d20542906853f1b14c92d1bb4beed83a | GET /library_books/1 GET /library_books/1.json | [
{
"docid": "641f6fc4bc403985e10fbdbcdc045e27",
"score": "0.77463233",
"text": "def show\n @library_book = LibraryBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library_book }\n end\n end",
"title": ""
}
] | [
{
"docid": "a613f6e6f0318023e97fa4ad7cee0b91",
"score": "0.76484346",
"text": "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(g... |
460b4a5892735c5a9b0a04a6dfd6143f | Returns the value of attribute tags. source://cucumbermessages//lib/cucumber/messages.dtos.rb401 | [
{
"docid": "9ecb3e21eb0272cf371ebff09e2f402c",
"score": "0.0",
"text": "def tags; end",
"title": ""
}
] | [
{
"docid": "935136d8c6742e3fa0519995da1f1722",
"score": "0.7551213",
"text": "def tags\n attributes.fetch(:tags)\n end",
"title": ""
},
{
"docid": "935136d8c6742e3fa0519995da1f1722",
"score": "0.7551213",
"text": "def tags\n attributes.fetch(:tags)\n e... |
2d3f2f6291224ca401594a24c4ec21ba | GET /projects GET /projects.json | [
{
"docid": "77fff7e9aa18f251958d9fdd94bc4d0d",
"score": "0.0",
"text": "def index\n @projects = Project.page(params[:page]).per(10)\n end",
"title": ""
}
] | [
{
"docid": "dc8505687156cb859adc07f1e0435407",
"score": "0.8865399",
"text": "def projects\n return get(\"/projects/list\")\n end",
"title": ""
},
{
"docid": "e5cff083faf736771900db26645e7ffe",
"score": "0.87301385",
"text": "def get_projects\n self.class.get(\"/projects.jso... |
ee79465d3218530b6d8eb24d9f6599fd | builds a prop that is not a List or Map type PrimitiveType is one of Boolean, Double, Integer, Json, String, or Timestamp | [
{
"docid": "4836582a059df38acb7f3c7048fc977e",
"score": "0.0",
"text": "def singular_from(key, spec, substructs)\n primitive = spec['PrimitiveItemType'] || spec['PrimitiveType']\n\n if primitive\n primitive = 'Integer' if primitive == 'Long'\n const_get(:\"#{primitive}Pro... | [
{
"docid": "434a303cafa05aa5565e9b416608c891",
"score": "0.6256127",
"text": "def build_simple_property(values)\n values.collect do |value|\n case value\n when RDF::Literal::Integer\n value.to_i\n when RDF::Literal::Double\n value.to_f\n when RDF::Liter... |
914e299f818bb9f831e68ef9a39c6fc7 | Retrieve (optionally) and apply a catalog. If a catalog is passed in the options, then apply that one, otherwise retrieve it. | [
{
"docid": "2f3f95f028df0c8a9bfe1eff08b99b15",
"score": "0.7513439",
"text": "def retrieve_and_apply_catalog(options, fact_options)\n unless catalog = (options.delete(:catalog) || retrieve_catalog(fact_options))\n Puppet.err \"Could not retrieve catalog; skipping run\"\n return\n end\n\n... | [
{
"docid": "e4b19f7d5118224b8faf88941726b982",
"score": "0.66991943",
"text": "def catalog(id, options={})\n result = catalogs[id]\n if result.nil? && options[:create]\n result = Catalog.new({:server => self, :id => id}, :create => true)\n end\n result\n end",
"title": ... |
66106345c7de6b3921c4c00acb0c465b | Reject a message, indicating to the sender that is invalid and should never be delivered again to this or any other receiver. | [
{
"docid": "5105d71cf84e62fea4dbd39c8cd55faa",
"score": "0.5966748",
"text": "def reject() settle REJECTED; end",
"title": ""
}
] | [
{
"docid": "a02e156d0effca7f912ad5d91ce02275",
"score": "0.73940223",
"text": "def reject(message_id)\n end",
"title": ""
},
{
"docid": "964adf6f0390e1db3e1aaf8cea46302b",
"score": "0.7149085",
"text": "def reject!(message, cause)\n log 'message rejected:', message\n\n ... |
1779d9955615fcf76980f9be9268fb1f | Returns spots corresponding to the newly sunken ship If ambiguous, return empty array | [
{
"docid": "08de7947dfaf5e1b084ea10f41ba7bf1",
"score": "0.68025136",
"text": "def find_sunk_ship_spots(tile, destroyed_ship)\n hs = find_hit_ship_tiles(tile, [:left, :right])\n vs = find_hit_ship_tiles(tile, [:up, :down])\n if hs.size == destroyed_ship && vs.size != destroyed_ship\n ... | [
{
"docid": "51da2215945f2827c2ac3ce54c0ba471",
"score": "0.64496034",
"text": "def all_ships_are_sunk?\n shots_array = []\n shots.where(:is_hit => true).each do |shot|\n shots_array << {:x => shot.x , :y => shot.y}\n end\n\n ships_array = []\n ship_co_ordinates_in_use.each do |ship_c... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "e28e328ad28141e2c6f4b992f697619d",
"score": "0.0",
"text": "def set_practice_area\n @practice_area = PracticeArea.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "bd89022716e537628dd314fd23858181",
"score": "0.6163163",
"text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"title": ""
},
{
"docid": "3db61e749c16d53a52f73ba0492108e9",
"score": "0.6045976",
"text": "def action_hook;... |
9ba98b13d0d1df7b5e453090a9beb3eb | Returns a hash with day_of_year as keys and arrays of tweet objects as values | [
{
"docid": "834627f5f11cb9dd9a2bf2ec707d7b84",
"score": "0.68744296",
"text": "def group_tweets_by_day(tweets)\n\t\tdays = tweets.group_by{|tweet| tweet[\"date\"].yday}.sort_by{|k,v| k}\n\tend",
"title": ""
}
] | [
{
"docid": "0bc85e5620a6fbbfca4969155566123b",
"score": "0.72488695",
"text": "def tweet_day(array)\n day = {}\n array.each do |tweet|\n if day.has_key?(tweet.created_at.strftime(\"%a\"))\n day[tweet.created_at.strftime(\"%a\")] += 1\n else\n day[tweet.created_a... |
5a2f5288fabc5421d013b0760d3e9deb | I call on the method, say_hello, and give it the string "Richard" | [
{
"docid": "9d8a7849cd87294f6349db145ff480ed",
"score": "0.0",
"text": "def say_hello(name = \"Ruby Programmer\")\n puts \"Hello #{name}!\" \nend",
"title": ""
}
] | [
{
"docid": "8b40998aa991081e06a4faf58ab25750",
"score": "0.8495739",
"text": "def say_hello",
"title": ""
},
{
"docid": "da52d9c31872a16ff60b884227ac1c0d",
"score": "0.8279021",
"text": "def say_hello \n\t\"hello\"\nend",
"title": ""
},
{
"docid": "0be41d4245699a45e6335b1... |
5d9ca798894382a9ef9cdf7b40c7cf44 | Overwrite Server Initializer to add file_hash | [
{
"docid": "b79213dbd0778fbc113fbd8fcfd75a51",
"score": "0.0",
"text": "def initialize(options)\n super(options)\n @server_files = hash_files\n @routes = {}\n controller_names = read_and_load_controllers\n @controllers = create_controller_hash(controller_names)\n if File.ex... | [
{
"docid": "a56ff259f63690f6186ec4778a45861a",
"score": "0.70438594",
"text": "def initialize\n @server_files = {}\n end",
"title": ""
},
{
"docid": "948022ab5a7718b070f1d2df1dbb3338",
"score": "0.63575095",
"text": "def file_hash=(value)\n @file_hash = value\n... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "e24a94b70a1aba69022fe006dc3f036c",
"score": "0.0",
"text": "def set_invention\n @invention = Invention.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "d... |
56b1325b71f3e135b9c604a04b2f3433 | Send the selected values to model and get the data for the charts | [
{
"docid": "82e05eeb64f26068f3e319dde51446c8",
"score": "0.0",
"text": "def set_options\n\n\t\tchoices = params[:choices_str].split(\"\")\n\t\tchoices.each_with_index do |choice, index|\n\t\t\tif not choice.in?([\"A\",\"B\",\"C\",\"D\"])\n\t\t\t\tchoices[index] = choice.to_i\n\t\t\telse\n\t\t\t\tchoices... | [
{
"docid": "f6d0a83f11ea745b15624e2e1b3d5574",
"score": "0.61088353",
"text": "def get_chart_data\n chart_params\n end",
"title": ""
},
{
"docid": "2d8f5a4d7cd4bd9d53fd5cab12ed4115",
"score": "0.6062596",
"text": "def index\n \n chart_params\n \n @diaini = params[:aux... |
fb5bb511b47ed3f9aad531700569eae8 | will have its ID validates :price_paid, :numericality => true | [
{
"docid": "98ff6102ebfae2b21e94dc69ebcddbae",
"score": "0.0",
"text": "def user_id_session\n return :no_such_item\n end",
"title": ""
}
] | [
{
"docid": "b8861faba340bac0f30436c5ece21e15",
"score": "0.65261173",
"text": "def save_paid\r\n self.paid = calc_paid\r\n self.save\r\n end",
"title": ""
},
{
"docid": "fd4c7f3535492d89669835e8f401b038",
"score": "0.6260754",
"text": "def save!\n if self.price_id.blank?\... |
51d0c5e6714e0b105db9bd3d8e2813d5 | Pair Product? Define a boolean method, pair_product?, that accepts two arguments: an array of integers and a target_product (an integer). The method returns a boolean indicating whether any pair of elements in the array multiplied together equals that product. You cannot multiply an element by itself. An element on its... | [
{
"docid": "c9b97f14ec3b016d450ea2406450c13d",
"score": "0.84679914",
"text": "def pair_product?(arr, target_product)\n arr.combination(2).map {|pair| pair.reduce(:*)}.include?(target_product)\n\nend",
"title": ""
}
] | [
{
"docid": "56247bc00e51dcf2b85ba6598132401f",
"score": "0.8806622",
"text": "def pair_product?(arr, target_product)\n\nend",
"title": ""
},
{
"docid": "1a109ccba6a3daacf5080b91ecb4ecb8",
"score": "0.88057125",
"text": "def pair_product?(arr, target_product)\n arr.map do |num|\n ... |
a7a817661c0faa5c863dfc7d8fa829b2 | Returns the string representation of the object | [
{
"docid": "a408df9f3be79d7c20500741a990725c",
"score": "0.0",
"text": "def to_s\n to_hash.to_s\n end",
"title": ""
}
] | [
{
"docid": "e0c61d22481a9b8a23b7a0620c2b5f87",
"score": "0.90105623",
"text": "def to_s\n @object.to_s\n end",
"title": ""
},
{
"docid": "fc45164ab937a7dc1e465646a36f565c",
"score": "0.89507985",
"text": "def to_s\n object.to_s\n end",
"title": ""
},
{
"do... |
c159403ea09610a0f47a7dbf9958b7f8 | validate fields that should be in hash for any item object in SearchWorks Solr | [
{
"docid": "046c7afc999639a0449815095db0c425",
"score": "0.0",
"text": "def validate_item(config)\n result = validate_gdor_fields(config)\n result << \"#{druid} missing collection\\n\" unless field_present?(:collection)\n\n Array(self[:collection]).each do |collection_druid|\n resu... | [
{
"docid": "389e834b29dbfcc1fd3d0769453f041b",
"score": "0.616786",
"text": "def check_item_fields\n # Process each field for this item\n @fields.each do |field, options| \n # If manadatory make sure it exists and a value have been defined \n rc = true \n rc =... |
7cf5b42f6991df24e6c56fb5f170d5e6 | render errors with json saying status unauth | [
{
"docid": "1fce00188b1a3c8bf2c768c2aa0b005c",
"score": "0.80611974",
"text": "def render_unauthorized(message)\n errors = { errors: [detail: message ] }\n render json: errors, status: :unauthorized\n end",
"title": ""
}
] | [
{
"docid": "5a01daa2c0e632f4589dcdfaf8231062",
"score": "0.8300477",
"text": "def render_failed_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"Valid email and token must be present.\"})\n end",
"title": ""
},
{
"docid": "59c4ab280b881ab88cb089f... |
3768bb2296f298736f42d5a56d74c6e0 | List all account permission List all account permission | [
{
"docid": "48f7c46b634271a0ca411133a7dfaf82",
"score": "0.0",
"text": "def get_all_account_permission_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AccountApi.get_all_account_permission_using_get ...'\n end\n ... | [
{
"docid": "81934c9ec4557f94348fe9c079f2d4bd",
"score": "0.7732833",
"text": "def index\n @admin_account_permissions = Admin::AccountPermission.account_group_find(params).paginate(page: params[:page])\n end",
"title": ""
},
{
"docid": "13987b98ba0a50b45574199c26f3c480",
"score": "0.7... |
af630984682f1a0b5a68e6092af0d102 | Update properties of this object | [
{
"docid": "55fd5a78c781c46939e44848ef093fdf",
"score": "0.0",
"text": "def update!(**args)\n @access = args[:access] if args.key?(:access)\n @binding_explanations = args[:binding_explanations] if args.key?(:binding_explanations)\n @full_resource_name = args[:full_resource_nam... | [
{
"docid": "150fa2bdc1fc43d28ac45e2278a1f797",
"score": "0.7012263",
"text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"t... |
1280d0698675a4c2bc1e6856913837dd | GET /rss_tests/1 GET /rss_tests/1.json | [
{
"docid": "57f888f0e9d3f1ebe299635a2e260bec",
"score": "0.757505",
"text": "def show\n @rss_test = RssTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rss_test }\n end\n end",
"title": ""
}
] | [
{
"docid": "1396743edd57caac463f3c2257aaa62e",
"score": "0.7896816",
"text": "def index\n @rss_tests = RssTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rss_tests }\n end\n end",
"title": ""
},
{
"docid": "8bb41f2e8739160b... |
7d6c198dabf21bff00e752670cb1fa10 | Return boolean indicated if thread pool is running. If at least one worker thread isn't terminated, the pool is still considered running | [
{
"docid": "d9f7322818a2555c01f510b7acf7ade5",
"score": "0.7433077",
"text": "def running?\n !terminate && (@timeout.nil? || (!@timeout_thread.nil? && @timeout_thread.status)) &&\n @job_runners.all? { |r| r.running? }\n end",
"title": ""
}
] | [
{
"docid": "4fdbfd91528acd24d9cf463b615680da",
"score": "0.8230854",
"text": "def started?\n @thread_pool&.running?\n end",
"title": ""
},
{
"docid": "4fdbfd91528acd24d9cf463b615680da",
"score": "0.8230854",
"text": "def started?\n @thread_pool&.running?\n ... |
c6721f3bd58494c955ed57bd1b0ea77b | publish sends messages to a BigQuery table immediately | [
{
"docid": "5192d6077e0c1fe7b03f2c3a005d7b9a",
"score": "0.740809",
"text": "def publish(messages)\n begin\n return if messages.nil? || messages.empty?\n\n table = get_table_name\n @logger.info(\"Publishing #{messages.length} messages to #{table}\")\n\n create_table_if_not_exists ... | [
{
"docid": "4ca1122ff9fc2bb4b8348b43526366bb",
"score": "0.6490805",
"text": "def pubsub_create_bigquery_subscription project_id:, topic_id:, subscription_id:, bigquery_table_id:\n pubsub = Google::Cloud::Pubsub.new project_id: project_id\n topic = pubsub.topic topic_id\n subscription = topic.subscri... |
e14740e712a67cb2f43a44bdb80e9194 | Takes a base64encoded, tarred string | [
{
"docid": "feffacaa1937e29b1e684347be1199ba",
"score": "0.0",
"text": "def initialize encoded\n tar = Base64.decode64(encoded)\n @files = {}\n Minitar::Reader.new(StringIO.new(tar)).each do |entry|\n next unless entry.file?\n @files[entry.full_name] = entry.read\n end\n end",
... | [
{
"docid": "8750a0870d213101cca93e909b5162ee",
"score": "0.8216274",
"text": "def base64(str); end",
"title": ""
},
{
"docid": "8750a0870d213101cca93e909b5162ee",
"score": "0.8216274",
"text": "def base64(str); end",
"title": ""
},
{
"docid": "48de0cab76bce6f86baf5d62e5d7... |
1ed9bdbc928387681c9cdcd4d52462fa | DELETE /register_executions/1 DELETE /register_executions/1.json | [
{
"docid": "d8f1a05492589a3ce933581db73b5514",
"score": "0.5782601",
"text": "def destroy\n @analysis_execution.destroy\n respond_to do |format|\n format.html { redirect_to analysis_executions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] | [
{
"docid": "aaffbf4d2cc1113e27e91c14f98c6adf",
"score": "0.64545625",
"text": "def delete!\n url = \"#{Rails.configuration.waste_exemplar_services_url}/registrations/#{uuid}.json\"\n Rails.logger.debug \"Registration: about to DELETE\"\n deleted = true\n begin\n response = RestClient.de... |
5b5a1eaf4a329a9c6832de41b1f2206d | TODO: automatically figure this out | [
{
"docid": "9d80b0b583c5aa8c8181861c86e27e16",
"score": "0.0",
"text": "def creator\n \"Pat Allan\"\n end",
"title": ""
}
] | [
{
"docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1",
"score": "0.744697",
"text": "def private; end",
"title": ""
},
{
"docid": "0b8b7b9666e4ed32bfd448198778e4e9",
"score": "0.6633029",
"text": "def probers; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
... |
1a661da53ced61c81f5e8a816950453d | Use Faraday to connect to the collection's JSON API | [
{
"docid": "a53c37f3051e6251fe83bed660158193",
"score": "0.6090455",
"text": "def endpoint_connection\n @endpoint_connection ||= Faraday.new(url: endpoint_url) do |faraday|\n faraday.adapter :net_http\n end\n end",
"title": ""
}
] | [
{
"docid": "84ebcfdf730b55abc0407d7baaed8d74",
"score": "0.7234193",
"text": "def connection\n @connection ||= Faraday.new(api_endpoint) do |http|\n http.headers[:accept] = \"application/json, */*\"\n http.headers[:user_agent] = user_agent\n\n http.request :authorizatio... |
abdb96e6f47995cf6ce5f2da77d6c933 | Generate a matcher that expects to equal the given +html+. | [
{
"docid": "12cf5d0b140b8280903d1c8038965967",
"score": "0.6731209",
"text": "def be_transformed_into( html )\n return TartanCloth::Matchers::TransformMatcher.new( html )\n end",
"title": ""
}
] | [
{
"docid": "b20ca44ec7c6aa66833cdb49caa75bdd",
"score": "0.69031197",
"text": "def be_the_same_html_as(expected)\n BeTheSameHtmlAs.new(expected)\n end",
"title": ""
},
{
"docid": "47f0c921e5418863aebd22f02e87676c",
"score": "0.6573339",
"text": "def test_html\n assert_instance... |
65e0805dede5d4a1bc0c8da76ef3975f | Creates a new contact object | [
{
"docid": "5a85e525c01ff55e5d35782765715b4b",
"score": "0.0",
"text": "def initialize(id, name, email, phone_number)\n # TODO: Assign parameter values to instance variables.\n @id = id\n @name = name\n @email = email\n @phone_number = phone_number\n end",
"title": ""
}
] | [
{
"docid": "aa6179f387359da7d4c7491a88430de3",
"score": "0.8122467",
"text": "def create_contact()\n Contact.new(id: rand(2000)).tap do |c|\n contacts << c\n end\n end",
"title": ""
},
{
"docid": "fd25c33edb1dc3ff9cab5e94f3dd68a2",
"score": "0.7880839",
"text": "d... |
10d48b2909e4bebb1441899b39f732d6 | Create a new dataset, if the decay factor is too big the flt ruby library is used for internal computations to allow greater precision, the performance impact should be minimal. | [
{
"docid": "3c0538097516e96fb84477cbd8e86384",
"score": "0.42229658",
"text": "def initialize(id, reservoir_size, alpha)\n @id = id\n @values = Drone::request_hash(\"#{@id}:values\")\n @count = Drone::request_number(\"#{@id}:count\", 0)\n @start_time = Drone::request_number(\"#{@id}:... | [
{
"docid": "f2585052c44657155513570fdc2d9846",
"score": "0.5149174",
"text": "def prepare_data(num_rows)\n app_train = read_dataset_from_csv('./input/application_train', num_rows)\n data = app_train[\"data\"]\n set_categorical_labels(data)\n numeric_features, _categorical_features = get_numeric_cate... |
9a343beb9346bb62599c3bf57b5b595f | Deletes the star record if it exists. | [
{
"docid": "1f13579f738e7edd7d2ee720f74eaf3f",
"score": "0.0",
"text": "def unstar(starable)\n if star = get_star_from(starable)\n star.destroy\n end\n end",
"title": ""
}
] | [
{
"docid": "d5160143440daef9f71eeb6c307fbc00",
"score": "0.6725125",
"text": "def delete\n @table.delete @record\n end",
"title": ""
},
{
"docid": "fe03f3f869acf986ecfcb64d1c018942",
"score": "0.66648793",
"text": "def destroy\n @star = Star.find(params[:id])\n @star.... |
ea72b095492ad3c87f0fb81f453c64e4 | The sequential record_id field is not a fixed name. Get the first field from the data dictionary | [
{
"docid": "f817ab2c96a828c9b0f783081a7d5848",
"score": "0.79538083",
"text": "def record_id_field\n all_fields.keys.first\n end",
"title": ""
}
] | [
{
"docid": "52b2131f375cd2f81a10a48e7041c39b",
"score": "0.7814805",
"text": "def record_id_field\n data_dictionary.record_id_field\n end",
"title": ""
},
{
"docid": "8d9a6aa05457b0e056a56249f41abbad",
"score": "0.74806184",
"text": "def record_id\n rec_metadata[:id]\n en... |
9e1cf2d2a79eb773e629d14c448f89ee | Public: Determines if the VM exists or not. This method looks for the VM's conf file ('.vmx') to determine if the VM exists or not. Examples | [
{
"docid": "cad943cc60610cddebe2cff91aaac1ea",
"score": "0.58102995",
"text": "def exists?\n conf_file.successful?\n end",
"title": ""
}
] | [
{
"docid": "684b94e2f65b09d81b97589e318d79eb",
"score": "0.7622194",
"text": "def exists?\n File.exists? vmx_path\n end",
"title": ""
},
{
"docid": "4e0419d8b2ec8900a31c26bc5e14e23b",
"score": "0.754773",
"text": "def check_fusion_vm_exists(options)\n set_vmrun_bin(options)\... |
92d5d4e5dcc8c0ef28513dc69ca602d9 | below are methods pertaining to the "rotate" notion where you may want to look at the same tree data organized another way FIXME: remove baked in underscore separator in field name | [
{
"docid": "942283c9037471b71bea1d8dbf60919c",
"score": "0.0",
"text": "def is_hierarchical?(field_name)\n (prefix,order) = field_name.split(/_/, 2)\n list = blacklight_config.facet_display[:hierarchy][prefix] and list.include?(order)\n end",
"title": ""
}
] | [
{
"docid": "2d25017ec9586ab19016a6858e93d3fd",
"score": "0.6107726",
"text": "def transform_data(tree)\n data = {}\n last_level = 0\n path = []\n # root -> left -> right\n tree.traverse_preorder do |level, node|\n d = node.leaf? ? leaf_info(node) : directory_info(node)\n\n if le... |
b103b449556353d65a3da8c050457f86 | Try to acquire a lock using SQL UPDATE. Returns true if successfully acquired. | [
{
"docid": "814102cad56331baa540707a83016964",
"score": "0.73466307",
"text": "def acquire_lock\n\t\t@@logger.info { \"Acquiring a lock in the database.\" } if have_logger?\n\t\tTournament.dataset.filter(:id => self.id, :locked => false).update(:locked => true) != 0\n\tend",
"title": ""
}
] | [
{
"docid": "83f75b7a013a464f945e8b35f02693ee",
"score": "0.73523533",
"text": "def acquire_lock(lock_name)\n begin\n acquired = false\n sql = lock_query(lock_name)\n connection.query(sql) do |result|\n acquired = result.fetch_row.first == \"1\"\n end\n ac... |
5446512cef82ac23171d624cb4e9ee55 | POST /exercises POST /exercises.json | [
{
"docid": "d3c1ef3767dd5a4b6ae21242972e89dc",
"score": "0.70962274",
"text": "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, :notice => 'exercise was successfully created.' }\n forma... | [
{
"docid": "d34f7fa06b4bf364069154fdf002ac26",
"score": "0.7109185",
"text": "def create\n @api_v1_exercise = Api::V1::Exercise.new(api_v1_exercise_params)\n\n respond_to do |format|\n if @api_v1_exercise.save\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successf... |
8c9f8045a8695cf7637f314aa91c49e7 | This is a great question for interview prep, so let's not google it. Instead, try whiteboarding, and thinking of your approach before coding. There are multiple approaches to this question, so try to think of the most efficient one you can! Write a method that will take a string as an argument. The method will check th... | [
{
"docid": "c2199fa79875137aad7344846a208b47",
"score": "0.8192611",
"text": "def exes_and_ohs(str)\n arr = str.downcase.split(\"\")\n\n count_o = 0\n count_x = 0\n \n arr.each do |i|\n if i == \"o\"\n count_o += 1\n elsif\n i == \"x\"\n coun... | [
{
"docid": "adf4c355346c15af25ec0654cde741e5",
"score": "0.8513731",
"text": "def ex_oh(str)\n str.downcase.scan(/x/).count == str.downcase.scan(/o/).count\nend",
"title": ""
},
{
"docid": "acfb283dfcddfb689519939527c4f1eb",
"score": "0.84668297",
"text": "def XO(str)\n str.downcas... |
80b425160aac95fed11d2613853e693f | make cell lists, each of which should contain unique numbers in a solved grid | [
{
"docid": "8a9197dab031e6ec86ff948ec9c63cf7",
"score": "0.630679",
"text": "def make_cell_lists\n @cellLists = []\n add_row_cell_lists\n add_column_cell_lists\n add_block_cell_lists\n end",
"title": ""
}
] | [
{
"docid": "add27b67f7785250a8089d3cade909e9",
"score": "0.73106915",
"text": "def unique_cells; end",
"title": ""
},
{
"docid": "30d2b6f185a5207327c5f519a60590da",
"score": "0.6954772",
"text": "def solution_grid\n\t\t\t\tArray.new(1) { Array.new(1) { Array.new(4) { Cell.new} } }\n\... |
7bb15a400a99eb5e1983c94ddef8c65d | produce multiple XML elements with text specified as hash also produce multiple XML elements with attributes lowlevel function Usage: ov.xml_mix() | [
{
"docid": "83e473db222c4d45e7d7f8a7682d71f0",
"score": "0.6415845",
"text": "def xml_mix(name, child, attr, elem)\n\t\t\txml = REXML::Element.new(name)\n\t\t\tchild.keys.each do |k|\n\t\t\t\txml.add_element(k)\n\t\t\t\txml.elements[k].text = child[k]\n\t\t\tend\n\t\t\telem.keys.each do |k|\n\t\t\t\txml... | [
{
"docid": "57d818c52b2ed097bd73333728beb365",
"score": "0.61492026",
"text": "def buildTags(xml, tags, hash)\n tags.each do |t|\n text = hash[t]\n xml.method_missing t, text if text\n end\n end",
"title": ""
},
{
"docid": "f029a310e0c30b7b820bfc4729fb4723",
"score": "0.... |
ecd9b30dcd92722ef6ea9749eefc5c9b | Returns the full name of a patient. | [
{
"docid": "5854335c9af1eb0d3a79f18902d2bb0e",
"score": "0.8179544",
"text": "def full_name(patient)\n return unless patient\n\n if patient.family_name.blank? && patient.animal_type.present?\n return [patient.given_name,\n patient.middle_name,\n \"(#{animal_species_n... | [
{
"docid": "acfe4d6a5811a8c69c5e4b4138324911",
"score": "0.821073",
"text": "def name\n name = PersonName.where(person_id: patient.id)\\\n .order(:date_created)\\\n .first\n\n given_name = na\n\n \"#{name.given_name} #{name.family_name}\"\n e... |
a51f4e290268729f508af0c8a8d03c89 | Delete a record by its primary key from data | [
{
"docid": "1d58a58b12a057b261ae4f8675774c74",
"score": "0.6959314",
"text": "def delete_by_primary_key(primary_key)\n query = \"DELETE FROM `#{@table_name}` WHERE \"+build_where({@primary_key => primary_key})\n\n begin\n queryresult = @mysql.query(query)\n rescue Exception => e\n ... | [
{
"docid": "7fd70428740c70438e41ee46874b7099",
"score": "0.7575023",
"text": "def delete_record *rid\n db.delete_record rid\n end",
"title": ""
},
{
"docid": "18eabf26b1c7709e81b9725921afe154",
"score": "0.7436668",
"text": "def delete record\n db_name = database_name_fo... |
4f1fb28f10ffb322ba46b674c2ee69c5 | checks to see if a value has been set for the `version_limit` config option, and if so enforces it | [
{
"docid": "ef7f3ed694800d8386b560301775bd7c",
"score": "0.64490634",
"text": "def enforce_version_limit!\n return unless PaperTrail.config.version_limit.is_a? Numeric\n previous_versions = sibling_versions.not_creates\n return unless previous_versions.size > PaperTrail.config.version_lim... | [
{
"docid": "29bddc2d5928a9de0f7ea55ca10d9ca6",
"score": "0.6416929",
"text": "def should_be_limited?\n options[:limit] || (options[:limit].is_a?(Integer) && options[:limit].positive?)\n end",
"title": ""
},
{
"docid": "b957778c4afefe165b532e652af57afa",
"score": "0.6368169",
... |
fbb63d75adc098dc19d607c454e2498c | Adds framing output to the given parent. | [
{
"docid": "56ebc6f1e27ad2a443d21412c8730854",
"score": "0.6863033",
"text": "def add_frame_output(state, parent, property, output)\n if parent.is_a?(Hash)\n debug(\"frame\") { \"add for property #{property.inspect}: #{output.inspect}\"}\n parent[property] ||= []\n parent[prope... | [
{
"docid": "a3a6ceb2b6cd027957912d6a4029a4ba",
"score": "0.69752634",
"text": "def add_frame_output(parent, property, output)\n if parent.is_a?(Hash)\n parent[property] ||= []\n parent[property] << output\n else\n parent << output\n end\n end",
"title": ""
},... |
f8c91e60325cb647d59a3ca35bccd507 | Create the singleton getter method to retrieve the tag separator for a given context for all instances of the model. | [
{
"docid": "a7dff2bb9beeaef4897fddf6f9bad7e4",
"score": "0.8268314",
"text": "def define_class_separator_getter(context)\n self.class.class_eval do\n define_method :\"#{context}_separator\" do\n get_tag_separator_for(context)\n end\n end\n end",
"title": ""
}
] | [
{
"docid": "5f1d37be0a60696da5e453a4a4f79569",
"score": "0.8289144",
"text": "def define_class_separator_getter(context)\n self.class.class_eval do\n define_method :\"#{context}_separator\" do\n tag_contexts[context].separator\n end\n end\n end",
"title": ""
},
... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "808d812bbf9896b5b45a1109ffedd8cd",
"score": "0.0",
"text": "def set_provider\n @provider = Provider.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "d... |
56b5c89fa00921603767f24c8e368c08 | The encoding of the values when the type is not `STRING`. | [
{
"docid": "3c85095e361d827bcf7c7b15284aaa83",
"score": "0.0",
"text": "def encoding\n @gapi.encoding\n end",
"title": ""
}
] | [
{
"docid": "e2938098fdd1ace1aa1a13410f56e2b3",
"score": "0.7488941",
"text": "def value_encoding_from_string(str); end",
"title": ""
},
{
"docid": "6c62b5c5011d9a2516d915fafa94285e",
"score": "0.7214447",
"text": "def encoding\n attributes[:encoding]\n end",
"title": ""
... |
c0ad316bb9b9f2e21b860a586eb74274 | Initializes a Grid object. | [
{
"docid": "fc065828e761ea6c6f1dff6cbf34d4a2",
"score": "0.0",
"text": "def initialize\n @shows = []\n end",
"title": ""
}
] | [
{
"docid": "3d3d7ee0154ff5b7c6f989c0cdb5cf23",
"score": "0.81725496",
"text": "def initialize(grid)\n @grid = grid\n end",
"title": ""
},
{
"docid": "80305836de7df0afb72bf4965b6dc9f4",
"score": "0.79613096",
"text": "def initialize(grid: default_grid)\n @grid = grid\n e... |
4cb93d045a3dbc77c40993849e58267a | TODO: see if can match widths for edit/view content of posts across tinymce and user display TODO: add last updated timestamp with proper html5 markup to blog posts TODO: increase default size of dialog upload box TODO: look into video embed TODO: get better favicon TODO: make vector/gimp layer version of logo for infi... | [
{
"docid": "66bee70e0139e92067d3699ede5bc175",
"score": "0.0",
"text": "def authenticate\n unless logged_in?\n #unauthorized access\n redirect_to root_path, :notice => 'Please login before doing that.'\n end\n end",
"title": ""
}
] | [
{
"docid": "ddc1434583022f0222e8e87f399dee6e",
"score": "0.57588935",
"text": "def layout\n # number of columns = the most we can fit on one row, or 1 if that is \n # too small\n contentWindow.numColumns = [width/Photo::THUMB_SIZE,1].max\n super\n end",
"title": ""
},
{
"docid":... |
a599e46f8e1cf68cff8835c4807a3b1a | create applications in all states and set the created_at: and updated_at dates to create_date default create_date = Time.zone.now | [
{
"docid": "cb485073c7917d0af9331fdef765d0f3",
"score": "0.7496882",
"text": "def create_apps_in_states(create_date: Time.current)\n\n NUM_APPS_IN_STATE.each_pair do |state, number|\n create_shf_apps_in_state(number, state, create_date: create_date)\n end\n\n end",
"title": ""
}
] | [
{
"docid": "acacd0d0171d5c1a5acd6558035921f9",
"score": "0.67802423",
"text": "def create_shf_apps_in_state(num, state, create_date: Time.current)\n shf_apps = []\n\n num.times do\n shf_apps << create(:shf_application, state: state, created_at: create_date,\n updated_a... |
c2dc7019e8b9925d0838fbc1a353ff98 | [BETA] Find nonposted vouchers. | [
{
"docid": "c0b7248be515d6981ca71ccfc346ecc9",
"score": "0.0",
"text": "def non_posted_with_http_info(include_non_approved, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LedgervoucherApi.non_posted ...\"\n end\n # verify the required ... | [
{
"docid": "8b7f0a9c5641ddce5830776dbc9322cd",
"score": "0.6195597",
"text": "def index\n @gift_vouchers = current_user.gift_vouchers.not_claimed\n end",
"title": ""
},
{
"docid": "65e9ea6dea4953d8e8d5cf42bac39b6f",
"score": "0.61915946",
"text": "def unapproved_reviews\n revi... |
938d5c828b7d67a6589db1a0a64dbb0f | clear SMS fields if requested | [
{
"docid": "5d9fdf33ae4d0f74e88f582b6d30c5b7",
"score": "0.8240544",
"text": "def clear_sms_fields_if_requested\n if clear_twilio == \"1\"\n self.twilio_phone_number = nil\n self.twilio_account_sid = nil\n self.twilio_auth_token = nil\n self.twilio_auth_token1 = nil\n end\n ... | [
{
"docid": "03b7c7e503d8e1cfa595e9780df6a36e",
"score": "0.66473264",
"text": "def clear_client_data\n self.phone = self.phone_normalized = self.email = self.name = nil\n end",
"title": ""
},
{
"docid": "65e29abe9c22a4d51fa7e52e9c554c3c",
"score": "0.658037",
"text": "def clear_s... |
1f9e3e287a8902dfcb5af91577b08448 | Takes an optional convention and returns a string suitable as a variable name in the convention. The support conventions are: snake_case (default) tallsnakecase CamelCase lowerCamelCase Any text between parans is removed. Any nonalphanumberic is removed. | [
{
"docid": "91134fdc360bf2e2e4a5c1041ddcd49d",
"score": "0.7316825",
"text": "def variablize(convention = 'snake_case')\n unless convention.valid_naming_convention?\n error \"Invalid naming convention: #{convention}; supported: #{VALID_NAMING_CONVENTIONS.join(', ')}\"\n return n... | [
{
"docid": "f3e2bc3700c0c8c91c5d565e8fcac99b",
"score": "0.67078286",
"text": "def variable_name_of(a_string, convention = :snake_case)\n unless String == a_string.class\n unless a_string.respond_to?(:to_s)\n raise ArgumentError, \"Expected a string; got #{a_string.class}\"\n else\n a_s... |
a5fe838b1b4036caedcd71fab56683c1 | GET /sequoia_customers GET /sequoia_customers.json | [
{
"docid": "c19ef187abf03f0aeb27edaf711bfb92",
"score": "0.0",
"text": "def index\n if params[:product]\n @sequoia_customers = SequoiaCustomer.where('product LIKE ?', \"%#{params[:product]}%\")\n else\n @sequoia_customers = SequoiaCustomer.order(:purchase_date => :desc).first(75)\n en... | [
{
"docid": "44d5c99d89ab374d2baf04ebcdda12b5",
"score": "0.7764741",
"text": "def getcustsjson\n render :json => @customers\n end",
"title": ""
},
{
"docid": "e9c7651d1891953067719cb341ff5ccb",
"score": "0.7752199",
"text": "def index\n @customers = Customer.all\n\n render ... |
81f1ebf08e21b3ea074868f44d1156df | PATCHes data to the API via the Cropster::Client | [
{
"docid": "d32eeb2786beeb7d69cb4777abc3b659",
"score": "0.0",
"text": "def update(object_url, id, data)\n response = patch(\"/#{object_url}/#{id}\", data)\n handle_error(response)\n process(response)\n end",
"title": ""
}
] | [
{
"docid": "a9a7bf63fffdaf43ed4c76593ebe2674",
"score": "0.70921266",
"text": "def patch(url, data, options={})\n default_client.patch(url, data, options)\n end",
"title": ""
},
{
"docid": "05c1bed948daa058e70016e863c7cd96",
"score": "0.6985142",
"text": "def update_request(d... |
d0848cee9ea416dfbd5b07103b6fd1ec | get every test to pass before coding runner below | [
{
"docid": "e1e97430455e198a14e711f879a87be9",
"score": "0.0",
"text": "def runner\n\n welcome\n counter = initial_round\n \n until counter > 21 do\n counter = hit?(counter)\n display_card_total(counter)\nend\nend_game(counter) \nend",
"title": ""
}
] | [
{
"docid": "5026efbc525d65125229c5ec4866d886",
"score": "0.7274132",
"text": "def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do ... |
3db70fc8b1ee4900edf24c44cbca871b | Add a new swagger response header | [
{
"docid": "7aaa26bfa05fd156b0d762a8452ab61b",
"score": "0.8288922",
"text": "def add_response_header(name, type, description)\n name = name.to_s\n check_duplicate(name, 'Response header')\n @response_headers[name] = SwaggerResponseHeader.new(name, type, description)\n ... | [
{
"docid": "26588b231630360edf8fd96ad29c9b61",
"score": "0.702932",
"text": "def set_header name, value\n response_object.header name, value\n end",
"title": ""
},
{
"docid": "1a22640ad4f2799a55545b062243fafb",
"score": "0.6890965",
"text": "def fill_header(response); end",
"... |
8c2af07abcb926cc00cb4c8699699261 | Show offert prices GET /projects/:project_id/subprojects/:subproject_id/subsubprojects/:subsubprojects_id/offerte | [
{
"docid": "2132384a430181923e420c9471ba1f1c",
"score": "0.6243222",
"text": "def offerte\n @subsubproject = Subsubproject.find(params[:subsubproject_id])\n @subproject = @subsubproject.subproject\n @project = @subproject.project\n @grobengineerings = Grobengineering.where(:subsubproject_id ... | [
{
"docid": "9f818fd12dc107c8c1b4e434434b0d28",
"score": "0.59999967",
"text": "def show\n @project = Project.find(params[:project_id])\n @labour_estimate = @project.labour_estimates.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json... |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "632efdf7deaa19eccee31462c434454d",
"score": "0.0",
"text": "def qa_setting_params\n params.require(:qa_setting).permit(:name, :setting_id, :team_id, :description, :out_of, :qa, :position)\n end",
"title": ""
}
] | [
{
"docid": "e164094e79744552ae1c53246ce8a56c",
"score": "0.69792545",
"text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e662f0574b56baff056c6fc4d8aa1f47",
"score": "0.6781151",
"text": "def strong_params\n params.requ... |
8844db07509109bbeb0b5fe4bdbd153c | GET /v1/year_amount_summary params: year | [
{
"docid": "f04b600a978acbe2b3b49e4df177350b",
"score": "0.81124383",
"text": "def year_amount_summary\n render json: Year.year_amount_summary(params[:year]), each_serializer: YearsAmountSummarySerializer, :callback => params[:callback]\n end",
"title": ""
}
] | [
{
"docid": "f5d394a348e8536221dd00fb482800cb",
"score": "0.6397139",
"text": "def getStatsEntityBy_year( entity_id, year)\n params = Hash.new\n params['entity_id'] = entity_id\n params['year'] = year\n return doCurl(\"get\",\"/stats/entity/by_year\",params)\n end",
"title": ""
},
{
... |
9af9e00d42a61f827de5de74018407d5 | Formats values for issue status | [
{
"docid": "7b559118f7fc99f6c26a88bdcdf9036a",
"score": "0.56145996",
"text": "def print_status(status)\n color = :green if %w(Fixed Closed).include? status\n color = :yellow if %w(Open Reopened).include? status\n color = :yellow if status == 'In Progress'\n set_color... | [
{
"docid": "0fc6fae6b71305322582f47f0951fee6",
"score": "0.6701027",
"text": "def status\n if @issue_deleted == false\n color=status_color(@issue.status)\n {\n value: @issue.status.name,\n color: color\n }\n else\n {\n value: l(:label_deleted).capital... |
4950b8e690e8c336367a809b0869ba93 | DISPLAY Draws the player tile on the map based on the tile index view | [
{
"docid": "3572889b758c8ed83b364411a3f89610",
"score": "0.62473106",
"text": "def display_player(index_x, index_y)\n x = @data[\"player_x\"] - get_camera_range(\"x\", \"down\")\n y = @data[\"player_y\"] - get_camera_range(\"y\", \"down\")\n\n\n if x == index_x && y == index_y\n ... | [
{
"docid": "76248b7570f7311148f66dda006f78bd",
"score": "0.7016381",
"text": "def draw\r\n\r\n # Attach the camera location to the player\r\n @player.draw(@camera_x, @camera_y,1)\r\n\r\n # Cycle thru each map level...\r\n for l in 0...@level.size\r\n\r\n # ... and ... |
990137f38e64aa79a5e6e21783c44e68 | ActiveSupportpresent? and other related protocols depend on this semantically indicating the number of results from the query | [
{
"docid": "ad933dd1f92b20c8e1668cb31d42b465",
"score": "0.0",
"text": "def empty?\n total_count == 0\n end",
"title": ""
}
] | [
{
"docid": "79fa78f61e103a4d61478156cc37bfc2",
"score": "0.70812315",
"text": "def more_results?()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "c0a4d2ac190a1d325bb968fc84c23299",
"score": "0.68472254",
"text": "def pagination_needed?\n ... |
c3c0c1375d3ade6060a90c071dfe2f93 | plain_texts_path end def new_text_path new_plain_text_path end | [
{
"docid": "fd456ed797163c570712a8e89f7a3e20",
"score": "0.0",
"text": "def register user, password\n visit '/signup'\n fill_in 'Name', :with => user\n fill_in 'Password', :with => password\n fill_in 'Confirm Password', :with => password\n click_button 'Connect'\nend",
"title": ""
}
] | [
{
"docid": "4fff9892adb65456eb42ae27cdb79f46",
"score": "0.6869084",
"text": "def new_text; end",
"title": ""
},
{
"docid": "4fff9892adb65456eb42ae27cdb79f46",
"score": "0.6869084",
"text": "def new_text; end",
"title": ""
},
{
"docid": "4fff9892adb65456eb42ae27cdb79f46",... |
0cd45ff018efb24c0ff33234a8514a79 | Convert a string representation of a unit into an array of terms | [
{
"docid": "3ecfe7604c99841a19e454488c526220",
"score": "0.0",
"text": "def decompose(expression)\n Decomposer.parse(expression)\n end",
"title": ""
}
] | [
{
"docid": "7ed70388dcb1658c9dcc9f79d8fa823a",
"score": "0.6292385",
"text": "def word_to_array(word)\n word.downcase.scan /[a-pr-z]|qu/\n end",
"title": ""
},
{
"docid": "bf02beb4cd94fd4255e23bbc1da50e74",
"score": "0.62525743",
"text": "def word_to_array(word)\n word.d... |
13f2d0aea6632f765d1ebe20688e9b62 | if post is over 30 days old, produces this format: Thursday 25 May 2006 1:08 PM | [
{
"docid": "a9b1a38a212376edcb785a1ec9b55403",
"score": "0.6551084",
"text": "def nice_date(date)\n dt = DateTime.new(date.year, date.month, date.mday)\n diff = DateTime.now - dt\n if diff.to_i > 30\n h date.strftime(\"%A %d %B %Y - %H:%M %p\")\n else\n return time_ago_in_words(date)+\... | [
{
"docid": "83bf1e69cb84ad8e65f0ca2c7c1a56ce",
"score": "0.6647225",
"text": "def updated_on(post)\n title = post[:title].gsub(\" \", \"\")\n # so that we don't have two posts on the same date :D\n minutes = title[0].chr.downcase[0] - 87\n seconds = title[1].chr.downcase[0] -... |
bcfa540a6786ecad4b72bd2557645253 | Add to or remove tag values from the filter. | [
{
"docid": "9f1dd610f85c16990e6b056253536847",
"score": "0.0",
"text": "def process_filter\n # Create the session variable if necessary.\n unless session.has_key?(:filter)\n session[:filter] = Array.new\n end\n\n start_size = session[:filter].length\n \n # Adding to the filter?\n ... | [
{
"docid": "e034befbd327c01eb0c4cce4ab13455a",
"score": "0.65148705",
"text": "def add_filter_taggings\n filter = self.canonical? ? self : self.merger\n if filter\n Work.with_any_tags([self, filter]).each do |work|\n work.filter_taggings.find_or_create_by_filter_id(filter.id)\n en... |
738df1b13703ee7ecc8be10d754bc8f7 | Continue with current order as guest | [
{
"docid": "6037b9b096a0ccd0212c65fa79f52198",
"score": "0.65463316",
"text": "def guest\n @quote.customer_is_guest = true\n @user = User.new\n\n respond_to do |format|\n\n if @quote.update(quote_params)\n format.html { redirect_to after_checkout_login_path }\n f... | [
{
"docid": "c1b268352264a6a09afedc20c9b08f5a",
"score": "0.67697805",
"text": "def start_guest_checkout\n add_mug_to_cart\n restart_checkout\n fill_in 'order_email', with: 'guest@example.com'\n click_button 'Continue' # On registration page\n expect(current_path).to match(/(checkout|addre... |
ba2fb15da69b431b829782678affe75f | POST /answers POST /answers.json | [
{
"docid": "700c8983eab7ff4392ac9d7a8d5f35cd",
"score": "0.6876082",
"text": "def create\n @answer = @question.answers.new(answer_params)\n if @answer.save\n redirect_to @answer.question\n else\n render plain: 'Error save'\n end\n end",
"title": ""
}
] | [
{
"docid": "1354a38154203916165c2441565c995f",
"score": "0.74338484",
"text": "def create\n @answer = Answer.new(params[:answer])\n\n if @answer.save\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n en... |
3cc8c6bbe9829707a120087bb6c125ae | input: integer output: star diamond rules: method that displays a 4pointed diamond in n x n grid n is an odd integer supplied in an argument to the method assume argument will always to be an odd integer algorithm: create a method to iterate through numbers create another method to print out the diamond shape print out... | [
{
"docid": "ce4f0b0ee7159b613a25e06f1610fe24",
"score": "0.71142215",
"text": "def diamonds(num)\n diamond = \"*\"\n 1.upto(num-1) do |count|\n puts (diamond * count).center(num) if count.odd? \n end\n (num).downto(0) do |number|\n puts (diamond * number).center(num) if number.odd?\n end\nend"... | [
{
"docid": "8cb0da93d3ea544833d9aef65a891866",
"score": "0.80931836",
"text": "def diamond(n) # where n is an odd integer\n halfway = n / 2 + 1\n diamonds = {}\n spaces = {}\n # Using math to build number of diamonds and spaces for half the lines\n 1.upto(halfway) do |num|\n diamonds[num] = 2*nu... |