query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
1efd555cb8bf15fabd25f9af84daae81
Part Two Confident that your list of box IDs is complete, you're ready to find the boxes full of prototype fabric. The boxes will have IDs which differ by exactly one character at the same position in both strings. For example, given the following box IDs: abcde fghij klmno pqrst fguij axcye wvxyz The IDs abcde and axc...
[ { "docid": "8dfaf0002609c4b2dfabb8ed8c90c1eb", "score": "0.52129", "text": "def common_letters(input_filename)\n ids = []\n\n File.readlines(input_filename).each do |line|\n line = line.strip\n\n ids.each do |id|\n diff_index = diff_by_one(id, line)\n if diff_index != -1\n retur...
[ { "docid": "e8de91825639304cb9e844e06baf7e90", "score": "0.6760053", "text": "def onlyOneCharacterDifference(boxIdOne, boxIdTwo)\n mismatchCount = 0\n (0..boxIdOne.length - 1).each do |charIdx|\n if boxIdOne[charIdx] != boxIdTwo[charIdx]\n mismatchCount = mismatchCount + 1\n end\n...
8cc8102c257c1f3fb7ae5a94ab5421d7
returns the number of days the customer is bound to this product as in "mindestlaufzeit"
[ { "docid": "f8beda337e21e55babcd74118ba29b33", "score": "0.5879702", "text": "def term_in_days\n if self.is_subscription?\n if RAILS_ENV == \"production\" && self.attributes.symbolize_keys.keys.include?(:term_in_days)\n self[:term_in_days] || self.monthly_term_days\n else\n # ...
[ { "docid": "3f05d056545be8c0b6c065d568d77d59", "score": "0.64800394", "text": "def pro_rated_days\n _date_begin = pro_rata_start_date\n _date_end = subscription_start_date\n if _date_begin.blank? || _date_end.blank?\n 0\n else\n ((_date_end - _date_begin) / 1.day).round(0).to_i # n ...
376b83660a76a5aa7b32ed0da4840257
Checks if the link should be modified
[ { "docid": "71bc2094f7ee8ab5f8829575328030ba", "score": "0.0", "text": "def skip_link?(href, exclusions)\r\n local_link?(href) || excluded?(href, exclusions)\r\n end", "title": "" } ]
[ { "docid": "1b196cfcba9a455beb88ad145697eb71", "score": "0.74422264", "text": "def update_links_to_if_changed\n return true unless content_was_changed\n update_links_to\n end", "title": "" }, { "docid": "cc0c141e12f6607d24dcac96327368eb", "score": "0.7437337", "text": "def pop...
d4f08dfa0daa301df064378841277c5d
toString method dev purposes
[ { "docid": "752b61e1172141fea1deea0efbce6807", "score": "0.0", "text": "def to_s\n \"#{self.singleton_class} name: #{@name}, expires_in: #{@expires_in}, quality: #{@quality}\"\n end", "title": "" } ]
[ { "docid": "86129319a2a6447f6fe874d37b39c363", "score": "0.8699825", "text": "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "title": "" }, { "docid": "261e99bc26f16e3740139586062394ef", "score": "0.8449966", "te...
fb72d4a80bf9f47e4a096d33a0f4122a
Adds a true/false status for the success of the "overall" scan. We report true if all enforced scanners passed, else false.
[ { "docid": "50e0fd1db697afd3900eb166c48599e8", "score": "0.7174019", "text": "def report_overall_scan\n failed_scans = @report.to_h[:scans].map do |scan, info|\n scan if info['passed'] == false\n end.compact\n\n if (failed_scans & @config.enforced_scanners.to_a).any?\n @repo...
[ { "docid": "39019c14d488d96db8820b1bee5df87f", "score": "0.6765009", "text": "def scan_succeeded?\n report_h = @report.to_h\n report_h[:scans]['overall'] && report_h[:scans]['overall']['passed']\n end", "title": "" }, { "docid": "7e88a8f3dd76e8ce9e32119894d32e19", "score": "...
1ed015dc313ec4f38a7187948a7445f1
Patches for building. The first block is for clang compatibility. The rest is adapted from macports:
[ { "docid": "e8f277f31fb65847265234ca2c98c49f", "score": "0.0", "text": "def patches; DATA; end", "title": "" } ]
[ { "docid": "3c6f0a521524f8da43518b4cb62880ef", "score": "0.7523391", "text": "def patches\n DATA if ENV.compiler == :clang and !build.devel?\n end", "title": "" }, { "docid": "54057c00d2a96c90ba0f319be52ecd37", "score": "0.7409837", "text": "def patches\n DATA if ENV.compiler ...
6269b3a04828d2447aa72b67d23f71da
7. Naming Animals. Fix the following code so that the names are printed as expected.
[ { "docid": "012d4560db2b69f435efba976210072a", "score": "0.0", "text": "def dog(name)\n return name\nend", "title": "" } ]
[ { "docid": "32e5296c458b9ee38bccf5b998e63449", "score": "0.7199277", "text": "def do_names\n animal_list = get_names()\n print_names(animal_list)\n end", "title": "" }, { "docid": "cbf23f223866d5b1a03b30b4149aefda", "score": "0.6916469", "text": "def name\n @named_dog\n en...
8c70f0f44b1ac72a97a058b07b113262
Test if a given content is resolved Parameters:: iContent (_Object_): The tester's content Return:: _Boolean_: Is the content resolved ?
[ { "docid": "17505ae3b322e36178957f026ee1739f", "score": "0.66639316", "text": "def is_content_resolved?(iContent)\n # * *iContent* (<em>list<String></em>): The list of Exes to resolve (extensions might be guessed)\n rSuccess = false\n\n # For each required file, test that it exists ...
[ { "docid": "90b4ffcaf90bdf2324477cc903853170", "score": "0.6875583", "text": "def content?(name, content)\n page = Islay::Pages.definitions[name]\n page and page.contents[content].present?\n end", "title": "" }, { "docid": "bbe94686aeed28c0a70523b63ae9a804", "score": "0.66630656",...
311f3c8d45ae0e54e6b640092d85e39e
list all keys. only for debugging/admin purposes
[ { "docid": "c8a18ddb00798082abcd2228b988e516", "score": "0.0", "text": "def index\n @keys = Key.all\n render json: @keys\n end", "title": "" } ]
[ { "docid": "f501cc50e90bb1ff7ba4af4d9162ef1b", "score": "0.85903525", "text": "def list_all_keys(options = {})\n get \"admin/keys\", options\n end", "title": "" }, { "docid": "7f5e1d6d9a40144496b31c9ef06abb6c", "score": "0.8529201", "text": "def list_keys\n request(:...
3b59680db481143fc2eb1c93b6aea234
create a while loop to run as long as we have nodes in our open set
[ { "docid": "ac787ce1cb38470a5466add1d21a5746", "score": "0.5750812", "text": "def findPath\n\t\twhile @open_nodes.size > 0 do\n\t\t\t# grab the lowest f(x)\n\t low_i = 0\n\t for i in 0..@open_nodes.size-1\n\t if @open_nodes[i].fCost\t< @open_nodes[low_i].fCost || (@open_nodes[i].fCost =...
[ { "docid": "e600295f6c581bb8de9e710719144ce2", "score": "0.641726", "text": "def wait_for_nodes(count)\n pass_until(timeout: 3) do\n node_set.nodes.length == count\n end\n end", "title": "" }, { "docid": "e7fd9b333695666bd110b3341621e0b2", "score": "0.6273383", "t...
54d505a2e669ec2f446b48fa1a906f13
PATCH/PUT /pkhds/1 PATCH/PUT /pkhds/1.json
[ { "docid": "5c4b0a739c11308b5b26d12ac1923f40", "score": "0.61149853", "text": "def update\n respond_to do |format|\n if @pkhd.update(pkhd_params)\n format.html { redirect_to edit_pkhd_path(@pkhd), notice: 'Pemakaian was successfully updated.' }\n #format.json { render :show, status...
[ { "docid": "8d6a61f3186174209e44862cb0ae05d7", "score": "0.67255294", "text": "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATC...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "fd2c14b928193d2d2ffb2b5113534498", "score": "0.0", "text": "def favorite_route_params\n params.require(:favorite_route).permit(:origin_city_id, :destination_city_id, :user_id, :active)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496729", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958585", "text": "def strong_params\n params.require(:request).permit(param_white...
cf65995fef826a231474012546955a5a
DELETE /expense_items/1 DELETE /expense_items/1.xml
[ { "docid": "d8230fa10198aab98a454c0545d24146", "score": "0.7001124", "text": "def destroy\n @expense_item = ExpenseItem.find(params[:id])\n @expense_item.destroy\n\n respond_to do |format|\n format.html { redirect_to expense_month_url(\n Date.today.year, Date.today.mon) }\n f...
[ { "docid": "ebcb9406ef8eb58373edbcf11a370458", "score": "0.7093295", "text": "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, ...
beaf318003e2c97cc665ddbae8f474eb
This endpoint accepts a single raw_time_row and returns an identical raw_time_row with data_status, split_time_exists, lap, and other attributes set POST /api/v1/event_groups/1/enrich_raw_time_row
[ { "docid": "4bf9db47556f3c8e04316f0079734e83", "score": "0.84097165", "text": "def enrich_raw_time_row\n authorize @resource\n event_group = EventGroup.where(id: @resource.id).includes(:events).first\n\n raw_times_data = params[:data] || ActionController::Parameters.new({})\n ...
[ { "docid": "a18e8524cd6bdb79c3acd4be61b49ef6", "score": "0.6794284", "text": "def submit_raw_time_rows\n authorize @resource\n event_group = EventGroup.where(id: @resource.id).includes(:events).first\n\n data = params[:data] || []\n errors = []\n raw_time_rows = []\n\n...
b27d35b7f5763b72074aa9b7f9bb3616
'to_h' lets us look at the read/write hash structures
[ { "docid": "1fc1c94826fd5869073b86d4d9955f35", "score": "0.0", "text": "def to_h( which = :read )\r\n { @name => (which == :read) ? @has : @should } \r\n end", "title": "" } ]
[ { "docid": "7b80a5cd34b3ff10c045a4c7d8274bff", "score": "0.6840768", "text": "def output_hash; end", "title": "" }, { "docid": "7b80a5cd34b3ff10c045a4c7d8274bff", "score": "0.6840768", "text": "def output_hash; end", "title": "" }, { "docid": "b7da22ec07cc1f2b56cc0a9ce244...
338a47bd2ac9cbbe71fc6ff7ad66c76b
Set the value of the QueueName input for this Choreo.
[ { "docid": "20ae90fae4f6fd66e49caa605d5e8edf", "score": "0.71375424", "text": "def set_QueueName(value)\n set_input(\"QueueName\", value)\n end", "title": "" } ]
[ { "docid": "ed44b768c54fee8c7099ccb4635091c1", "score": "0.7152449", "text": "def queue_name(name)\n @queue_name = name\n end", "title": "" }, { "docid": "7cd704d3c168b69fd50bed4b05d1807a", "score": "0.7001148", "text": "def queue_name(name)\n @queue_name = name\n ...
d2d9b5d4b1d38132eab066fe79972463
Misc Methods and Constants
[ { "docid": "4c5d5814383bde78f86b0adb1e82ad09", "score": "0.0", "text": "def my_friends_id_array\n\t\tfriend1Array = self.friendships.pluck(:friend1ID)\n\t\tfriend2Array = self.friendships.pluck(:friend2ID)\n\t\tcombinedArray = friend1Array + friend2Array\n\t\t# need to remove all IDs that are the ID of ...
[ { "docid": "8d3e2f6695659386a9f5d95e1daf8385", "score": "0.7342726", "text": "def utilities\n end", "title": "" }, { "docid": "8d3e2f6695659386a9f5d95e1daf8385", "score": "0.7342726", "text": "def utilities\n end", "title": "" }, { "docid": "8d3e2f6695659386a9f5d95e1daf...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "3d863de7b58ae32fc890174a413b1a55", "score": "0.0", "text": "def set_admin_media_type\n @admin_media_type = Admin::MediaType.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163443", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.604317", "text": "def action_hook; ...
4238c9be6033290d6dc77fcbf6d40662
Combines instantiating a new location/uuid and returning the important bits
[ { "docid": "5d79e89c77298b9367f2c060354ff9c5", "score": "0.0", "text": "def get_upload_location_and_uuid\n upload_info = get_upload_info\n upload_location_to_location_and_uuid(upload_info)\n end", "title": "" } ]
[ { "docid": "34a74b015a77ae7b5dddc3bcf9e983d1", "score": "0.6722286", "text": "def location_or_id; end", "title": "" }, { "docid": "b44194d7475924cf045e3fb38a005ec3", "score": "0.6546002", "text": "def create!\n recs = \"<data><loc><id>0</id>\n <cid>#{self.cid}</cid>\n <n...
bce687614a9ffb241a5065236063465b
returns the color code corresponding to the difference between actual value and target value
[ { "docid": "de9459b5fc925f5056c5512ebaf1d869", "score": "0.61891294", "text": "def get_color_number_absolute value\n color_number = 0\n color_number += 1 while (value >= (COLOR_THRESHOLDS_ABSOLUTE[color_number]||0) and color_number < COLOR_THRESHOLDS_ABSOLUTE.size)\n color_number\n end", "...
[ { "docid": "54c57e6ef396fa637816450b5daf5ae8", "score": "0.66962594", "text": "def actual_color\n ColorCode.where(numeric_code: default_code.split(\"-\")[-2])[0]\n end", "title": "" }, { "docid": "712ca5720e0272f45ea7b0f906a420fa", "score": "0.6375232", "text": "def brightness_di...
32e1239700fd5f0b21bd1d651f356798
def get_name not instance variable, method cuz of :html attr_reader all_the_h3s = html.search("h3") search returns back the tags and everything inside of it "a" all the s. Return a a html object to all_the_h3s. all_the_h3s.text .text is a method that gives the content of the tag. Can be called on the special Nokogiri o...
[ { "docid": "fd31c7b1162ed03aa4fad87a49ce814f", "score": "0.0", "text": "def twitter_url\n\t\ttwitter = []\n\t\ttext = html.search(\"a\").text.split(\" \")\n\t\ttext.each do |element|\n\t\t\tif element.to_s.match(/@/)\n\t\t\t\ttwitter << element\n\t\t\tend\n\t\tend\n\t\t\treturn twitter\n\tend", "tit...
[ { "docid": "e78faac6d84bca25aeabf41c789c6fb8", "score": "0.6642188", "text": "def get_category_names \n @data.search(\"div.award h1\").collect { |title| title.text }\n end", "title": "" }, { "docid": "6fa51f3849287fe576483d247bc36ee9", "score": "0.6528857", "text": "def gets_name...
4fc49e06b40658382b835c1ccdda25ba
Returns HTML content for the moveresource panel. Responds to GET /resources/:id/movetree via XHR.
[ { "docid": "d66362bd8aa64968abc5277284e0fcbc", "score": "0.51183593", "text": "def move_tree\n @resource = Resource.find(params[:resource_id])\n render partial: 'resources/move_panel_body'\n end", "title": "" } ]
[ { "docid": "df5b2be2fb48a9d447befb771f89ed01", "score": "0.5606804", "text": "def movie_page(selected_movie)\r\n movie_html = movie_url(selected_movie)\r\n Nokogiri::HTML(open(movie_html))\r\n end", "title": "" }, { "docid": "4e46a136a4f177b1d6869101d57bb650", "score": "...
d95f2d663362ac00ab9be217697f3371
rand > returns a float from 0 1 rand(100) > returns an integer from 0 100
[ { "docid": "fb03befe7af5271de734f01a13eb8c2d", "score": "0.0", "text": "def maybe(odds)\n if rand < odds\n yield\n end\nend", "title": "" } ]
[ { "docid": "48becc5a3b28cef3acc9071e57eb1ea2", "score": "0.7831176", "text": "def rand_number\n (rand(100) + 1)*((-1)**rand(2))\n end", "title": "" }, { "docid": "48becc5a3b28cef3acc9071e57eb1ea2", "score": "0.7831176", "text": "def rand_number\n (rand(100) + 1)*((-1)**rand(2)...
cad00e37f3e9bd3f7501e0ee16960e88
Check that a communication with a nil role still saves ok
[ { "docid": "9a7cff90e0e0f067bce84dd8927eb2c8", "score": "0.663856", "text": "def test_add_communication_with_nil_role\n \n \n #Create a communication but dont save it just yet \n communication = create_communication\n \n #Check that the communication is saved and added to the person -...
[ { "docid": "99ab1b2864ee45302a62c5ebba4ca7f0", "score": "0.6301688", "text": "def test_add_communication_invalid_role_person_id\n \n # Create a new role to ensure an incorrect person id\n # Note that from the web interface, the role will already exist\n role = create_role(@person2.person_id...
1f552f50dbd7afe1f7f05baf4b35e55f
Finds multiple icons based on the term term search term limit limit the amount of results offset offset the results page page number
[ { "docid": "72303659acd922a7b94424b7fb7612b9", "score": "0.71451104", "text": "def find(term, limit = nil, offset = nil, page = nil)\n fail(ArgumentError, \"Missing search term\") unless term\n\n term = OAuth::Helper.escape(term)\n\n args = {\n \"limit\" => limit,\n \"offset...
[ { "docid": "7bbb65dc1bcff5cfb982c63546a00b31", "score": "0.64445776", "text": "def search options = { :q => 'icon', :p => 0, :c => 10, :min => 1, :max => 48 }\n options[:p] = 0 if options.key?(:p) == false\n options[:c] = 10 if options.key?(:c) == false\n options[:min] = 32 if options.key?(:min...
1d23d65bcfafe9e14143455a7ac7b74a
PATCH/PUT /admin/tests/1 PATCH/PUT /admin/tests/1.json
[ { "docid": "f98aabd4e920d12395833c2bb66ef92e", "score": "0.6454721", "text": "def update\n respond_to do |format|\n if @admin_test.update(admin_test_params)\n format.html { redirect_to [:admin, @admin_test], notice: 'Test was successfully updated.' }\n else\n format.html { ren...
[ { "docid": "452a3e52d07987fb95c1b8288f231819", "score": "0.6732498", "text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to tests_path, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n ...
33926859d9cfae46d07e559e6fdffc99
product => new_product_path product under category => new_category_product_path(product.category) product under brand/category => new_brand_category_product_path(product.brand, product.category)
[ { "docid": "6f00ca111c8ea35d5e60daa6cb15c284", "score": "0.0", "text": "def new_resource_path_test(resource=nil, prefix_parent=nil)\r\n resource ||= singular_table_name\r\n prefix_parent = prefix_parent || \"#{resource}.\"\r\n \"new_#{underscore_resource_path}_path(#{formatted_paren...
[ { "docid": "6cea2ede43d335e4ba3fc12ca4eb9b65", "score": "0.68340707", "text": "def new\n add_create_breadcrumb\n @product = params[:category_slug] ? category.products.new : Product.new\n end", "title": "" }, { "docid": "6e728c4b3e01f73df0df13277e8d22a1", "score": "0.67669785", ...
854b77469bd9ceee2684cb6de5e65084
Figure out the response status code to return. It might be from the response body or from the RestClient response.
[ { "docid": "45d23aa77a937b48675bf087d260a494", "score": "0.67800605", "text": "def compute_response_code_to_return(j, response)\n if Hash.try_convert(j)\n # if there is a nested response code then use that.\n if j.has_key?('responseCode')\n rc = j['responseCode']\n else\n ...
[ { "docid": "fb4e8437b72da039737f90f12da7d2f8", "score": "0.825946", "text": "def status\n if @real_response.respond_to?(:code)\n @real_response.code.to_i\n else\n @real_response.status.to_i\n end\n end", "title": "" }, { "docid": "24011a4e5d5513ff48dd03e255099...
1127bb45f381b915c7e1fb4dab2d6b96
DELETE /stats/1 DELETE /stats/1.json
[ { "docid": "d6515ed551ad871c4a284e1903adf3da", "score": "0.7492238", "text": "def destroy\n @stat = Stat.find(params[:id])\n @stat.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/stats\" }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "9cbd6d13d3d30ec49d9180d854566752", "score": "0.7623856", "text": "def destroy\n @stat = Stat.find(params[:id])\n @stat.destroy\n\n respond_to do |format|\n format.html { redirect_to stats_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { ...
4c76b864f82a8ab38ede29b0ebce865d
only when logged in.. `current_user` variable should be there
[ { "docid": "20a1858f7702a27b2852c819c1c146cd", "score": "0.0", "text": "def get_notifications\n \t\n \t@notifs = []\n\n \tif current_user\n @notifs = Notification.where(:user_id => current_user.id, :seen => false)\n \tend\n end", "title": "" } ]
[ { "docid": "0afbbc8ccebbeac9207027de57f9db20", "score": "0.78297585", "text": "def current_user\n @current_user if logged_in?\n end", "title": "" }, { "docid": "0afbbc8ccebbeac9207027de57f9db20", "score": "0.78297585", "text": "def current_user\n @current_user if logged_...
89aff5cae29c29ca1f29a14db9c8d328
GET /data_sets/1 GET /data_sets/1.xml
[ { "docid": "5659b4d1e621927bcff6e6f63c60fc5e", "score": "0.6767438", "text": "def show\n @page_title = \"Data Sets\"\n @data_set = DataSet.find(params[:id])\n add_crumb(\"Admin\", '/admin')\n add_crumb(\"Data Sets\", '/data_sets')\n add_crumb(params[:id.to_s])\n respond_to do |format|\...
[ { "docid": "3c7137d28b9bd22c19dcc6ed14224e58", "score": "0.72059923", "text": "def index\n @datasets = Dataset.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datasets }\n end\n end", "title": "" }, { "docid": "6047bf4d...
d299080b7cf7b9f4f3d9422cc06e5570
FUNCTION : manager_interviews_status. DESCRIPTION : Show the list of manager's reqmatches whose status == "SCHEDULED" Function to be used for REQ_MANAGER
[ { "docid": "a23418eae81f3cc4c1a3160389cf5abb", "score": "0.6613411", "text": "def manager_interviews_status\n @interviews_late, @interviews_done, @under_process = ResumesController.filter_interviews_based_upon_processing(get_current_employee)\n render \"interviews_status\" \n end", "title": "...
[ { "docid": "443af7f7ef83e2a1908d08a7ff65d388", "score": "0.59657425", "text": "def manager_status\n get '/manager/status'\n end", "title": "" }, { "docid": "5834e92509ccf111027f023aca69897a", "score": "0.5694852", "text": "def status_monitoring\n @params = Monito...
014a2c0e9ef0b69eff8ec957853b9746
Server cert file. Change or specify. This is the author's default. Not currently used in stomp examples.
[ { "docid": "efc906ef94063ae30ce75dabf82c7a2a", "score": "0.70413375", "text": "def svr_cert()\n\t\tENV['SVR_FILE'] || \"server.crt\" # The server cert File\n\tend", "title": "" } ]
[ { "docid": "02695df70b6db9d0f6de55c92a03857a", "score": "0.7434602", "text": "def ssl_cert_file(file)\n @options[:ssl_cert_file] = file\n end", "title": "" }, { "docid": "b8d81afe35e3c2dc21344668c36704e5", "score": "0.70582896", "text": "def cert_file\n @opts[:cert_file]...
8a86e737726579276a6fda53e43e3cb4
Uses add_notes to sound a chord (a major triad in root position), using the given note as the low note. Like add_notes, increments the pertrack timer.
[ { "docid": "fc7d9be244205e93e9ef057e8c34aca1", "score": "0.71651864", "text": "def add_major_triad(low_note, velocity=127, duration='quarter')\n add_notes([0, 4, 7].collect { |x| x + low_note }, velocity, duration)\n end", "title": "" } ]
[ { "docid": "cc13942f5ea1226ae7cffac985492da0", "score": "0.74041516", "text": "def power_chord(low_note,velocity=127,duration='quarter')\n\t add_notes([0,7].collect { |x| x + low_note }, velocity, duration)\n end", "title": "" }, { "docid": "cc13942f5ea1226ae7cffac985492da0", "score": "...
a27b3233fc9fa16d165a05fadbc438e3
Helpers Gives us new_json, current_json, not_found_json, etc.
[ { "docid": "883ac741bfc18461d874794fccf7128f", "score": "0.0", "text": "def resource_class\n Chef::Resource::ChefDataBag\n end", "title": "" } ]
[ { "docid": "3a584045086910571982326c83894752", "score": "0.74057657", "text": "def augment_current_json(json)\n json\n end", "title": "" }, { "docid": "41aa8d7b75e6da9a24a2a5f0e38c0e85", "score": "0.7099646", "text": "def augment_new_json(json)\n json\n end", ...
1b0ec5467c6358c55371ee520f311370
Enqueue a call into the batch for later processing. See APIgraph_call
[ { "docid": "5181ea369540e844756ee0512a35446e", "score": "0.61951977", "text": "def graph_call(path, args = {}, verb = \"get\", options = {}, &post_processing)\n # normalize options for consistency\n options = Koala::Utils.symbolize_hash(options)\n\n # for batch APIs, we queue up the...
[ { "docid": "bebcad35562550f737bdf49659ba5cc5", "score": "0.7250555", "text": "def call\n run_callbacks :call do\n enqueue\n end\n end", "title": "" }, { "docid": "4ecb9b427a5a674b8e1310e17cf5dc49", "score": "0.66608685", "text": "def enqueue(*args); end", "tit...
0f79f2e80162a9e7f9ade316d4c71c93
Resets the vector to zero
[ { "docid": "a163c063a1331714339897f4d40abac5", "score": "0.67014223", "text": "def clear\n @x = 0.0\n @y = 0.0\n end", "title": "" } ]
[ { "docid": "f306e9881a409f3570d6a95ad88bafa8", "score": "0.7074353", "text": "def clear\n @val = 0\n self\n end", "title": "" }, { "docid": "9efdacf49fb578104958d8fd72b96c29", "score": "0.6977395", "text": "def reset\n clear\n @position = 0\n @current_index = 0\...
7b0599d0149411c0222dfc881dcda85f
determine if player has a card they can play
[ { "docid": "2322c731bdf440957fe319cf7ceb5a81", "score": "0.0", "text": "def which_card(top_card)\n @color_playable = find_color_playable(top_card)\n return @color_playable.last unless @color_playable.empty?\n\n @like_playable = find_like_playable(top_card)\n return @like_playable.last unless...
[ { "docid": "b6bf38be9934b47ba74c73beb69aa0a8", "score": "0.83667356", "text": "def can_play?\n return @deck.cards.length > 0 && @players.length > 0\n end", "title": "" }, { "docid": "485f286e060bc205cf4a549b3925fa5a", "score": "0.809207", "text": "def valid_play?(card)\n end", ...
f975a42d0bc382a650f6e137b892e030
(1) what is the name of the file with the error? (2) what is the line number where the error occurs? (3) what is the error message? (4) what is Ruby telling you is causing the error? (5) what is the 'type' of the error? error
[ { "docid": "3fb4fb33be420068795166bb5045303e", "score": "0.0", "text": "def cartmans_lie(lie, name)\n puts \"#{lie}, #{name}!\"\nend", "title": "" } ]
[ { "docid": "b0a2c460299a944ddca2cf695cd8863b", "score": "0.7508916", "text": "def error(msg)\n raise \"#{msg} :#{@file}:#{@line}\"\n end", "title": "" }, { "docid": "89fd7859ed037d333f3d1b39cc5c119b", "score": "0.69714934", "text": "def error; end", "title": "" }, { ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f3becbd39c99a84255f4c0dce91ab2fb", "score": "0.0", "text": "def user_block_params\n params.require(:user_block).permit(:blocked_user_id, :username)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7493595", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6954758", "text": "def strong_params\n params.require(:request).permit(param_white...
b1fc4320ab241d5606e6971169984435
provides feature choices, allowing user to select multiple prints cats that match any of the features selected
[ { "docid": "e2984a572dd77df55acae110b0072b14", "score": "0.7528204", "text": "def search_by_feature(shelters)\n puts \"Search kitty by feature\\n\"\n choices = %w(Male Female Short_hair Medium_hair Long_hair Tabby White Ginger Black Tortoise_shell)\n feature_select = TTY::Prompt.new.multi_selec...
[ { "docid": "0e90b81ed0708360387a7e90fcb53b0a", "score": "0.6845966", "text": "def get_feature_selections\n f_selections = []\n params[:feature]&.each_pair do |feature_id, value|\n feature = Feature.find(feature_id)\n f_selection = FeatureSelection.new\n f_selection.feature_id = feat...
d102e1226c6878230151bb91b63983b6
TODO Test case pending Message should be added
[ { "docid": "5f74f0d96804a16e7589aff2426013ef", "score": "0.0", "text": "def check_delete_draft_success_message_exists\r\n return selenium.is_text_present \"\"\r\n end", "title": "" } ]
[ { "docid": "d06691c442fe61f1bb3e282924fb0e35", "score": "0.6944613", "text": "def message()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "b93494472c640c05b12c482b4448e573", "score": "0.6882126", "text": "def messaging; end", "title": "" }, ...
90a548a1e2b8c7f4282ec6d5c54f2841
GET /obszars GET /obszars.json
[ { "docid": "71b94a6574051f98acb236a9017ee606", "score": "0.7159908", "text": "def index\n @obszars = Obszar.all\n end", "title": "" } ]
[ { "docid": "4a96bad2424136bffb535a5ee4349b7f", "score": "0.6966546", "text": "def index\n @osoby = Osoba.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @osoby }\n end\n end", "title": "" }, { "docid": "ee400d964ed6a7dc3cb23adef...
4002acd3f54770856c1ac81a9ec23de8
Define a function to print the current list to the console
[ { "docid": "c70bd224c9b4e467e652ccbfb2f08e76", "score": "0.7327174", "text": "def printList(list)\n\tputs \"____CURRENT LIST____\"\n\t\tlist.each do |x|\n\t\t\tputs (list.index(x)+1).to_s + \". \" + x\n\t\tend\n\tputs \"____CURRENT LIST____\"\nend", "title": "" } ]
[ { "docid": "277d504adc12aacb3ef21ec2994d2bdd", "score": "0.8440588", "text": "def print_list; end", "title": "" }, { "docid": "267216ed2f67db7ba6afc0e7a351313c", "score": "0.78728724", "text": "def print(list)\n\tputs list\nend", "title": "" }, { "docid": "95d176eaa954072...
50d3e2e363bb95019eba3794298c9076
Public: Make changes to a user object. GET /users/1/edit
[ { "docid": "13d9d82b05c59c1d7d22387e67a6f80a", "score": "0.0", "text": "def edit\n end", "title": "" } ]
[ { "docid": "fe1987671bc716b46d2ae58a00019b74", "score": "0.83062935", "text": "def edit\n\t @user = User.find(params[:id])\n\t\tif @user.update_attributes(params[:user])\n\t\t\tredirect_to user_root_path\n\t\telse\n\t\tend\n\tend", "title": "" }, { "docid": "f19d3319fa45373ab7da9fb5d3660b...
dfd079d3a35a39f28790c6663f435537
Based on current values
[ { "docid": "1b0389f0107672ca44a2004930cb0f59", "score": "0.0", "text": "def current_debt\n invoice.debt\n end", "title": "" } ]
[ { "docid": "c71a8be944fb89ab77a17fd4c16f7193", "score": "0.6583202", "text": "def update_values\n end", "title": "" }, { "docid": "c71a8be944fb89ab77a17fd4c16f7193", "score": "0.6583202", "text": "def update_values\n end", "title": "" }, { "docid": "c71a8be944fb...
8d9d025ec4d5bf3d31f793b4dca46150
Delete Firewall Session Timer Profile Binding API will delete Firewall Session Timer Profile Binding
[ { "docid": "5c57a509138648fd863285ee164b1113", "score": "0.6429046", "text": "def delete_policy_firewall_session_timer_binding_with_http_info(domain_id, group_id, firewall_session_timer_profile_binding_map_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Ca...
[ { "docid": "2a1553b6f14164b3082b617b569e87f6", "score": "0.65585303", "text": "def delete_tier0_session_timer_profile_binding_with_http_info(tier0_id, session_timer_profile_binding_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecurity...
4266c5b5324b45c57981fe4cb80b423f
this filter should be skipped for pages with dual mode (public view and private/edit view)
[ { "docid": "b4b7485f1a51df7b2d4e4cfe18ef9eb8", "score": "0.0", "text": "def require_my_home_mode\r\n @single_mode_page = true\r\n return handle_permission_denied unless my_home?\r\n end", "title": "" } ]
[ { "docid": "6c0f35d3e4f6aef2d4bd35b6b5e6007e", "score": "0.6547404", "text": "def filter_private_pages\n if @public_mode\n private_pages_path = \"/#{@site.config['private_pages_path']}\"\n @site.pages.delete_if do |p|\n p.relative_path.start_with? private_pages_path\n ...
852d94f0ffe480e3634b74ae3ae68d47
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: initialize empty hash
[ { "docid": "833fd19281ff7a7336e469baeba55f29", "score": "0.0", "text": "def create_list(input)\n grocery_list = {}\n # convert items in string to hash keys:\n input_array = input.split\n # convert string into array using\n # iterate through array assign each string item to a hash ke...
[ { "docid": "116294f9fefae4998863ccbd653923c2", "score": "0.7230347", "text": "def new_list (string)\nitem_hash= hash.new\nitem_array = string.split\nitem_array.each do |item|\n item_hash[item] = 1\nend\nitem_hash\nend", "title": "" }, { "docid": "ab9defcd2d5057453813269f3ab270a8", "scor...
c245a2daf3ae7733b2ba457b24440449
GET /stories/new GET /stories/new.xml
[ { "docid": "d6626cd49921b531f65a81064ad9ef6c", "score": "0.76181066", "text": "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @story }\n end\n end", "title": "" } ]
[ { "docid": "5da16b2c91298b65822f602999d1754d", "score": "0.86232907", "text": "def new_stories\n get('/newstories.json')\n end", "title": "" }, { "docid": "1ce8c6100a3d082b498ee1b93f6395e4", "score": "0.7970199", "text": "def new\n path = \"/view/new\"\n retrieve_storie...
55414d5c69f2b53630be7f92de0b20c0
PUT /cars/1 PUT /cars/1.json
[ { "docid": "0c956d658551785f3ad07155f16a80d0", "score": "0.60700613", "text": "def update\n @car = current_user.cars.find(params[:id])\n\n respond_to do |format|\n if @car.update_attributes(params[:car])\n format.html { redirect_to params[:redirect] ? params[:redirect] : @car, notice: ...
[ { "docid": "232b9330ebe66f8fe15e85745ae1b42c", "score": "0.7167529", "text": "def update\n @car = Car.find(params[:id])\n \n if @car.update(car_params)\n render json: @car, status: :ok \n else\n render json: @car.errors, status: :unprocessable_entity\n end\n end", "title": ...
a6dca191342a15ac77b44652dd7636d6
Writes the given string(s) to the socket and appends a newline character to any string not already ending with one.
[ { "docid": "7fc3e065c49cc023aca07ed9b890609c", "score": "0.0", "text": "def puts *string\n self.write string.map{ |s| s.chomp }.join(\"\\n\") + \"\\n\"\n end", "title": "" } ]
[ { "docid": "8b33f8650a66baf25b30027c95efd6c6", "score": "0.76598334", "text": "def write(str)\n @socket.write str + CR\n end", "title": "" }, { "docid": "679dacb7dc24ac042211c3c38649f9fd", "score": "0.70417005", "text": "def write s\n raise RuntimeError, \"No socket\" unless @...
eab5bfad003c17cfa3684b94b41f2ba8
GET /workflows/1 GET /workflows/1.xml
[ { "docid": "e3a3ebb03943c17b8612a18feb2c1cc5", "score": "0.6777288", "text": "def show\n @workflow = @medium.workflow\n @statuses = Status.order('position')\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workflow }\n end\n end", "title":...
[ { "docid": "67ff06dc58c0f7f045c1af2370c7feef", "score": "0.7352035", "text": "def workflow\n if @workflow == \"\"\n @workflow = @server.read(links[:workflow], \"application/xml\",\n @credentials)\n end\n @workflow\n end", "title": "" }, { "docid": "a8a51dd2b...
dbed55cf2055e7b02e76d76b97435364
create array of diagonals as subarrays then check for four consecutive pieces
[ { "docid": "04f7d25727a1d1f3c530187f08a15f97", "score": "0.75999165", "text": "def check_diagonals(piece)\n #create padding array e.g. [[],[nil],[nil,nil]] etc\n padding = [*0..(grid.length - 1)].map { |i| [nil] * i }\n\n #pad the grid on both sides to shift each row over i elements\n padded...
[ { "docid": "08410302a074eea8326cb021edb54b65", "score": "0.7339021", "text": "def convert_diagonals_to_arrays_part_1(diagonals = [], start = 0)\r\n\treturn diagonals if diagonals.size == 6\r\n\tdiagonal = []; x = start; y = 0\t\t\t\r\n\tuntil x > 5\r\n\t diagonal << cell_check(x,y)\r\n\t x += 1; y += ...
7a9578b1ab838515c9b6d05a725ceb15
Create a resource object, associate it with a client, and set its properties.
[ { "docid": "5f8dd79ee43a5072db76369bca4e3b9c", "score": "0.0", "text": "def initialize(client, params = {}, api_ver = nil)\n super\n @data['buildPlans'] ||= []\n @data['planScripts'] ||= []\n @data['deploymentPlans'] ||= []\n @data['goldenImages'] ...
[ { "docid": "b750a3dc6649361c898be26ab9207ea9", "score": "0.812363", "text": "def create(resource)\n resource.client = self\n resource.create\n end", "title": "" }, { "docid": "3e9c287720dc926e52ac7e4900cde880", "score": "0.6743573", "text": "def create_resource object\n ...
705fe4d3d0c267e70db0d65a3716a4ce
GET /offerts/new GET /offerts/new.json
[ { "docid": "17fcb13ae7d2c87e752c5f6b25b4885b", "score": "0.7780003", "text": "def new\n @offert = Offert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offert }\n end\n end", "title": "" } ]
[ { "docid": "41d0fb714483fec53e42d68b93ab0bf2", "score": "0.7083705", "text": "def new\n @getoff_info = GetoffInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @getoff_info }\n end\n end", "title": "" }, { "docid": "4c90567c0f...
26229638f279ccd0b5be870bfcf9d1bb
POST /work_tasks POST /work_tasks.json
[ { "docid": "5af037cfea5db015fd14cfeaa6b30e51", "score": "0.7449732", "text": "def create\n @work_task = WorkTask.new(work_task_params)\n\n respond_to do |format|\n if @work_task.save\n format.html { redirect_to @work_task, notice: 'Work task was successfully created.' }\n format...
[ { "docid": "1385910316a51d36021210de27fc9830", "score": "0.7690608", "text": "def create\n @work_task = WorkTask.new(work_task_params)\n @work_task.user_id = current_user.id\n\n if @work_task.save\n render :json => @work_task\n else\n render json: @work_task.errors\n ...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "265f9aa1f62eb1656ebd9056269081ca", "score": "0.0", "text": "def listing_params\n params.require(:listing).permit(:title, :description, :brand, :price, :size, :category, :user_id, :image)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74768823", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.71700543", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist...
cc610c81466b95216b403d3001f3c977
POST /loginusers POST /loginusers.json
[ { "docid": "f51f9c33851fb260c6648712ce238fee", "score": "0.0", "text": "def create\n @loginuser = Loginuser.new(loginuser_params)\n\n respond_to do |format|\n if @loginuser.save\n Category.create(categoryname: \"株主配当金\" , hanbetsu: \"収入\" , loginuser_id: @loginuser.id)\n Categor...
[ { "docid": "22201f22e629399ac67e583badeab894", "score": "0.70208985", "text": "def post_users_json payload\n\tJSON.parse ( rest_client_request :post, HF_URL, payload ).body\nend", "title": "" }, { "docid": "e213318cad401736e73be11051ca17b1", "score": "0.70045847", "text": "def http_p...
92a6c03db917c8a9a33237b5c6101f8a
XXX: a 'registered' barclamp could have a has_many :proposals and have a factory method for creating them. Then the check for barclamp arg would not be needed, as we'd always know the barclamp exists.
[ { "docid": "795bb7097b3cab42c86b807a84dfd785", "score": "0.54181", "text": "def initialize(attributes = nil, options = {})\n raise ArgumentError.new(\"Barclamp attribute is required\") unless attributes && attributes.key?(:barclamp)\n\n super\n end", "title": "" } ]
[ { "docid": "ddf67a202d90fcc098eab3ba55b0ec29", "score": "0.65550244", "text": "def get_proposals_from_barclamps(barclamps)\n modules = {}\n active = RoleObject.active\n barclamps.each do |name, details|\n props = ProposalObject.find_proposals name\n modules[name] = { :description=>det...
58e5420dfde47ded47c47519e05d7689
PUT /events/1 PUT /events/1.json
[ { "docid": "a50df5fd67b50ecac470c40c19173221", "score": "0.0", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n Attachment.create(:attachment => params[:attachment], :attachmentable => @event) if params[:a...
[ { "docid": "dc4ff2adcbcefec9118bdd7e8716ad75", "score": "0.76718694", "text": "def update\n event = event.find(params[\"id\"]) \n event.update_attributes(event_params) \n respond_with event, json: event\n end", "title": "" }, { "docid": "c1e91edfe4a0b5c098fb83a06d3cccfc", "scor...
9c4d4c7164a316d5f696399e50e6eadc
Returns a hash from COS containing attributes of a group
[ { "docid": "6eecc1f85df6e8cf7f456cbefc7fc97f", "score": "0.5871762", "text": "def get_group_hash(cookie=nil)\n cookie = Session.kassiCookie if cookie.nil?\n \n begin\n group_hash = Rails.cache.fetch(\"group_hash/#{id}\", :expires_in => GROUP_HASH_CACHE_EXPIRE_TIME) {Group.get_group(self.id...
[ { "docid": "706cbdb4c78e6b67e29589df0a4b1b5c", "score": "0.6350407", "text": "def attr_hash\n md5 = Digest::MD5.new\n # just hash it by name\n md5.update @name\n #\n # @attributes.each do |k,v|\n # md5.update \"#{k}:#{v.attr_hash}\"\n # end\n md5.hexdigest\n ...
1e29aea22226f49abf57784c4b687a9c
Produces a set of messages to the broker.
[ { "docid": "07826c7955a671a51bdf42b07332bbef", "score": "0.0", "text": "def produce(**options)\n request = Protocol::ProduceRequest.new(**options)\n\n @connection.send_request(request)\n end", "title": "" } ]
[ { "docid": "567f7aaf33baebd80c06a1f02236a4b4", "score": "0.6642986", "text": "def messages(options = EMPTY_HASH)\n message_set(options)\n end", "title": "" }, { "docid": "9d4aedf6401360eb2cd8fbf81a8d674a", "score": "0.65304637", "text": "def messages\n read_o...
33ec5f5a3857a272b36d49ced8cd9c57
GET /gradeworks GET /gradeworks.json
[ { "docid": "1ff79050919e8b3d9b1a539029890c77", "score": "0.59797156", "text": "def index\n @gradeworks = Gradework.all\n @juries = User.users_jury\n @directors = User.users_director\n @students = User.users_student\n end", "title": "" } ]
[ { "docid": "29055100c782913775ba69824e2618d9", "score": "0.7110845", "text": "def index\n @grades = Grade.all\n render json: {data: @grades, status: \"SUCCESS\"}, :status => 200\n end", "title": "" }, { "docid": "1f70053553840398b48d958eebe21854", "score": "0.7073633", "text":...
bc84503106c02138d729c27e177a44d4
twitter check operates on the instance's title this looks pretty good, clean up code and space out formatting
[ { "docid": "ccbabd35eaaefaecdb72ba44ecb65ad3", "score": "0.68134665", "text": "def twitter_check\n if title.length < 140\n diff = (140 - title.length)\n puts \"Your msg is ready for Twitter, you have #{diff} chars to go\"\n else\n diff = title.length - 14...
[ { "docid": "2a810a71634ce45b4989344d128f5692", "score": "0.6419984", "text": "def twitter\n if self.vanity and not @twitter\n url= \"http://www.twitter.com/#{self.vanity}\"\n begin\n m= WWW::Mechanize.new.get(url)\n if m #and m.title.match(/#{self.name}/)\n @twitter= ...
c2adb297d76c10066ae13f477b37e3fc
OUTPUT: the minimum path distance between points and t, after rotating between theta a and theta b by steps of theta delta
[ { "docid": "609a15e2023ec9a8a37948eb892b3e14", "score": "0.0", "text": "def recognize(points, templates) #INPUT: an Array of Points, and an Array of Gestures\n b = INFINITY\n t_prime = 0\n score = 0\n sizesqrt = Math.sqrt(SIZE**2 + SIZE**2)\n templates.each do |t|\n d = distance_at_b...
[ { "docid": "7118326c62b7a0687de170163a9ba818", "score": "0.72264564", "text": "def distance_at_angle(points, t, theta)#INPUT: 2 Arrays of Points \"points\" and \"t\", and an angle \"theta\"\n new_points = rotate_by(points, theta)\n d = path_distance(points, t)\n return d\n end", "title": "...
c8606122291aa3b766b3cd7b11a50935
GET /admin/rs_imports GET /admin/rs_imports.json
[ { "docid": "3b8554656ca8d5541504d39c51c13754", "score": "0.0", "text": "def show\n @playlist = Admin::RsImport.create_playlist\n position = (@playlist.playlist_albums.maximum(:position) || 0) + 1\n @admin_rs_import = Admin::RsImport.new(:position => position)\n\n respond_to do |format|\n ...
[ { "docid": "4837deacd45f6b1097d9834c3a7fe4b8", "score": "0.76888436", "text": "def my_imports\n get(\"/members/imports\")\n end", "title": "" }, { "docid": "239f64f2c7c71ac1cd057b5ac391ff5b", "score": "0.71731496", "text": "def index\n @imports = TrelloImport.order(c...
61c89fe86fa279e1cc341a74a40b358d
Deserializes the data based on type
[ { "docid": "03862ead1ea00c038215c579c55497f9", "score": "0.0", "text": "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i...
[ { "docid": "36a7ecd8f09e91284f3ff814815f745d", "score": "0.82312816", "text": "def deserialize(data, type = nil)\n serializer(type).deserialize(data)\n end", "title": "" }, { "docid": "36a7ecd8f09e91284f3ff814815f745d", "score": "0.82312816", "text": "def deserialize(data, type =...
b8a198895d45481798f15e5ca52e4f33
GET /free_videos/1 GET /free_videos/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "fa4650928c92a5eca6789239e3cadb9c", "score": "0.7413305", "text": "def show\n @api_v1_video = Api::V1::Video.find(params[:id])\n\n render json: @api_v1_video\n end", "title": "" }, { "docid": "d256d5a449fa14ccc33f50ba4718fe8b", "score": "0.7403559", "text": "def ind...
3975264f1e4048441a1785030dd64dd8
Method asserts that link is visible
[ { "docid": "5549954167a78ff4265fcb6e79a3fff3", "score": "0.77604204", "text": "def assert_link_is_visible(text, is_target_link=nil, link=nil)\n if !is_target_link.nil?\n find_link(text, visible: true)[:target].should == \"_blank\"\n elsif !link.nil?\n expect(page).to have_link(te...
[ { "docid": "4f5a418904d38b5f7525713283225c2f", "score": "0.71587914", "text": "def assert_visible\n raise('Cannot use ControlChainMethods#assert_visible on control with no #visible? method') unless respond_to?(:visible?)\n\n expect(visible?).to be_truthy\n\n self\n end", "t...
7a6d0838290240491c93db24ad9033a4
def swap(string) words = string.split(' ') words = words.each do |word| next if word.size == 1 word.insert(0, word[1]) word.chop! word.insert(1, word[1]) word[1] = '' end words.join(' ') end
[ { "docid": "3332f3d8647c3bf15fa10d8afa8e6bba", "score": "0.0", "text": "def swap_first_last_characters(word)\n word[0], word[-1] = word[-1], word[0]\n word\nend", "title": "" } ]
[ { "docid": "d0db53c875114f71ecf4148f16b47408", "score": "0.9406764", "text": "def swap(string)\n words = string.split.map do |word|\n if word.length == 1\n word\n else\n word[1..-2].prepend(word[-1]).concat(word[0])\n end\n end\n words.join(' ')\nend", "title": "" }, { ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "655dcf20c4a70891435919b948c11d87", "score": "0.0", "text": "def set_error_template\n @error_template = ErrorTemplate.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...
2deb4524414afccc859a198093f95887
PUT /contactinfos/1 PUT /contactinfos/1.json
[ { "docid": "2c7e29e7a8339947a7b535306151d43c", "score": "0.7074757", "text": "def update\n @contactinfo = Contactinfo.find(params[:id])\n\n respond_to do |format|\n if @contactinfo.update_attributes(params[:contactinfo])\n format.html { redirect_to person_path(@contactinfo.people_id), ...
[ { "docid": "6bff282c16ccbd69d353e8db3d11a546", "score": "0.71177554", "text": "def update\n @contactinfo = Contactinfo.find(params[:id])\n\n respond_to do |format|\n if @contactinfo.update_attributes(params[:contactinfo])\n format.html { redirect_to @contactinfo, notice: 'Contactinfo w...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "224bb1ae6f4136753c8fe4bf08ceb3f6", "score": "0.0", "text": "def update!(**args)\n @ad_group_id = args[:ad_group_id] if args.key?(:ad_group_id)\n @ad_id = args[:ad_id] if args.key?(:ad_id)\n @advertiser_id = args[:advertiser_id] if args.key?(:advertiser_id)\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...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "1f0e71847c42fc7a547bc4e57c0c5b2c", "score": "0.0", "text": "def set_sport_event\n @sport_event = SportEvent.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6162554", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60452986", "text": "def action_hook...
6b0fdd0af1564e56a29473f05de77807
GET /activity_type_fs/1 GET /activity_type_fs/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "1140a9c3b749e23f60ae5a2bd7571d1e", "score": "0.71939576", "text": "def index\n @activity_type_fs = ActivityTypeF.all\n end", "title": "" }, { "docid": "34cf82690ba7ddc6d587baa73b3d7074", "score": "0.6382043", "text": "def set_activity_type_f\n @activity_type_f = ...
211e09c933b4906678ab2a82ad1c6a40
Publish the given data to a specific channel. This ends up sending a Net::HTTP POST request to the Faye server.
[ { "docid": "80e25411109fe9f83e2c7996ff5d60cb", "score": "0.7640554", "text": "def publish_to(channel, data)\n publish_message(message(channel, data))\n end", "title": "" } ]
[ { "docid": "9798ad416d3e45c54e3672f7894dfbe3", "score": "0.8190095", "text": "def publish(channel, data)\n send_action('publish', channel, data)\n end", "title": "" }, { "docid": "705d32e2cf0f59249d51e9e06a5e627c", "score": "0.8163558", "text": "def publish(data)\n fay...
f37531fd540015be09ea466b9ed68d30
Show a human readable size, or if it's already a string, show that
[ { "docid": "edcb3e4ed04be4508ac01686c1d69249", "score": "0.7987573", "text": "def display_size(size)\n size = number_to_human_size(size.to_i + 1) if size.is_a?(Numeric) || size =~ /^[0-9]+$/ # assumes bytes\n size.to_s\n end", "title": "" } ]
[ { "docid": "baed064642113aabaf9578430a493ecf", "score": "0.75529224", "text": "def human_size\n count = 0\n n = size\n while n >= 1024 and count < 4\n n /= 1024.0\n count += 1\n end\n format(\"%.1f\",n) + %w(B kB MB GB TB)[count]\n end", "title": "" }, {...
d487a64b9df7328792355535a10e7464
reassign ids to instances in annotations to avoid id confiction
[ { "docid": "b7f75d124ac2e4646a334f0fdcdb4e41", "score": "0.7182909", "text": "def reid_annotations!(annotations, doc)\n existing_ids = doc.get_annotation_hids(id)\n unless existing_ids.empty?\n id_change = {}\n if annotations.has_key?(:denotations)\n annotations[:denotations].each...
[ { "docid": "b3d35975d9d8677916e134a69fc290c2", "score": "0.617127", "text": "def ids_setter(name, metadata)\n ids_method = \"#{name.to_s.singularize}_ids=\"\n re_define_method(ids_method) do |ids|\n send(metadata.setter, metadata.klass.find(ids.reject(&:blank?)))\n ...
79515981df6339da4625e296d7445b11
Load a file from the specified URL and apply the file as a background to each page of the output PDF. A background can be either a PDF or an image. If a multipage file (PDF or TIFF) is used, the first page is used as the background. +url+ The supported protocols are http:// and Returns The converter object.
[ { "docid": "15a2462c11502d163b90dcf8b4b765ff", "score": "0.6208346", "text": "def setPageBackgroundUrl(url)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"setPageBackgroundUrl\", \"image-to-pdf\", \"The supported proto...
[ { "docid": "1b333933733141bc906a70ee8dd135fc", "score": "0.6194465", "text": "def setPageBackgroundUrl(url)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"setPageBackgroundUrl\", \"pdf-to-pdf\", \"The supported protoco...
bd3a7dfddc30bc69012064ac1ec450c4
Given a hash with numeric values, return the key for the smallest value
[ { "docid": "05b3305d8eb88f1fadd17498a43bf114", "score": "0.0", "text": "def key_for_min_value(name_hash)\nkey = nil\nvalue = nil\nname_hash.collect { |k, v|\nif value == nil || v < value\n key = k\n value = v\nend\n}\nkey\nend", "title": "" } ]
[ { "docid": "187165074e32a7573ee53a9cabb44ed4", "score": "0.8880233", "text": "def key_for_min_value(hash)\n lowest_key=nil \n lowest_value= Float::INFINITY\n hash.each do |name,number|\n if number < lowest_value\n lowest_value=number\n lowest_key= name\n end \n end\n lowest_key\nend...
0b058780bd9a01a0c529dafe258a7d26
Indicates if there is a stock warning for the SKU. The warning is only true if the stock is for sale, published and low.
[ { "docid": "e0c77f47a17401ba34baf5d4d0c974f8", "score": "0.8402849", "text": "def stock_warning?\n normalized_published? and normalized_for_sale? and low_stock?\n end", "title": "" } ]
[ { "docid": "11aab1d6e1ac0a9d7ccfdf33a39c95ac", "score": "0.7862367", "text": "def low_stock?\n stock < stock_warning_level ? true : false\n end", "title": "" }, { "docid": "5529eb5e36a96a8e630e011ceb7c9558", "score": "0.7601881", "text": "def stock_values\n if self.stock && se...
940075178e1125f11cc6bef0ab614407
connect HEAD requests to proxy of Service
[ { "docid": "7bb203466555a6302bb8d4e257f77afa", "score": "0.644374", "text": "def connect_head_namespaced_service_proxy_with_http_info(name, namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CoreV1Api.connect_head_namespaced_service_proxy...
[ { "docid": "72242b03b59b3a1b5554039e11e19a96", "score": "0.7737341", "text": "def do_HEAD( req, res )\n perform_proxy_request( req, res ) do |url, header|\n Arachni::HTTP.request( url, http_opts( method: :head, headers: header ) ).response\n end\n end", "title": "" }, ...
f962d56083911752f399cf79d6e36916
Update the data store. Can be used from cron job. Example: >> ExchangeRate.new.update_data
[ { "docid": "19a75d27b42dd26fa26c06e36548719f", "score": "0.71291006", "text": "def update_data\n @store.get_data true\n end", "title": "" } ]
[ { "docid": "241385d6448ff275dae0010e8e428a88", "score": "0.6775063", "text": "def update(data)\n @update_block.call(data)\n end", "title": "" }, { "docid": "4d99a75fda54b4f4696bc39379a4ee6a", "score": "0.6620059", "text": "def update(newdata)\n self.class.db.update(sel...
90f42774ea8f762292e9a83c9d6e5458
POST /juicios POST /juicios.json
[ { "docid": "4ce7eb5ef6d4e243938cf30e45c60f39", "score": "0.55570054", "text": "def create\n @juicio = Juicio.new(juicio_params)\n\n respond_to do |format|\n if @juicio.save\n format.html { redirect_to @juicio, notice: 'El proceso fue creado con éxito.' }\n format.json { render :...
[ { "docid": "22201f22e629399ac67e583badeab894", "score": "0.6366243", "text": "def post_users_json payload\n\tJSON.parse ( rest_client_request :post, HF_URL, payload ).body\nend", "title": "" }, { "docid": "92008bad042579793da1bda239d95223", "score": "0.62742704", "text": "def create\...
ba33ceb0fc1a894f15a71fe240dfa066
Handle a `new_assembly` message from the server.
[ { "docid": "80d642def8e3ddaade32ab372ddb9f99", "score": "0.66075414", "text": "def on_new_assembly_message( assembly, * )\n\t\tself.log.info \"Creating a new builder for: %p\" % [ assembly ]\n\t\tbuilder = Assemblage::AssemblyBuilder.new( assembly )\n\t\tbuilder.start\n\n\t\tself.builder_queue << builde...
[ { "docid": "b1d70d4a6829e73f65088e724c1f7056", "score": "0.5836911", "text": "def create\n @assembly = @plan.assemblies.build(params[:assembly])\n\n respond_to do |format|\n if @assembly.save\n format.html { redirect_to [@plan, @assembly], notice: 'Assembly was successfully created.' }...
b8b8b8488ccb4e90d730abe564ce326e
Index is for caching, but it causes us problem, we don't need the caching
[ { "docid": "3eda9107636951c9a87b3756898cb645", "score": "0.0", "text": "def index\n self\n end", "title": "" } ]
[ { "docid": "9dfc00ab81488c4cd2ae6fa5f37889ea", "score": "0.7970822", "text": "def index\r\n build_index unless @index\r\n @index\r\n end", "title": "" }, { "docid": "2c6677897eef6f4955d578af4926baaa", "score": "0.75951034", "text": "def construct_index\n end", "title": ...
98e6594df3049878b6e123765e85a682
DELETE /rates/1 DELETE /rates/1.json
[ { "docid": "26be876696e34f12a3c5924d443667c7", "score": "0.76177055", "text": "def destroy\n @rate.destroy\n respond_to do |format|\n format.html { redirect_to rates_url, notice: 'Rate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }...
[ { "docid": "2615214360c60d42dc46cabe69bfee0f", "score": "0.77900356", "text": "def destroy\n @rate.destroy\n respond_to do |format|\n format.html { redirect_to rates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0f58d8b06c4a506d702e000e...
96414694643c1b1dcd911991180ce99e
filter GET /roles GET /roles.json
[ { "docid": "d717cf5c1d4bbcd0a0e4e1dd32fd68ff", "score": "0.71777755", "text": "def index\n if current_user.is_admin?\n @q = Role.where(editable: true).ransack(params[:q])\n else\n @q = Role.where.not(name: COMPANY_ADMIN).where(editable: true).ransack(params[:q])\n end\n @roles = @q...
[ { "docid": "fd6d98644a771196d9eeee6e36f133d8", "score": "0.7672589", "text": "def roles\n render :json => {:roles => User.roles}, :status => 200\n end", "title": "" }, { "docid": "be168d7c75df5b88ee256c8e85f7a7f1", "score": "0.75893664", "text": "def list\n get('roles')[...
8f406b7a66270d8857fa59f429381893
Silences the logger for the duration of the block.
[ { "docid": "a5bccf2c345e4a5c5aca029acaf6087b", "score": "0.68297344", "text": "def silence(temporary_level = Logger::ERROR)\n if silencer\n begin\n old_local_level = local_levels[local_log_id]\n local_levels[local_log_id] = temporary_level\n\n yield self\n en...
[ { "docid": "d94f54e508521a2b6bc349e3d25017d6", "score": "0.7636211", "text": "def silence_logging\n Rails.logger.silence do\n yield\n end\n end", "title": "" }, { "docid": "c9435df902d0c8607d9612d13e80f3c9", "score": "0.7493147", "text": "def silence(&block)\n begi...
ab230ac7fde26645e3808a9d02b446fb
11.3 Image Blocks int fill_imageblock(int page, string blockname, int image, string optlist)
[ { "docid": "d9645d5dbe69fc58fda2fdd97dd31817", "score": "0.7578076", "text": "def fill_imageblock(*args)\n @p.fill_imageblock(self, *args)\n end", "title": "" } ]
[ { "docid": "233c45717947f50ae5f0950b49f89cf6", "score": "0.63262665", "text": "def block_fill(x, y)\n marked = Array.new(@image.height) { Array.new(@image.width) }\n find_block_info_recursive(marked, 0, @dp, @cc, x, y, x, y)\n end", "title": "" }, { "docid": "329ee76d4c42cb44bf9...
54766b7bae058569e569e334e6ca62b9
O(n) T | O(1) S
[ { "docid": "9d5a473b1d5ded1f4dbbfaa09e8c3c28", "score": "0.0", "text": "def length_of_cycle\n cycle_present = has_cycle()\n return unless cycle_present\n\n counter = 1\n @fast = @fast.next\n while @fast != @slow\n counter += 1\n @fast = @fast.next\n end\n counter\n end", ...
[ { "docid": "2ef941411f7d8d40265eb21cb1df0897", "score": "0.60222363", "text": "def t(n)\n return @ts[n] if @ts.size >= n and @ts[n]\n return t(n/2) if n.even?\n return 1 - t((n-1)/2) if n.odd?\nend", "title": "" }, { "docid": "a2ba808e6ff0401483e3cb8c3d9eac49", "score": "0.59741485", ...
686868beae1b3175ff7c6c2cdd895cd5
Define a combination of libraries. Calling this method will bind all the libaries listed under one common name that can be loaded into .wrb files and handlers using combo(). This is used to load a collection of libraries simply and easily without repeating lib() methods. Params: +name+:: The desired name of the combo +...
[ { "docid": "1d81ce793c5f2d043374cd002f379950", "score": "0.70419663", "text": "def combo name, *targets\n @combos[name.to_sym] = targets\n targets\n end", "title": "" } ]
[ { "docid": "0861f594ab8e9c450300c0a70408daae", "score": "0.615441", "text": "def library(*libraries)\r\n @libraries << libraries\r\n end", "title": "" }, { "docid": "41f8a052cf597fee617404f48ee751dd", "score": "0.55361575", "text": "def has_lib!(*names)\n\t\tnames.each { ...
b87d84c9dd1636eb4e0c74cf1a4ca12f
Validate city value entered
[ { "docid": "d9ad4c4aa355e9b47df00eef7b1c49b3", "score": "0.6092913", "text": "def validateCityName(cityName)\n cityName = cityName.strip\n cityRegex = /^([A-Za-z])+([^0-9{}|()!@#$%^&*~_\"':;<>,?\\-])*/\n\n if cityName.length == 0\n puts \"City name not entered. Please try again.\"\n return fal...
[ { "docid": "9eea73d941af79c32f95d1e746816b70", "score": "0.7753446", "text": "def city_is_valid?(city_name = nil)\n self.city = city_name if city_name\n\n geocoding ? true : false\n end", "title": "" }, { "docid": "52dcd6917c978f87c835fe749f766770", "score": "0.73045474", "tex...
5959a2d851857a1497b3336694ed6155
GET /group_memberships GET /group_memberships.json
[ { "docid": "6c3cfaf58851c6ecae2c0bcd14625c99", "score": "0.75032", "text": "def index\n @group_memberships = GroupMembership.all\n end", "title": "" } ]
[ { "docid": "2f01f45d062d77558dc1b855fd53cb1c", "score": "0.81220084", "text": "def index\n @memberships = @group.memberships\n render json: @memberships\n end", "title": "" }, { "docid": "a0c46e36c314168de187567fa9a0c246", "score": "0.7743692", "text": "def group_memberships(o...
773b9cc0af934ca671bef404ed33ca5a
Cancel the payment modifying the status of the source (Spree::Billet)
[ { "docid": "c218e7f242d330d70c7872541f3d3437", "score": "0.7158422", "text": "def cancel(response_code)\n billet = Spree::Billet.find_by document_number: response_code\n billet.status = 'void'\n billet.save\n\n ActiveMerchant::Billing::Response.new(true, 'Billet Method: Successfully ...
[ { "docid": "e5cbc251e5229b11df73dbe576492ef6", "score": "0.7673869", "text": "def cancel\n \n unless status == :cancelled\n transaction do \n if total_paid > 0\n update(:status => :cancelled, :payment_status => :refunded, :total_paid => 0, :total_pend...
5c4838367e7646407a53a5ec007a3e50
GET /sproducts/1 GET /sproducts/1.xml
[ { "docid": "5b1ce6bb8df828a4bc9629878743e071", "score": "0.7272896", "text": "def show\n @sproduct = Sproduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sproduct }\n end\n end", "title": "" } ]
[ { "docid": "aae9f0e5583cf2189e9480d93de85179", "score": "0.693166", "text": "def index\n @sproducts = Sproduct.where(\"vendor = ?\", current_user.shopify_product_vendor)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sproducts }\n end\n end"...
9886ca423f1422e015cc4b64ad974664
Find the specified user when preparing to revoke their permission
[ { "docid": "4804c1abc490e93d6b79cc84c66321f4", "score": "0.0", "text": "def find_user\n raise ExceptionTypes::BadRequestError.new(\"user_id must be present\") unless params[:user_id].present?\n \n @user = User.find(params[:user_id])\n end", "title": "" } ]
[ { "docid": "e97ea0ed11c886d86f69abff3c8a981e", "score": "0.6169411", "text": "def correct_user\n @user = User.find(params[:id])\n # redirect_to root_path, notice: \"You do not have permission.\" unless @user == \"Admin\" || @user == \"Member\"\n end", "title": "" }, { "docid": "...
9a44e64c22cd32d13b31acadcc64015e
To set the maintenance mode, just create a file called maintenance.txt in tmp/.
[ { "docid": "54582dd6978e28433a0dc27034c529b6", "score": "0.6343219", "text": "def website_is_in_maintenance?\n File.exists?(Rails.root.join('tmp', 'maintenance'))\n end", "title": "" } ]
[ { "docid": "e4987cfb4ce948ca18fee0d97b598e51", "score": "0.70568174", "text": "def create_maintenance_html\n \n puts \"===== Setting up maintenance.html\"\n maintenance_file = @settings['local']['application_root']+\"/public/maintenance.html\"\n if !File.exist?(maintenance_file) || force? ||...
5b4e099266b5e2059f6c91da77177586
This method is used for retrive the original password.
[ { "docid": "6f1065501de6d91088153a6baf6cff8e", "score": "0.0", "text": "def password_clean\n crypted_password.decrypt(salt)\n end", "title": "" } ]
[ { "docid": "830b02746cfa330ae8c5aaf66c427f74", "score": "0.80862534", "text": "def password\n return @password_copy\n end", "title": "" }, { "docid": "830b02746cfa330ae8c5aaf66c427f74", "score": "0.80862534", "text": "def password\n return @password_copy\n end", "title": ...