query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
6a2eac0519dd2a17d0d08a7f55d89f19
Check whether object could be licensed means, current_user is the owner of the object, independently of object scope
[ { "docid": "329cc461ee2e5f2f82dad448df2afb90", "score": "0.798522", "text": "def licenseable\n object.user.id == current_user.id\n end", "title": "" } ]
[ { "docid": "aee65406d09fc9beb8c506319a4a8b7f", "score": "0.757242", "text": "def user_owns?(product)\n \tproduct.user == current_user\n end", "title": "" }, { "docid": "b3b1a1907769bb47e4a76ab2a5f5fd97", "score": "0.74140745", "text": "def current_user_owns?(object)\n signed_in? ?...
d58d07a88c14469ceb12ee2a131997eb
extracts the list of units to be added, updated and deleted. Returns a Hash with three keys: +create+: a list of +Roomorama::Unit+ instances representing units that were added. +update+: a list of +Roomorama::Diff::Unit+ instances representing the set of changes to existing units that should be applied. +delete+: a lis...
[ { "docid": "391c66ea5bb761f88194879c275955b2", "score": "0.6479658", "text": "def extract_diff\n\n # 1. index the original and the new list of units according to their identifiers.\n original_index = index(original)\n new_index = index(new)\n\n # 2. extracts the list of identifi...
[ { "docid": "e7d83852b0b2ccb7a36bd06c7c2bd1eb", "score": "0.629817", "text": "def units\n @_hash_units ||= listing_units.map(&:to_unit_hash)\n end", "title": "" }, { "docid": "152268021c4af965a466f4afa8e19c8c", "score": "0.61449724", "text": "def build_units(units)\n units.map ...
1770b9f257a641b735b24e1419fb337b
RETURNS User instance where todo user_id matches user id.
[ { "docid": "5cc7cb6b90cccd432131e957257c52aa", "score": "0.0", "text": "def get_user_info\n return User.find_by_id(self.user_id)\n end", "title": "" } ]
[ { "docid": "3d751c0ac762865ca90ca3a2a5066b9f", "score": "0.7470821", "text": "def find_todo_by_user\n @todo = @current_user.todos.find(params[:id])\n end", "title": "" }, { "docid": "f3b0cee9a74a992262a69651addb9ad8", "score": "0.66569006", "text": "def user(id:)\n User.find...
c254720775fdc369cc01bb3f6698898a
=begin :rtype: TreeNode =end
[ { "docid": "4e7abb3fb71f59f47bcc5809e5410e67", "score": "0.0", "text": "def get_root()\n @root\n end", "title": "" } ]
[ { "docid": "1ec6bc58978a9abd4d91d1d912631562", "score": "0.7736329", "text": "def tree; end", "title": "" }, { "docid": "1ec6bc58978a9abd4d91d1d912631562", "score": "0.7736329", "text": "def tree; end", "title": "" }, { "docid": "f65b718d4741ed3251eb0bf08f73ef37", "sc...
a58a075d6d7de5fc8d5e2027ffc44749
DELETE /panels/1 DELETE /panels/1.json
[ { "docid": "465780a861660024eee710391f6c7735", "score": "0.7273623", "text": "def destroy\n @panel.destroy\n respond_to do |format|\n format.html { redirect_to panels_url, notice: 'Panel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" ...
[ { "docid": "545611f28d5697891b6681a9cdf5dd4e", "score": "0.756517", "text": "def destroy\n @panel = Panel.find(params[:id])\n @panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_panels_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, {...
ccedab5f0113ea0f20e1ebf94e9a53df
Add an employee to a department.
[ { "docid": "528ee7c04dcd17107e91907eeb205d30", "score": "0.70529574", "text": "def test_add_emp_to_dept\n a = Employee.new(name: \"John Smith\", email: \"jsmith@gmail.com\", phone: \"123.456.7890\", salary: 100000)\n b = Department.new(\"Development Engineering\")\n b.add_employee(a)\n asser...
[ { "docid": "70e6bc34d22c162fc3db5c498fec7ccb", "score": "0.7542409", "text": "def test_add_employee_to_department\n dept = Department.new(\"Public Health Department\") # => #<Department:0x007f9ce2002428 @dept_name=\"Public Health Department\", @employee_roll=[]>\n assert_equal...
34478255b5b91e9d24843840d42b5bd6
Test edgecases for values passed to this method.
[ { "docid": "6b2c3cacad7a400c71465d42a553938c", "score": "0.0", "text": "def test_set_z_edgecases\n a = [1,2,3]\n a.z = 0\n assert_equal(0, a.z, 'Failed in test_set_z_edgecases, 0' )\n a.z = -5\n assert_equal(-5, a.z, 'Failed in test_set_z_edgecases, -5' )\n a.z = 5\n assert_equal(5,...
[ { "docid": "0eacd646de4a4b67872471cc83ed430d", "score": "0.7019483", "text": "def supports_value_expectations?; end", "title": "" }, { "docid": "f93665ba81bf26b17f7f5635542d665d", "score": "0.6900005", "text": "def test(value, attributes)\n raise NotImplementedError\n end...
5ba17577bf48878c11f56d48a14ca8a8
create an array of n length
[ { "docid": "0522952c9f74391d566f674970335414", "score": "0.72057796", "text": "def create_array(n)\n test_array = []\n n.times do\n test_array.push(\"a\")\n end\n return test_array\nend", "title": "" } ]
[ { "docid": "c9cf0e447b0053343c88ff2164606ef0", "score": "0.8605919", "text": "def mkarray(n)\n (1..n).to_a.bind{|as| as.concat(as.init.reverse) }\n end", "title": "" }, { "docid": "fa06d320b6de1df59ffcf02cb7bc26f1", "score": "0.7678644", "text": "def arr(n)\n (0..n).to_a\nend", ...
575e2577095f187debb3fb3f2e233de4
return the main reddit.
[ { "docid": "301008e360e79f22311a28db0f02e15f", "score": "0.75753975", "text": "def main\n return Reddit.new\n end", "title": "" } ]
[ { "docid": "9d20888581a755544e8b5eb2de8e0795", "score": "0.7429593", "text": "def main\n return Reddit.new()\n end", "title": "" }, { "docid": "0507b84f407501e63c51bef0c843b170", "score": "0.69566894", "text": "def subreddit = self", "title": "" }, { "docid": "705...
45369571423ac2229380bf3725f0aa1a
does not work but ran out of time
[ { "docid": "e2bc146a2b74bb123038c424353f38d7", "score": "0.0", "text": "def rooms_sorted_by_area\n room_sort = @rooms.map do |room|\n room.sort_by {|area| area.size}\n end\n end", "title": "" } ]
[ { "docid": "7cdab61b2dd9a16a226d418b72594093", "score": "0.6434533", "text": "def timeout; end", "title": "" }, { "docid": "7cdab61b2dd9a16a226d418b72594093", "score": "0.6434533", "text": "def timeout; end", "title": "" }, { "docid": "7cdab61b2dd9a16a226d418b72594093", ...
960a02bbdb35215345b27662e72e6fed
write am ethod that takes in an array and returns a new array w/ first half of elements; if odd include the middle one too
[ { "docid": "b3ebbdb47bcf573c8ae50b8b568b37cc", "score": "0.7437684", "text": "def first_half(array)\n\tarr = [] # initialize arr\n \ti = 0 # start at first indice\n\n while i < (array.length / 2.0) # while indice is less than the length of the array rounded up by half\n push_this = array[i] #...
[ { "docid": "2818cb8ca0d3fe7be22bfdef6abb5355", "score": "0.84811544", "text": "def first_half(array)\n\n new_arr = []\n even_arr = array.length / 2\n odd_arr = even_arr + 1\n \n i = 0\n \n if array.length % 2 == 0\n \t \n while i < even_arr\n \t \n \tnew_arr << array[i] \n i +...
db60ec6ad12821254c1f165bd31da6d1
change with own icons
[ { "docid": "d7703d475a0239bc9e470f662ae50749", "score": "0.0", "text": "def status_icon_for(album)\n if album.private_album?\n icon_url = \"http://www.clker.com/cliparts/B/1/y/Z/B/s/padlock-icon-hi.png\"\n elsif album.unlisted_album?\n icon_url = \"http://www.clker.com/cliparts/B/1/y/Z/B...
[ { "docid": "9b22e1cdf19035e6f85fdd4006f132de", "score": "0.7352632", "text": "def icon_set; end", "title": "" }, { "docid": "8ba5cb93ce7103e709948ad6727c6fc6", "score": "0.7292633", "text": "def iconSet; end", "title": "" }, { "docid": "3ca3a51945d6ea80d9a285a59967654d", ...
ce47e2fc561d9540412076e481064c6c
internal function to count specified days in the schedule
[ { "docid": "68f8451e502c3549fd26c3da3a5cff6d", "score": "0.67127025", "text": "def count_days(city, cost)\n @schedule.reduce(0) do |m, day|\n m + (day.city == city && day.cost == cost ? 1 : 0)\n end\n end", "title": "" } ]
[ { "docid": "b19312794ac73a5c59d7dcac14126069", "score": "0.6956981", "text": "def number_of_days_scheduled(start_date, end_date)\n days_scheduled(start_date, end_date).count\n end", "title": "" }, { "docid": "0c35a5ef17fde1e0a22e647aa4fc260b", "score": "0.6719791", "text": "def t...
9cb2b151553aed0c65feb62c3b9b027b
Move animation alongside battler
[ { "docid": "ada33cf445d639d7c61ba2e08a3607fe", "score": "0.66985655", "text": "def move_animation(dx, dy)\n if @animation && @animation.position != 3\n @ani_ox += dx\n @ani_oy += dy\n @ani_sprites.each do |sprite|\n sprite.x += dx\n sprite.y += dy\n end\n end\n e...
[ { "docid": "c675c9d65b9e6ce5e10ed40fedb1f90b", "score": "0.7287252", "text": "def move_animation_camera_relative_follow\n if @animation.position != 3\n last_screen_x = @anim_origin.screen_x\n last_screen_y = @anim_origin.screen_y\n @anim_origin.x = @battler.x\n @anim_origin.y = @b...
6cfa1befc7a030ffb95189feafbcb83b
RSpec utilities define page title for Spec tests
[ { "docid": "792e44d03c7c48301ff7a79c4403e56c", "score": "0.0", "text": "def sign_in(user)\n visit signin_path\n fill_in \"Email\", with: user.email\n fill_in \"Password\", with: user.password\n click_button \"Sign in\"\n # Sign in when not using Capybara as well.\n cookies[:remember_token] = us...
[ { "docid": "b59a919f15d6e22b1453893b005e8d24", "score": "0.75259817", "text": "def have_a_page_title(expected) \n simple_matcher(\"have a page title in the <head> element with [#{expected}]\") do |given, matcher|\n given.should have_tag('head > title', expected)\n end\n ...
95544c7878c05a3f07631f9a412bb9a8
Sends an unsuccessful response.
[ { "docid": "c135dc9c752172889c61f14335ba22ee", "score": "0.61289394", "text": "def fail(code, error)\n render json: { success: false, error: error }, status: code\n end", "title": "" } ]
[ { "docid": "ab966b7b74ec81240cd0caddfdb9bf5e", "score": "0.7112724", "text": "def send_bad_request_response\n\t\tthrow :halt, [ 400, 'Bad Request' ]\n\tend", "title": "" }, { "docid": "742703034a6a8329e6d771cfce9ad04f", "score": "0.7018449", "text": "def bad_response(response)\n ...
df86675cf9e723af44b6cedfe86d3918
Store the URI of the current request in the session. We can return to this location by calling redirect_back_or_default.
[ { "docid": "2d87ff8fce3bb0c0ed1e2cd82d1ec350", "score": "0.0", "text": "def store_location\n session[:return_to] = request.url unless request[:preview]\n end", "title": "" } ]
[ { "docid": "2b28d7c862e76f19dba23db5b1bc319f", "score": "0.80054516", "text": "def store_location\n session[:return_to] = request.uri\n end", "title": "" }, { "docid": "2b28d7c862e76f19dba23db5b1bc319f", "score": "0.80054516", "text": "def store_location\n session[...
dc05983cb7c267e3428d978e7f815d09
Get line +line_number+ from file named +filename+.
[ { "docid": "64386224b75ee077137b54f0bdc03e00", "score": "0.7980011", "text": "def line_at(filename, line_number)\n source_reload\n\n return \"\\n\" unless File.exist?(filename)\n line = Tracer::Single.get_line(filename, line_number)\n\n return \"#{line.gsub(/^\\s+/, '').chomp}\"\n ...
[ { "docid": "8e3686da867d944f2eaa6822192126ab", "score": "0.7939525", "text": "def get_line(filename, lineno)\n File.open(filename) do |f|\n f.gets until f.lineno == lineno - 1\n f.gets\n end\n end", "title": "" }, { "docid": "0c01896099bea8691182d9d505584...
ba8ff10b059f2fe580472e40be171b87
url's without any path must end with trailing slash e.g. is not ok
[ { "docid": "1c17158eb6c64fe14b6ccc867a0fb2b4", "score": "0.0", "text": "def add_auth_basic auth, url, client_opts\n l = @spaces.bsearch_lower_boundary { |x| x.prefix <=> url }\n space = nil\n\n if l < @spaces.length && self.class.prefix?(@spaces[l].prefix, url)\n space = @spaces[l]...
[ { "docid": "1818d566c292a703466a5ebddfa407da", "score": "0.75500554", "text": "def ensure_url_ends_with_slash(url)\n return \"#{url}/\" unless url.end_with?(\"/\")\n\n return url\n end", "title": "" }, { "docid": "ffe0c298ae4a76e761784ac44245516f", "score": "0.6946801", ...
ffe47b89824fb2ecc943bfd42f78d247
Get column of board. returned as array of values Assumption is that all rows are of equal length Params : c = column number to retrieve
[ { "docid": "c54d31bfe9a81190768e237047e75bde", "score": "0.88166803", "text": "def get_col(c)\n\t\tif c.between?(0,@board_width-1)\n\t\t\tarr = Array.new(@board_height)\n\t\t\tfor i in 0..@board_width-1\n\t\t\t\tarr[i] = @arr_board[i][c]\n\t\t\tend\n\t\t\treturn arr\n\t\telse\n\t\t\treturn nil\n\t\tend\...
[ { "docid": "cd095ec8bb705c90f7dc57f2cfe16496", "score": "0.7728926", "text": "def get_col(board, col)\n\t\n column =[]\n board.length.times do |i|\n column << board[i][col]\n end\n return column\n\nend", "title": "" }, { "docid": "13243fe1b8f7913bc689e8801de68950", ...
b718efb83f0eb3f618ce981a17cd063b
For use by RecordChangelog
[ { "docid": "48bfefa709c4f4dd81b650cb29a56903", "score": "0.60756415", "text": "def record_changelog_identifier\n\t\tself.piping_component\n\tend", "title": "" } ]
[ { "docid": "95a8f2dab9dae89897551835c4df498a", "score": "0.6953281", "text": "def compound_changelog; end", "title": "" }, { "docid": "563c62b62fd579737ee9c1a7b4dc1e83", "score": "0.69216216", "text": "def changes; end", "title": "" }, { "docid": "8125057e876d1588c05098e6...
01962b5bcc34528a68d4ba6c4fe0daa2
6.2 Calling a Method Cooperative objects
[ { "docid": "a2b6feb83342c5508d9d21c254bb248e", "score": "0.0", "text": "def add(a_number, another_number)\r\n a_number + another_number\r\n end", "title": "" } ]
[ { "docid": "adc143d9921490a32ce81e2ec1b81602", "score": "0.740098", "text": "def invoke; end", "title": "" }, { "docid": "adc143d9921490a32ce81e2ec1b81602", "score": "0.740098", "text": "def invoke; end", "title": "" }, { "docid": "adc143d9921490a32ce81e2ec1b81602", "...
0865279f5c3b76484eef9a49b5f5af4d
Define an ordered list of all possible Dimension Values for the segment. Optional +proc+ a Proc of a single parameter, an ActiveRecord Scope which can be used to query for the values
[ { "docid": "b6a4bf6c332784a0e7de864f2f701374", "score": "0.46775007", "text": "def values(&proc)\n raise \"no block!\" if !proc\n @values_proc = proc\n end", "title": "" } ]
[ { "docid": "451383d039091ad69451d914d6b5c600", "score": "0.5536173", "text": "def dimension_values_for_segments(segment_keys)\n if segment_keys && !segment_keys.empty?\n segment_keys.map{|sk| segment(sk)}.map(&:dimension_values).reduce(&:+)\n else\n dimension_values\n ...
1be9a949ff3134e7b4f79d6be2a263c4
New method : Battler update
[ { "docid": "dcfae9b968ad24853186bb5266625117", "score": "0.0", "text": "def update\n return if $game_temp.global_freeze && battle_phase != :skill\n update_move # Update movements (Basic Module)\n update_smove # Update smooth movement (Basic Module)\n if fiber_obj\n fi...
[ { "docid": "cb2162d3a1fd3434effd12aa702f250f", "score": "0.72105503", "text": "def update() end", "title": "" }, { "docid": "5ca2caa1a207739e77f437de35e41cf1", "score": "0.71896195", "text": "def update ; end", "title": "" }, { "docid": "3c9838ba31e732a25709f7f82181d684",...
8768dfee889b6a680eda8f29a475b65d
This method retrieves and formats the form title. CSS identifier: h2
[ { "docid": "33fddfa23cff282bec1fe6adf49ba927", "score": "0.7604382", "text": "def smerf_title\n if !@smerfform.form.name.blank?\n content_tag(:h2, raw(@smerfform.form.name))\n end\n end", "title": "" } ]
[ { "docid": "9598179be3900209a5efd50ff003f044", "score": "0.7325884", "text": "def parse_title\n @html.css(\"h2.entry-title\").text\n end", "title": "" }, { "docid": "23d81816b2647c6f13acc4c8f0d2ada8", "score": "0.73182315", "text": "def form_title(title, description = '')\n co...
6e8fa590a44ff524a05104b066d61c1c
Update the EBSCO fields in one or more documents.
[ { "docid": "b9f61a0d1fe4ecd6b604a9c446485613", "score": "0.0", "text": "def eds_edit!(doc)\n case doc\n when Hash\n # Adjust EDS item identifiers so that they can be used with Rails\n # paths. (E.g., \"/articles/db__idbase.part2\" would appear to Rails\n # as ID \...
[ { "docid": "5d385cf106c474825d54886bf875ce1c", "score": "0.70307356", "text": "def bulk_update(documents)\n @strategy.bulk do |b|\n documents.each do |doc|\n b.update(\n doc[:_id],\n { doc: { doc[:attr_name] => doc[:attr_value] } }\n )\n end\n ...
a416697bf3bdba11f6773f996d90b156
Writer that behaves in the same way as []
[ { "docid": "a16d450234c0c626d4ab850ec58f05f0", "score": "0.0", "text": "def []=(index_or_predicate, value)\n if(index_or_predicate.is_a?(Fixnum))\n ordered_objects[index_or_predicate] = value\n else\n super\n end\n end", "title": "" } ]
[ { "docid": "7b05a27fe0243a88a10b5f3f957bdd92", "score": "0.69002694", "text": "def write; end", "title": "" }, { "docid": "7b05a27fe0243a88a10b5f3f957bdd92", "score": "0.69002694", "text": "def write; end", "title": "" }, { "docid": "864faf9af4b3608b54b954da75034d46", ...
cd8a6cbb2caf86ea8fb5bd1099c1d6d0
Unescapes a URI escaped string with +encoding+. +encoding+ will be the target encoding of the string returned, and it defaults to UTF8 source://rack//lib/rack/utils.rb56
[ { "docid": "563916342faa8cfaabb42266108be5be", "score": "0.74309224", "text": "def unescape(s, encoding = T.unsafe(nil)); end", "title": "" } ]
[ { "docid": "ec31a16ad620a7cb94b909c91a9e5bf5", "score": "0.76488847", "text": "def unescape(string, encoding = T.unsafe(nil)); end", "title": "" }, { "docid": "dddc1d68b0daf52756882d8c8828b160", "score": "0.7141567", "text": "def unescape(uri, options = {})\n encoding = options.fe...
527bbe1287a2ee054d6c7c2353938209
return random sentences default is 3 sentences
[ { "docid": "fd0ff6e6f98342a241672d91b4de1682", "score": "0.79408044", "text": "def sentences(sentence_count = 3)\n Faker::Lorem.sentences(sentence_count).join(' ')\n end", "title": "" } ]
[ { "docid": "4a83f59a1ae2d387dcfb928759a82d44", "score": "0.83256793", "text": "def sentences(total)\n (1..total).map do\n words(randm(4..15)).capitalize\n end.join('. ')\n end", "title": "" }, { "docid": "681b2d78f44942a5f625df4221f502dc", "score": "0.8257824"...
1f8f571cbf25d84bd051249036c974c7
The last date of the retail year
[ { "docid": "8a6261d96ccbc7d0ced9ddf298b3d6f8", "score": "0.0", "text": "def start_of_year(year)\n end_of_year(year - 1) + 1\n end", "title": "" } ]
[ { "docid": "7e01aa8ef6a31bb20655bd285468a1eb", "score": "0.8467055", "text": "def last_year; end", "title": "" }, { "docid": "7e01aa8ef6a31bb20655bd285468a1eb", "score": "0.8467055", "text": "def last_year; end", "title": "" }, { "docid": "d34fbf6739625934e5b2bcbe81e0ec92...
dc70f070afc556a8d1b27d063e6d7e6d
Exercise 5 and Exercise 6
[ { "docid": "81745c3f9f5037de27b705512d453633", "score": "0.0", "text": "def method_1(train_list)\nnew_array =[]\n train_list.each do |item|\n if item[:direction] == \"east\"\n new_array.push (item[:train])\n end\n end\n return new_array\nend", "title": "" } ]
[ { "docid": "29f9730e102343c58d90b25ab70ebfc4", "score": "0.7364256", "text": "def exercise_6 \n end", "title": "" }, { "docid": "61a5aa5387d7586d627164f40eaf623a", "score": "0.66124654", "text": "def solution6(input)\n end", "title": "" }, { "docid": "c3cb3e948c27b241ea...
ed0b3d1bd21524770512986514ff6cb5
Initialize a session and store it's ID
[ { "docid": "f672ebab71481d28cf8d672e6cfe2233", "score": "0.7220123", "text": "def init\n @id = Diplomat::Session.create(\n :Name => name,\n :TTL => \"#{ttl}s\",\n :LockDelay => \"#{delay}s\",\n :Behavior => behavior\n )\n logger.info(\" - Initialized a Consul s...
[ { "docid": "f1aba94aac4b7d04da6cc528940cc6f7", "score": "0.7929823", "text": "def initialize_session\n end", "title": "" }, { "docid": "1f760c16d5a1d3d005ccd13bdccab83a", "score": "0.7889244", "text": "def init_session\n if session\n if session.updated_at < Time....
0d32437d0f3e505c5967888f2724b70d
POST /stories POST /stories.json
[ { "docid": "401030051ff397c26d292f5fd7baaac9", "score": "0.6626967", "text": "def create\n @story = Story.new(params[:story])\n @story.author = current_author\n\n standard_save_on_create_response @story\n end", "title": "" } ]
[ { "docid": "5da16b2c91298b65822f602999d1754d", "score": "0.7779506", "text": "def new_stories\n get('/newstories.json')\n end", "title": "" }, { "docid": "4af32e91209e50a758a2e7970b400c6b", "score": "0.7726463", "text": "def create\n @story = Story.new(story_params)\n if @s...
c1f846b6f9b0dfb7d70e15c3299261c3
1. If left equals nil then print 2. Else, go to right most of left element 3. Point its right to equal current node 4. Again go to right most of left and break the link and print current 5. Assign right of current to current
[ { "docid": "6f853586c27740cab8930910111fc7f3", "score": "0.63133436", "text": "def inorder(node)\n\tcurrent = node\n\twhile current != nil\n\t\tif current.left == nil\n\t\t\tprint current.val\n\t\t\tprint ' '\n\t\t\tcurrent = current.right\n\t\telse\n\t\t\tpre = current.left\n\t\t\twhile pre.right != ni...
[ { "docid": "4a78731a8efcabcaf5faad5e72e4225c", "score": "0.72661775", "text": "def print_linked_list_right(head)\n while !head.nil?\n print \"#{head.value} \"\n head = head.right\n end\nend", "title": "" }, { "docid": "5143595317780033cf4fd46a83ed5571", "score": "0.7074609", ...
5bbff6e930d5d254f5a7f7135d81c878
RETURNS self.image if the value is not an empty string. If string is empty, returns placeholder String
[ { "docid": "591d0aa866e9c960588ea638fdc7fbdf", "score": "0.7784189", "text": "def get_image_or_placeholder\n return (self.image != \"\") && (self.image != nil) ? self.image : \"http://cdn.browshot.com/static/images/not-found.png\"\n end", "title": "" } ]
[ { "docid": "d92630551674fd3d16525c0fa8813e5c", "score": "0.7021539", "text": "def photo(if_not_found = \"anonymous.jpg\" )\n photo_name.nil? ? if_not_found : photo_name\n end", "title": "" }, { "docid": "4cd2a3ac4a4d8bbc41c8b3706f64a1f2", "score": "0.6941382", "text": "def name_...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "704991cc8b458ec123eeb440b7c02a09", "score": "0.0", "text": "def comment_params\n # need :is_update parameter to distinguish whenever user clicked on update or cancel button\n # :is_update is passed from additional button in form\n # f.submit won't allow custom block content an...
[ { "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...
32a0013a586ead97bac343116ce77a68
Add meta tags to the meta_information hash.
[ { "docid": "26ca1c90cfd7c2f00c1f72b41e7514b8", "score": "0.8092227", "text": "def meta_tags(hash)\n meta_information.merge!(hash)\n end", "title": "" } ]
[ { "docid": "b6784abd39656d9bf4ce8de9eea06124", "score": "0.7702975", "text": "def add_meta_data(meta_hash)\n meta.merge! meta_hash\n end", "title": "" }, { "docid": "a300e903fc53ce4dc1ed99329b968ed1", "score": "0.715826", "text": "def add_meta(meta)\n self.meta.merge!(me...
9c08396d62a912c232f168a6c6716327
Hash one single entry from the summary file
[ { "docid": "de4e85d4ceb581faf42468c22e6f14f7", "score": "0.0", "text": "def add_sum_entry(d, indels)\n sum_entry = Struct.new(:id, :chr, :coor, :ori, :flank, :ref, :var, :class, :length)\n se = if indels\n sum_entry.new(d[0], d[1].gsub(/chr/i, ''), d[2], d[3], d[4], \n # in...
[ { "docid": "11d90d89db35b8e041a4bcb4050e4d5a", "score": "0.6748886", "text": "def hash\n file.hash ^ line.hash\n end", "title": "" }, { "docid": "453f5ab3c9c004704205a8f2c18e3d7b", "score": "0.6687239", "text": "def hash_for_file(filename)\n digest = Digest::SHA1.new...
06c06e682bb1ed656b14e1282c056bcf
Truncate tweets over 140 characters after shortening
[ { "docid": "94f7a8439d96d674d5281559d25128ef", "score": "0.77874726", "text": "def shortened_tweet_truncator(tweet)\n shortened = selective_tweet_shortener(tweet)\n\n if shortened.length > MAX_TWEET_LENGTH\n shortened[0...MAX_TWEET_LENGTH]\n else\n shortened\n end\nend", "title": "" } ]
[ { "docid": "11e54a09f5971ae5d215b0df4936ae23", "score": "0.88270646", "text": "def shortened_tweet_truncator(tweet)\n if tweet.length > 140\n tweet = tweet[0..136] + \"...\"\n else\n tweet\n end\nend", "title": "" }, { "docid": "7c168f0c50953e54d80793cd620d6890", "score": "0.865...
0a136c0136841675554568f2da4221e6
Define methods that use iteration and control the return values of those methods. Define methods that call other methods.
[ { "docid": "aaca74d4d406f5468e84a9e3d61d85d0", "score": "0.0", "text": "def badge_maker(name)\n puts \"Hello, my name is #{name}.\"\n return \"Hello, my name is #{name}.\"\nend", "title": "" } ]
[ { "docid": "03fac5c467ccd39f52e9931bc540ae92", "score": "0.70699084", "text": "def runIteration\n end", "title": "" }, { "docid": "563e80e2256b075189838314ffd4945c", "score": "0.68062204", "text": "def iterate!\n end", "title": "" }, { "docid": "15e5a1985284ac2687af13...
41a8a50fba336e808f47da5dc42220e2
The path to the current ruby interpreter. Adapted from Rake's FileUtils.
[ { "docid": "d8c1ad65956f2d547ffe3e6dc7f1a8c3", "score": "0.698191", "text": "def ruby_path\n ext = ((RbConfig::CONFIG['ruby_install_name'] =~ /\\.(com|cmd|exe|bat|rb|sh)$/) ? \"\" : RbConfig::CONFIG['EXEEXT'])\n File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + ext).sub...
[ { "docid": "d99da818d735a71bed86d90485a62b23", "score": "0.78348446", "text": "def ruby_interpreter_path\n Pathname.new(\n File.join(Config::CONFIG[\"bindir\"],\n Config::CONFIG[\"RUBY_INSTALL_NAME\"]+Config::CONFIG[\"EXEEXT\"])\n ).re...
16a2857884f613c3ca8323159a077069
Save the file with the same file name.
[ { "docid": "1d3c6c1c0f77e3cf92e8d58229a06097", "score": "0.0", "text": "def save!(output_encoding = 'utf-8')\n save_as!(@input_file_name, output_encoding)\n end", "title": "" } ]
[ { "docid": "2458dc3d8f384aa5ec97ea811217db31", "score": "0.7954492", "text": "def save\n File.open(@name, 'w'){|f| f.write self.to_s }\n end", "title": "" }, { "docid": "46ee30c7262e9057855210eebac58073", "score": "0.793344", "text": "def file_save\n if @filename\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "637a51191e5b5438e070dd7a857b7e1a", "score": "0.0", "text": "def set_organization\n @organization = Organization.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;...
6b85799089be4d5024c32e7767baebaf
create listing properties from hash for easy searching
[ { "docid": "96fc5458180ec5e931aa10d3efa76493", "score": "0.68576366", "text": "def build_properties\n properties.each do |key,val|\n prop = listing_properties.find_or_initialize_by(key:key)\n prop.value = val\n\n end\n end", "title": "" } ]
[ { "docid": "cc0e0741276c8378327e046f8b63c69a", "score": "0.6594713", "text": "def properties_from_hash(hash)\n hash.inject({}) do |newhash, (k, v)|\n k = k.gsub(\"-\", \"_\")\n k = \"_#{k.to_s}\" if k =~ /^\\d/\n self.class.property :\"#{k}\"\n newhash[k] = v\n ne...
8b56818056aba82b173e5906401b0531
Stop the http service Stop the http service
[ { "docid": "608b542ce5e5f65aa927f44b9d8d8faa", "score": "0.0", "text": "def create_proxy_service_action_stop_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiNsxComponentAdministrationApplianceManagementApi.create_p...
[ { "docid": "04a4fa15ba98d13288ce5d82ad0434e4", "score": "0.80661464", "text": "def stop\n @service.stop\n end", "title": "" }, { "docid": "df177079711e5daeb1ae9112e5437bed", "score": "0.79876727", "text": "def stop!\n @status = :stopping\n\n # invoke a new reque...
52a97e2cab99a7edb7f31337c8a73330
PATCH/PUT /admin/problem_sources/1 PATCH/PUT /admin/problem_sources/1.json
[ { "docid": "67e5690c2779743981797e996cd87254", "score": "0.68291986", "text": "def update\n if @admin_problem_source.update(admin_problem_source_params)\n redirect_to @admin_problem_source\n else\n render :edit\n end\n end", "title": "" } ]
[ { "docid": "29194ecc13f53869aa3ba04da6040d35", "score": "0.62586755", "text": "def update\n logger.info(params[:id])\n logger.info(params[:source])\n\n @source = @person.sources.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format....
8308c64de7f9bd8b13b1faafffd73674
PUT /counselors/1 PUT /counselors/1.json
[ { "docid": "47e75815a9f90834fc337d57c560f3f4", "score": "0.69262207", "text": "def update\n @counselor = Counselor.find(params[:id])\n\n respond_to do |format|\n if @counselor.update_attributes(params[:counselor])\n format.html { redirect_to @counselor, notice: 'Counselor was successfu...
[ { "docid": "768ba8007846da13c96df82f57217c25", "score": "0.66337603", "text": "def update\n respond_to do |format|\n if @counselor.update(counselor_params)\n format.html { redirect_to @counselor, notice: 'Counselor was successfully updated.' }\n format.json { render :show, status: ...
3c6e384b81557054498adc9cb290de1e
Array of keys with the currently configured prefix that have nonnil values.
[ { "docid": "9ce10a9c9c6b38ef3567949f0d93c7df", "score": "0.7244104", "text": "def keys\n store.keys.select{ |k| k.match(/^#{prefix}/) and self[k] }\n end", "title": "" } ]
[ { "docid": "099657a8094b8c01fde09d3b11ca6675", "score": "0.7544417", "text": "def keys\n out = [ ]\n @source.keys.each do |key|\n if key.starts_with?(@prefix)\n out << key[@prefix.length..-1]\n else\n out << key\n end\n end\n ...
7dd39db54665b7dbd33275bd69dc0846
Initializes the instance with the api_key (required) and an optional shared_secret (required only if you need to make authenticated call). Current available option is: :raise_exception_on_error: set this key to true if you want the call method to raise an error if Flickr returns one :rest_endpoint custom REST API endpo...
[ { "docid": "17dc79aaf86724cc4864e6f87c74bd02", "score": "0.70396435", "text": "def initialize(options = nil)\n @options = options || @@default_options\n @api_key = @options[:api_key] || @options[:oauth_consumer_key]\n @shared_secret = @options[:shared_secret]\n @rest_endpoint = @options[:res...
[ { "docid": "c01de492f58c0ac3b7e0c3e397990eb9", "score": "0.79232925", "text": "def initialize(api_key = nil, shared_secret = nil, options = nil)\n @api_key = api_key || @@default_api_key\n @shared_secret = shared_secret || @@default_shared_secret\n @options = options || @@default_options\n @...
4a815f635f627645250758de130836f9
DELETE /links/1 DELETE /links/1.json
[ { "docid": "3a4d422ac308a775301b5e5249835a56", "score": "0.72376317", "text": "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }...
[ { "docid": "45db0dd30998091a7c52fa8553fa3637", "score": "0.75310004", "text": "def destroy\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "7ba6fbe4387588d244d7a76800c926...
cbfe70a26830eaefb847a61099535d19
The Great Computer Language Shootout contributed by Gabriele Renzi
[ { "docid": "e34b73a81e9658352704ebc248b4728a", "score": "0.0", "text": "def takfp x, y, z\n return z unless y < x\n takfp( takfp(x-1.0, y, z),\n takfp(y-1.0, z, x),\n takfp(z-1.0, x, y))\nend", "title": "" } ]
[ { "docid": "0d43bd6b1b8f4127d756d2d46c3f96bf", "score": "0.59821683", "text": "def take_bath\n self.hygiene += 4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n end", "title": "" }, { "docid": "0d43bd6b1b8f4127d756d2d46c3f96bf", "score": "0.59821683", "text": "def take_b...
7e8648be18948ed9a84a5b33a44c41be
List Tags Returns an array of Tag objects
[ { "docid": "ee8921ee20c9210e06340e2b8c159b35", "score": "0.0", "text": "def list_tags_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagsApi.list_tags ...'\n end\n if @api_client.config.client_side_validation && !opts[:'l...
[ { "docid": "ab239355c19730b1272435965e9fb6a4", "score": "0.7970689", "text": "def list_of_tags\n tag_list\n end", "title": "" }, { "docid": "03aed83d9d03ecbeb45773b9ee5962cf", "score": "0.78024685", "text": "def taglist\n\tself.tags.map {|t| t.name}\n end", "title": "" }, ...
e43b5cb745948b7e9ec0615920729f79
Instantiates a new synchronizationJobRestartCriteria and sets the default values.
[ { "docid": "7ef81c87eb67a10f03b6ac27e68651f1", "score": "0.0", "text": "def initialize()\n @additional_data = Hash.new\n end", "title": "" } ]
[ { "docid": "49f85eb76a6f53c53664e57dd21a7e03", "score": "0.5586233", "text": "def initialize(child_specs, restart_strategy, max_restart_count=3, max_restart_window=5)\n @child_specs = Hash.new\n child_specs.each {|child_spec| @child_specs[child_spec.child_id] = child_spec}\n\n ...
332b535096aa74e68a16d108ebf287eb
Removes the target from the dom. The target can either be a dom id string or an object that responds to to_key, which is then called and passed through ActionView::RecordIdentifier.dom_id (all Active Records do). Examples:
[ { "docid": "43ed0dd2b0092cda669b791f2535424a", "score": "0.66102713", "text": "def remove(target)\n action :remove, target, allow_inferred_rendering: false\n end", "title": "" } ]
[ { "docid": "642c5bcc5a935c607bcb3b5f2d86fa3c", "score": "0.6704681", "text": "def remove(target = nil)\n self.class.remove(self.component_key, target)\n end", "title": "" }, { "docid": "9818092a3108f9d7378a3e99426cfdcf", "score": "0.66865665", "text": "def remove(target = nil...
9666815cf85f5fc12b88d350405f4385
GET /models/1 GET /models/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "26c20be6e6a40993737bf1e78bfc7b38", "score": "0.67585015", "text": "def show\n\n @model = Model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end", "title": "" }, { "docid": "3210adf4b32...
bb5305d70c07287ad57c6b43388016c9
GET /propiedads GET /propiedads.json
[ { "docid": "77cf2b89744ca33527a371ce2fa94651", "score": "0.0", "text": "def index\n @propiedads = Propiedad.all\n if current_user\n if current_user.role=='admin'\n else\n respond_to do |format|\n format.html { redirect_to :root, notice: 'Tu cuenta debe ser de tipo...
[ { "docid": "acdc3b2b66cde364c6d33c7fad2ba220", "score": "0.678837", "text": "def index\n @propiedads = Propiedad.all\n end", "title": "" }, { "docid": "397753e4473df4d73e604f5001dc8ac7", "score": "0.6395755", "text": "def index\n render json: @ads = Ad.all\n end", "title"...
49c5459772143e3c9000700fa836e53e
Provides operations to call the assignLicense method.
[ { "docid": "502621975a06a55e657b8e3af0ff1d69", "score": "0.7293965", "text": "def assign_license()\n return MicrosoftGraph::Groups::Item::AssignLicense::AssignLicenseRequestBuilder.new(@path_parameters, @request_adapter)\n end", "title": "" } ]
[ { "docid": "d4e5ccc73cd644bf0e0aab506d205ee3", "score": "0.76020235", "text": "def set_license\n @license = @software.licenses.find(params[:id])\n end", "title": "" }, { "docid": "6cf1ecc09bd656b741e5af9baf10901d", "score": "0.7581178", "text": "def set_license\n @licens...
61d5aae0afe9719cc7e63f4442a7366f
Changing this method requires you to fix save_results? method
[ { "docid": "2a47e9d3dc29093b15efcb3e52196d0c", "score": "0.0", "text": "def initialize_data_arrays_for_multiple_runs\n hist_results = Array.new([[\"Filename\"],[\"Volume_Sum\"]]) \n raw_results = Array.new([[\"Filename\"],[\"Avg._Diameter\"],[\"Avg._Volume\"]]) \n return hist_results,raw_results\ne...
[ { "docid": "b0c452c3fff43f873bed3258c6419023", "score": "0.81008625", "text": "def save(results); \n @results = results; \n end", "title": "" }, { "docid": "248431fe5505bf312832a720403e8c36", "score": "0.80010504", "text": "def save(results)\n @results = results\n ...
38de0f0134245913fd0c7540cfb5c1b4
logs in a user
[ { "docid": "67d70331fc5083c51445d9b0a40548c0", "score": "0.0", "text": "def login\n user = Account.authenticate(params[:email], params[:password])\n if user\n session[:user_id] = user.id\n else\n flash[:error] = \"Invalid username or password\"\n end\n\n if user && user.account_...
[ { "docid": "39d95e452910dd9c69fdad7b4834aa1b", "score": "0.8484374", "text": "def log_user_in(user)\n login(user)\n end", "title": "" }, { "docid": "09303a73586934e910e61d042e475676", "score": "0.77813745", "text": "def login\n\t\tlogin_user\n\tend", "title": ...
2ad77b359d226856134d19c2129babc9
Return the name of the current branch
[ { "docid": "b7c197096c2c552ca5063164becbe410", "score": "0.80956787", "text": "def current_branch\n git('branch')[/^\\* (.*)$/, 1]\n end", "title": "" } ]
[ { "docid": "1f24987d8aab8f697754daa85a594820", "score": "0.90367657", "text": "def branch_name\n $repo.current_branch\n end", "title": "" }, { "docid": "80e254507b1408a3de7eff9b58c6af15", "score": "0.8721565", "text": "def branch_name\n `git name-rev --name-only HEAD`.stri...
b9df2e637cf3e0928cde80b88cdaaddd
the strings length plus padding
[ { "docid": "d4a106f7c2e354c602c9b2cfad1c2db1", "score": "0.68028456", "text": "def length\n string.length\n end", "title": "" } ]
[ { "docid": "137436a6fdadb72420f9c61b50580e28", "score": "0.76501566", "text": "def len ; 24 ; end", "title": "" }, { "docid": "e40783067a34ecaf7a915abd0a451366", "score": "0.7299691", "text": "def padded_width; end", "title": "" }, { "docid": "bd6de429eadd9118076071152a5c...
5b2822759f16bbbf8897036dd297a5ad
Retrieves your email rejection blacklist. You can provide an email address to limit the results. Returns up to 1000 results. By default, entries that have expired are excluded from the results; set include_expired to true to include them.
[ { "docid": "efb40a3a90609840e46b6d02ca3d8933", "score": "0.72099966", "text": "def list(email=nil, include_expired=false, subaccount=nil)\n _params = {:email => email, :include_expired => include_expired, :subaccount => subaccount}\n return @master.call 'rejects/list', _params\n ...
[ { "docid": "1c272ef40b9c97c81a73118e38adf2a1", "score": "0.7205243", "text": "def list(email=nil, include_expired=false, subaccount=nil)\n _params = {:email => email, :include_expired => include_expired, :subaccount => subaccount}\n return @master.call 'rejects/list', _params\n end", "t...
203c8f354a3a89e6798d02f6830b9f47
Returns the value of attribute attributes. source://language_serverprotocol//lib/language_server/protocol/interface/delete_files_params.rb25
[ { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.0", "text": "def attributes; end", "title": "" } ]
[ { "docid": "98040b8f1ee5ec6f0143e5087152c8f5", "score": "0.6878059", "text": "def attachment_delete\n @attributes[:attachment_delete]\n end", "title": "" }, { "docid": "898db0d412dd734184884a9f4710e1e1", "score": "0.6644757", "text": "def get_attributes_needed_for_deleting\n ...
5c82d70c7720c6791253056955382450
Process a GSS authentication buffer. If no buffer is specified, the request is assumed to be the first in the negotiation sequence.
[ { "docid": "5995e9f666b3bdc17ef5c0d3526d556b", "score": "0.80727255", "text": "def process_gss(buffer=nil)\n @gss_authenticator.process(buffer)\n end", "title": "" } ]
[ { "docid": "8edefb65d911abb8a59eba98ebb7109b", "score": "0.6453819", "text": "def process_buffer\n if waiting_for_username?\n read_username_from_buffer\n\n elsif waiting_for_password?\n read_password_from_buffer\n\n else\n super\n end\n ensure\n @buffer.clear\n end", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "167e2ee1920af0afb96ca27ea65f826d", "score": "0.0", "text": "def set_interact\n @interact = Interact.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...
356277883ffc4d4850c92a11ced41a4e
Return the public 'routable' address for this resource or nil if not known yet.
[ { "docid": "717a2f1d17d5ad4eae4018cbaf05bcc0", "score": "0.59223145", "text": "def resource_address\n resource_topic.address\n end", "title": "" } ]
[ { "docid": "e2ea1046a2029b5f1f2bff6708efbfd4", "score": "0.6579733", "text": "def public_address\n self\n end", "title": "" }, { "docid": "f7e75037c1363188a73ea402c38a425a", "score": "0.62703615", "text": "def public_ip_address\n public_ip_addresses.first\n en...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "5b2658f2ab3be2319686c07f983e6ab9", "score": "0.0", "text": "def set_booking\n @booking = Booking.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60320485", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6013371", "text": "de...
7c725fc8bc505092c38b5b7f249a0543
Provides a list of fields that are actually dates. ==== Returns Array:: A list of field names as symbols.
[ { "docid": "9d33a503648d1b27fbfae1ba1abe8ca1", "score": "0.0", "text": "def boolean_fields\n return [:required]\n end", "title": "" } ]
[ { "docid": "b24408a508ee456aef7c587aae85b855", "score": "0.82710546", "text": "def date_fields\n return []\n end", "title": "" }, { "docid": "b2520c70bd22b86b3b3dde06b5d50dcd", "score": "0.71599215", "text": "def day_fields\n []\n end", "title": "" }, { "d...
3b8621c0068e0ae973ca94693930615a
limits of department report's authority is departmanager
[ { "docid": "3c7b7801b51a64c1d182936922d92719", "score": "0.0", "text": "def submit_department_report(to_submit_report,name,title)\n select_report_option to_submit_report\n switch_to_man_frame\n department_tab_click\n click_title\n input_department_r...
[ { "docid": "d23bffe5d07841548c59365e3991d77e", "score": "0.616436", "text": "def can_do_admin?\n true # current_user[:department_name] == 'IT'\n end", "title": "" }, { "docid": "8b4d1684d62849c26cd18d3c5de6ca0d", "score": "0.6076354", "text": "def for_department(departmen...
45f40ef4174455c306d4d0b2aee69846
! means raise error if not working Relates to new.html.erb file This controller relates to that view new creates instance of Tweet.rb (model)
[ { "docid": "8f7a3ded47af209576afb32adf9b5a0b", "score": "0.6765586", "text": "def new\n\t\t@tweet = Tweet.new\n\t\t@tweets = current_user.tweets\n\tend", "title": "" } ]
[ { "docid": "db08ea12afb0f36bce6a0884901299f9", "score": "0.73093134", "text": "def new\n @tweet = Tweet.new\n #this creates an empty tweet object in the 'new' tweet view that we can fill in with data\n end", "title": "" }, { "docid": "814a1c44d499bba992e267a51a232971", "score": "0...
2982db929440b026ff8f85798ec3e1ba
Saves a YAML copy of the database, with binary values Base64 encoded (URL safe variant)
[ { "docid": "b87ce89ad04dc8a872d02a5642e584b2", "score": "0.0", "text": "def export_secrets(filename = default_backup_file)\n @connection.store.export_yaml filename\n filename\n end", "title": "" } ]
[ { "docid": "7f6188316badaeb73b93e65e7a6dc9d2", "score": "0.65587574", "text": "def save\n File.open(@dbfile,'w') do |f|\n YAML::dump(@db.values,f)\n end\n end", "title": "" }, { "docid": "cdb68fc0f080605f5a01f875a4fbc440", "score": "0.65018004", "text": "def save_yaml(dat...
ce5b6b1e7c3bbd558bdfe1a5b0f11c00
Send notification to OneSignal
[ { "docid": "6ef25069c2822555e15cef565a07a969", "score": "0.682144", "text": "def notify_players!\n # POST request to one signal server\n res = Typhoeus.post(\"#{ONE_SIGNAL_URL}/v1/notifications\",\n headers: {\n 'Content-Type' => 'application/json;charset=utf-8',\n 'Authorizati...
[ { "docid": "8766ed46012834bdfe22a6ca1f7a8b4f", "score": "0.7941034", "text": "def send_notification\n end", "title": "" }, { "docid": "1cd28c635560c673eb2dfa30eb23e5cc", "score": "0.7383256", "text": "def send_notification\n puts \"this is the notification\"\n end", "title...
74e41cba3b8b749bd77ba52f3a851142
Like .value but casts to float since Redis addresses these differently.
[ { "docid": "db3d20a1b5640eb139f1ec4505c55fa5", "score": "0.6810893", "text": "def to_f\n redis.get(key).to_f\n end", "title": "" } ]
[ { "docid": "0b2f7f2a8b2d1e75daa85bf94908ebcb", "score": "0.7860853", "text": "def typecast_value_float(value)\n Float(value)\n end", "title": "" }, { "docid": "02ae94697a28f1d7afd57c600412eb81", "score": "0.7796705", "text": "def float\n Util.from_bytes :float, value\n en...
44882a5664915cf60747f81fd0fa6cdd
Returns a filename for the xlsx file using the collection_name and current date such as 'myarticles20110624.xlsx'.
[ { "docid": "1d212a6ae5805022854b38df11169063", "score": "0.8644713", "text": "def xlsx_filename\n \"#{resource_collection_name.to_s.gsub('_', '-')}-#{Time.now.strftime(\"%Y-%m-%d\")}.xlsx\"\n end", "title": "" } ]
[ { "docid": "24e1acedae62e7336d2a78d1fdc2d838", "score": "0.81660277", "text": "def xls_filename\n timestamp = Time.now.strftime('%Y-%m-%d')\n \"#{resource_collection_name.to_s.tr('_', '-')}-#{timestamp}.xls\"\n end", "title": "" }, { "docid": "45f5cc45d3090eb8961ab46fbd3b2...
afe31e00985661ddff351ca900db1a1d
GET /customer_debit_notes/new GET /customer_debit_notes/new.xml
[ { "docid": "cfce143ffdaef432270f15edc69f266b", "score": "0.0", "text": "def new\n @customer_debit_note = CustomerDebitNote.new\n @customer_debit_note.cust_debit_note_date = Date.today\n @customer_debit_note.customer_id = 0\n @customer_debit_note.save!\n session[:customer] = 0\n redirec...
[ { "docid": "cbea0b97ee400dcbdacf806757517d93", "score": "0.7253259", "text": "def new\n @debit_note = DebitNote.new_note(@company)\n @from_accounts = TransactionType.fetch_from_accounts(@company.id, 'journal')\n @to_accounts = TransactionType.fetch_to_accounts(@company.id, 'sales')\n @debit_...
13b0936655392d4aaef08bbde0556d78
overriding method from activefedora: lib/active_fedora/semantic_node.rb The purpose of this override is to ensure that a collection cannot contain itself. TODO: After activefedora 7.0 is released, this logic can be moved into a before_add callback.
[ { "docid": "d5d3ed06e5dde83d496b19b9271de421", "score": "0.0", "text": "def add_relationship(predicate, target, literal=false)\n return if self == target\n super\n end", "title": "" } ]
[ { "docid": "63a66ed5d2a6ec604e2aaa97e0cfb9e5", "score": "0.6694819", "text": "def collection_node; end", "title": "" }, { "docid": "63a66ed5d2a6ec604e2aaa97e0cfb9e5", "score": "0.6694819", "text": "def collection_node; end", "title": "" }, { "docid": "4cf766313743b6163ae0...
831f5d3f594673c5d9a2d1e2e03e9b32
configure the current model to automatically query and populate objects based on the current tenant see Multitenantcurrent_tenant
[ { "docid": "17a05c880420624d5bfb07db73dfa7b3", "score": "0.0", "text": "def belongs_to_multitenant(association = :tenant)\n reflection = reflect_on_association association\n before_validation Proc.new {|m|\n m.send(\"#{association}=\".to_sym, reflection.klass.current_tenant) if reflecti...
[ { "docid": "0fc9abc0cda4d53dd46bc666ca1b5fe1", "score": "0.68533707", "text": "def set_current_tenant\n\n # Grab the current host\n @current_tenant = Tenant.current = Tenant.where(:host => request.host.to_s.downcase).first\n\n # Create a tenant record for this host if none exists. \n @curren...
b5c3d37d1a302cbdd1fc857ee5e776aa
Do not edit the methods above this line
[ { "docid": "992b7673b5e24c9cbce2dfc0919c798e", "score": "0.0", "text": "def fits_ride?(ride_minimum_height)\n @height >= ride_minimum_height\n end", "title": "" } ]
[ { "docid": "2290804b238fc95bfd6b38f87c6d2895", "score": "0.7218663", "text": "def override; end", "title": "" }, { "docid": "a9dd648a5d0d2e7d56223e7c753f5e2e", "score": "0.7160897", "text": "def telegraphical()\n end", "title": "" }, { "docid": "b6b2bcc0062aeb115edab7b...
dbff4776947400620b88f8fc829c2547
create the number queue should be threadsafe, probably a better way to do this but didnt want to create a ton of rows in the DB and a ton of queries
[ { "docid": "5a27f8c9a6193b213cc79cf319778185", "score": "0.8232394", "text": "def create_number_queue\n\t\tif (@@number_queue.nil?)\n\t\t\t@@number_queue = Queue.new\n\t\t\ttotal_numbers = TOTAL_SMALL_LOCKERS + TOTAL_MEDIUM_LOCKERS + TOTAL_LARGE_LOCKERS\n\t\t\ttotal_numbers.times do |i|\n\t\t\t\t@@numbe...
[ { "docid": "4c871a08d9165d5c1bd483601ee17812", "score": "0.675646", "text": "def create_job_queue\n (0 .. @baskets.rows.length - 1).each do |row_index|\n @job_queue << row_index\n end\n end", "title": "" }, { "docid": "fce0e822a1fa0ef5ffe225dc33856352", "score": "0.6524365", ...
5c82aa4bb5ac447a55a1a760a394e906
Prints a string listing warnings or errors if there were any, otherwise does nothing.
[ { "docid": "9a68bc046cd437b01853753ce2d83e6b", "score": "0.6497962", "text": "def print_problems_if_any\n if @missing_required.size > 0\n puts \" Error: #{@name} missing required front matter: \" + @missing_required*\", \"\n site.config['morea_fatal_errors'] = true\n end\n ...
[ { "docid": "bf1b1f0e59e02b24aeb8359bb52f4422", "score": "0.713746", "text": "def print_warnings\n STDOUT.flush\n warnings.each do |warning|\n next if warning[:verbose_only] && !verbose?\n STDERR.puts(\"\\n[!] #{warning[:message]}\".yellow)\n warning[:actions].each do |acti...
1cd299dbfeface7cc88cc4e56fb67def
PATCH/PUT /musical_orders/1 PATCH/PUT /musical_orders/1.json
[ { "docid": "8b66fedf5c216ee02e99678d2f263b4c", "score": "0.7016467", "text": "def update\n respond_to do |format|\n if @musical_order.update(musical_order_params)\n format.html { redirect_to @musical_order, notice: 'Musical order was successfully updated.' }\n format.json { render ...
[ { "docid": "5475e478e362598519f05ab929db4ab8", "score": "0.6766305", "text": "def update\n @order = Order.find(params[:id])\n @order.update_attributes(order_params)\n render :json => @order\n end", "title": "" }, { "docid": "66c979dede895693d89bd15161614588", "score": "0.655147...
669b4080b6db84c895577491c7de6600
Default method, subclasses must override this
[ { "docid": "5afa0c7b2ebbc754d5fd7de1e8b3ed11", "score": "0.0", "text": "def run\n super\n\n #get entity name and type\n entity_name = _get_entity_name\n\n #headers\n headers = { \"Accept\" => \"application/json\"}\n\n # Get responce\n response = http_get_body(\"https://...
[ { "docid": "2290804b238fc95bfd6b38f87c6d2895", "score": "0.77684987", "text": "def override; end", "title": "" }, { "docid": "c294800a6c72a962070b4ca27d34a2fc", "score": "0.7488381", "text": "def default()\n #This is a stub, used for indexing\n end", "ti...
5522679ce74e98cc76786257c95ea490
actions renders a list of all the user's accepted contacts (friends)
[ { "docid": "0fac4c74c7d9113a91779c9375de8978", "score": "0.0", "text": "def index\n @title = \"#{[@tier, @topic].compact.map(&:name).join(' ')} #{ @tier.members_t}\".firstcase\n @people = do_search_people(@topic || @tier, :members, :with_tags => !request.xhr?,\n :sort => false, :sort_display ...
[ { "docid": "f7fef8e45d18203844764c6d9d0e9ad7", "score": "0.6708223", "text": "def index_friends\n\t@user = current_user\n\trender :friends\n\n\n end", "title": "" }, { "docid": "a6889c6d0528aed72f8c28fb2ae1b293", "score": "0.66650164", "text": "def index\n init_displayed_user(cur...
07d4b9ed977cf0172acfb23e2f19ba5c
DELETE /concepts/1 DELETE /concepts/1.json
[ { "docid": "33bd9f8d8abad2c83f2b494f7e7bf94f", "score": "0.0", "text": "def destroy\n if params[:persist]\n @concept.aliases.each do |a|\n Event.change_names(@world, a.name, @concept.name) \n end\n end\n @concept.destroy\n respond_to do |format|\n format.html { redirect...
[ { "docid": "583264a590e5b1442195c55f48e23453", "score": "0.76057196", "text": "def destroy\n @concept.destroy\n respond_to do |format|\n format.html { redirect_to concepts_url, notice: 'Definicja pojęcia została usunięta.' }\n format.json { head :no_content }\n end\n end", "title...
07baa49dad583bce9b7e1588e5dd8190
Move up to the next option unless the value is 0
[ { "docid": "94b1c34f8d94c8bd15dc8e624bf9ee0b", "score": "0.0", "text": "def move_up\n unless @value.eql? 1\n @y -= 50\n @value -= 1\n end\n end", "title": "" } ]
[ { "docid": "24ef7d6af6b70f8208596b77e79980bc", "score": "0.6068406", "text": "def select_next_value\n self.choice = next_value.to_sym if next_value?\n self\n end", "title": "" }, { "docid": "6711d6463594a40b51ea5d34ebd8b5c4", "score": "0.558241", "text": "def...
fa94fe3fc41082d578f9b91a1e215b43
DELETE /plays/1 DELETE /plays/1.xml
[ { "docid": "445715e9eb7d29e1fff07cf8e43b829a", "score": "0.70156175", "text": "def destroy\n @play = Play.find(params[:id])\n project = @play.project\n @play.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_plays_path(project), :notice => \"Stück gelöscht.\") }\n ...
[ { "docid": "30612d383904f9a0209b18809825a08f", "score": "0.7532962", "text": "def destroy\n @play = Play.find(params[:id])\n @play.destroy\n\n respond_to do |format|\n format.html { redirect_to plays_url }\n format.xml { head :ok }\n end\n end", "title": "" }, { "doci...
b90bb7afd27cfd14699ad26f03412309
Adds a slot from a name and a value.
[ { "docid": "2777844b2625a0fef1d39b2f54dd5ba2", "score": "0.90705043", "text": "def add_slot(name, value)\n slot = Slot.new(name, value)\n @slots[:name] = slot\n slot\n end", "title": "" } ]
[ { "docid": "1fb60e901d1eb427b9bdd83bd39c81cc", "score": "0.7433076", "text": "def []=(name, value)\n @slots[name] = value\n end", "title": "" }, { "docid": "2745c687ec4fa08d64f0d2950069229c", "score": "0.7048113", "text": "def []=(slotname, value)\n slotname = slotname.t...
168280ac7bde0c8eeec6f8bee1fd83d5
Sets the maximum LDAP response cache sizes in bytes. If zero is specified, the cache is not activated.
[ { "docid": "67b9b2a90802f549a6d21749e4812369", "score": "0.618782", "text": "def set_cache_size(opts)\n opts = check_params(opts,[:sizes])\n super(opts)\n end", "title": "" } ]
[ { "docid": "a71ee32bea88ea893b228e3343ed5a7d", "score": "0.69872034", "text": "def size=(max)\n\t\t\t\tlock_cache do\n\t\t\t\t\tprune while getdata(@cache_count,false) > max\n\t\t\t\t\tputdata(max,@cache_maxsize)\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "a419ae9be6d1f343b4cbedfc4c...
c93cf0351161233bea6a918bd1cb3b93
Loads the user's +config.rb+ and all model files.
[ { "docid": "7a701e27bab8357b30f5dd26ceb3f2bd", "score": "0.60068935", "text": "def load(options = {})\n update(options) # from the command line\n\n unless File.exist?(config_file)\n raise Error, \"Could not find configuration file: '#{config_file}'.\"\n end\n\n confi...
[ { "docid": "18594dc927f0a375200f384481a1d41f", "score": "0.6934577", "text": "def load_user_config(config_path = nil)\n config_path = \"lita_config.rb\" unless config_path\n\n begin\n load(config_path)\n rescue Exception => e\n Lita.logger.fatal I18n.t(\n ...
739a0aee91d3c7aa60e315f33f7eddf3
Gets a random answer from the jService API, and does some cleanup on it: If the question is not present, requests another one If the question contains a blacklisted substring, request another one If the answer doesn't have a value, sets a default of $200 If there's HTML in the answer, sanitizes it (otherwise it won't m...
[ { "docid": "8e05e3dc59646ed4730eb962c44bc90b", "score": "0.7389503", "text": "def get_question(category_key = nil)\n if !category_key.nil? && data = $redis.get(\"category:#{category_key}\")\n category = JSON.parse(data)\n offset = rand(category['clues_count'])\n uri = \"h...
[ { "docid": "a6bcdd439b521721baa67588ade81754", "score": "0.77032286", "text": "def get_question\n uri = 'http://jservice.io/api/random?count=1'\n request = HTTParty.get(uri)\n puts \"[LOG] #{request.body}\"\n response = JSON.parse(request.body).first\n # Some questions have no question, some have b...
d492d792ada5d215911da3af8e66cd58
Platform icon. Make sure there are icons for all the different platforms and sizes in the public/images folder
[ { "docid": "a8bac053c3b9d9f38c29ef03b3398d94", "score": "0.83341295", "text": "def platform_icon(software, size=17)\n img = case software.platform.to_s\n when /windows/i\n \"icons/windows_#{size}.png\"\n when /mac/i\n \"icons/mac_#{size}.png\"\n when /linux/i\n \"i...
[ { "docid": "a2612c325576c557e46bd1a676fdb45e", "score": "0.82825935", "text": "def platform_icon(software, size=17)\n img = case software.platform.to_s\n when /windows/i\n \"icons/windows_#{size}.png\"\n when /mac/i\n \"icons/mac_#{size}.png\"\n when /linux/i\n \"i...
f54dd916bc5923c3315281214824178c
Used to remove an inactive user by their handle Params: +handle+:: inactive user's handle
[ { "docid": "e67a90631a4021f918c259eff7268036", "score": "0.7740451", "text": "def remove_user_by_handle(handle)\n ct = @handle_keys.key(handle)\n socket = @socket_keys.key(ct)\n @sockets.delete socket\n\n @handles.delete handle\n @handle_keys.delete ct\n @socket_keys.delete socket\n ...
[ { "docid": "201d7fb60bc72e5d912d8ce69bc405dd", "score": "0.7607864", "text": "def disable_user(handle)\n request(Net::HTTP::Delete, \"/api/#{API_VERSION}/user/#{handle}\", nil, nil, false)\n end", "title": "" }, { "docid": "8dab770a95acb3cda90d35e585a12c01", "score": "0.66911...
231fda66ec42e2c0d244e7dde98f4bbc
The autobuild description of a package by its name
[ { "docid": "0b237ced3f978fd4eaa86b5c3c129a32", "score": "0.7185975", "text": "def find_autobuild_package(name)\n find_package_definition(name)&.autobuild\n end", "title": "" } ]
[ { "docid": "af2b3dc0742a738663e3c8935ceb9f79", "score": "0.7146824", "text": "def description\n res = (@package.short_description ? @package.short_description : \"Description not available\") + \"\\n\"\n return res unless @package.long_description\n @package.long_description.each_line do ...
d0b7c529ea2194e17568da821df79e95
Creates an application version for the specified application. ==== Options ApplicationName: The name of the application. If no application is found with this name, and AutoCreateApplication is false, returns an InvalidParameterValue error. AutoCreateApplication: If true, create the application if it doesn't exist. Desc...
[ { "docid": "b04f5567440f7e38a6b85f29bd7e5493", "score": "0.73291695", "text": "def create_application_version(options={})\n if source_bundle = options.delete('SourceBundle')\n # flatten hash\n options.merge!({\n 'SourceBundle.S3Bucket' => sour...
[ { "docid": "0895b6825ade9966f95fbb0874f0e93d", "score": "0.72876585", "text": "def create_application_version\n resp = @elasticbeanstalk.create_application_version({\n application_name: @app_name,\n auto_create_application: true,\n description: \"#{@app_name} version #{@sha_hash}\",\n ...
17828b1801c21d8d731041585f3dea41
all tasks must implement a run method and call super, so this code should be run immediately upon entry into the task
[ { "docid": "06f95c7f09ad829ee5df2c894aa4bf6b", "score": "0.0", "text": "def run(opts)\n # pull our required arguments out\n required_options = self.class.metadata[:options].select { |a| a[:required] }\n\n # colllect all the missing arguments\n missing_options = []\n re...
[ { "docid": "559113bb1913127977405593752f673a", "score": "0.7475063", "text": "def task; end", "title": "" }, { "docid": "559113bb1913127977405593752f673a", "score": "0.7475063", "text": "def task; end", "title": "" }, { "docid": "6b354b9ba0e769b3e0a86a9012c8de1c", "sc...
ee19362954906322a208ba6ed4242b78
An abstraction of the `dup.instance_eval` pattern used throughout this class.
[ { "docid": "041fe0fb2cb150ae8988e4f9a54aba30", "score": "0.0", "text": "def alter(&block); end", "title": "" } ]
[ { "docid": "e10a081020525fa19954d2f1a0a32c5f", "score": "0.61784726", "text": "def eval(*args)\n instance_eval(*args)\n end", "title": "" }, { "docid": "4aad92ab79b362345d93774aa87bf465", "score": "0.61717904", "text": "def eval(*args)\n\t instance_eval(*args)\n\tend", "titl...
b7fa7b2e6d44c85bc996f2fdc01e9f51
Indirect associations Validations Scopes
[ { "docid": "4d79f43d17f69a4c13d70bbff59918a3", "score": "0.0", "text": "def to_s\n username\n end", "title": "" } ]
[ { "docid": "ab8f5544ec344bfc5af3ed332fb958b1", "score": "0.72087616", "text": "def validate\n return true if scope.blank?\n assoc, model_class, scoper_class = model_name.pluralize, model_name.to_class, scope.to_class\n error_message = \"Couldn't find a valid relation from #{scope.pluralize} to ...
2a0ea1f293b572ac720d9ff1408b69f7
get the string inside the first [[]]
[ { "docid": "288c9e6fb77327c2470320745df01dce", "score": "0.57529235", "text": "def rmDBrakets (str) \n return str[(str.index('[[')) + 2..(str.index(']]') - 1)]\n end", "title": "" } ]
[ { "docid": "69ca7b2d348667baff683e10dc21830f", "score": "0.667853", "text": "def extract_first(str)\n extract_multi(str).first\n end", "title": "" }, { "docid": "60b6e24b67c560f7c645bb7e35d8c55e", "score": "0.6602822", "text": "def data\n match = /.*\\[(.*)\\]/.match...
90312a83933d5cd2f7a1cc1c3248fdde
Performs authentication. Calls success! if authentication was performed successfully and halt! if the authentication information is invalid
[ { "docid": "422d711b5c8ce4b1bc9e0fd9ed663815", "score": "0.0", "text": "def authenticate!\n given = env[\"HTTP_X_AKAMAI_G2O_AUTH_SIGN\"]\n sign_data = \"#{env[\"HTTP_X_AKAMAI_G2O_AUTH_DATA\"]}#{request.path}\" # even though the akamai documentation always specifically mentions \"URL\" they actuall...
[ { "docid": "092108b14e7afd46c56210c7272b3b7a", "score": "0.7701995", "text": "def authenticate!\n success! @@user\n end", "title": "" }, { "docid": "e1f47d83e6f263d2dc06bce19cfe2154", "score": "0.7516577", "text": "def authenticate!\n error!('401 Unauthorized', 401) un...
3f52973818698070d105a2c20fdb77a5
Serializes information the current object
[ { "docid": "876c05f83e7e0558bb9be04c169872ac", "score": "0.0", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_enum_value(\"action\", @action)\n writer.write_enum_value(\"actionType\", @action_type)\...
[ { "docid": "d162e297d0f84ca205afa381c3f6a428", "score": "0.7830697", "text": "def serialize\n Marshal.dump(self)\n end", "title": "" }, { "docid": "762bca0e2db3ff19d91cc4521bb1e1d9", "score": "0.7645999", "text": "def serialize(object) end", "title": "" }, { "docid": ...