query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
f3d61c7c021041f52d81ab2a68f1d9da
code snippet 1, normal function
[ { "docid": "c5e68d54d75752d4297fa376cf49d10f", "score": "0.0", "text": "def say_goodnight(name)\n\tresult = \"Good night, \"+name\n\treturn result\nend", "title": "" } ]
[ { "docid": "792be6eadacebdee265be975baeda2c7", "score": "0.7214509", "text": "def function; end", "title": "" }, { "docid": "b6b2bcc0062aeb115edab7b10cbe6930", "score": "0.69081205", "text": "def desired; end", "title": "" }, { "docid": "c66f3477911241684923f50f19928246",...
f3921b4875512e4d06f7896cecc7e75e
New Method : Clear TSBS
[ { "docid": "706acf0068cb7dc6d82821847d0087dd", "score": "0.0", "text": "def clear_tsbs\n super\n @ori_x = 0\n @ori_y = 0\n end", "title": "" } ]
[ { "docid": "9cd9e70975caf7b97171700d904d74e0", "score": "0.69894767", "text": "def clear; end", "title": "" }, { "docid": "9cd9e70975caf7b97171700d904d74e0", "score": "0.69894767", "text": "def clear; end", "title": "" }, { "docid": "9cd9e70975caf7b97171700d904d74e0", ...
9b845a41b1bf8f3baa84277dad05a856
puts get_phrase 'd' Make a method to generate the cipher alphabet for the encryption algorithm. This method should take a key as input and return back the list of letters in the alphabet offset by that key. (More info on the cipher alphabet in the assignment instructions.)
[ { "docid": "a95f704a66071a6819ad601937f576fe", "score": "0.71197176", "text": "def get_cipher_bet key\n alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".split('')\n cipherbet = []\n # Get the letters from the key to the end of the alphabet and add to cipherbet\n counter = key\n while counter < a...
[ { "docid": "427881de2650df4f5784ab2edd2b1093", "score": "0.80096763", "text": "def build_keyphrase_cipher_alphabet(plaintext_alphabet, keyphrase) \r\n # Copy the plaintext alphabet to a new cipher alphabet\r\n cipher_alphabet = Array.new\r\n plaintext_alphabet.each do |current_letter|\r\n cipher_a...
6cf50031dbe25cdb96db2fb44c0efda4
Give it 2GB of RAM so I can run all the things
[ { "docid": "021ad57af68b161d16b24f3db12e5893", "score": "0.0", "text": "def config_my_puppet(config)\n config.vm.provision :puppet do |puppet|\n puppet.manifests_path = \"~/Projects/puppet/manifests\"\n puppet.manifest_file = \"govuk_dev.pp\"\n puppet.module_path = \"~/Projects/puppet/modules\...
[ { "docid": "9bea815400e77f7d29f3829bedc32e03", "score": "0.6454632", "text": "def memos; end", "title": "" }, { "docid": "9bea815400e77f7d29f3829bedc32e03", "score": "0.6454632", "text": "def memos; end", "title": "" }, { "docid": "9bea815400e77f7d29f3829bedc32e03", "...
7ea69a467b9f8cda02d8df7eeaf77f25
POST /phase_type_defaults POST /phase_type_defaults.json
[ { "docid": "26e63e5bd20bc91eb026dfc8e82ad13f", "score": "0.7683364", "text": "def create\n @phase_type_default = PhaseTypeDefault.new(phase_type_default_params)\n\n respond_to do |format|\n if @phase_type_default.save\n format.html { redirect_to @phase_type_default, notice: 'Phase type...
[ { "docid": "7bf0421f2abf7f6ebb26db710173f5db", "score": "0.7507803", "text": "def phase_type_default_params\n params[:phase_type_default]\n end", "title": "" }, { "docid": "1d0c18509efc3578c7760d656b4f25bd", "score": "0.7179596", "text": "def create\n @phase_type_default_h...
a568f99215ba0027a7b48bcbf259ee34
'', 'mini', 'small', 'normal', 'large'
[ { "docid": "5f151e1724619a73c3adc030b3fb129a", "score": "0.0", "text": "def size\n add_html_data('size', value: matching_size[options[:size]]) unless options[:size].nil?\n end", "title": "" } ]
[ { "docid": "88c8af4fa6d6985704981e58186ff0b1", "score": "0.65674263", "text": "def size_in_text\n case square_feet.to_i\n when 0 then :custom\n when 0..50 then :small\n when 51..150 then :medium\n when 151..300 then :large\n else :'x-large'\n end\n end", ...
85fe19b24df865ddc5fba250b5fa1ec1
the text of the line on which the user is
[ { "docid": "26249f93e5f597a320540f2dde27810e", "score": "0.65640163", "text": "def text\n source.current_value.to_s\n end", "title": "" } ]
[ { "docid": "36065fa402d21635f71a32fc5f939107", "score": "0.72099227", "text": "def string\n @line\n end", "title": "" }, { "docid": "64c50bec3a8869c3cff5888d71f8d75a", "score": "0.71775424", "text": "def line\n @line\n end", "title": "" }, { "docid": "a8aa...
7efe7d18b032741adc439a28ba5652df
Transfer btc between 2 addresses
[ { "docid": "1c5919e63e1ecc20d75a2907a735cc75", "score": "0.62620777", "text": "def transfer(from, to, amount)\n tx = blockchain.new_utxo(from, to, amount.to_f)\n if tx\n coinbase_tx = Transaction.new_coinbase(from)\n coinbase_tx.set_id\n block = blockchain.build_block([coinbase_tx, ...
[ { "docid": "70e2e17978a589f108540a88c9b67540", "score": "0.6764826", "text": "def transfer_btc(btc_transfer_spec, fees)\n transfer_btcs([btc_transfer_spec], fees)\n end", "title": "" }, { "docid": "0ff4d834bc25dd4cc618de835073842f", "score": "0.6751287", "text": "def tran...
fc0b5e70b32bad93a0b064a9bbe2deda
Currently no support for options.
[ { "docid": "c535ed0c0857996f834ade3927c05a14", "score": "0.0", "text": "def normalize_date_options(_options)\n {}\n end", "title": "" } ]
[ { "docid": "495419ea568ab1c50e1d8023645231e6", "score": "0.8636532", "text": "def options() end", "title": "" }, { "docid": "240fd90c6b643e791d6431d6bc0cb650", "score": "0.8585394", "text": "def options(*) end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2"...
43cbea4bba609bbdb768e5bb8946110e
update each of the orders if the amount applied has changed
[ { "docid": "af6a15568b40303f87193771ba8a22af", "score": "0.88051826", "text": "def update_orders\n @data.applied_amounts.each do |order_id, applied|\n applied = unfmt_money(applied)\n if (@data.original_pays[order_id] - applied).abs > 0.001\n update_order(order_id, applied)\n en...
[ { "docid": "9ab13502f83bf91653cb139068a9c685", "score": "0.76561034", "text": "def update_orders\n # Get all the order which is not completed\n orders = Spree::Order.where(completed_at:nil)\n # Iterate over the order object, update the line_items, personalization cost.\n orde...
390da279691377eb33debd7eed4af47b
build array for year selection dropdown
[ { "docid": "e2924b8c96be76adf7a50836a7d0dd66", "score": "0.6486044", "text": "def get_year_ary\n (Date.today.year-99..Date.today.year).inject([]){|x,y| x << y}.reverse\n end", "title": "" } ]
[ { "docid": "78799696d197881908b3b5d2edf5d271", "score": "0.75351536", "text": "def build_year_options(selected, options = {})\n start = options.delete(:start)\n stop = options.delete(:end)\n step = options.delete(:step)\n\n select_options = []\n start.step(st...
432909d04401891dc07c212e67916a22
Returns true if the date/time is in the past.
[ { "docid": "b64e39294d88953b9b786f74e9f6fe57", "score": "0.0", "text": "def past?\n self < self.class.current\n end", "title": "" } ]
[ { "docid": "525292ea7d83d8d60535e4c37d2dfaa8", "score": "0.8229588", "text": "def past?\n end_time < Time.zone.now\n end", "title": "" }, { "docid": "882f20bb0884c35482009658a83e33d3", "score": "0.81537724", "text": "def in_the_past?\n to_datetime.in_the_past?\n end", "ti...
3a74020f43b944b4608a8632c1c879ad
def find_max_value(array) array.sort! array[1] end
[ { "docid": "91758b5d943f2e12202851c93419e3ae", "score": "0.80100566", "text": "def find_max_value(array)\n count = 0\n maximum = -1\n while count < array.length do\n if maximum < array[count]\n maximum = array[count]\n end\n count += 1\n end\n maximum\nend", "title": "" } ]
[ { "docid": "75415739021100cc9ca04f9799e3131d", "score": "0.9102416", "text": "def my_max(array)\n\tarray.sort.last\nend", "title": "" }, { "docid": "f48288947d6997302577f9f8ac86970f", "score": "0.8758426", "text": "def my_max(array)\n array.sort.max\nend", "title": "" }, { ...
02bf9b9ce6912fc169ba5eb24d610bb5
GET /age_groups/1 GET /age_groups/1.json
[ { "docid": "771612795f67a2e363f39961bfbf75d0", "score": "0.7086628", "text": "def show\n @title = \"Возрастная группа\"\n @age_group = AgeGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @age_group }\n end\n end", "t...
[ { "docid": "b9ed4e48773650eae14d626d576ef53c", "score": "0.7485678", "text": "def age_groups\n get_endpoint(Bestsellers::AgeGroup.path).map{|g|\n Bestsellers::AgeGroup.new(g)\n }\n end", "title": "" }, { "docid": "0803f8ce94eb36ecc2c968c8cf8c9a3f", "score": "0.7227442...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "e6476ae19d41c60ab3f436c924ee39c6", "score": "0.0", "text": "def admin_post_params\n params.require(post_sym).permit(:title, :content, :digest,:type, :user_id, :age_policy_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74959", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957448", "text": "def strong_params\n params.require(:request).permit(param_whiteli...
502b9b5565d1d26e00370dbf8b8f6d5c
The player has a nam and a symbol is gonna play with on the board (X or O
[ { "docid": "cc462c964ab60297eb52141cb6d26f69", "score": "0.0", "text": "def initialize(name, symbol)\n\t\t@name = name\n\t\t@symbol = symbol\n\tend", "title": "" } ]
[ { "docid": "756ef6fb918dbaac1285f3d97e1966be", "score": "0.7558233", "text": "def choose_symbol_for_player\n if @@players.count == 0\n return \"X\"\n else\n return \"O\"\n end\n end", "title": "" }, { "docid": "b049e207eb72dece35c5c0ad77f89678", "score": "0.7316116", ...
5e6abb6f044065ccf1214c4dc70051c0
Add and remove favorite recipes for current_user
[ { "docid": "3cb274d4f0074a7066091da6574b008a", "score": "0.0", "text": "def favorite\n type = params[:type]\n if type == \"favorite\"\n current_user.favorites << @story\n redirect_to @story, notice: 'You favorited #{@story.title}'\n\n elsif type == \"unfavorite\"\n current_user.f...
[ { "docid": "b2a55c7a7548411db39bebbd4291fb34", "score": "0.73621935", "text": "def add_recipe_to_favorites(recipe)\n UserFavorite.find_or_create_by_recipe_id_and_user_id(:recipe_id => recipe.id, :user_id => self.id)\n end", "title": "" }, { "docid": "7b190d53d478ae77ffe5f9e7e4920cc2", ...
9c31d8165bb73ea795bd141946fe3d66
Get hourly usage for cloud workload security.
[ { "docid": "025edb6c783f8c8aeaa4700f3ff4fc54", "score": "0.0", "text": "def get_usage_cws(start_hr, opts = {})\n data, _status_code, _headers = get_usage_cws_with_http_info(start_hr, opts)\n data\n end", "title": "" } ]
[ { "docid": "14d2f2413562c62546433956c7bcc780", "score": "0.6360073", "text": "def get_hourly(response)\n response['hourly']\n end", "title": "" }, { "docid": "3585589755d98b9533802c392f2d0719", "score": "0.63212144", "text": "def get_hosts_usage(start_hr, end_hr = nil)\n @us...
40beeee7e51ecfe64ebeecb36313ca81
Returns the string representation of this value as it would be output to the CSS document.
[ { "docid": "99b5cb03003b2929dba282be1ff2881b", "score": "0.0", "text": "def to_s(opts = {})\n Sass::Util.abstract(self)\n end", "title": "" } ]
[ { "docid": "a98873ec33321d4d9fbdaa05cc10cfd1", "score": "0.8062769", "text": "def to_s\n @css_output\n end", "title": "" }, { "docid": "a98873ec33321d4d9fbdaa05cc10cfd1", "score": "0.8062769", "text": "def to_s\n @css_output\n end", "title": "" }, { "docid...
f235dfe0d27ec2f0c447befe5811b9e5
funcion para mostrar tablero iniciando X
[ { "docid": "17190d100baa0edabe0344690cb2b993", "score": "0.0", "text": "def nine_steps()\n table = [[1,2,3], [4,5,6], [7,8,9]]\n table_game = [[1,2,3], [4,5,6], [7,8,9]]\n selected= []\n showtable(table)\n puts '|X|BEGINS Time to play, Put the number you want!'\n get_x(table, selected)...
[ { "docid": "99959efdab8d894039e9935c88934da4", "score": "0.7410335", "text": "def dibujar_tablero\n fil = 0\n self.tablero.each do |l|\n col = 0\n l.each do |c| \n print \" \"\n case c\n when 1\n print \"X\"\n when 2 \n print \"O\"\n ...
bc4c39144538edd2c5b5f60481f73e5d
This authenticates against bluepages using LDAP.
[ { "docid": "f7c7378b9271cfe6090f111b026df069", "score": "0.76766306", "text": "def ldap_authenticate\n # logger.debug(\"ldap_authenticate\")\n # ldap_time = Benchmark.realtime { ActiveLdap::Base.setup_connection }\n # logger.debug(\"LDAP: took #{ldap_time} to establish the connection\")\n au...
[ { "docid": "a390a2def4d08db381724ee027905791", "score": "0.7469873", "text": "def authenticate_with_active_directory(username, password)\n auth_ldap = ADMapper::Connection.current_connection.dup.bind_as(\n :filter => Net::LDAP::Filter.eq( \"sAMAccountName\", username ),\n :base...
153bb01a550762006ea3d6ab0440d662
returns :equal, :local_behind, :local_ahead, or :branchpoint type can be :remote_branch or :local_branch
[ { "docid": "755d3b0286bd650f01656e069d6f7deb", "score": "0.0", "text": "def ret_merge_relationship(type, ref, opts = {})\n if (type == :remote_branch && opts[:fetch_if_needed])\n # TODO: this fetches all branches on the remote; see if anyway to just fetch a specfic branch\n # ref will...
[ { "docid": "ca5608c3e96bcb5f830aee68de1e6163", "score": "0.6432324", "text": "def branch_location branch_name\n case\n when branch_name.start_with?('origin/') then 'remote'\n when branch_name.start_with?('upstream/') then 'upstream'\n else 'local'\n end\nend", "title": "" }, { "docid": ...
c94ab7653da40044632ee41ada7657df
Add icon for clear button.
[ { "docid": "f6f11a4987469f0cb7bc24c2075130b0", "score": "0.0", "text": "def choice_html(choice)\n template.content_tag(:label,\n template.hidden_field_tag(input_name, choice_value(choice)) <<\n choice_label(choice) <<\n template.content_tag(:i),\n label_html_options.merge(:for => ...
[ { "docid": "01fa05ed2db1e53e83015cfedbfda073", "score": "0.7007085", "text": "def icon\n \"\"\n end", "title": "" }, { "docid": "c9cec4333acde01bc0f392be27a739eb", "score": "0.68512857", "text": "def delete_icon( options={} )\n icon_tag(:delete, options)\n end", ...
d1b05bc60b5f2dccf85af32323c64071
Update the Ability table if the response from remote has been changed
[ { "docid": "c7e2f1c221a08773e47905b0e53b47af", "score": "0.71451426", "text": "def update_abilities_table(response)\n response.to_h['data'].map do |ability_attr|\n Ability.update_or_create_by(ability_attr['id'], Ability.slice_attributes(ability_attr))\n end\n end", "title": "" } ]
[ { "docid": "c86253a1753b52bd0b6f11a908f39a81", "score": "0.64997274", "text": "def update\n respond_to do |format|\n if @ability.update(ability_params)\n format.html { redirect_to user_abilities_path(@user) }\n flash[:success] = \"Ability updated!\"\n format.json { render :s...
5e60653fcda098f73db4132e4cf0b0a2
PATCH/PUT /lat_crimes/1 PATCH/PUT /lat_crimes/1.json
[ { "docid": "5f4e84ab4bbf38e90e9c59f2d43c917f", "score": "0.7531882", "text": "def update\n respond_to do |format|\n if @lat_crime.update(lat_crime_params)\n format.html { redirect_to @lat_crime, notice: 'Lat crime was successfully updated.' }\n format.json { render :show, status: :...
[ { "docid": "778486df5d938fddf14d859d281d7cb6", "score": "0.66063666", "text": "def set_lat_crime\n @lat_crime = LatCrime.find(params[:id])\n end", "title": "" }, { "docid": "98ce1c39a05e4828361f75ff8bef1e66", "score": "0.6407817", "text": "def update\n @empresa = Empresa.f...
b98e110eb0e4f4f99bf98ed4a7ac4155
Use this to close a tag to get some sort of failing indentation...
[ { "docid": "8dd109efc4344b3076427fe976b86b6c", "score": "0.59898466", "text": "def close_tag(*args)\n @tags_opened ||= 1\n @tags_opened = (@tags_opened - 1).abs\n concat(*args)\n end", "title": "" } ]
[ { "docid": "c5d677740ba5751df4c7788affa24970", "score": "0.7936657", "text": "def _close_tag(name)\n @opened_tags.pop\n @level -= 1\n _indent\n _end_tag(name)\n _newline\n end", "title": "" }, { "docid": "299f41f139138ae8236c1f99f10339dd", "score": "0.76327133...
89ef1d1955a76abd8e0627fa6f8ef71a
PUT /product_company_prices/1 PUT /product_company_prices/1.json
[ { "docid": "d5b48b421ea5fd2f4197873b8cf06401", "score": "0.6993066", "text": "def update\n @product = $product\n @company = $company\n @product_company_price = ProductCompanyPrice.find(params[:id])\n @product_company_price.updated_by = current_user.id if !current_user.nil?\n\n r...
[ { "docid": "55dc679e8ae9ab08f7fe5756be21b439", "score": "0.6659907", "text": "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "title": "" }, { "docid": "a782d35178f57bdee01ec44f318149c6", "score": "0.6543909", "text": "def update\n @asse...
00a070b10d6104992868f8bffc413636
GET /security/role_type_menus GET /security/role_type_menus.json
[ { "docid": "9af92883ed504efad059f930433e9ff1", "score": "0.79831827", "text": "def index\n @security_role_type_menus = Security::RoleTypeMenu.all\n end", "title": "" } ]
[ { "docid": "177c19eb8bec7bee105beca1521d44e1", "score": "0.7229199", "text": "def set_security_role_type_menu\n @security_role_type_menu = Security::RoleTypeMenu.find(params[:id])\n end", "title": "" }, { "docid": "6e33f83b9d8c20433eae576d8c658f84", "score": "0.70320815", "te...
baddc2c94a3048c1cf39d8e7abc5020e
testing that erase_render_results works as expected
[ { "docid": "3097d4e88d81ab49fad23d4c95bdfe14", "score": "0.60371184", "text": "def bar\n respond_to(:json)\n erase_render_results\n end", "title": "" } ]
[ { "docid": "fab493607e9b7ffad849bbf421cf5b5a", "score": "0.64440805", "text": "def discard_results; end", "title": "" }, { "docid": "ffaa7849ed6480c51d9a7d85c676e4d0", "score": "0.6441835", "text": "def abandon_results!()\n #This is a stub, used for indexing\n end",...
834004625c4b3029d809da64f64fb853
Remove the given costumes from this outfit's object.
[ { "docid": "f09e2d840ff491eb4dd784543b44d1fa", "score": "0.757286", "text": "def remove(*other_costumes)\n change_getup do\n other_costumes.each do |costume|\n @costumes.delete(costume.name)\n end\n end\n end", "title": "" } ]
[ { "docid": "97fc39c38326d8fa5a1b28ef4735b27a", "score": "0.6762636", "text": "def take_off(costume_name)\n costume = self.class.closet[costume_name]\n if costume\n @outfit && @outfit.remove(costume)\n @outfit = nil if @outfit && @outfit.empty?\n else\n rai...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "974997f8d23a1bd026c5b25944efbd9e", "score": "0.0", "text": "def set_visitedcafe\n @visitedcafe = Visitedcafe.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60326946", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015941", "text": "de...
8a8244fbd70969370ddaf872e4cc3977
Recently created events connected with this profile.
[ { "docid": "399858e40502d0de9ef941e251437085", "score": "0.0", "text": "def recent_feed_items(limit = 100)\n feed_items.order('created_at DESC').limit(limit)\n end", "title": "" } ]
[ { "docid": "8b32f73e217fd6f329af9bdcae3779df", "score": "0.67807466", "text": "def events\n events_tracker.events\n end", "title": "" }, { "docid": "49a2c9c2df8b14151e5963cdce6664bc", "score": "0.6618778", "text": "def created_events\n Event.where(user_id: object.id)\n en...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "d9bd77e256fdd1b9416a24c746648b01", "score": "0.0", "text": "def active_device_params\n params.require(:active_device).permit(:remote_notification_token, :is_ios, :last_location_latitude, :last_location_longitude, :dev_uuid)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
edc9ae648dafbf34fc9a6af5f5d05fe3
DELETE /catalogs/supplies/1 DELETE /catalogs/supplies/1.xml
[ { "docid": "8b18557ff611953c2a81ee8c3be693f0", "score": "0.7207061", "text": "def destroy\n @catalogs_supply = Catalogs::Supply.find(params[:id])\n @catalogs_supply.destroy\n\n respond_to do |format|\n format.html { redirect_to(catalogs_supplies_url) }\n format.xml { head :ok }\n ...
[ { "docid": "7fd174a5ad15dc48a63b0278dd7f1b09", "score": "0.66583157", "text": "def destroy\n @catalog = Catalog.find(params[:id])\n @catalog.destroy\n\n respond_to do |format|\n format.html { redirect_to(catalogs_url) }\n format.xml { head :ok }\n end\n end", "title": "" },...
82e1c8b9e59555b60974f0815c6289e4
this method is no more used for now !
[ { "docid": "78e3d82a8559fc4b825550aa908008af", "score": "0.0", "text": "def destroy\n @asset = Asset.find(params[:id])\n if @asset.destroy\n flash[:success] = 'Asset removed'\n redirect_to assets_path\n else\n flash[:danger] = 'Failed to remove asset ' + @asset.product_serial\n ...
[ { "docid": "33e1db3c06643dd523dcc31fccf3a005", "score": "0.6511271", "text": "def used; end", "title": "" }, { "docid": "33e1db3c06643dd523dcc31fccf3a005", "score": "0.6511271", "text": "def used; end", "title": "" }, { "docid": "3ae137b1a40ff3aae4f3cbb2b6082797", "sc...
a897a0c951115176e8d3d5825c510d0d
see task 61 to fix off by 1 issue
[ { "docid": "0b541b1634456fb34eacc5340ecd9eec", "score": "0.0", "text": "def initialize(hg_client, source_browser)\n @hg_client = hg_client\n @source_browser = source_browser\n end", "title": "" } ]
[ { "docid": "bc658f9936671408e02baa884ac86390", "score": "0.5978473", "text": "def anchored; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.5799976", "text": "def probers; end", "title": "" }, { "docid": "d88aeca0eb7d8aa34789deeabc5063cf", ...
037bbdf4b6607926491c44d185cd71b0
Returns an array of the column names for the table
[ { "docid": "91a312eb14179474eb634ce13429e773", "score": "0.8836211", "text": "def column_names\n columns.map { |c| c.name }\n end", "title": "" } ]
[ { "docid": "739c8f999f2e26cbc79d39c0491a8639", "score": "0.8818663", "text": "def col_names\n table_builder.names\n end", "title": "" }, { "docid": "42f5b29f47ed6b049a0e74d8314c8284", "score": "0.87765473", "text": "def column_names\n @table.columns_in_order.collect { |c...
aeed092a75fdad17968efda5d1430302
[30] pry(main)> merge([0], [1]) => [0, 1] [31] pry(main)> merge([1], [0]) => [0, 1] [32] pry(main)> merge([1], [0, 2]) => [0, 1, 2] [33] pry(main)> merge([1, 3], [0, 2]) => [0, 1, 2, 3] [34] pry(main)> merge([1, 3], [0]) => [0, 1, 3] [35] pry(main)> merge([1, 3], []) => [1, 3] [36] pry(main)> merge([], [1, 2]) => [1, 2...
[ { "docid": "4c550f87dcae50161cd251f9f8770e54", "score": "0.0", "text": "def fibonacci(n)\n if n<=2\n [0,1].take(n)\n else\n arr = fibonacci(n-1)\n arr << arr[-2]+arr[-1]\n end\nend", "title": "" } ]
[ { "docid": "ef894597926776300cd9f62f32147023", "score": "0.72124606", "text": "def mergesort(list)\n return list if list.size <= 1\n mid = list.size / 2\n left = list[0...mid]\n right = list[mid...list.size]\n merge(mergesort(left), mergesort(right))\nend", "title": "" }, { "docid": "76...
c60abe62f2aa3e7397e2a95d87d348ee
Updates the associated record with custom update method Returns the number of affected rows.
[ { "docid": "de85674bef12ca126dc747bb3bbbd6f7", "score": "0.0", "text": "def update_with_custom_method(attribute_names = @attributes.keys)\n # check if class has custom create method\n return update_without_custom_method unless self.class.custom_update_method\n return 0 if attr...
[ { "docid": "fb5fbf984e9e3db8526f187bfb3b74d9", "score": "0.75541735", "text": "def update\n check_fields\n sql = \"UPDATE #{table} SET #{to_update_record_str} WHERE id=#{@id}\"\n Database.transaction(sql)\n @log.debug \"Record[#{self}] is updated on Table[#{table}]\"\n e...
b3ff645e25a09b26c143548250f41ef8
Launches a mapreduce job to create appnexus list to upload. The list is made up of appnexus user ids and appnexus segment id pairs. It is obtained by joining xguids to xguidappnexus user id map. Currently the work is done by elastic map reduce.
[ { "docid": "1fe789f924bc5a204796e305bd9b9e45", "score": "0.6186096", "text": "def launch_create_list\n emr_params = build_emr_parameters(params)\n \n cmd = params[:emr_command] + [\n '--create',\n '--name', emr_params[:name],\n '--log-uri', emr_params[:log_url],\n '--num-ins...
[ { "docid": "3ca0297c47ba62ac3bff83ea8c176918", "score": "0.6673655", "text": "def launch_create_list\n emr_params = build_emr_parameters\n \n options = {\n :name => emr_params[:name],\n :log_uri => emr_params[:log_uri],\n :instance_count => emr_params[:instance_count],\n :ma...
57c2227e39ecb320dc2f4f5545f8c3cb
DELETE /spoken_languages/1 DELETE /spoken_languages/1.json
[ { "docid": "75837bd3925b52c25238ca769c5e77ef", "score": "0.8070628", "text": "def destroy\n @spoken_language = SpokenLanguage.find(params[:id])\n @spoken_language.destroy\n\n respond_to do |format|\n format.html { redirect_to spoken_languages_url }\n format.json { head :no_content }\n...
[ { "docid": "222f71f905e876fe7c61859d9bf87356", "score": "0.7604491", "text": "def destroy\n @language = Language.find(params[:id])\n @language.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_languages_url }\n format.json { head :ok }\n end\n end", "title":...
f40cc645bb995eecedb600a56256c6db
Exit if object is empty
[ { "docid": "46ae5cbd6e713e428891e8547056270a", "score": "0.81983364", "text": "def exit_if_empty(obj, msg = 'Empty Record')\n exit_with_msg(msg.red, false) if obj.nil? || obj.empty?\n end", "title": "" } ]
[ { "docid": "1f7234910657bcfec98bd8ece8d6f4bf", "score": "0.75949675", "text": "def empty?\n @data[:object].nil?\n end", "title": "" }, { "docid": "a3f48ecdb8f3e8e9da061ad648308fcf", "score": "0.7049183", "text": "def object_blank?(obj)\n obj.respond_to?(:empty?) ? !!ob...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "28cea3c61ad7448ebb968f54e1357ff0", "score": "0.0", "text": "def set_business\n @business = Business.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163754", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045816", "text": "def action_hook;...
40db25bc897ac1381ea073b3bb68cf79
GET /redeemed_deals/new GET /redeemed_deals/new.json
[ { "docid": "c5db3124d442bb947ffe952823073b81", "score": "0.7843364", "text": "def new\n @redeemed_deal = RedeemedDeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @redeemed_deal }\n end\n end", "title": "" } ]
[ { "docid": "d2cbd14e26a676ad8c9800352f867fa7", "score": "0.72001743", "text": "def new\n @rateddeal = Rateddeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rateddeal }\n end\n end", "title": "" }, { "docid": "9004ddc0ecc802423...
08db0d298c887cbba9f2fd0ff057bd47
GET /albums/1 GET /albums/1.json
[ { "docid": "b5b769c891aa477652a0d44a09d1b114", "score": "0.71037704", "text": "def show\n @album = Album.find(params[:id])\n get_artist @album\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "title": "" } ]
[ { "docid": "a6a13dcf8cf4ce83cdef5b35e328fc77", "score": "0.8184047", "text": "def get_albums\n \t json = call_api(\"#{base_url}\", {})\n\n \t return json[\"data\"]\n \tend", "title": "" }, { "docid": "36903453c7179ac3cbb206cffc59401d", "score": "0.8026249", "text": "de...
fbd361003f8a24484f30c209c86b5ae7
Returns true if the line is a command. Empty lines or lines start with '' will return false
[ { "docid": "098a03a1b94a0fe70a1eac675d4079f3", "score": "0.6358572", "text": "def should_parse?(line)\n stripped = line.strip\n (!stripped.empty?) && (!stripped.start_with?('#'))\n end", "title": "" } ]
[ { "docid": "5141a503d389d8c405d0336135c12dff", "score": "0.75059676", "text": "def matches_command_type?(command_type)\n raise \"No command type was specified.\" if command_type.nil?\n return !(@line =~ /\\A#{command_type} /).nil?\n end", "title": "" }, { "docid": "e...
a07d6e1d9636c6b5cc537278de0d50c2
Transform the ruby obj > to a Hash
[ { "docid": "67f438513994dce9ebf6b7e2babf3977", "score": "0.0", "text": "def to_hash\n index_hash = Hash.new\n self.each do |predef|\n index_hash[predef.name] = predef.to_s\n end\n index_hash\n end", "title": "" } ]
[ { "docid": "73b0517f5904d0ced2a4053b7ce9d704", "score": "0.8024133", "text": "def object_to_hash(obj)\n if obj.respond_to?(:to_hash)\n obj.to_hash\n else\n obj\n end\n end", "title": "" }, { "docid": "73b0517f5904d0ced2a4053b7ce9d704", "score": "0.8024133"...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "19c8a07a3ac17d0d8bf6ed808dd19629", "score": "0.0", "text": "def set_attention\n @attention = Attention.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...
bf34bc142c0ce0156a5e01f86d1df1c7
Returns the parent directory. This can be chained.
[ { "docid": "524d11fc678ac0e0bdf47b8c1d9e6c16", "score": "0.6838189", "text": "def parent\n self / '..'\n end", "title": "" } ]
[ { "docid": "8318c2f15b62321a48b0702463eec943", "score": "0.83112866", "text": "def parent_dir\n File.expand_path('..', base_dir)\n end", "title": "" }, { "docid": "34d8482b17b976a253aad1079b9db54b", "score": "0.81870055", "text": "def parent_path\n self.path.split(PAT...
97ff7ee7332e20bc9079e1b5fa178071
Find invoice entry in Spree::SpringboardResource related to springboard_return
[ { "docid": "e4c8f6c55a2c5fb226b2698df2210ae3", "score": "0.84287", "text": "def find_spree_invoice(springboard_return)\n Spree::SpringboardResource.find_by(\n resource_type: 'invoice',\n springboard_id: springboard_return[:parent_transaction_id]\n )\n end",...
[ { "docid": "4289aa48b9189412e8b82dc7cd83fa55", "score": "0.67093545", "text": "def create_from_springboard_resource(springboard_return)\n # Find invoice entry in Spree::SpringboardResource related to springboard_return\n invoice_resource = find_spree_invoice(springboard_return)\n\n ...
84f7396f04035694333f0bcd5ab4a2ee
GET /classifications GET /classifications.json
[ { "docid": "b601f4da741556be17a9014b7b29da54", "score": "0.6619037", "text": "def index\n @classifications = Classification.all\n end", "title": "" } ]
[ { "docid": "4c19450bd344625116763960094b9487", "score": "0.7234929", "text": "def classifications\n bugzilla_resource('Classification')\n end", "title": "" }, { "docid": "efb9e283fe360619a283c0769ac43027", "score": "0.70105124", "text": "def classifications\n if params[:...
695c311cef77b8b8ecb25ca032db6f9b
Gets the data in a given x,y cell. Returns nil if the cell is not valid.
[ { "docid": "d4cb7d7eacc2eb33763aa2e365786609", "score": "0.7250257", "text": "def get_cell(x, y)\n return @grid[x][y] if is_valid?(x, y)\n end", "title": "" } ]
[ { "docid": "28511eee3b93dbf1f044bf840648fd8a", "score": "0.77852225", "text": "def getCell(x, y)\n # Check if the coord are valid\n if(x >= @current.size || x < 0 || y >= @current[0].size || y < 0)\n return nil\n end\n\n return @current[x][y]\n end", "title"...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b27b6bc290b22372d73710ff4df8eecb", "score": "0.0", "text": "def project_params\n params.require(:project).permit(\n :id,\n :name,\n :number,\n :project_state_id,\n :start_date,\n :end_date,\n :notes,\n :created_at,\...
[ { "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...
220b3e744d548c7e9184232a245ec406
return unit vector parallel to this element
[ { "docid": "bac05783ab7cfeb2480c3c1d752c0616", "score": "0.7321063", "text": "def unitVect\n\t\tv=getVect()\n\t\tv.length =1\n\t\tv\n\tend", "title": "" } ]
[ { "docid": "cb6000b84d37936ddf100c66ed731ac5", "score": "0.71145445", "text": "def unit\n (@p1 - @p0).normalize\n end", "title": "" }, { "docid": "aa27210a60a121ffb878af601383761a", "score": "0.7107352", "text": "def unit_(v_)\n (self - v_).normalize\n end", "titl...
66d40d43f0b37a1b22640e36c8613df3
def sort_direction %w[asc desc].include?(params[:direction]) ? params[:direction] : "asc" end def sort_column Good.column_names.include?(params[:sort]) ? params[:sort] : "name" end
[ { "docid": "5179b0e47770e14976ad7aa3c7751798", "score": "0.0", "text": "def find_able\n params.each do |name, value|\n if name =~ /(.+)_id$/\n return @able = $1.classify.constantize.find(value) \n end \n end \n nil \n end", "title": "" } ]
[ { "docid": "9e689ffe2956193a1193e98823573f72", "score": "0.85626554", "text": "def sort_column\n \n Pantry.column_names.include?(params[:sort]) ? params[:sort] : \"name\"\n\n end", "title": "" }, { "docid": "edea5166f7493bb49e61643e5963509a", "score": "0.844966", "text...
47a4f88bc73ad90da964170f2196c8a6
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.admin_mailer.submission.subject
[ { "docid": "fce301297c35a1c6c453ab14460a5571", "score": "0.0", "text": "def submission(thing)\n @thing = thing\n\n mail to: \"chapambrose@gmail.com\",\n subject: \"Somebody Submitted a #{thing.class}\"\n end", "title": "" } ]
[ { "docid": "8928fe4f050d7ebd3e9aa992b07e320a", "score": "0.78544486", "text": "def subject_for\n ActiveSupport::Deprecation.warn \"subject_for\"\n I18n.t(:\"subject\", scope: [:notifications, :mailer],\n default: [:subject])\n end", "title": "" }, { "docid": ...
0f1330d4dd74e298994e009891234e15
sending by new.html.erb, initial a new post object and save it, then redirect to indext page
[ { "docid": "db369da363aab13a9e3b945c15010fa5", "score": "0.0", "text": "def create\n @post = @board.posts.build(params[:post])\n @post.user = current_user\n if @post.save\n flash[:notice] = \"新增成功\"\n redirect_to board_posts_path(@board)\n else\n flash[:notice] = \"新增失敗\"\n ...
[ { "docid": "596a4bd1f05b2b529fa717499f653165", "score": "0.79279345", "text": "def create\n #create\n @post = Post.new(params[:post])\n if @post.save\n #redirect to index action\n redirect_to :action => :index\n else\n #load view associated with new action\n render :actio...
2e6b7f9e6a7fea65cec2f4ac488b14f1
it needs a write function
[ { "docid": "2c6091ddd2db5ac07065b3310a699652", "score": "0.0", "text": "def write(line)\n begin\n @sock.puts line\n rescue\n end\n puts \">> #{line}\"\n end", "title": "" } ]
[ { "docid": "7b05a27fe0243a88a10b5f3f957bdd92", "score": "0.87941784", "text": "def write; end", "title": "" }, { "docid": "7b05a27fe0243a88a10b5f3f957bdd92", "score": "0.87941784", "text": "def write; end", "title": "" }, { "docid": "ef0d3fed61018b177a096fab04840a30", ...
984bfc41339d9a0a1a85b5adb550e143
function to update an annotated sentence
[ { "docid": "0c0cbecc296a11f25fb411bf373d00db", "score": "0.0", "text": "def send_sentence\n\n require 'json'\n\n upload_tag_array = request.body.read.split\n\n sentence = []\n\n upload_tag_array.each do |ele|\n json_ele = JSON.parse(ele)\n update_str = json_ele[\"tag\"] + \"\\t\" +...
[ { "docid": "bdb0aa15f0a9a9ba0df8515103d2b4c9", "score": "0.65305865", "text": "def update!(**args)\n @text_segments = args[:text_segments] if args.key?(:text_segments)\n end", "title": "" }, { "docid": "bdb0aa15f0a9a9ba0df8515103d2b4c9", "score": "0.65305865", "text":...
7fba3702b5bd4dc5f53229437ba6ecb6
The class to access the api's projects declare needed overloaded methods here
[ { "docid": "4eed3e234161bc834e51bf7ef69574a6", "score": "0.0", "text": "def created_at\n @created_at ||= self[:created_at] ? Time.parse(self[:created_at]) : nil\n end", "title": "" } ]
[ { "docid": "13cfbe50a73176f08b681f3684afe561", "score": "0.7340943", "text": "def apis; end", "title": "" }, { "docid": "e223b6498b42a8245c5e113225590b5b", "score": "0.70616764", "text": "def api; end", "title": "" }, { "docid": "e223b6498b42a8245c5e113225590b5b", "sc...
2bef5287ba23b283dae0577778dcd70b
DELETE /test_mongos/1 DELETE /test_mongos/1.json
[ { "docid": "931b93cd6b9c48a4392d821d35fe469a", "score": "0.7617135", "text": "def destroy\n @test_mongo.destroy\n respond_to do |format|\n format.html { redirect_to test_mongos_url, notice: 'Test mongo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "1b2e1947d2cc3c7769345115f3dae579", "score": "0.75587535", "text": "def destroy\n @mongotest = Mongotest.find(params[:id])\n @mongotest.destroy\n\n respond_to do |format|\n format.html { redirect_to mongotests_url }\n format.json { head :no_content }\n end\n end", "...
e17ecea6e6439371098d740d9e3a5ee2
DELETE /adherents/1 DELETE /adherents/1.json
[ { "docid": "eaf1e3c7998960c386bf44b2b42cc593", "score": "0.70210373", "text": "def destroy\n @adherent = Adherent.find(params[:id])\n @adherent.destroy\n\n respond_to do |format|\n format.html { redirect_to adherents_url, alert: @adherent.errors[:base]}\n format.json { head :no_conten...
[ { "docid": "d41fc1b8d5324a7e8968611bce8875b3", "score": "0.70564854", "text": "def destroy\n @adherent.destroy\n respond_to do |format|\n format.html { redirect_to adherents_url, notice: 'Adherent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "ti...
54cb04afac956007797559a0cedbc4b7
p str.count("lo") QUESTION: challange
[ { "docid": "2ff1cb8d63015d97c3c0444a4f78318c", "score": "0.7305147", "text": "def customCount(stri,searchString)\n count =0\n stri.each_char {|ele| count+=1 if searchString.include?(ele)}\np count\nend", "title": "" } ]
[ { "docid": "d732444e098d6b18890ff9eb0607e53e", "score": "0.787395", "text": "def stringCount\n return $str.count('rl')\nend", "title": "" }, { "docid": "89269e66c3a53645244bd59b24806fa4", "score": "0.751335", "text": "def appearences\n\t\"How many times does the letter 'a' appear in...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "54e5f2939ded2d6ce5a25a0c947f7ba0", "score": "0.0", "text": "def kid_params\n params.require(:kid).permit(:email, :password, :organization, :age, :avatar, :city, :description, :favourite_thing_list, :worst_thing_list, :tag_list)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title"...
b1fee48ca14640407e3d388c386516ba
Private: Extract parameters from the configuration
[ { "docid": "879b865425d6b63f5fab46ea78c218b7", "score": "0.687659", "text": "def param_cfg(res)\n Hash[ *(@impl.parameters.map { |k,v| [k, res.get(k)] }.select { |ent| ent[1] }.flatten) ]\n end", "title": "" } ]
[ { "docid": "e333288d660e7f4f9e4a62a33f94f389", "score": "0.7283735", "text": "def parameters\n extract_hash(:parameters, :parameter_key, :parameter_value)\n end", "title": "" }, { "docid": "b4ac8bc6941a87425ac2dc42a226295f", "score": "0.7122407", "text": "def filtered_params_...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "353e917b0c40ccf5bd6977d88cc30dc3", "score": "0.0", "text": "def salary_type_params\n params.require(:salary_type).permit(:name, :hourly_rate, :daily_rate, :overtime_rate)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
f0083b8c8829ac4161459073278c9a90
Print script version information
[ { "docid": "d46fd4eeee93394b0a30655fc4b4fcf4", "score": "0.80750614", "text": "def print_version()\n (version,packager,name) = get_version()\n puts name+\" v. \"+version+\" \"+packager\n exit\nend", "title": "" } ]
[ { "docid": "afd022e42a87a35e458009724a3bed11", "score": "0.8235307", "text": "def output_version\n puts \"#{File.basename(__FILE__)} v#{VERSION}\"\n end", "title": "" }, { "docid": "ea0ba3245933270d98a2d359d6b4c2a5", "score": "0.821781", "text": "def print_version()\n (version,p...
ee1aa887d8a038b77c9e0aebfad4b769
Convert to 8character hexadecimal string. The highest order byte (left most hexadecimal pair represents the alpha value).
[ { "docid": "f4ddc2e045ee22ecae593ad15275c854", "score": "0.7782156", "text": "def to_hex8\n \"##{to_basic_hex8}\"\n end", "title": "" } ]
[ { "docid": "8808c2c33de7e91aef08c64c4c10a227", "score": "0.78719467", "text": "def to_hexstr\n Common.unpackbytes(to_s)\n end", "title": "" }, { "docid": "5be4a1c7cd7b1f6745ee1c9474800369", "score": "0.7674162", "text": "def to_hex_s\n strings = to_bytes.map do |byte|\...
b4eda071a58fcbd3fe76648415420955
drop old business data and create a new busineses table
[ { "docid": "a20662451fb23d04b7bad24998a50d0f", "score": "0.6600844", "text": "def create_business_table (db)\n\tdb.execute \"DROP TABLE IF EXISTS businesses\"\n\n\tdb.execute \"CREATE TABLE IF NOT EXISTS businesses (\n\tId INTEGER PRIMARY KEY AUTOINCREMENT,\n\tName TEXT NULL,\n\tAddress TEXT NULL,\n\tCi...
[ { "docid": "1b72bd12639c43b0656b0336b54fce04", "score": "0.61435074", "text": "def teardown\n sql = [\n \"DROP TABLE IF EXISTS #{@carto_name}\",\n \"ALTER TABLE IF EXISTS #{@new_carto_name} RENAME TO #{@carto_name}\",\n index_table_sql\n ].join(\";\")\n # ...
ef0ac3121b7b43b164e2dbc282f7ad62
Get root nodes count/array for explorer tree
[ { "docid": "843dc480e2deca30698cdee66f5bd2fe", "score": "0.6818326", "text": "def x_get_tree_roots(count_only, _options)\n objects = Rbac.filtered(Dialog.all).sort_by { |a| a.label.downcase }\n count_only_or_objects(count_only, objects)\n end", "title": "" } ]
[ { "docid": "eb6a376cd804fc10f97ecbc46886fd3a", "score": "0.769075", "text": "def x_get_tree_roots\n count_only_or_objects(false, PxeServer.all, \"name\")\n end", "title": "" }, { "docid": "12d39bfa92f1f9e1a1c7848e4d235195", "score": "0.7564679", "text": "def x_get_tree_roots\n ...
71e26c1c3b74521e394cb1aab3fb1bf3
Mutates the value according to the passed mutation
[ { "docid": "3c6ec8ea8d68011c8c9b2cccd2c5bbd7", "score": "0.7149044", "text": "def mutate(value, mutation)\n case mutation\n when *BYTE_MUTATIONS[:std] then value\n when *BYTE_MUTATIONS[:add] then value += 128\n when *BYTE_MUTATIONS[:neg] then value = -value\n when *BYTE_MUTATION...
[ { "docid": "d678be3257546019ec198faf5d8cb250", "score": "0.74706936", "text": "def mutation; end", "title": "" }, { "docid": "2cd3e70acd5bd147adb6e05101655e22", "score": "0.72556597", "text": "def mutate(mutator); end", "title": "" }, { "docid": "b0705040c29ebb2ccd3cae091...
bf97c1b068ca447585dbfc146cab3c44
creates an index file with iframes if does not exists
[ { "docid": "7314e69ff268b8534d3d4dae1c9b06f2", "score": "0.6421154", "text": "def append_index\n index_file = File.join(Rails.root, 'doc', 'index.html')\n unless File.exists?(index_file)\n tpl_path = File.join(File.dirname(__FILE__), 'templates', 'index.erb')\n rendered_d...
[ { "docid": "feaffb31d4976d9297216ab28e6c3952", "score": "0.73014396", "text": "def create_index!\n @logger.info \"create index frame\"\n File.open(File.join(\"#{@options[:output]}\", \"index.html\"), \"w\") do |file|\n file.write(template(binding, :index))\n end \n end", "title": "...
ec7b47bb5203e4810882eeaf09ed636a
PUT /line_items/1 PUT /line_items/1.json
[ { "docid": "946fdd6f7f3c489446781d0cc856c1f9", "score": "0.0", "text": "def update\n @cart = current_cart\n #We use params to get the product ID from the request\n #This is stored locally as no need to let view see it\n product = Product.find(params[:product_id])\n \n #Adds an item to ...
[ { "docid": "d6588a4e9658b0577402d1bdbc8a5637", "score": "0.75266916", "text": "def update\n @line_item = @order.line_items.find(params[:id])\n\n if @line_item.update(line_item_params)\n head :no_content\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n ...
dc127c67f41c026e0c27c93fdf54b3b0
GET /torrents/new GET /torrents/new.xml
[ { "docid": "03409d9d999f690a1b6ee51ae76b7b07", "score": "0.0", "text": "def add\n @torrent = Torrent.new\n @torrent.dvd_id = params[:id]\n end", "title": "" } ]
[ { "docid": "a6fadacb5976c84ffe23cbd4b60b4804", "score": "0.8188979", "text": "def new\n @torrent = Torrent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @torrent }\n end\n end", "title": "" }, { "docid": "a6fadacb5976c84ffe23cb...
51d1911e038aebaca309f77ddad60cab
DELETE /topping_lists/1 DELETE /topping_lists/1.json
[ { "docid": "ca3a685666535567114ca3c4e3c80c1a", "score": "0.7855933", "text": "def destroy\n @topping_list.destroy\n respond_to do |format|\n format.html { redirect_to topping_lists_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "95143bcc2d01f1049f03f73837d8ea91", "score": "0.7312533", "text": "def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end", "title": "" }, { "docid": "a6c8a1293d654f0c910aceb49b1729d8", "score": "0.73073643", "text": "def destroy\n @list.destroy\n respon...
42eae2a8641f93e5471c3bb69cb74d2f
Iterate from 1 to n For each iteration (nb) Switch lights[] elements at index % 'nb' Find indexes in lights[] where value is 1
[ { "docid": "a7d668924e47436ec90cf9aeb870d406", "score": "0.6668433", "text": "def initialize_lights(nb_elements)\n lights = []\n nb_elements.times { lights << 0 }\n lights\nend", "title": "" } ]
[ { "docid": "e328c19d3c33ac9a29e27a178b11b35a", "score": "0.84582376", "text": "def light_switcher(n)\n lights = Array.new(n)\n\n 1.upto(n) do |i|\n lights.map!.with_index(1) { |light, idx| idx % i == 0 ? !light : light }\n end\n\n lights.map.with_index(1) { |on, idx| idx if on }.compact\nend", ...
1552df6bd5bbb26be50e956f9a01b65f
Parse and execute the interface commands
[ { "docid": "d8b445652db71b8f7c5b591213370104", "score": "0.0", "text": "def execute_command(cmd)\n command, args = parse_input(cmd)\n\n case command\n when :place\n place_robot(args)\n when :move, :left, :right\n @toy_robot.send(command)\n when :report\n puts @toy_robot.rep...
[ { "docid": "dbcb94c793609518d0c8b22e317d0770", "score": "0.68221754", "text": "def parse_cli\n raise \"Undefined interface for the command line of #{cli.task}\"\n end", "title": "" }, { "docid": "314a049a12ddc517310f8ccf2d8e69eb", "score": "0.68040407", "text": "def run\n # ...
249f2ca05bdcc187f4c03eb091b8a868
GET /buildings/new GET /buildings/new.json
[ { "docid": "c263076af1568c5012c9fa2cf3415739", "score": "0.7037388", "text": "def new\n @building = Building.new\n @building.photos.build\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @building }\n end\n end", "title": "" } ]
[ { "docid": "a98c03a27b2357ba97cad225d35e4c36", "score": "0.7923042", "text": "def new\n @building = Building.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @building }\n end\n end", "title": "" }, { "docid": "6edc5252177777d5a43bd...
29a5ed8fb7965a1134fb92e0ece82f3e
True if this is a user mode flaw.
[ { "docid": "97e5cf6fc4b1c9badb320ba700dcf190", "score": "0.70330346", "text": "def is_user_flaw\r\n is_user_app\r\n end", "title": "" } ]
[ { "docid": "51b68c72ce1338db073448170443f7a9", "score": "0.71675843", "text": "def inUserMode?\n return @userMode\n end", "title": "" }, { "docid": "319cef83bfbd208c881c189fbcb2fa7f", "score": "0.6925009", "text": "def is_local_user_flaw\r\n is_local_flaw and is_user_f...
548593c07a4598ba3d6fbd6564dc5324
all the methods from before go below here define a DSL (domainspecific language) outputs text name is the person speaking statement is what to say
[ { "docid": "09c09c5f75978f5cd6722371457fa288", "score": "0.0", "text": "def say(name, statement)\n puts(name.nil? ? statement : \"#{name.capitalize}: #{statement}\")\n # puts if name.nil?\n # statement\n # else\n # \"#{name.capitalize}: #{statement}\"\n # end\n end", "title":...
[ { "docid": "34fb90a09c817f79b3971c7d856eb09d", "score": "0.6289234", "text": "def speak\n\t\tputs \"Meow. My name is #{@name.capitalize}.\"\n\t\tputs \"I am #{@age} years old and I live in #{@location}\"\n\t\tputs \"I am a #{@colour.downcase} #{@breed.downcase}.\"\n\tend", "title": "" }, { "...
db68eb7a3058154981d24f0e83c69c98
1920px (this covers FullHD screens and up) 1600px (this will cover 1600px desktops and several tablets in portrait mode, for example iPads at 768px width, which will request a 2x image of 1536px and above) 1366px (it is the most widespread desktop resolution) 1024px (1024x768 screens, excluding iPads which are hidensit...
[ { "docid": "b4ad85b5724b7bbbce2150457b781835", "score": "0.5652708", "text": "def make_responsive(img,width)\n [\n [\"-resize 'x#{width}>'\", \"-#{width}.webp\"],\n [\"-resize 'x#{width * 2}>'\", \"-#{width}@2x.webp\"],\n ].each do |i|\n convert(img, i.first, i.last)\n end\nend", "ti...
[ { "docid": "edd53c12877d57dfde8a2abe1854100a", "score": "0.6749999", "text": "def resolution\n if width >= 3800 || height >= 2100 # close to 3860 x 2160\n \"HQ\"\n elsif width >= 1900 || height >= 1000 # close to 1920 x 1080\n \"1080p\"\n elsif width >= 1200 || height >= 700 ...
655c68968fce28938781af6ac6ad8ccb
Detach tag to contact Detach a tag to the provided contacts
[ { "docid": "0931768ed1be95c178c2fd16c38e0f4f", "score": "0.5617634", "text": "def action_detach_tag(list_id, detach_tag_request, opts = {})\n data, _status_code, _headers = action_detach_tag_with_http_info(list_id, detach_tag_request, opts)\n data\n end", "title": "" } ]
[ { "docid": "26b9e306fa2aab44ceb5a0b3a7349fcc", "score": "0.73808277", "text": "def remove_tag_from_contact\n\t\t\t\t# unlike the remove method in account, this only removes the tag from one contact\n\t\t\t\t\n\t\t\tend", "title": "" }, { "docid": "e515d817c0438d18fa49f3d8b3037c25", "scor...
5f57c1d839779729fbdbfb0573d9b5be
Invite user to join a group
[ { "docid": "4133ee047dd2e8920dae2fbae94eb68a", "score": "0.7145728", "text": "def invite_to_group(user_group, user)\n if user_group.is_member?(self) and not user_group.is_member?(user)\n membership = Membership.create_with_notification!(:user => user,\n ...
[ { "docid": "32257a2019aa8bb9c9e3758c70da008b", "score": "0.77132463", "text": "def invite_group(email, group_id, user)\n @user = User.find(user)\n @email = email\n @group = Group.find(group_id)\n mail(to: \"#{@email}\", subject: \"#{@user.name} - Invited You to Join Their Scavenger Hunt Awes...
1ae3dffebfd1e017e3f235e2c5635055
POST /manifest_items POST /manifest_items.json
[ { "docid": "61abab2db3788619a1e49f4e205f975c", "score": "0.71474415", "text": "def create\n @manifest_item = ManifestItem.new(params[:manifest_item])\n\n respond_to do |format|\n if @manifest_item.save\n format.html { redirect_to @manifest_item, notice: 'Manifest item was successfully ...
[ { "docid": "95e4410cdb716526c509bfb555399bc2", "score": "0.62736607", "text": "def bulk_item_data\n prm = manifest_item_bulk_post_params\n items = prm[:data]\n raise_failure(\"not an Array: #{items.inspect}\") unless items.is_a?(Array)\n raise_failure('no item data') unle...
366e71ff4fcb8e436c24fe5ffce768a4
POST /commitments POST /commitments.xml
[ { "docid": "2211dadb35f848a92daba3f16f673695", "score": "0.5133413", "text": "def create\n @order_list = OrderList.find(params[:order_list_id])\n @commitment = Commitment.find(:first, :conditions => [\"user_id = ? and orderable_id = ?\", params[:commitment][:user_id], params[:commitment][:orderabl...
[ { "docid": "80ca4a019dfff353c53f29a2735ba84a", "score": "0.62479854", "text": "def create\n @commitment = current_user.commitments.new(:event_id => params[:event_id], :status => 'OFFERED')\n\n respond_to do |format|\n if @commitment.save\n format.html { redirect_to root_path, notice: '...
4507a9973efc350625d498cb1d7a3c8b
Calculates weighted sum For example with 12345678, [1,2] Ref.num. 1 2 3 4 5 6 7 8 Multipl. 1 2 1 2 1 2 1 2 Total 1+ 4+ 3+ 8+ 5+1+2+ 7+1+6 = 38 source://faker//lib/faker/default/invoice.rb111
[ { "docid": "f288fc18ec5ccc690c281e4738c99cad", "score": "0.7814299", "text": "def calculate_weighted_sum(base, weight_factors); end", "title": "" } ]
[ { "docid": "c8cf2f925582c2f26f98953417a03db3", "score": "0.7895826", "text": "def weightedsum\n ws = 0\n @inputs.each_index { |i| ws = ws + @inputs[i]*@weights[i] }\n ws\n end", "title": "" }, { "docid": "262e05b8188699ea23fb6f0db2f72bf4", "score": "0.7386995", "text": "def...
f161a1a58cb0528527fb2926c6c0f2b5
Publishes one or more messages to the topic.
[ { "docid": "585b3aa555d92fc63b2102a0ea3d4227", "score": "0.0", "text": "def publish data = nil, attributes = {}\n ensure_connection!\n batch = Batch.new data, attributes\n yield batch if block_given?\n return nil if batch.messages.count.zero?\n publish_batch_messages b...
[ { "docid": "74a28c4a38254cb72584f31f26146ada", "score": "0.7827055", "text": "def publish topic, messages\n publish_req = Google::Pubsub::V1::PublishRequest.new(\n topic: topic_path(topic),\n messages: messages.map do |data, attributes|\n Google::Pubsub::V1::P...
f6243136ba15c4b7ac25dce8c9d055ec
Gets the handler for the given command type from this provider. Arguments command + As an integer, specifies the command type a handler is needed for. + May also be a Message or PDU object, from which the command type is read.
[ { "docid": "c5233850cd89f4ce253af45a38d089e4", "score": "0.80161", "text": "def handler_for(command)\n # User might be tempted to just pass in the message, or pdu,\n # if so, just pluck the command off of it.\n if command.kind_of?(Message)\n command = command.pdu.command\n els...
[ { "docid": "51e395c7b8c4f3eb24220a2c7454c9de", "score": "0.71583676", "text": "def get_command(type, command)\n commands[type] ? commands[type][command] : nil\n end", "title": "" }, { "docid": "dc38ad311079db5fe333ee19f1c86927", "score": "0.6394161", "text": "def get_comm...
8423069733c1683e2c2617c8352a9741
Checks whether a nonce length is valid for this cipher.
[ { "docid": "73d44f6d12450abc01d86c639f33b932", "score": "0.8588256", "text": "def valid_nonce_length?(nonce_len)\n rc = Botan.call_ffi_rc(:botan_cipher_valid_nonce_length, @ptr, nonce_len)\n rc == 1\n end", "title": "" } ]
[ { "docid": "13910ec58a79b9a4cb4344e7ed77a4b3", "score": "0.69729286", "text": "def valid_nonce?\n !request.check_nonce(response.basic).zero?\n end", "title": "" }, { "docid": "508b7510fca4b9612bb86be57bb5fa56", "score": "0.6932574", "text": "def _check_nonce(nonce)\n fail Nonc...
92af4a662d4760f1e9c32e4d62db4988
DELETE /boards/1 DELETE /boards/1.json
[ { "docid": "3f6a95baa5102533d7266cf62c11ef02", "score": "0.0", "text": "def destroy\n\n end", "title": "" } ]
[ { "docid": "bd783a6a6c1b11a5c105a42c468cedff", "score": "0.77836585", "text": "def destroy\n @multi_board = MultiBoard.find(params[:id])\n @multi_board.destroy\n\n respond_to do |format|\n format.html { redirect_to multi_boards_url }\n format.json { head :no_content }\n end\n end"...
55a2e13f42ea7447e223b729a42359c6
GET /cursoporcarreras/1 GET /cursoporcarreras/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "8ac9215decbe864a71c52a40dfdbd438", "score": "0.7220554", "text": "def index\n @cursoporcarreras = Cursoporcarrera.all\n end", "title": "" }, { "docid": "eb40784899ac9f9f5f8b1d0cfc29240a", "score": "0.6823373", "text": "def index\n @cursos = Curso.all\n\n respond...
1b03d8eaeec1bc97002b2189eaf6161c
Read timeout in seconds.
[ { "docid": "b1b0669cfb57cf1984ee89c299ec7332", "score": "0.82831204", "text": "def read_timeout(read_timeout)\n @options[:read_timeout] = read_timeout\n end", "title": "" } ]
[ { "docid": "991e504bdeda61c49b5c6143787f6023", "score": "0.89498013", "text": "def read_timeout\n @io.read_timeout\n end", "title": "" }, { "docid": "6f2be1b04d041b3e616aecc6ce96ae0c", "score": "0.89225227", "text": "def read_timeout=(timeout); end", "title": "" }, { ...
b0f7ec39f3a85fe173fa8fd79e196c6b
POST /cuts POST /cuts.xml
[ { "docid": "47c8844f9cf96c4854bd276fd49df77f", "score": "0.4571058", "text": "def create\n @cut = Cut.new(params[:cut])\n\n respond_to do |format|\n #format.html # new.html.erb\n #format.xml { render :xml => @cut }\n if @cut.save\n format.html {render :template => 'shared/clo...
[ { "docid": "126eb6dd87eb9cebc19418639d0313d6", "score": "0.5507414", "text": "def create\n @cut = Cut.new(params[:cut])\n\n respond_to do |format|\n if @cut.save\n format.html { redirect_to @cut, notice: 'Cut was successfully created.' }\n format.json { render json: @cut, status...
586f6c99d87010895d8025269f4385d9
Set the time for the quiz before saving. 30 minutes: Verbal 35 minutes: Quant
[ { "docid": "2174bef32ff9284e234c3f73ffb03c07", "score": "0.7385832", "text": "def set_time_before_save\n \n if self.quiz.quiz_type_id == QuizType.find_by_name(\"FullQuiz\").id\n if self.section_type_id == SectionType.find_by_name(\"Quant\").id\n self.time = 35\n elsif self.section...
[ { "docid": "b712bfdb8ec2a4215611ccee64063a60", "score": "0.6486865", "text": "def change_time(hike_instance)\n system 'clear'\n puts \"-----MY HIKES-----\"\n hours = @prompt.ask(\"Enter time in hours: \", required: true, convert: :int) {|input| input.in('0-24')}\n minutes = 6...
3cacd4187e936e527e3262237605d3fd
Generate log files for playing back rounds
[ { "docid": "5a572793857269fd2085404d034ecc52", "score": "0.0", "text": "def save_round_json(slug, round)\n #Check if the match directory exists already\n match_directory = File.join(@logs_directory, @match.slug)\n unless File.directory?(match_directory)\n FileUtils.mkdir_p(match_directory)...
[ { "docid": "4beb5f273427f291717bbe1b6453e7ad", "score": "0.6538894", "text": "def create_log_file_path\r\n log_dir = File.join(SAF::LOG, File.dirname(test_path))\r\n log_file_pre = File.join(log_dir,\r\n File.basename(test_path, \".*\"))\r\n \"#{log_file_pre}...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "464dc4167e54963a544605283ef1cec1", "score": "0.0", "text": "def update!(**args)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @notification_config = args[:notification_config] if args.key?(:notification_config)\n ...
[ { "docid": "184b1b1ed771473d3eb9f338c0734c38", "score": "0.73066413", "text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end", "title": "" }, { "docid": "5076c5a88404ae72986f958710f5687a", "score": "0.72631145", "text": "def update...
a0ebc5dc0c288d5f140903b6e41e9e85
only updating information on the nodes for now
[ { "docid": "0945168e97743d26930ac848880766b7", "score": "0.0", "text": "def update_positions(data)\n # json doesn't seem to include empty arrays\n if data[:nodes]\n data[:nodes].each do |data_node|\n self.display_nodes.find(data_node[:id]).update_position(data_node)\n end\n end...
[ { "docid": "f67caa9534439581d6b7cd0be3302197", "score": "0.80441344", "text": "def update_node_information\n\t\t\t\tpublish(\"#{@service_name}_nodes\", @nodes)\n\t\t\tend", "title": "" }, { "docid": "5a4faff9cb157a02b6c307d50e4ee886", "score": "0.74279493", "text": "def update_node_r...
6430ce670843e545897d52207bb410f3
POST /prequestionnaires POST /prequestionnaires.json
[ { "docid": "cae08d7da15bd1df6ac976157ab7641a", "score": "0.6725083", "text": "def create\n @prequestionnaire = Prequestionnaire.new(prequestionnaire_params)\n\n respond_to do |format|\n if @prequestionnaire.save\n format.html { redirect_to thanks_path(thanks: 'prequestionnaire'), notic...
[ { "docid": "412c14b5e04e8aed2fd02684f9dd9b74", "score": "0.67093253", "text": "def questionaire_params\n params.require(:questionaire).permit(:title, :description, question_ids: [])\n end", "title": "" }, { "docid": "8b4dc357855a7182d7180fcd1085f190", "score": "0.63724184", "...
a4662b7bd5ec77c0a69fc02f192b30f0
Here getting back url either redirect to session url or back or default
[ { "docid": "439c7d87fe53051ebcc4dd2fa6042271", "score": "0.767882", "text": "def redirect_back_or_default(default = root_url)\n \tredirect_to(session.delete(:return_to) || request.env['HTTP_REFERER'] || default)\n\tend", "title": "" } ]
[ { "docid": "6e2775710598ab29664caaae6ce316ca", "score": "0.81910354", "text": "def go_back url='/'\n if session[:return_to] && session[:return_to] != \"#{request.request_uri}\"\n redirect_to session[:return_to]\n else\n redirect_to url\n end \n session...
43d5367fe69a28e18109c7ee4c0f7898
DELETE /listes/1 DELETE /listes/1.json
[ { "docid": "11f7ddf0672156082630662e7d811e3e", "score": "0.6673197", "text": "def destroy\n @liste.destroy\n respond_to do |format|\n format.html { redirect_to listes_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "00eded1c246f6ba932df779edfa05888", "score": "0.709438", "text": "def delete(list_id)\n del \"#{@endpoint}/#{list_id}\"\n end", "title": "" }, { "docid": "181e4a675d8c3dc433da33c54a0221d5", "score": "0.70366836", "text": "def destroy\n @enlist = Enlist.find(para...