query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
8dc02495e362e1cecb46a7d43b72d76f
dominant octopus takes O(n log n) time to find the longest fish
[ { "docid": "d51a05ad42bebf1c7f7a2a7e6cbdfc37", "score": "0.7244692", "text": "def dominant_octopus(fishes)\n merge_sort(fishes).last\nend", "title": "" } ]
[ { "docid": "0fca09242c00be44024f4565a0da0c63", "score": "0.83298004", "text": "def dominant_octopus(fish)\n big_fish = fish.sort { |a, b| b.length <=> a.length } # O(n log n) // since sort uses quick sort algorithm\n big_fish[0]\nend", "title": "" }, { "docid": "a844cbd656787bb319d8f3e05d...
8e69bfcb78cd33bde63bb9f064c3c8d2
Here we assume a 1:1 relation between route and polyline.
[ { "docid": "f47278c1dc77e2bdecbc880bb9269e86", "score": "0.0", "text": "def remove_unused_polylines\n\t\t#Polyline.delete(self.polyline_id)\n\t\tPolyline.destroy_all([\"id = ?\", self.polyline_id])\n\t\t\n\t\tSyncronisation.destroy_all([\"route_id = ?\", self.id])\n\t\t\n\t\t#Polyline.find(:all, :condit...
[ { "docid": "5ee9647c4c68827fbf1b43ce24599256", "score": "0.690366", "text": "def polyline\n @polyline ||= Automatic::Client::Polyline.new(self.path)\n end", "title": "" }, { "docid": "3b37fc95498c252624ab3b3a4b688730", "score": "0.6791112", "text": "def add_route(station,...
f05182129ef94b2233f5796ed9849ec8
Generate an absolute url from the url. If the url is already an absolute url, this will return it unchanged.
[ { "docid": "3ad59990e083f172e22773c6df0d79e3", "score": "0.74631417", "text": "def absolute_url(url, options={})\n URL.new(env, url, options).to_absolute\n end", "title": "" } ]
[ { "docid": "562536f51cb0f860147d424ed8841bdb", "score": "0.8578292", "text": "def make_absolute_url(url)\n return url unless Addressable::URI.parse(url).relative?\n begin\n Addressable::URI.parse(@page_url).merge(url).to_s\n rescue\n url\n end\n end", "title": ""...
5d6f7be827f441469d0e7cf161103709
GET /moments/1 GET /moments/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "7412ce1ab88795a9144f6fcfb3a87d0a", "score": "0.7233894", "text": "def index\n @moments = @current_user.moments\n end", "title": "" }, { "docid": "c95910b4a143155363ac5e0593483321", "score": "0.7145479", "text": "def user_moments(user_id, params = {})\n get(\"/v1/...
f07d7eeb0d6188cd830a4cb36c1f4368
Base labels are merged with per metric labels
[ { "docid": "91a58a6d6bdb8f77ec5639b21986c017", "score": "0.7522731", "text": "def base_labels(base_labels = nil)\n @base_labels = base_labels unless base_labels.nil?\n\n @base_labels\n end", "title": "" } ]
[ { "docid": "757210135e2e6734dfe0e08cefcf22a6", "score": "0.7852948", "text": "def metric_labels(other_labels = {})\n @metric_labels.merge other_labels\n end", "title": "" }, { "docid": "b303a82d5395a828caa360d232c53824", "score": "0.6820106", "text": "def labels; end", "t...
b72e15c7c590af8c16d0243d4d85e0ea
Returns any images with absolute URLs in the document
[ { "docid": "9b82a92e678024cc79b84ea6c98d63a9", "score": "0.0", "text": "def images(limit = 3)\n if @options[:image_extractor]\n extractor = ImageExtractor.new(self, @url, {\n :min_width => @options[:min_image_width],\n :min_height => @options[:min_image_height],\n ...
[ { "docid": "aa1cf5f0fcd378f8f194159291e084b4", "score": "0.7885512", "text": "def images\n @images = doc.css('img').map { |img| img['src'].to_s }.uniq.delete_if { |src| src.empty? }.map { |url| absolutify(url.strip) }\n end", "title": "" }, { "docid": "dbeadbccdeb207606ad46fba3b05c43...
d3bd14f2daf8c330a91d4d50a233b7f9
Prsist a temporary native pdf.
[ { "docid": "5964e79076fe43ec6541fa64c9f22121", "score": "0.5751658", "text": "def copy_temp_pdf name, temp_pdf_path\n if settings.production?\n pdf_obj = s3_bucket.object(name)\n pdf_obj.upload_file temp_pdf_path\n pdf_obj.public_url\n else\n path = File.join settin...
[ { "docid": "170ecddfd8370dd74f88f8ac68343106", "score": "0.6902008", "text": "def pdf_file\n docs='';self.pages.each {|p| docs+=' '+p.path(:org)}\n pdf=Tempfile.new([\"cd_#{self.id}\",\".pdf\"])\n java_merge_pdf=\"java -classpath './java_itext/.:./java_itext/itext-5.3.5/*' MergePDF\"\n res=...
56c715444177a2025a896b052edf0566
GET /key_indicate_map/indicator_keys/1 GET /key_indicate_map/indicator_keys/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "68c1334f1d2a68c4df11abe4b11e2040", "score": "0.7093843", "text": "def set_key_indicate_map_indicator\n @key_indicate_map_indicator = KeyIndicateMap::Indicator.find(params[:id])\n end", "title": "" }, { "docid": "e7316b62505e126f299af7cce67c8e87", "score": "0.7090322",...
2c2b320696db6549b66e0d1c7101b4c3
GET /artifact_notes/new GET /artifact_notes/new.xml
[ { "docid": "b9762d7cd0b7e268477851160bdaea65", "score": "0.7575553", "text": "def new\n @artifact_note = ArtifactNote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @artifact_note }\n end\n end", "title": "" } ]
[ { "docid": "ee4eb3a7e026c7b6411b0990c881ca4e", "score": "0.70250815", "text": "def create\n @artifact_note = ArtifactNote.new(params[:artifact_note])\n\n respond_to do |format|\n if @artifact_note.save\n format.html { redirect_to(@artifact_note, :notice => 'ArtifactNote was successfull...
e3a02648083e26c73e9767c2e0088c04
Returns true if the application is staged.
[ { "docid": "f1e1c9b0b69e3c42ffa094f37e0388dd", "score": "0.8288656", "text": "def staged?\n @staged\n end", "title": "" } ]
[ { "docid": "35c1f58e4a04ed48564083ccc3fca152", "score": "0.85790867", "text": "def staged?\n !Pakyow.app.nil?\n end", "title": "" }, { "docid": "a99ae885a017f4d87b9cbaf17ec5e07a", "score": "0.79720813", "text": "def staged?\n\t\t(@staged or payload_type == Type::Stager or...
4e197f9c5f68e8bba6b79e39547ae99b
DELETE /messages/1 DELETE /messages/1.xml
[ { "docid": "5d3a540e1fc6b9ca321fc3ffeebea291", "score": "0.73018837", "text": "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "title": "" } ...
[ { "docid": "222538ccd47aead88fdc9836327a0563", "score": "0.75064015", "text": "def destroy\n \t\n @message = Message.find(params[:id])\n @message.delete\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "title": ""...
e8767100645069d261d463048fdcf6c0
Like [Stringrstrip], but preserves escaped whitespace at the end of the string.
[ { "docid": "02ef6378c53b33811c17f40397b92320", "score": "0.72668564", "text": "def rstrip_except_escapes(string)\n string.sub(/(?<!\\\\)\\s+$/, '')\n end", "title": "" } ]
[ { "docid": "58dbe9d79987bf1fe64bdc5124213cdc", "score": "0.7115217", "text": "def strip_except_escapes(string)\n rstrip_except_escapes(string.lstrip)\n end", "title": "" }, { "docid": "f7fe8988a12399cbde36879ba943acc8", "score": "0.7097177", "text": "def rstrip() end", "t...
0516b7c581913a3c9d11d5be79109396
"7 hour fcst" => 7 "1112 hour acc fcst" => 12 "1112 hour max fcst" => 12 c.f. Inventories.jl
[ { "docid": "6e186e4a6782ea1dff7dbbf8c3417c6c", "score": "0.56987303", "text": "def extract_forecast_hour(forecast_hour_str)\n Integer(forecast_hour_str[/(\\d+) hour (\\w+ )?fcst/, 1])\nend", "title": "" } ]
[ { "docid": "5f92428c0de09dba7514f48457077fea", "score": "0.68816835", "text": "def generic_forecast_hour_str(forecast_hour_str)\n # \"11-12\" => \"one hour long\"\n forecast_hour_str.gsub(/^\\d+-\\d+\\s+hour/) do |range_str|\n start, stop = range_str.split(/[\\- ]/)[0..1].map(&:to_i)\n int_to_en...
107fe091a903c71d81e5ad864130387f
Handle calls to keymethods
[ { "docid": "7b32056e4babb8799e93ff6417b8817f", "score": "0.0", "text": "def method_missing( sym, *args )\n\t\t\tkey = sym.to_s.sub( /(=|\\?)$/, '' ).to_sym\n\n\t\t\t# Create new methods for this key\n\t\t\treader = self.create_member_reader( key )\n\t\t\twriter = self.create_member_writer( key )\n...
[ { "docid": "fdf199c50871672678e5c05a53c32336", "score": "0.72519255", "text": "def handle_key_up(_key) end", "title": "" }, { "docid": "d2f31665a7658a940ea841c4bc7e31d6", "score": "0.7234698", "text": "def handle_key key\n key\n end", "title": "" }, { "docid":...
f4901336f982cfe284aa85083955939b
pirates_say_arrrrrrrrr("are you really learning Ruby?") => "eenu" pirates_say_arrrrrrrrr("Katy Perry is on the radio!") => "rya" pirates_say_arrrrrrrrr("Pirates say arrrrrrrrr") => "arrrrrrrr"
[ { "docid": "ac92661edd0aef8ac285614aa9698fd1", "score": "0.0", "text": "def pirates_say_arrrrrrrrr(string)\n\toutput = Array.new\n\tstring.chars.each_with_index do |item, index|\n\t\tnext if item.downcase != \"r\"\n\t\toutput << string[index+1]\n\tend\n\treturn output.join\nend", "title": "" } ]
[ { "docid": "7a02fa5a64551ab847d36110bfe361d9", "score": "0.7581697", "text": "def pirates_say_arrrrrrrrr(string)\n\nend", "title": "" }, { "docid": "850b1aa471a26aaa6eed817f42f2550f", "score": "0.7220404", "text": "def offer_rose (string)\r\n \"Would you take this rose, #{string},...
13137f76d9d5e689ded38c5f0bf85e3f
create a Baas account
[ { "docid": "f40e46b770c32ce88941ccb2a2e40e68", "score": "0.0", "text": "def create_baas_account_using_post_with_http_info(baas_account_co, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BaasApi.create_baas_account_using_post ...'\n end\n ...
[ { "docid": "2d5fa1d47b34ee7bf5aa1b4a7e3077eb", "score": "0.763258", "text": "def create_account name, password\n\n\t\tend", "title": "" }, { "docid": "87e0658b420ce6021de27b899a9983ee", "score": "0.75422156", "text": "def create_account(name)\r\n\r\n end", "title": "" }, {...
213127383872bd5f6564460fe2b95ab6
GET /snippits/1 GET /snippits/1.json
[ { "docid": "99fd09677e4320fc135d9cbec6d590f6", "score": "0.0", "text": "def show\n if :html.empty?\n redirect_to edit_snippit_path(@snippit)\n end\n @current_snippit ||= Snippit.find_by_id(params[:snippit_id]) || Snippit.find_by_id(params[:id])\n @html = @current_snippit.html\n @css ...
[ { "docid": "1aaaa1013733aea16f284d3def9425ad", "score": "0.6772483", "text": "def index\n @snippits = current_user.snippits\n end", "title": "" }, { "docid": "3c4a954a8ebb3698b8141b5f6f2bbd60", "score": "0.66645366", "text": "def index\n @snips = Snip.all\n\n respond_to do ...
e115badba5bfdb3dd6d60c006d93700e
only this 4 methods will call set_article
[ { "docid": "f632d98328c30d04dec8984dc1a715d3", "score": "0.0", "text": "def index\n\t\t@articles = Article.all #grab all the articles(plural for convenience)\n\tend", "title": "" } ]
[ { "docid": "36ac8a6067e871325def6fd654faea74", "score": "0.78454906", "text": "def set_article\n # byebug\n @article = Article.find(params[:id])\n end", "title": "" }, { "docid": "f2b5707c02fdffcc9327f8e835726932", "score": "0.7834195", "text": "def set_article\n \t@article...
5218d2b48b4330e530f2caf07792741d
GET /archives GET /archives.json
[ { "docid": "e2e69cf2749d0a8b46738040663cbe5e", "score": "0.66733754", "text": "def index\n @archives = Archive.published\n @future_meetups = Archive.unpublished\n end", "title": "" } ]
[ { "docid": "d5a26159a8b3b5c341d13f7655452e1d", "score": "0.72945553", "text": "def index\n logger.debug \"cm/archives/index - session_id: #{request.session_options[:id]}\"\n @archives = @current_user.archives\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { re...
63a5c1b5c3cdafc9d933274fd90f8301
return the ancestors w/out the root node
[ { "docid": "8cf2e2432e1574c745f28dc2728a3b0d", "score": "0.794319", "text": "def parents\n ancestors.reject { |a| a.is_root?}\n end", "title": "" } ]
[ { "docid": "dd805e03f23ca7c40c6c03d3495f9aaa", "score": "0.83971506", "text": "def ancestors\n if root?\n []\n else\n parent.ancestors.push parent\n end\n end", "title": "" }, { "docid": "a569ace6993f562c3c6aca9df2a4770b", "score": "0.82922506", "text"...
e553f3a4646f1114e4caa10a782d483b
POST /player_game_statistics POST /player_game_statistics.json
[ { "docid": "f610980c4ee2ab0190b006ca366890b4", "score": "0.69627726", "text": "def create\n @player_game_statistic = PlayerGameStatistic.new(player_game_statistic_params)\n\n respond_to do |format|\n if @player_game_statistic.save\n #format.html { redirect_to @player_game_statistic, no...
[ { "docid": "538f6c46b86f5824fdbc7fc2365f8f79", "score": "0.6742095", "text": "def index\n @player_game_statistics = PlayerGameStatistic.all\n end", "title": "" }, { "docid": "9d27f771d99d21379ef24bf13c5b6c38", "score": "0.6710285", "text": "def player_game_statistic_params\n ...
42c9ab64ee22196aa60a3c5ca8cad3c6
Lookup the site store for a domain; then return the fingger print info of the site
[ { "docid": "2a439f111cf7882dc72fbab5884eaeee", "score": "0.67843866", "text": "def site_lookup(domain)\n tracker=Wmap::SiteTracker.instance\n tracker.verbose=false\n #first order search\n tracker.known_sites.each do |key,val|\n if key.include?(domain.strip.downcase) && key.include?(\"ht...
[ { "docid": "6a0cb833fadcc4bb662d12fb97d3e6b7", "score": "0.65267384", "text": "def stdlookup(session,domain,dest)\n\tdest = dest + \"-general-record-lookup.txt\"\n\tprint_status(\"Getting MX and NS Records for Domain #{domain}\")\n\tfilewrt(dest,\"SOA, NS and MX Records for Domain #{domain}\")\n\ttypes ...
aec9994771447b3f50f0e7794edc3801
I worked on this challenge by myself. Your Solution Below =begin Initial Solution def array_concat(array_1, array_2) Your code here if (array_1.length == 0) && (array_2.length == 0) return [] else return array_1 + array_2 end end =end Refactored Solution
[ { "docid": "5399cffb2b65da3d0faacbff574166b2", "score": "0.8086192", "text": "def array_concat(array_1, array_2)\n # Your code here\n return array_1.concat(array_2)\nend", "title": "" } ]
[ { "docid": "67db71fe93a5be4543948afa21d284a5", "score": "0.9024748", "text": "def array_concat(array_1, array_2)\n # Your code here\n if (array_1.length == 0) || (array_2.length == 0) then return []\n end\n\n array_1.concat(array_2)\n return array_1\nend", "title": "" }, { "docid": "117...
4cad15fdc1545434c05b9b6a1271e96e
If the enemy collides with the player, it will cause him to lose health.
[ { "docid": "25ef192f0e3597f5f2cec6e0414fac19", "score": "0.7752158", "text": "def collidesWithPlayer\n for x in @x.round..(@x + @width).round\n for y in (@y - @height).round..@y.round\n if @map.player.containsPoint?(x, y)\n @map.player.loseHealth\n end\n end\n end\...
[ { "docid": "6cb44e3382a86c71208cbbe36d691d20", "score": "0.7678804", "text": "def collidesWithPlayer\n for x in @x.round..(@x + @width).round\n for y in (@y - @height).round..@y.round\n if @map.player.containsPoint?(x, y)\n @map.player.loseHealth\n death\n retur...
f5b1f0fe1e63198117260e7d2ab37fdb
creating a new user using perms from stong method user_perms
[ { "docid": "651b69c902890f81164a1f28296094b9", "score": "0.0", "text": "def create\n @user = User.create(user_params)\n if @user.save\n session[:id] = @user.id\n redirect_to user_path(@user)\n else\n redirect_to new_user_path\n #redirects to user/:id\n end\n end", "t...
[ { "docid": "b22680b8639ab8fb83cca85cd1ee38eb", "score": "0.6886235", "text": "def create_user\n @user = nil\n\n # Reset flash messages.\n flash[:error] = false\n\n # User level select options.\n @user_levels = {\n 'Regular User' => '1',\n 'Admin User' => '2'\n }\n\n # You ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "8c2ac202ae5b7d22bd01d37d70a64c73", "score": "0.0", "text": "def set_admin_company_status\n @admin_company_status = Admin::CompanyStatus.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...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "c0399a97692e530ea281da80b517655b", "score": "0.0", "text": "def zombie_params\n params.require(:zombie).permit(:name, :bio, :age, :decomp)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6981269", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6783559", "text": "def strong_params\n params.requi...
07dced10dea5b848354e1815d6155363
PATCH/PUT /perfil_admins/1 PATCH/PUT /perfil_admins/1.json
[ { "docid": "7f4a1e305e59c313899d71d1afb0e164", "score": "0.6672511", "text": "def update\n respond_to do |format|\n if @perfil_admin.update(perfil_admin_params)\n format.html { redirect_to @perfil_admin, notice: 'Perfil admin se actualizó correctamente' }\n #format.json { render :s...
[ { "docid": "51bba0a3ae2a4119e7a3f1f7a9de82b9", "score": "0.6652777", "text": "def update\n respond_to do |format|\n if @admin.update_attribute(:name , params[:admin][:name]) | @admin.update_attribute(:right_sig_url , params[:admin][:right_sig_url]) |\n\t\t\t\t\t\t\t\t @admin.update_attribute(:m...
dbfa5a65dd62607e3e6e69898126b7c9
A list of the facet field names from the configuration.
[ { "docid": "b7f3e14373df4bb1e842a66b960b1ee6", "score": "0.82645315", "text": "def facet_field_names(lens = nil)\n blacklight_config_for(lens).facet_fields.values.map(&:field)\n end", "title": "" } ]
[ { "docid": "57075e0017ce5224457f5618f13f9427", "score": "0.84147906", "text": "def facet_field_names\n Blacklight.config[:facet][:field_names]\n end", "title": "" }, { "docid": "1d96bca613929788d27d75f477dd30e6", "score": "0.7709925", "text": "def manifestation_facet_field_names\...
0b0a56a265d13863b7895424d2726231
The entity id is now five digits: section(2)+service(3, zero filled)
[ { "docid": "362498698dc4456148f7328e3875a21e", "score": "0.79432786", "text": "def get_entity_id(section, service)\n return section if service.nil? or service.empty?\n section+service.rjust(3, '0')\nend", "title": "" } ]
[ { "docid": "fbcb01a345890a16ba5ac6a84947f780", "score": "0.6922817", "text": "def entity_id\n match(/Entity\\sID\\s+:\\s+([A-F0-9]+)$/)\n end", "title": "" }, { "docid": "8f13bddd4c309abef85b5241e282bb90", "score": "0.6690439", "text": "def entityID\n end", "title": "" ...
3ad506a8efc735b21345a1a8854d14d0
Retrieve reports for 1099
[ { "docid": "78b46e08cc6cbb5e2f1a33d8ff4c9012", "score": "0.0", "text": "def get_report_ten_ninety_nine(xero_tenant_id, opts = {})\n data, _status_code, _headers = get_report_ten_ninety_nine_with_http_info(xero_tenant_id, opts)\n data\n end", "title": "" } ]
[ { "docid": "fb9dde964d834510a90d7b8189a81cfe", "score": "0.71625715", "text": "def reports\r\n DList._get('/reports')\r\n end", "title": "" }, { "docid": "330c62a0ace209d20a0ab7925187931a", "score": "0.6927535", "text": "def retrieve_report_list\n\t\tstatus = @@mws.reports.ge...
487bbdfc0b65e4e34f39c9040896a5f2
Use SSL to access the service?
[ { "docid": "cec62b764fb8adfdc36379612cfa0003", "score": "0.0", "text": "def ssl?\n @port == 443\n end", "title": "" } ]
[ { "docid": "ed76217264bb228f254e856d3de176f3", "score": "0.7918022", "text": "def ssl; end", "title": "" }, { "docid": "ed76217264bb228f254e856d3de176f3", "score": "0.7918022", "text": "def ssl; end", "title": "" }, { "docid": "364181178d0b9d0933e73bca13bcaf2d", "scor...
890cbf286c3240c6b61561eeab107348
GET /mailings/1 GET /mailings/1.xml
[ { "docid": "111f8246642dad02ccb6f7a30c28df63", "score": "0.61755925", "text": "def show\n @mailing = Mailing.my(@current_user).find(params[:id])\n @mailing_mails = get_mailings_mails(:page => params[:page])\n @users = User.except(@current_user).all\n\n respond_to do |format|\n format.ht...
[ { "docid": "2a6c4d4a1b907d84764c59fed96d4cb6", "score": "0.7259196", "text": "def index\n @mailings = Mailing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mailings }\n end\n end", "title": "" }, { "docid": "312a4798e068c1de...
28fb640d30e6c15fa33b72d1f26beb22
Overwrite method : Sprite
[ { "docid": "938bd1e7e4c399a738dc5f20cf67b5f6", "score": "0.65068185", "text": "def sprite\r\r\n $game_temp.event_sprites[@id]\r\r\n end", "title": "" } ]
[ { "docid": "f41208b4218f3d14f8dcdf4d841de552", "score": "0.77073896", "text": "def sprite=(spr)\r\r\n end", "title": "" }, { "docid": "dd201005e358dda0beed07ab664f8153", "score": "0.7642235", "text": "def main_sprite ; end", "title": "" }, { "docid": "b8aaf21dba1d44d...
4407d95124d6250bf6b25f6c027f29c2
The method must return a boolean and be case insensitive. The string can contain any char. input: string of Xs and Os output: boolean process: read each char of the str and increment each value then determine if Xs == Os hash needed
[ { "docid": "4cc487710144f425672126554b94e28b", "score": "0.76566315", "text": "def XO (str)\n x_o = Hash.new(0)\n str.upcase!\n\n str.each_char do |x|\n x_o[x] += 1\n end\n if !str.include?('X') or !str.include?('O')\n print true\n elsif (x_o['X'] == x_o['O'])\n pr...
[ { "docid": "fcabbcade6f1cd22a5b540e1427c7f9f", "score": "0.7562336", "text": "def XO(str)\n str = str.downcase\n str.count('x') == str.count('o') ? true : false\nend", "title": "" }, { "docid": "fd05a89566861d6ee6ee3f2fa9762303", "score": "0.75481486", "text": "def XO(str)\n strin...
793cfd83416048e4b2ba14bf4ac4975c
We rely on the blink(1) command line tool to control the dongle
[ { "docid": "56b7193541ec12bd5770a7ebf033db49", "score": "0.6340893", "text": "def build_command(settings, count=1)\n [ 'blink1-tool', \n # colour or color should keep those Americans happy :)\n \"--rgb #{settings['colour'] || settings['color']}\",\n \"--blink #{count}\",\n # Stay silent\n ...
[ { "docid": "b93ad7b01ad088110b4e94c66e12272a", "score": "0.7631748", "text": "def blink(args)\n system(\"blink1-tool #{args}\")\n end", "title": "" }, { "docid": "3dff11c70e82730b97a0a37e53aefd9e", "score": "0.7158577", "text": "def blink; end", "title": "" }, { "...
f772a3b3c1cb138fd4b6accfb0eb94c0
generates x random faulty set of size n from the task graph tg
[ { "docid": "4ef3a8b01169c2172103173f2fc0a7ed", "score": "0.83597904", "text": "def generate_faulty_set(tg,n,x)\n #get the faulty tasks\n a = Array.new(x){random_combination(tg[0],n)}\n\n #pull out the ids\n result = Array.new(a.size)\n a.each_with_index do |v,i|\n result[i] = Array.new(n){|ii| ...
[ { "docid": "4b50f3228a73399cfc6a2f4d7ed558e8", "score": "0.6680104", "text": "def generate_random_targets(n)\n\t\t\ttargets = []\n\t\t\tn.times {\n\t\t\t\t#targets << \n\t\t\t}\n\t\t\ttargets\n\t\tend", "title": "" }, { "docid": "812922416420365972063f10f27d5bcf", "score": "0.66553104", ...
2713df522e3ea4bb4671ee38375aae9b
DELETE /articles/1 DELETE /articles/1.xml
[ { "docid": "119a4d1ed761e3e1faea8de2246a19d5", "score": "0.71530527", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(blog_articles_url(@blog)) }\n format.xml { head :ok }\n end\n end", "tit...
[ { "docid": "25b73618d591b9b3bdeed6986f23142f", "score": "0.74979556", "text": "def destroy\n Comment.delete_all(\"article_id = #{params[:id]}\")\n Article.find(params[:id]).destroy\n\n respond_to do |format|\n format.html { redirect_to(root_url) }\n format.xml { head :ok }\n end\n...
59063bfad4766be2bfba063da5f5b4e2
Update an object's attributes and save it
[ { "docid": "b4a930f33846cdd70c3b25d4c86ab8be", "score": "0.0", "text": "def update(attrs)\n run_callbacks(:update) do\n self.attributes = attrs\n self.save\n end\n end", "title": "" } ]
[ { "docid": "3d6712ebc8063869a99dffb04503fa6a", "score": "0.8010821", "text": "def update attributes\n attributes.each do |name, value|\n send \"#{name}=\", value if respond_to? \"#{name}=\"\n end\n save\n end", "title": "" }, { "docid": "3d6712ebc8063869a99...
9af9858c3c66294aff362e5132ab4cee
DEPRECIATED Converts an array of coordinates to alpha numerical locations
[ { "docid": "906492918b9dbad9bef247672057898d", "score": "0.5616847", "text": "def convert_coordinates_to_location(coordinates)\n index_to_letter(coordinates[0]) + coordinates[1].to_s\n end", "title": "" } ]
[ { "docid": "53d91e8bb63fd0da4a81ab4782cf4118", "score": "0.66715026", "text": "def convert_location_to_coordinates(alpha)\n coord = []\n alpha.split(/(\\d+)/).each do |ch|\n if is_number?(ch)\n coord.push(ch.to_i)\n else\n coord.push(letter_to_index(ch))\n end\n end...
0af201d7a695f9a3354ee01d201ca2f9
Returns number of bound children of specified type
[ { "docid": "103d65336330e134657a7ef4e14ac971", "score": "0.5651204", "text": "def bond_count( child_model = nil )\n filter = {\n :parent_model => self.class.to_s,\n :parent_id => id,\n :manual => true,\n :relation => 1\n }\n ...
[ { "docid": "024c49654019c1ddfdd914eea74cd0ec", "score": "0.7560776", "text": "def child_count(type=nil)\n if ((type != Resource::RESOURCE) && (type != Resource::LEARNING_COLLECTION) && (type != Resource::COLLECTION_OBJECT) && (type != Resource::EXHIBITION))\n type = nil\n end\n if (type ==...
45c13378db056f87853ddd8421cb4668
commented out, test was looking for the old roman num style def to_roman mod_roman_num = '' M line doesnt need any conditions to change as we are only converting numbers up to ~3000 mod_roman_num << 'M' (self / 1000) else ifs to determine whether CM or CD is needed if (self % 1000 / 100) == 9 mod_roman_num << 'CM' elsi...
[ { "docid": "8419520f679962007fd76ce1756422cc", "score": "0.8087386", "text": "def to_roman\n old_roman_num = ''\n\n old_roman_num << 'M' * (self / 1000)\n\n old_roman_num << 'D' * (self % 1000 / 500)\n\n old_roman_num << 'C' * (self % 500 / 100)\n\n old_roman_num << 'L' * (self % ...
[ { "docid": "8b2d244c4017e942fb5122ba1c2e65d3", "score": "0.8787731", "text": "def old_roman_numeral(num)\n\t@romanNumeral = \"\"\t\n\n\twhile num > 0\n\t\tquotient, modulus = num.divmod(1000)\n\t\t\tif quotient > 0 \t\t\t\t\t\t\t\t\t\t#using a divisor \n\t\t\t@romanNumeral << (\"M\" * quotient) #using ...
d88a7038c7c30b1a26180a791a972f44
GET /nacionas/new GET /nacionas/new.xml
[ { "docid": "8b0daaa30a15afe32df8eca14177d309", "score": "0.77464837", "text": "def new\n @naciona = Naciona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @naciona }\n end\n end", "title": "" } ]
[ { "docid": "9ec31f78b967512c2a1822a280594a78", "score": "0.7451708", "text": "def new\n @nota = @solicitud.notas.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end", "title": "" }, { "docid": "fcc9a65abd0fc31db1a...
f9af5080b9cd495b338a2c17ae7114f1
Returns an array of nodes matching a given XPath.
[ { "docid": "13385355620aecbaf13f5668dc372624", "score": "0.0", "text": "def match element, path=nil, namespaces=nil, variables={}\n @parser.namespaces = namespaces\n @parser.variables = variables\n path = \"*\" unless path\n element = [element] unless element.kind_of? Array\n @parser.pars...
[ { "docid": "ae0f594324df9fee4ae245e1c9d5c4a6", "score": "0.7335836", "text": "def get_elements( xpath )\n @elements.to_a( xpath )\n end", "title": "" }, { "docid": "ae0f594324df9fee4ae245e1c9d5c4a6", "score": "0.7335836", "text": "def get_elements( xpath )\n @elements.to...
62586d3b6dfc91a305299ef5b2ee5b90
Used to generate a (hopefully) unique ID for DOM elements. Used as a fallback if the user doesn't specify one.
[ { "docid": "4450e54be58a35b63c5a07e593da31c2", "score": "0.0", "text": "def uuid\n (0...10).map { rand(65..90).chr }.join\n end", "title": "" } ]
[ { "docid": "228b742cc4473fcce3211506995ae304", "score": "0.751454", "text": "def element_dom_id(element)\n return \"\" if element.nil?\n \"#{element.name}_#{element.id}\".html_safe\n end", "title": "" }, { "docid": "193656e1bb60602c69c96a39ef8a4d1f", "score": "0.74666154", ...
e6e204f09a0e02da71762636d4b43a1f
Update the auth_credential issued to use by the target node This method is experimental and is not part of the spec.
[ { "docid": "e72d682bcb7689553c6a18443d3e6c09", "score": "0.74772877", "text": "def update_auth_credential\n @node = Node.find_by_namespace!(params.require(:namespace))\n @node.auth_credential = params.require(:auth_credential)\n render \"shared/update\", status: 200\n end", "title": "" }...
[ { "docid": "fa9c6d3116d69e80b9b5f23419211e80", "score": "0.6993566", "text": "def set_credential(credential, value)\n @credentials[credential] = value\n @auth_handler.property_changed(credential, value) if auth_handler\n end", "title": "" }, { "docid": "d50baacf0071123bfeabe68d9...
30def128406c18e844abef4ffd0fc5a9
Returns a String with the name of the formal Linnean classification rank.
[ { "docid": "c428ca6912cef4e7d847f67086ad3f89", "score": "0.0", "text": "def name\n self[:Name]\n end", "title": "" } ]
[ { "docid": "13dc393474bec68e3e5cc060b970ed48", "score": "0.74404126", "text": "def rank_name\n self.class.get_rank_name rank if respond_to? :rank\n end", "title": "" }, { "docid": "02cedac5b58b20fc7c2340463e95888e", "score": "0.70300305", "text": "def rank_to_s\n\t\t\tRanking...
5b1d9275a5bdf6fdc97abf1b945c27d9
Generates a string of all the references of the specified type
[ { "docid": "8fa81600c487701661f2891b4bf9a76d", "score": "0.7987418", "text": "def reference_string_by type\n\t\t\t\t\trstring = []\n\t\t\t\t\ttype.each do |ref|\n\t\t\t\t\t\trstring << ref.value\n\t\t\t\t\tend\n\n\t\t\t\t\trstring.join(\", \")\n\t\t\t\tend", "title": "" } ]
[ { "docid": "505f086f30e003fee96fc2f1ff17d592", "score": "0.6652865", "text": "def format_ref(ref, type)\n len = ref.length\n case type\n when \"soybase\"\n if len < 4\n chr = ref.slice(2, len)\n return \"gm0#{chr}\"\n end\n when \"jcvi\"\n if le...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "f998f178fe76f06075c528b99f095e5c", "score": "0.0", "text": "def set_quiz\n @quiz = Quiz.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163927", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6046165", "text": "def action_hook;...
bc16ba09a98b798079162a2f081cf100
From the given scope string, try to fetch a scope handler class for it. Scope handlers are defined in "app/models//auth_scope.rb" files.
[ { "docid": "38a074c630e80717dfd5848e9dceeefc", "score": "0.7564009", "text": "def scope_handler(registry, scope_string)\n str = scope_string.split(\":\", 3)\n raise ScopeNotHandled, \"Wrong format for scope string\" if str.length != 3\n\n case str[0]\n when \"repository\"\n auth_scope =...
[ { "docid": "b826e7f35391b2a3964153b01f93b60b", "score": "0.7796327", "text": "def scope_handler(scope_string)\n str = scope_string.split(\":\", 3)\n raise ScopeNotHandled, \"Wrong format for scope string\" if str.length != 3\n\n case str[0]\n when \"repository\"\n auth_scope = Namespace...
8add5594d0555dae882515935839e7e5
goodbye method will exit the program after confirming with the user if they would really want to exit
[ { "docid": "f3ff93b4c313b2bf78f1ecf5a0ee8151", "score": "0.0", "text": "def goodbye \n puts \"Wait wait are you sure? (Yes/No)\"\n input = gets.strip.downcase\n if input == \"no\"\n selection \n end \n end", "title": "" } ]
[ { "docid": "b6a51b68e3a933aa5806ae5e50e0b11f", "score": "0.86312294", "text": "def goodbye\n puts \"goodbye please comeback to the casino again!\"\n exit\n end", "title": "" }, { "docid": "548d3d8893f3e2b270100f2f291460de", "score": "0.837436", "text": "def exit_program\n @...
bbcfe36a865a05138b0eac56ed58a812
GET /networks/1 GET /networks/1.json
[ { "docid": "bf478799a8935d0cfb36c96992ff01eb", "score": "0.66659087", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @network }\n end\n end", "title": "" } ]
[ { "docid": "e760c92c34ad662c8232e3e263ead4da", "score": "0.71365094", "text": "def index\n @networks = Network.all\n end", "title": "" }, { "docid": "e760c92c34ad662c8232e3e263ead4da", "score": "0.71365094", "text": "def index\n @networks = Network.all\n end", "title": ""...
e35438cb9840bf81ddf086c3b5e0e8c3
Perform an HTTP GET request
[ { "docid": "7bbfdf533e5564828ce266acacd35deb", "score": "0.7363602", "text": "def get_request(path, params={}, options={})\n request(:get, path, params, options)\n end", "title": "" } ]
[ { "docid": "291d8825b84313454d5f5ecfe483726c", "score": "0.82494193", "text": "def get\n execute_request('GET') do |uri, headers|\n HTTP.http_client.get(\n uri,\n follow_redirect: true,\n header: headers\n )\n end\n end", "title":...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "faa501182ad703e679ce177249de0e21", "score": "0.0", "text": "def set_kicker_stat\n @kicker_stat = KickerStat.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;...
ec7686f0ca82e4393e0f34059c0a5c06
DELETE /current_skills/1 DELETE /current_skills/1.json
[ { "docid": "b8d4c8699e39f0d6b6d411bc898e740d", "score": "0.7755304", "text": "def destroy\n @current_skill.destroy\n respond_to do |format|\n format.html { redirect_to current_skills_url, notice: 'Current skill was successfully destroyed.' }\n format.json { head :no_content }\n end\n ...
[ { "docid": "21d1279d97d8621898bb4d7d07749173", "score": "0.78235734", "text": "def destroy\n @skill = Skill.find(params[:id])\n @skill.destroy\n\n respond_to do |format|\n format.html { redirect_to skills_url }\n format.json { head :no_content }\n end\n end", "title": "" }, ...
2ebc467d333e75cf481a7d427eafdfb9
DELETE /fleets/1 DELETE /fleets/1.json
[ { "docid": "dbaa96397a5dcb9f933d52dd8c9a551c", "score": "0.64636344", "text": "def destroy\n @opportunity = Opportunity.find(params[:opportunity_id])\n @fleet = @opportunity.fleets.find(params[:id])\n @fleet.destroy\n redirect_to opportunity_path(@opportunity), notice: 'Vehicle group was del...
[ { "docid": "9f4d492120d198de4bfb4d7b09f1bf7b", "score": "0.7205547", "text": "def destroy\n @flesh = Flesh.find(params[:id])\n @flesh.destroy\n\n respond_to do |format|\n format.html { redirect_to fleshes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, ...
8da8c72a87ffd80bb8a3c09c7836ee4d
A git or svn repository URL from the command line.
[ { "docid": "7ecaa45b6ee244a3a485f862d4e0d520", "score": "0.0", "text": "def repository\n return options[:repository] if options.has_key? :repository\n return IO.read(skeleton_dir).strip if skeleton_dir and test(?f, skeleton_dir)\n nil\n end", "title": "" } ]
[ { "docid": "91ae53f87a7a3cd05e8f8398de98fb11", "score": "0.72884166", "text": "def svn_url\n if svn_ssl?\n \"https://#{svn_host}/#{svn_path}\"\n else\n \"http://#{svn_host}/#{svn_path}\"\n end\n end", "title": "" }, { "docid": "a58b63b8006c7ae30445a845e7f481b4...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "cc5529afb894e54966504aaf90c0e8d8", "score": "0.0", "text": "def set_user_comment\n @user_comment = UserComment.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...
99855db0aa7cf0cd458d2f3c04a984e8
TODO: implement push notification
[ { "docid": "85dac8be9cfdd3c5f67a1d0a051c3f7c", "score": "0.0", "text": "def send_post(user_id, post_id)\n # add post to user\n # send push notification using firebase api\n UserReceivedPost.create({:user_id => user_id, :post_id => post_id})\n # header = {'Content-Type': 'application/json'}\n...
[ { "docid": "8766ed46012834bdfe22a6ca1f7a8b4f", "score": "0.77638924", "text": "def send_notification\n end", "title": "" }, { "docid": "c3de4b5c2e335c17e69751c0b881f197", "score": "0.7156843", "text": "def send_notifications\n\n\tend", "title": "" }, { "docid": "703df1...
715958f406d6fc2d53f778a2a01d3673
WUT, fix maybe, now identical with ^
[ { "docid": "ac387296a1eb180298f5bee5e2a0fd63", "score": "0.0", "text": "def get_contract_with(other_company)\n if !provides_to?(other_company)\n other_company.provides_to?(self)\n else\n provides_to?(other_company)\n end\n end", "title": "" } ]
[ { "docid": "a35a3749fdeb2db1a1a68be381549b20", "score": "0.6409509", "text": "def with_repl_like_sigint; end", "title": "" }, { "docid": "c77a1eccf6ba57d545ce8b9d83120bd5", "score": "0.6151325", "text": "def retrigger_characters; end", "title": "" }, { "docid": "c77a1eccf...
917b9992e7a9f7e5d19648c88050421e
Use 'trace', 'color', 'false' for more information.
[ { "docid": "c02cb2568352724bdcc0ed4295448fbf", "score": "0.0", "text": "def run_puppet_device(cert_name, options = { allow_changes: true })\n acceptable_exit_codes = (options[:allow_changes] == false) ? 0 : [0, 2]\n on(default, puppet('device', '--verbose', '--waitforcert=0', '--trace', '--target', ce...
[ { "docid": "f066ca8f2b1c3a7ebb2f0c83db597eba", "score": "0.73581", "text": "def format_trace_flags; end", "title": "" }, { "docid": "dfef23d4917a6844e6f2bfde85cf7d22", "score": "0.7172197", "text": "def trace?; end", "title": "" }, { "docid": "dfef23d4917a6844e6f2bfde85cf...
50f4b529f93fcc28ed7d5129dd45cefb
Generates monolithic migration file that contains all database changes.
[ { "docid": "372a679732e26566056f7e8c2a9efa39", "score": "0.69366807", "text": "def create_migration_file\n migration_template 'migrations/create_good_jobs.rb.erb', File.join(db_migrate_path, \"create_good_jobs.rb\")\n end", "title": "" } ]
[ { "docid": "8ea72bf7d9da028aea51a4d677624bfa", "score": "0.7761929", "text": "def generate_migrations\n Dir[File.join(source_paths, 'db', 'migrate', '*.rb')].each do |file|\n migration_filepath = file.match(/\\A.+\\/(db\\/migrate\\/.+)\\Z/i)[1]\n raw_migration_filename = file.ma...
a8579a4435a4efa19ec1f0426e07e0ba
secret_word should not be readable by others!
[ { "docid": "c933c3d3599ef864b41e6cc7a65ebc15", "score": "0.0", "text": "def initialize(name = 'Kasih', file_name='./dictionary.txt')\n @name = name\n @full_dictionary = import_dictionary(file_name)\n @dictionary = @full_dictionary.dup\n @guessed_letters = [] #must res...
[ { "docid": "33bf870e5f35307f0dec63d7586aff56", "score": "0.7944301", "text": "def getsecretword\r\n\t\t return @secretword\r\n\t\t end", "title": "" }, { "docid": "fe664148fdea11d7a43ed4d18bbf30d6", "score": "0.7863947", "text": "def secret_word=(word)\n @secret_w...
25af9419fdd5853a892ce5a135a53ff1
Step 3. Creating a tokenizer A tokenizer reads the input string and converts it into a sequence of tokens Highly simplified tokenizer implementation.
[ { "docid": "c30fa59b4fa62f7ce10b399354e3370a", "score": "0.68597955", "text": "def tokenizer(aTextToParse, aGrammar)\n tokens = aTextToParse.scan(/\\S+/).map do |word|\n term_name = Lexicon[word]\n raise StandardError, \"Word '#{word}' not found in lexicon\" if term_name.nil?\n terminal = aGra...
[ { "docid": "214de25e9799e4f31a285f9a84baa591", "score": "0.7355602", "text": "def tokenize(string); end", "title": "" }, { "docid": "214de25e9799e4f31a285f9a84baa591", "score": "0.7355602", "text": "def tokenize(string); end", "title": "" }, { "docid": "10591b9c0d610d3f48...
a7a817661c0faa5c863dfc7d8fa829b2
Returns the string representation of the object
[ { "docid": "a408df9f3be79d7c20500741a990725c", "score": "0.0", "text": "def to_s\n to_hash.to_s\n end", "title": "" } ]
[ { "docid": "fbdd4f858146598aaabf84003282a8d1", "score": "0.901777", "text": "def to_s\n @object.to_s\n end", "title": "" }, { "docid": "d69be2e09bbb16dc0e9df0ec2905d3f4", "score": "0.88380826", "text": "def to_s\n\t\treturn self.obj.to_s\n\tend", "title": "" }, ...
72ca09b2c253257b992032dbb1174805
Check whether to use cache or db for find
[ { "docid": "d66de7c1ee860dc143f65f709779b468", "score": "0.67185414", "text": "def check_cache_param_find\n if params[:usecache] == \"true\" \n find_event_cached\n else\n find_event\n end\n end", "title": "" } ]
[ { "docid": "12fcd55c6cdbd2ae76cf4ba2d1776539", "score": "0.6966892", "text": "def cached_lookup_allowed?\n @klass.use_activerecord_cache && arel.where_sql.nil? && arel.join_sql.nil? && @limit_value.nil? && @offset_value.nil?\n end", "title": "" }, { "docid": "cc053d71d28eb34108be...
c3bf2d7c430d776334b16e44e86d0d69
Set is_active_toggled if the following is_active state has been modified. This ensures that counter_caches are only updated when a following state changes and not on other updates to a following_model.
[ { "docid": "d04547949b9047c53c7ca3d50014f7dc", "score": "0.8012855", "text": "def before_update(following)\n following.is_active_toggled = following.is_active_changed?\n end", "title": "" } ]
[ { "docid": "2381d6361c8fd34ba6266585e1dccea8", "score": "0.7010872", "text": "def after_update(following)\n if following.is_active_toggled\n following.is_active ? \n increment_counter(following) : \n decrement_counter(following)\n end\n end", "title": "" }, { "docid...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "e1a94b50e7107499775c78856de72f1f", "score": "0.0", "text": "def set_vacancy\n @vacancy = Vacancy.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;...
ecd6c77203d0d83525f19ba39d98a5ad
Add Reflex methods in this file. All Reflex instances expose the following properties: connection the ActionCable connection channel the ActionCable channel request an ActionDispatch::Request proxy for the socket connection session the ActionDispatch::Session store for the current visitor url the URL of the page that t...
[ { "docid": "f5635ceb0062e75569d6b6bf48daa9fb", "score": "0.0", "text": "def like\n topic = Topic.find_by(id: element.dataset['topic-id'])\n if current_user.following?(topic)\n current_user.stop_following(topic)\n else\n current_user.follow(topic)\n stream_client = StreamRails.cli...
[ { "docid": "e71aa24200c4e576869c5ca1e23a88f9", "score": "0.58141375", "text": "def flex_api; end", "title": "" }, { "docid": "1e5e53c4b9e93d9482caa25c8f435412", "score": "0.57532316", "text": "def methods; end", "title": "" }, { "docid": "c264b3fffa3fead03b7caaf78765acf9"...
ba1e3cc9229b2278221b236347b0927f
Only patients from form need this validation. Phantom patients don't have entity_id
[ { "docid": "1166dc0cfa903f373deff2fbdcc11281", "score": "0.68781817", "text": "def validate_name_and_entity_id\n @patient.valid?\n #@patient.errors.add(:entity_id, I18n.t('patients.create.no_entity')) if @patient.new_record? && !@patient.entity_id.present?\n @patient.errors.add(:name, I18n.t('p...
[ { "docid": "ab55bcfabd311e5ed0855124842f3ae1", "score": "0.6153507", "text": "def patient_forms\n # blank\n end", "title": "" }, { "docid": "afb37d22b6a5b9b946ee8994eecd3f7b", "score": "0.59866524", "text": "def patient_implicit?\n @authorized_user.patients.size == 1 \n end"...
317989b89d69a72872c58e86ff36a175
POST /shapes POST /shapes.xml
[ { "docid": "c88f31723ffc5a55265602d81ca78cda", "score": "0.7066098", "text": "def create\n @shape = Shape.new(params[:shape])\n\n respond_to do |format|\n if @shape.save\n flash[:notice] = trn_geth('LABEL_SHAPE') + \" \" + trn_get('MSG_SUCCESSFULLY_CREATED_F')\n format.html { re...
[ { "docid": "68795da443d71429571b3a0e62d5d0c0", "score": "0.67556226", "text": "def create\n @body_shape = BodyShape.new(params[:body_shape])\n\n respond_to do |format|\n if @body_shape.save\n format.html { redirect_to(@body_shape, :notice => 'BodyShape was successfully created.') }\n ...
32d4cfc1f0d03bcec9ace634dace58be
Internal: Given the tokens already processed, determine if the next token could be a regular expression. Returns true if the next token could be a regex, otherwise return false.
[ { "docid": "ceb440a0e58482a182c304fcce2f9794", "score": "0.7907431", "text": "def possible_regex?\n prev_token = tokens.reject { |r|\n FORMATTING_TOKENS.include?(r.type)\n }.last\n\n return true if prev_token.nil?\n\n REGEX_PREV_TOKENS.include?(prev_token.type)\n end", ...
[ { "docid": "dbe8f674682fef216fb8c35737199fe9", "score": "0.7052857", "text": "def regexp?\n false\n end", "title": "" }, { "docid": "ee150ea1a1504d0dd7f2c925d8b968dd", "score": "0.69856435", "text": "def regexp? exp\n exp.is_a? Sexp and exp.node_type == :lit an...
7c909d02a25e7b0bd48585f9665b391e
versioning implement read_version(key, version) and versions(key) in subclasses
[ { "docid": "01883ef2e684c4d39250d0a3c24bfb59", "score": "0.0", "text": "def versioned?\n respond_to?(:read_version)\n end", "title": "" } ]
[ { "docid": "868714b80fe90724dfaa8d9b2109275d", "score": "0.67038906", "text": "def cache_key_with_version; end", "title": "" }, { "docid": "868714b80fe90724dfaa8d9b2109275d", "score": "0.67038906", "text": "def cache_key_with_version; end", "title": "" }, { "docid": "c7cb...
ba7287d6b35fb112f4e93a2fd3cc59ad
This is the method that is run in a new thread in order to background the harvesting and sending of data during the normal operation of the agent. Takes connection options that determine how we should connect to the server, and loops endlessly typically we never return from this method unless we're shutting down the ag...
[ { "docid": "d241795a06941e6bffe0a68d9b7a7387", "score": "0.645409", "text": "def deferred_work!(connection_options)\n catch_errors do\n NewRelic::Agent.disable_all_tracing do\n # We try to connect. If this returns false that means\n # the server rej...
[ { "docid": "06e7b300188a9f9cb2dc5c3f1e6cff01", "score": "0.6642792", "text": "def perform_request_in_thread\n @conn_thread = Thread.new do\n begin\n @connected = true\n\n resp = @client.post(\n @url,\n body: @rd,\n ssl_context:...
5e0eda3bc74b808bbd0be22a1d521d51
Public: Fetches Links that the User recent liked. Returns Array of URLs.
[ { "docid": "abe74abe23b715285b240adf16fae563", "score": "0.63509", "text": "def fetch_url_likes\n facebook_client.fql_query(\"select url from url_like where user_id = me()\").map{|d| d[\"url\"]}\n rescue Koala::Facebook::AuthenticationError => e\n update_attribute(:credentials, nil)\n raise e\...
[ { "docid": "42919570f50f2e884521a748ba9004e9", "score": "0.6686855", "text": "def popular_links(opts={})\n if @realtime_links.nil? || opts.delete(:force)\n get_request(\"/user/popular_links\", opts){|data|\n @realtime_links = data['popular_links'].map { |rs| Bitly::V3::Popular...
6056f8ad3e92e0a4ca50b41bfd89a26d
Log into spire if not already
[ { "docid": "41af407c8c63e7d0109cba67adb721d0", "score": "0.0", "text": "def authenticate\n if(not authenticated?)\n\n # Add empty device features cookie, which is necessary to get past page\n @browser.cookie_jar << Mechanize::Cookie.new(domain: '.spire.umass.edu', name: 'PS_DEVICEFEA...
[ { "docid": "36ccb8e726a6d48a029414c0cffb8865", "score": "0.7171707", "text": "def login!\n login(true)\n end", "title": "" }, { "docid": "481c05890d317d94f98c34c068a32dd4", "score": "0.67825526", "text": "def using_login?; end", "title": "" }, { "docid": "edd388f0...
69d43b9fec78f29db3a93e3546d0525e
array of Column objects in a table.
[ { "docid": "01c19ef7607314da09b3557cae42a872", "score": "0.69602853", "text": "def columns\n @columns ||= list_columns.to_a\n end", "title": "" } ]
[ { "docid": "f3220568767858d775cc242444e72166", "score": "0.7522862", "text": "def columns\n @columns ||= []\n end", "title": "" }, { "docid": "ffe62b1026a81b9ec3d9e643bea9bb3a", "score": "0.7449569", "text": "def columns\n @columns ||= [].tap do |ary|\n re...
cd1123e1b5d00d907c4af9e21fd64d88
PUT /reservations/1 PUT /reservations/1.json
[ { "docid": "dc2394845554ab0247e28bf4f8257c77", "score": "0.0", "text": "def update\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation])\n format.html { redirect_to reservations_path, notice: 'Reservation was successfully updated.' }\n format.json { hea...
[ { "docid": "a740580a5b9a17c0f427281ce501801a", "score": "0.7367872", "text": "def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n @reservations = [@reservation]\n format.json { render :show, status: :ok }\n else\n format.json { render json...
884df9e5fa9513431d9c1956824aac02
Required property by OmniAuth::Strategy
[ { "docid": "8e21f2c805fe7a5513c66e975354e963", "score": "0.0", "text": "def initialize( app, *args, &block )\n options = args.first\n options[:host] = \"auth.4teamwork.ch\"\n super\n end", "title": "" } ]
[ { "docid": "bda8e92d689a72fab31762a24c4c4ab0", "score": "0.673633", "text": "def authenticated?; super; end", "title": "" }, { "docid": "1d0c50a547ba41355d998b96da2c2a5a", "score": "0.6729027", "text": "def active_for_authentication?; end", "title": "" }, { "docid": "1d0c...
9cb2540436c38aabfa7d568aa72c87cc
DELETE /documents/1 DELETE /documents/1.json
[ { "docid": "29cdc265009f19b0dba02232aa05a922", "score": "0.0", "text": "def destroy\n @project = @document.project\n @document.destroy\n @project.update_annotation_count\n respond_to do |format|\n format.html { redirect_back fallback_location: project_documents_path(@project), notice: '...
[ { "docid": "e5768f98469ac5f0d0ce7db23e8780e0", "score": "0.78227097", "text": "def delete\n @client.delete_document(@path)\n end", "title": "" }, { "docid": "632d703205bf00ab330dd6c8337049d6", "score": "0.7613933", "text": "def delete_document index, id\n uri = URI...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "951258526a53df568ddd8f8e6492d88e", "score": "0.0", "text": "def winepairing_params\n params.require(:winepairing).permit(:weight, :maindish_id, :wine_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
5af7c1d9b71b09ce05dcbe9b91eef1ae
cod_pais = NFe cPais
[ { "docid": "8b1442762acfed7f531492739796a024", "score": "0.703364", "text": "def codigo_pais(cod_pais)\n if cod_pais.nil? || cod_pais == '1058'\n '105'\n else\n cod_pais\n end\n end", "title": "" } ]
[ { "docid": "840f87f71691572bfba1e53469de58f3", "score": "0.66886044", "text": "def convertir_dolares_pesos_colombianos(monto_en_dolares)\n cop = monto_en_dolares * 3800\n puts \"#{monto_en_dolares} $ => #{cop} COP\"\n end", "title": "" }, { "docid": "5108617bec9202e3743df851491c37e4", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "518b4fd6ab05bfdf31bf8932b6f7bb00", "score": "0.0", "text": "def set_user\n @user = User.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;...
1f05929ac54a5eb44ee2f02e23b0ea41
Return the mapped type for the code generation.
[ { "docid": "528065d9fee0503fe9b0273b5d619ec7", "score": "0.0", "text": "def generator_type\n case self.type.to_sym\n when :one_to_many\n return (self.composition ? 'nested_many' : 'has_many' )\n when :one_to_one\n return (self.composition ? 'nested_one' : '...
[ { "docid": "e50549cc0d6e6fdb6489867562ac056e", "score": "0.74750173", "text": "def type\n attribute(mapping['type']).to_sym\n end", "title": "" }, { "docid": "deccb62d23b9b51938dbe193032880d6", "score": "0.7151026", "text": "def type_map\n TYPE_MAP\n end", "ti...
2fc2bea51aa40a6515a5e74ca4f431d0
calculation utilities (with memoization)
[ { "docid": "50f90922f7eaaf5ad146b7100f8298b0", "score": "0.0", "text": "def sum attribute, days_ago\n @stats[days_ago] ||= {}\n @stats[days_ago][attribute] ||= @wars[days_ago] ? @wars[days_ago].collect{ |war| war[attribute].to_i }.inject(0, :+) : 0\n end", "title": "" } ]
[ { "docid": "50f3733b42b7b058f267c783cd6c6dd0", "score": "0.6714993", "text": "def calculated; end", "title": "" }, { "docid": "c757282daed9ac982defc8f05b0f4e4c", "score": "0.66884786", "text": "def calculate!\n calculate_amount\n calculate_fee\n calculate_insurance\n calc...
79730530563325e1dd5159b5a4907dec
Read a 'resourcepool.Universe' resource.
[ { "docid": "b7a42cf7f64ee99cdba73a2949769f2d", "score": "0.57375634", "text": "def get_resourcepool_universe_list(opts = {})\n data, _status_code, _headers = get_resourcepool_universe_list_with_http_info(opts)\n data\n end", "title": "" } ]
[ { "docid": "a49386cd7f127b580008fc1b56d63499", "score": "0.57333547", "text": "def get_resourcepool_universe_by_moid(moid, opts = {})\n data, _status_code, _headers = get_resourcepool_universe_by_moid_with_http_info(moid, opts)\n data\n end", "title": "" }, { "docid": "52e7dcb4f...
a48fc26c54529dd04a51629bc335268c
if drawed, set last move as "drawing" remove the game from history board argument is used by real player class input: board: (not used), game_id: int, num: int (1..2)
[ { "docid": "fb018fd4fb8c9ae65292a4bcfa2594fc", "score": "0.7958562", "text": "def declare_draw(board, game_id, num)\n\t\tmark_last_move_as_drawing(game_id, num)\n\t\t@games_move_history[num].delete(game_id)\n\tend", "title": "" } ]
[ { "docid": "6095fc9798a50135b387e6364034c9b3", "score": "0.7489448", "text": "def mark_last_move_as_drawing(game_id, player_number)\n\t\tif @games_move_history[player_number][game_id].length > 0\n\t\t\tlast_move = @games_move_history[player_number][game_id].pop\n\t\t\tif @winning_moves[last_move.board_h...
93bb769659a25e25e34fa42ae7ea95e1
define won? method here
[ { "docid": "f895b6b78aae540a5260b042d851dfb0", "score": "0.0", "text": "def won?(board)\n if board == [\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"]\n return false\n end\n\n#counting so we don't return false until we have looked at all of the combinations.\ncount = 0\n\n WIN_COMBI...
[ { "docid": "df1bc4c1dec6aafd903b3fea85957e82", "score": "0.8717442", "text": "def won?\n\n end", "title": "" }, { "docid": "7f4bc2142f904af7b5ccfeba613dcd88", "score": "0.84204334", "text": "def won?\n self.win\n end", "title": "" }, { "docid": "b7cca8d77c70899b744b5...
b352bfe93f251b4dc8d06a64e00207f7
DSL method for building the `sort` part of a search definition
[ { "docid": "a0f8d9030209315f1d1e6d0336d2922d", "score": "0.0", "text": "def sort(*args, &block)\n if !args.empty? || block\n @sort = Sort.new(*args, &block)\n self\n else\n @sort\n end\n end", "title": "" } ]
[ { "docid": "ace49f28f3a55ba16435962358f33038", "score": "0.7277205", "text": "def sort\n build(ast.sort)\n end", "title": "" }, { "docid": "3c54f8658bbe451f9397e21aae451d57", "score": "0.71335137", "text": "def build_sort \n unless params[:sort].nil?\n @sort = Ferret::Sea...
2521cce994f5dd7b0674c0b1ab617ee8
Gets the applicationGuardEnabled property value. Enable Windows Defender Application Guard
[ { "docid": "99ffd55e4c72e64906cf4b2fcde0e56a", "score": "0.8051359", "text": "def application_guard_enabled\n return @application_guard_enabled\n end", "title": "" } ]
[ { "docid": "a26c889dbf9b21033b23d08f337c5c95", "score": "0.78977734", "text": "def application_guard_enabled=(value)\n @application_guard_enabled = value\n end", "title": "" }, { "docid": "81a284bc1e0d6cdbad21701b60dd4a14", "score": "0.6062242", "text": "def...
0a312d8be8bd81305e6ee62927e5f95e
Update a 'iam.LdapPolicy' resource.
[ { "docid": "b51da8f2d4a1fbdda3c69c6a7c50a69c", "score": "0.68501353", "text": "def update_iam_ldap_policy(moid, iam_ldap_policy, opts = {})\n data, _status_code, _headers = update_iam_ldap_policy_with_http_info(moid, iam_ldap_policy, opts)\n data\n end", "title": "" } ]
[ { "docid": "935dfad1ba91b5778ea107fb525b1dab", "score": "0.6829598", "text": "def update_policy(old_rule, new_rule)\n update_named_policy('p', old_rule, new_rule)\n end", "title": "" }, { "docid": "f789764d1fe824b1a6c9b67f1bef620f", "score": "0.67579144", "text": "def update\...
1062c277a6351834a66c738f47059fb2
2.5.178 LongRGBA The LongRGBA structure specifies a color as a combination of red, green, blue and alpha values.
[ { "docid": "61af9c8f92e09cb0ed86eecab4477ff6", "score": "0.6673191", "text": "def longrgba(data)\n data.unpack('H*').first.upcase.to_sym\n end", "title": "" } ]
[ { "docid": "c53133df27c6d00012d0f61f1e13c204", "score": "0.52183783", "text": "def argb_unpack(color)\n 3.downto(0).map do |shift|\n mask = (0xFF << shift*8)\n channel = color & mask\n value = channel >> shift * 8\n value\n end\nend", "title": "" }, { "docid": "bd72250dec90395c...
943ae5313e0b8ecff59f599077c311c7
GET /tags Tag index, ordered by tagging count
[ { "docid": "0d3e58be3a242fbb62bf45ae2a7281e8", "score": "0.7732047", "text": "def index\n params[:page] ||= 1\n #@tags = Op.tag_counts_on(:tags, :order => \"count desc\").paginate(:page => params[:page], :per_page => 24)\n @tags = Tag.popular.paginate(:page => params[:page], :per_page => 24)\n\...
[ { "docid": "bb6a134796cc8e5d1ea88f9bd023f728", "score": "0.7645354", "text": "def index\n @tags = Integral::Post.all_tag_counts(order: 'count desc').paginate(:page => params[:page])\n end", "title": "" }, { "docid": "b02ae86852ef90cfa3229fe620b22f80", "score": "0.76175016", "...
40b59ca313a6ac05eae81b0ad421b5f3
Like cursor_up in micro mode
[ { "docid": "a1f62630fb70f56dd55c104698139fbd", "score": "0.0", "text": "def micro_up\n Kernel.raise NotImplementedError\n end", "title": "" } ]
[ { "docid": "a21c1fdd1c2331c6975212834018f1b5", "score": "0.7770914", "text": "def cursor_pageup\n end", "title": "" }, { "docid": "a21c1fdd1c2331c6975212834018f1b5", "score": "0.7770914", "text": "def cursor_pageup\n end", "title": "" }, { "docid": "a21c1fdd1c2331c69752...
864e4ba92e1a2d723cd53b17101d8cf3
def person_params params.require(:person).permit(:name, :age) end
[ { "docid": "da3818104e2afc9efea6b40c7b206e39", "score": "0.0", "text": "def task_params\n params.require(:task).permit(:title, :desc)\n end", "title": "" } ]
[ { "docid": "d864cc65d27ca333948f8bcca6e653d9", "score": "0.98064923", "text": "def person_params\n params.require(:person).permit(:name, :age)\n end", "title": "" }, { "docid": "5a711c26c0dfeb6426c89cbdd19c39b1", "score": "0.9719098", "text": "def person_params\n param...
066675d4dedb4f6f6bebce652b9d552f
Execute the Choreo using the specified InputSet as parameters, wait for the Choreo to complete and return a ResultSet containing the execution results.
[ { "docid": "234d465fb99fe333ce880cb5ca2accd1", "score": "0.0", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListForumsResultSet.new(resp)\n return results\n end", "title": "" } ]
[ { "docid": "ea872306361fc864408e8279b0199bbe", "score": "0.7593775", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bf6609d69b18cbe3a5f620c672c2cbbf", "score": "0.7...
d4e8af30b6badb856775db58624e4fde
AWS.config( logger: Logger.new($stdout), log_level: :debug, http_wire_trace: true )
[ { "docid": "fbaf61ac6e412f5ae945daee32263b5b", "score": "0.0", "text": "def q3\n\t@q3 ||= AWS::SQS.new(\n\t\t:sqs_endpoint => 'localhost',\n\t\t:access_key_id => 'dummy',\n\t\t:secret_access_key => 'dummy',\n\t\t:use_ssl => false\n\t)\nend", "title": "" } ]
[ { "docid": "9c31632828a6f0422f8ddf86864361a1", "score": "0.62991005", "text": "def logger\n\t\t\tS3Shuttle::Server.logger\n\t\tend", "title": "" }, { "docid": "d2ddfd11b9d6a4c9556acf8dc36ab8c4", "score": "0.6044421", "text": "def logger\n Cloudenvoy.logger\n end", "title"...
78f2e07c2266f0bb71e09f13bdebb3a5
for listing all the clients.
[ { "docid": "e60c99e1b94f964c712e5be3fc3be354", "score": "0.6602731", "text": "def index\n if current_user\n @clients = Client.all.order(:id)\n else\n flash[:notice] = \"First Login to view the client Details\"\n redirect_to new_user_session_path\n end\n end", "title": "" }...
[ { "docid": "05db46a5f05e0c85be5d3a3a345bd4a7", "score": "0.85356456", "text": "def client_list\n @clients.each do |item|\n puts \"List of clients:\"\n puts \"----------------------------------------------\"\n puts item.name\n end\n end", "title": "" }, { "docid": "8a90f...
fd9c9dbd067a3ca00394303e7ac67d10
Arguments: tab: (Tabulator) Tabulator object Returns: N/A Prints all error and warning messages currently held by the Tabulator.
[ { "docid": "5a2c7ce17d9ca9740cc369fcdf6b4e62", "score": "0.7462474", "text": "def valtest_print_errors_warnings(tab)\n unless (tab.validation_errors.length == 0 &&\n tab.validation_warnings.length == 0)\n print \"\\n\" \n valtest_print_messages(tab.validation_errors, ERRHEAD, tru...
[ { "docid": "99709bd0975a8703da2583dcf2e604c1", "score": "0.7883023", "text": "def tabtest_print_errors_warnings(tab)\n unless (tab.validation_errors.length == 0 &&\n tab.validation_warnings.length == 0)\n print \"\\n\" \n tabtest_print_messages(tab.validation_errors, ERRHEAD, tru...
343ccf401d7de652202dd11adc786e72
Action: new Method: GET Purpose: This action contains functionality for providing an interface to create blog Author: Tushar Hawaldar Date: Url: /blogs/new Request Format: HTML Output Success Response : Renders new.html.erb
[ { "docid": "49442693c507dd2b26ab3ac851a3777f", "score": "0.83735985", "text": "def new\n begin\n @active_page = \"blogs\"\n @blog = Blog.new\n respond_with(@blog)\n rescue Exception => e\n log_error(e, \"Error occured in New action of BlogsController\")\n flash_error(t('bl...
[ { "docid": "87edd1d8ad52646a58353ed8a04b3bea", "score": "0.83020514", "text": "def new\n\t @blogs = Blog.all\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @blog }\n end\n end", "title": "" }, { "docid": "df4252f...