query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
cbec6e96918f42ab0b5ba2b94e2dfbc0
In the code above we see raise, this is how we can make exceptions manually. You'll commonly hear the phrase "raise an error" or "raise an exception" to refer to this. Bringing it all together Since our format_name method can raise an exception, we can also handle it with begin...rescue.
[ { "docid": "6c6de483c7b34fbefca9d9ed464942c8", "score": "0.5174638", "text": "def format_name(first, last)\n raise 'arguments must be strings' unless first.instance_of?(String) && last.instance_of?(String)\n\n first.capitalize + ' ' + last.capitalize\nend", "title": "" } ]
[ { "docid": "0debd91f8296023017c30e2468e26256", "score": "0.66977096", "text": "def format_for_exception; end", "title": "" }, { "docid": "22fd23fd8426574494d9b6f10da0d443", "score": "0.6309618", "text": "def formatted_name(exception)\n exception.name.split(':').last\nend", "titl...
31677bbed674761889c2c5b4e0e0f515
This method will be called when we insert the view in the content view of the window. Setting the frame of the superview will make posible to don't require the bounds on the setup. Notes: => In the case the user provides the bounds in the setup, it will honor it.
[ { "docid": "b6861cbc19f0b3447e8d5a83a6f008b5", "score": "0.6945754", "text": "def viewDidMoveToSuperview\n if @resize_to_superview\n self.frame = superview.bounds unless superview.nil?\n Joybox.director.originalWinSize = self.frame.size\n @resize_to_superview = false\n ...
[ { "docid": "6982bf8cafe701387c77e426c0a78090", "score": "0.70839405", "text": "def viewDidMoveToSuperview\n\n unless @resize_to_superview and superview.nil?\n self.frame = superview.bounds\n Joybox.director.originalWinSize = self.frame.size\n\n @resize_to_superview = fa...
02e6c409b092ea5f2a354ce71b052634
End method: edit method: update
[ { "docid": "a323842f97caa406b2cf33ecd5411ffa", "score": "0.0", "text": "def update\n\t@goodsreceive = Goodsreceive.find(params[:id])\n\n\t@goodsreceive.modified_by = 1\n\t\tif @goodsreceive.update_attributes(params[:goodsreceive])\n\t\tredirect_to :action => 'show', :id => @goodsreceive\n\t\tflash.now[:...
[ { "docid": "28209ee0aa3e250a92993c5783dadeb1", "score": "0.85514605", "text": "def update\n end", "title": "" }, { "docid": "cb3f5312c0ad8a8187f54e4563389018", "score": "0.84332716", "text": "def update\r\n\r\n end", "title": "" }, { "docid": "f6b6d3e59c6aad...
a6527a2ee7f77ed7a93a4b65ae76ef25
Obtain an InputSet object, used to define inputs for an execution of this Choreo.
[ { "docid": "8555fe481d14bdbec9c0a086bfe0648c", "score": "0.0", "text": "def new_input_set()\n return PostCodeSearchInputSet.new()\n end", "title": "" } ]
[ { "docid": "64c57f88a4eac6079f885b7b88602378", "score": "0.6654252", "text": "def execute(input_set = nil)\n # If the inputs are not configured, create a blank set.\n if input_set == nil\n input_set = InputSet.new()\n end\n param_map = {\"source_id\" => TembooSession.get_identifier()}\n...
25d18f0fbec94c8d23701a4778f89cb7
Complete the repeatedString function below.
[ { "docid": "9087716e9fa91034d0c68e756934f900", "score": "0.64987713", "text": "def repeatedString(s, n)\n remainder_matches = 0\n\n length = s.length\n puts 'length: %d' % [length]\n\n matches = s.scan('a').count\n puts 'matches: %d' % [matches]\n\n quotient = n / length\n puts 'quotient: %...
[ { "docid": "7fa7105edb67fc8efe966cef3550e64f", "score": "0.7409544", "text": "def repeat string, number=2\n\trepeated = \"\"\n\tcur_index = 0\n\n\tnumber.times do\n\t\trepeated += string\n\n\t\tif cur_index != number - 1\n\t\t\trepeated += \" \"\n\t\tend\n\n\t\tcur_index += 1\n\tend\n\n\trepeated\nend",...
37dc96759f86686ac54034c227c9ccf7
actions where filter is applied POST /login
[ { "docid": "63c511c6f7d627499ded35436e158339", "score": "0.0", "text": "def login\n\t\tuser = User.authenticate(params[:username],params[:password])\n\t\tif user\n\t\t\tsession[:current_user_id] = user.id\n\t\t\tflash[:notice] = \"logged in\"\n\t\t\tredirect_to '/home'\n\t\telse\n\t\t\tflash[:notice] = ...
[ { "docid": "fb9ad00a5cd851dca60a2cc7aaaaeab8", "score": "0.7317005", "text": "def run_filters\n set_user\n authorize\n end", "title": "" }, { "docid": "55a7e82bfbdae95d56b96ac383b2a47a", "score": "0.72560155", "text": "def login_filter\n\t\tif not protect?( action_name )\n\t\t...
27555ba65bbe0f91dcb2dae8b627b021
Generates an iCal unique ID for Event.
[ { "docid": "e34fb757543500fb4873cdb828bfa6e5", "score": "0.794292", "text": "def ical_uid(event)\n \"event-\" << event.id.to_s << \"@\" << DOMAIN\n end", "title": "" } ]
[ { "docid": "a3d0733bdbd8dfb10d92e25eb76d32a7", "score": "0.8587155", "text": "def gen_id(i_cal_evt)\n Base32.encode(i_cal_evt.uid.to_s + i_cal_evt.recurrence_id.to_s + i_cal_evt.sequence.to_s)\n end", "title": "" }, { "docid": "72b56967a9efd9e1e2af249b62784a06", "score": "0.80565...
e140191a5d36bc42d9de48f0989e6cd9
Retrieve data from cache
[ { "docid": "bd0d44ec45fcfb157b4308c1d5e32da4", "score": "0.77009594", "text": "def retrieve_from_cache\n retrieved = false\n return retrieved if @_cache_key.nil?\n\n data = Taupe::Cache.get(@_cache_key) || nil\n unless data.nil? || data.empty?\n @_values = data\n ...
[ { "docid": "309cf4a87332c3d639ed675279d21983", "score": "0.8092514", "text": "def cache\n DataCache\n end", "title": "" }, { "docid": "19d31ccf5ceeec45799866f4ecd3c7bf", "score": "0.77851665", "text": "def load_cache\n q = @client.caches.get(:name=>name)\n @client.logge...
49f4aabdbfd438fdd2ac77a6e7a68d60
this is the main page for angular applicaiton
[ { "docid": "d912d202a1094680689985cb160854ff", "score": "0.0", "text": "def index\n gon.user_info = current_user\n render :index\n end", "title": "" } ]
[ { "docid": "25942a85f5e1913bb016675809b0d443", "score": "0.6760754", "text": "def angular\n\tend", "title": "" }, { "docid": "2f4f801f4f27d831288b92bb32288954", "score": "0.65722215", "text": "def index\n @angulars = Angular.all\n end", "title": "" }, { "docid": "81a4...
ca8dcd99f0d81fa4314dd284592149b3
one should not call it from outside This callback resets Meta's finish flags
[ { "docid": "a41ab83a663fd343f645a4d27471c318", "score": "0.6943105", "text": "def after_perform_reset_meta(*)\n if should_reset_meta?\n meta_obj = meta\n\n meta_obj.data.delete('succeeded')\n meta_obj.data.delete('finished_at')\n\n meta_obj.save\n end\n ...
[ { "docid": "7e340608aeb31d3ea4c087fad943a73b", "score": "0.7162704", "text": "def do_finish; end", "title": "" }, { "docid": "1df65d045e0d65f9bf9b98c8cdd94356", "score": "0.70301074", "text": "def finish()\n #This is a stub, used for indexing\n end", "title": ""...
342a3d05a7d8a4333be95efa043b9a7a
identifies number in string form
[ { "docid": "e8066499202d48ff18c693ea265000a2", "score": "0.0", "text": "def numeric(input)\n return Float(input) != nil rescue false\n end", "title": "" } ]
[ { "docid": "823e9947e946714bc12f398697db5cd2", "score": "0.72186", "text": "def haystack_format_as_num(str)\n return \"n:#{str}\"\n end", "title": "" }, { "docid": "9481025400f7207695631e6b87c49500", "score": "0.71796316", "text": "def rewrite_num(t); t.string.to_i; end",...
356c11a59fd2c395b69cc54b81d353a4
Appends an element to the tail of this list.
[ { "docid": "de2dadb4bea9b24618c354cff170bb0f", "score": "0.0", "text": "def <<(value)\n value = normalize_value(value)\n @subject = nil\n @values << value\n self\n end", "title": "" } ]
[ { "docid": "f455f18cf1920e5c454b4dab6bd463b4", "score": "0.7667296", "text": "def addLast(elt)\n @elements << elt\n end", "title": "" }, { "docid": "4a751fbf418619177449dc630bfc9c8d", "score": "0.7423228", "text": "def add_at_tail(val)\n @array << val\n end", ...
ae76a71806f9661342f473d697d333a3
GET /workflows/1 GET /workflows/1.json
[ { "docid": "a9a8f7e6e71866f3a06ae95e8b3b379c", "score": "0.76120585", "text": "def show\n @workflow = Workflow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workflow }\n end\n end", "title": "" } ]
[ { "docid": "885415c44d28b51b12db87680f1e013a", "score": "0.78884053", "text": "def workflow(id)\n make_json_api_request :get, \"v2/#{account_id}/workflows/#{id}\"\n end", "title": "" }, { "docid": "63604e89c247e45090f9035189efb11e", "score": "0.77646613", "text": "def sho...
35857af0d44afe9b22cb98dfd8fd5177
Contructor of Resque adapter
[ { "docid": "64b06537ab52222868f41cd7274c8cf6", "score": "0.6469551", "text": "def initialize(options)\n Resque.redis = \"#{options[:server]}:#{options[:port]}\"\n Resque.redis.sadd(:queues, :default)\n end", "title": "" } ]
[ { "docid": "a624d14556136d5e2927e2974ef2319f", "score": "0.6805518", "text": "def initialize\n\t@read_q = Queue.new\n\t@conn = nil\n end", "title": "" }, { "docid": "3163f18d0401cb5157df06383799df2f", "score": "0.6530229", "text": "def initialize(queen=Queen.queen, config=Config...
ad2879a2ae277e645d7aa1b833c372cf
POST /testvalues POST /testvalues.json
[ { "docid": "1048d37c2bf79a7f9ca31cc48f05a93f", "score": "0.67829484", "text": "def create\n @testvalue = Testvalue.new(testvalue_params)\n\n respond_to do |format|\n if @testvalue.save\n format.html { redirect_to @testvalue, notice: 'Testvalue was successfully created.' }\n form...
[ { "docid": "c70c05e37dfb61cdf881bc7153a6cc5c", "score": "0.65369403", "text": "def testvalue_params\n params.require(:testvalue).permit(:value, :test_id, :result_state, :result_recommendation)\n end", "title": "" }, { "docid": "e0342d81961546c5e39944781cf0521c", "score": "0.62815...
b6250da3128f8ac268bd7ac7d8433744
Description: Finds the expenses and hiring incidence of a company. Parameters: none. Return: none.
[ { "docid": "8f8da33f567c762fe52e5e2592497a20", "score": "0.66066873", "text": "def find\n company_expenses = Expense.where( company_id: params[ :id ] )\n assert_object_is_not_null( company_expenses )\n company_hiring_incidence = find_public_agencies( company_expenses )\n...
[ { "docid": "e891fccc46f6d6caa32fd106f702dc47", "score": "0.6558826", "text": "def find_public_agencies( expenses )\n assert_object_is_not_null( expenses )\n assert_type_of_object( expenses, Expense::ActiveRecord_Relation )\n company_hiring_incidence = {}\n ...
88d9b472c86c5798323b2ce6203d270d
POST /contracttypes POST /contracttypes.xml
[ { "docid": "3b7563f454006cd45a5cc5eb78664eb9", "score": "0.6507546", "text": "def create\n @contracttype = Contracttype.new(params[:contracttype])\n\n respond_to do |format|\n if @contracttype.save\n format.html { redirect_to(@contracttype, :notice => 'Contracttype was successfully cre...
[ { "docid": "1d73b912fc841a28b6d9036c46fcd4ab", "score": "0.62927544", "text": "def contract_type_params\n params.require(:contract_type).permit(:name, :description)\n end", "title": "" }, { "docid": "6e6b2a7ec9982adaf586b80a6b13fdfc", "score": "0.6038748", "text": "def cr...
51f50f9e426942b55be9a93760b90226
Using a private method to encapsulate the permissible parameters is just a good pattern since you'll be able to reuse the same permit list between create and update. Also, you can specialize this method with peruser checking of permissible attributes.
[ { "docid": "6715c6cf2c8a6429153442920020f47a", "score": "0.0", "text": "def resource_params\n params.require(:maintenance).permit(:date, :mileage, :cost, :description, :warranty_time, :maintenance_type)\n end", "title": "" } ]
[ { "docid": "cd747885a831977c992824c23b2cd595", "score": "0.7022089", "text": "def permitted_params\n policy(resource || resource_class.new).send(\"permitted_#{action_name}_attributes\")\n end", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.7011586", "t...
f4d80d75ce62da536469d638d1612c83
adds a card to the pile
[ { "docid": "d157c17d84588bdcfa7c7ec52c01c036", "score": "0.0", "text": "def play(card)\n if valid_play?(card)\n @top_card = card\n @bottom_card = card if @bottom_card == nil\n else\n raise \"Not valid play\"\n end\n end", "title": "" } ]
[ { "docid": "ef54b5514e66e6ee6a51e54e6a04f746", "score": "0.8186976", "text": "def append(card)\n @pile << card\n end", "title": "" }, { "docid": "1274792d4b5f1a7a64e4a37280fe1c2a", "score": "0.8041224", "text": "def append(card)\n raise \"already in use\" unless @pile.empty?\n...
312b3c9eb9d4371811a71ecb2c83d805
Provide configuration in the form of the biding
[ { "docid": "7be5efca3b2709dd0135507116ee1fe5", "score": "0.0", "text": "def as_binding\n result = binding\n as_hash.merge(ENV).each_pair do |key, value|\n result.local_variable_set(key.downcase.to_sym, value)\n end\n result\n end", "title": "" } ]
[ { "docid": "e144c55fb8680de35acf575932b5572e", "score": "0.7888845", "text": "def configurations; end", "title": "" }, { "docid": "c66bae5aa37aac1df5f61e262d46ce97", "score": "0.76060826", "text": "def configuration; end", "title": "" }, { "docid": "c66bae5aa37aac1df5f61e...
041e45dd3d8a9cdd58cb184a43b60f88
POST /admin/positions POST /admin/positions.xml
[ { "docid": "f9464ca34513b8382085184f0558daba", "score": "0.7406189", "text": "def create\n @position = Position.new(params[:position])\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to(admin_position_path(@position), :notice => 'Position was successfully create...
[ { "docid": "93aae0287731e6ae9bbbeba2b1a16080", "score": "0.7138426", "text": "def create\n respond_to do |format|\n if position.save\n format.html { redirect_to( position, flash: { success: 'Position created.' } ) }\n format.xml { render xml: position, status: :created, location: ...
5a0560293e53aa7766e16f076b153203
PUT /fornecedor_custos/1 PUT /fornecedor_custos/1.json
[ { "docid": "b07513119e2c7aac33f0f9b993d16258", "score": "0.6870763", "text": "def update\n @fornecedor_custo = FornecedorCusto.find(params[:id])\n\n respond_to do |format|\n if @fornecedor_custo.update_attributes(params[:fornecedor_custo])\n format.html { redirect_to @fornecedor_custo,...
[ { "docid": "7811390984c1d88b310811ff18db6b7e", "score": "0.6837122", "text": "def update\n @custo = Custo.find(params[:id])\n\n respond_to do |format|\n if @custo.update_attributes(params[:custo])\n format.html { redirect_to @custo, notice: 'Custo was successfully updated.' }\n ...
1097a7e7758f08d32addfc88ea3fdcab
GET /users GET /users.json
[ { "docid": "8b1dbac81472eff58cb602a4a1473ebb", "score": "0.0", "text": "def index\n @users = User.all\n end", "title": "" } ]
[ { "docid": "8a29471646191d84def95f7af1e081bf", "score": "0.82109934", "text": "def users(args = {})\n get(\"/users.json\",args)\n end", "title": "" }, { "docid": "fd6f331d604ba2ad8967a7e5ed218329", "score": "0.7873764", "text": "def show\n begin\n user = User.find...
cba0b0eeeb0d23d89f47c7adcc29f108
GET /trello_cards GET /trello_cards.json
[ { "docid": "51527fe5543cdb71fa442077249d9c05", "score": "0.68825656", "text": "def index\n @trello_cards = TrelloCard.all.filter( params.permit( :environment, :priority , :message_type , :time_period) )\n end", "title": "" } ]
[ { "docid": "83f12c10eeae5f2ed65c1a8279833b59", "score": "0.7733007", "text": "def getCardList(cardId)\n\tresponse = RestClient.get(\"https://api.trello.com/1/cards/\"+cardId+\"/list?key=\"+$key+\"&token=\"+$token)\n\tresponse = JSON.parse(response)\nend", "title": "" }, { "docid": "595a31822...
c994e258ed018be36a6b84987e6a9a0a
DELETE /authorships/1 DELETE /authorships/1.xml
[ { "docid": "b0870847b848fc368b02c4a230e58158", "score": "0.77276725", "text": "def destroy\n @authorship = Authorship.find(params[:id])\n @authorship.destroy\n\n respond_to do |format|\n format.html { redirect_to(authorships_url) }\n format.xml { head :ok }\n end\n end", "tit...
[ { "docid": "5ac0f9f4977544cd3ef84ef03fd6e9dc", "score": "0.73663574", "text": "def destroy\n user = User.find_by_urlname(params[:id])\n @authorship = @program.authorships.find_by_user_id(user)\n @authorship.destroy\n \n respond_to do |format|\n flash[:notice] = 'Authorship destroyed'...
b60002774abd3ce6f3852ae9c18acd97
Gets the defaultValue property value. The default value for this column.
[ { "docid": "ac3e203b71a958cdb721bd6641995f6d", "score": "0.75021845", "text": "def default_value\n return @default_value\n end", "title": "" } ]
[ { "docid": "1f2a19df70b044dd43a3b04d48f872ee", "score": "0.7981609", "text": "def default_value\n @properties[\"defaultValue\"]\n end", "title": "" }, { "docid": "7d449e76a4d0c030081ae0356be87c1e", "score": "0.7801077", "text": "def default\n @default ||= @co...
5fcfd2f10a76dd3ce00b110d06ef2502
Method to add an item to a list input: item name and optional quantity, and the list steps:add grocery item and quantity to the end of the list output: updated list
[ { "docid": "eb4b8751f41822f9e5c45807962b40e8", "score": "0.0", "text": "def add_item(list, item, quantity=1)\n list[item] = quantity\n p list\nend", "title": "" } ]
[ { "docid": "be8834e29b40265407a8595b74b8920d", "score": "0.850059", "text": "def add_item(item_name, grocery_list, quantity=1)\n grocery_list[item_name] = quantity\n grocery_list\n end", "title": "" }, { "docid": "9d6b552c2432c00ab2c724c71fbc80db", "score": "0.84565735", "text...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "3ad91fa86d47596d14f6ba792a1af3cc", "score": "0.0", "text": "def vendor_params\n params.require(:vendor).permit(:name)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.7121987", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.70541996", "text": "def expected_permitted_parameter_names; end", "title": "...
640a6d1463de6ff4a0e2dd392adb9a79
is session active for current_user = authorized to see this resource? if not, redirect them and tell them so....
[ { "docid": "c53ef3fec89825b753f391a4198fee03", "score": "0.7819578", "text": "def authorization_check\n # sessions take user info from db and hold it\n # during their session so not continually going to db\n # and so we know a current session exists for them\n if session[:current_user] == nil\n ...
[ { "docid": "068c648fa328417580d0d5152a3be161", "score": "0.7861236", "text": "def authorization_check\n if session[:current_user] == nil\n redirect '/not_authorized'\n else\n return true\n end\nend", "title": "" }, { "docid": "ee75bd3bfc801a5a51cee0661dad9d81", "score": "0.78438...
1871799b20e80f1fe2436f1a86dbc39f
Formats the ElasticSearch resurts in a JSONAPI like manner. type: Type of instance which was searched for. count: Total amount of results that are available page: Currently requested page (in terms of pagination) size: Amount of results on a single page. results: Actual results in the form of the ElasticSearch response...
[ { "docid": "dca7de6a00a8536cc5f250fff1a4beae", "score": "0.7451235", "text": "def format_results type, count, page, size, results\n last_page = count/size\n next_page = [page+1, last_page].min\n prev_page = [page-1, 0].max\n\n query_string = request.query_string.gsub(/&?page\\[(number|size)\\]=[0-9]...
[ { "docid": "657dfecb68025e49f6778295adda8e5c", "score": "0.7608857", "text": "def format_search_results(type, count, page, size, results)\n last_page = count / size\n next_page = [page + 1, last_page].min\n prev_page = [page - 1, 0].max\n\n query_string = request.query_string.gsub(/&?page\\[(number|...
a8d084b67fd6369f5d7ebf443aa6becd
The value of the string Return type: String
[ { "docid": "a588fe93fc70303b2c7898df55985503", "score": "0.717079", "text": "def value\n\t\treturn read_ascii(@ida, offset.address) if type == 0\n\t\treturn read_unicode(@ida, offset.address) if type == 3\n\n\t\traise \"Invalid string type\"\n\tend", "title": "" } ]
[ { "docid": "c2443024e3ee5d9311a87b9c6ea388ee", "score": "0.81313646", "text": "def value\n instance_variable_defined?(:@string) && @string || to_s\n end", "title": "" }, { "docid": "0429a365ba2e0f808337d3394c078dae", "score": "0.787906", "text": "def string()\n ...
6c571f32a77396a1a03061f009d3e888
Reload the currently instantiated Berkshelf configuration
[ { "docid": "dc1631881136569d3956297b469b8df2", "score": "0.0", "text": "def reload\n @instance = nil\n instance\n end", "title": "" } ]
[ { "docid": "9c9249832b3a036288f9742f7395270d", "score": "0.70059186", "text": "def reload_config!\n @config = nil\n load_config!\n self\n end", "title": "" }, { "docid": "3a28328ccec132909203a72a7577c2ea", "score": "0.6997568", "text": "def reload!\n read_confi...
692ff32bd13dd29a9c66576e49ce0665
translate/jobs (POST) Submits a job or group of jobs to translate.
[ { "docid": "e2c6b0cce282d7f019adbfdb566c7637", "score": "0.6743411", "text": "def create(options = {})\n res = self.post \"/translate/jobs\", :body => options\n check_for_errors(res)\n res['response']\n end", "title": "" } ]
[ { "docid": "5378643d665b2f7e54c0ccb84320ad7f", "score": "0.6130469", "text": "def do_submit\n @job = Job.find(params[:id])\n @queue = JobsQueue.find_by_id(params[:job][:jobs_queue_id]) || JobsQueue.default_queue\n respond_to do |format|\n if @job.submit(@queue)\n flash[:notice] = 'J...
abe2b18d363d37519538a6b5c7a57e55
Returns the database from the connection
[ { "docid": "f213d48122e6f3e72ab9f8b7fce20098", "score": "0.8406924", "text": "def db\n @db ||= connection[database]\n end", "title": "" } ]
[ { "docid": "1763ba58c1eea501451b49de7b41205e", "score": "0.827849", "text": "def database\n @database || connection.db(database_name)\n end", "title": "" }, { "docid": "695f6b4cf055f97408dadc10f10302a0", "score": "0.822008", "text": "def db\n @db ||= connection.db(databa...
ef9a94f85172065f66e831577b5e0fcb
PATCH/PUT /cvs/1 PATCH/PUT /cvs/1.json
[ { "docid": "b09054f116dccee52e83a8cb7fb1040a", "score": "0.0", "text": "def update\n respond_to do |format|\n if @cv.update(cv_params)\n format.html { redirect_to @cv, notice: 'Cv was successfully updated.' }\n format.json { render :show, status: :ok, location: @cv }\n else\n ...
[ { "docid": "8d6a61f3186174209e44862cb0ae05d7", "score": "0.63191366", "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...
a7fcd2445a7b449c2dbd110676534849
Deletes all existing signers and creates and stores a new one
[ { "docid": "a97550a0a6b9f55ddbbeb119b4a91f17", "score": "0.6815838", "text": "def create_signer\n # Get all existing signer ids\n signer_ids = self.to_session.signers.all.dig(:embedded, :signers)&.map(&:id)\n # Remove the first signer if max number of signers reached to ...
[ { "docid": "26071b95707628f339de1bdd45570efa", "score": "0.5959909", "text": "def prepare_signers(signers, mode = Figaro.env.hello_sign_status)\n signers = (signers + self.signers).map(&:deep_symbolize_keys)\n sanitize(signers, mode)\n end", "title": "" }, { "docid": "63e6fd8419526861...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "5dd7295f545e3bc73570224ff0ccd89a", "score": "0.0", "text": "def team_params\n params.fetch(:team, {})\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
96d3c8d7efbf8d197f7e3b9f89a327e8
validates_is_unique :token, :scope => [:user_id]
[ { "docid": "bbff9a715e51933d9111049eef93688f", "score": "0.0", "text": "def info\n @info ||= CreditCardInfo.new(token)\n end", "title": "" } ]
[ { "docid": "7112129c00cf259fa49a5db49f70cb1c", "score": "0.738134", "text": "def ensure_token_uniqueness\n self.session_token = generate_token\n while User.find_by(session_token: self.session_token)\n self.session_token = generate_token\n end\n self.session_token\n end", "title": "...
22e0160a0a46632de08b14ad61474c2c
id implementation can't use hyphens ()
[ { "docid": "81fe4ae74cf0b7079ac5a635a5ae24cb", "score": "0.0", "text": "def id\n raise NoMethodError, \"#{self} should implement id\"\n end", "title": "" } ]
[ { "docid": "3b501bb50b7dfba07bdee122a75f9bca", "score": "0.7821544", "text": "def name_as_id\n self.name.gsub(/\\//, '-')\n end", "title": "" }, { "docid": "3b501bb50b7dfba07bdee122a75f9bca", "score": "0.7821544", "text": "def name_as_id\n self.name.gsub(/\\//, '-')\n end", ...
2abbaa9ea5b833f594aa59d72bc1d094
Check if it profile is an admin
[ { "docid": "ed72e1f65f3e20ed86c2e388f1b617b0", "score": "0.0", "text": "def admin?\n self.id == 1\n end", "title": "" } ]
[ { "docid": "b74cbeb3fd1e5c444acf2a8a0e265e3c", "score": "0.83817023", "text": "def type_admin?\n current_profile.type_admin? if (current_profile.present?)\n end", "title": "" }, { "docid": "618b5fb30a243764e1a7597528e4696f", "score": "0.81701565", "text": "def profiles_administra...
f8babe858a3199e36322965c714e8318
EXPERT Return the one integer in an array that is even or odd while the rest are of opposite parity, e.g. oddball([1,2,3]) => 2, oddball([2,4,5,6] => 5)
[ { "docid": "f10bec8d7136db08ca8b32e4c8c5b5a6", "score": "0.7590811", "text": "def oddball(arr)\n # your code goes here\n even_no = []\n odd_no = []\n arr.each do |x|\n if x.even? \n even_no << x\n else\n odd_no << x\n end\n end\n if even_no.length == 1\n return even_no[0]\n ...
[ { "docid": "e0c8087b606086895463502e862b28f4", "score": "0.808924", "text": "def odd_integers(array)\n array.select { |num| num.odd? }\nend", "title": "" }, { "docid": "e0c8087b606086895463502e862b28f4", "score": "0.808924", "text": "def odd_integers(array)\n array.select { |num| n...
a0c3333010e9cfda22290340959aaa60
Details of the developer curl XGET '
[ { "docid": "6649a4077c64c484e206cf6944773749", "score": "0.0", "text": "def developer_details\n developer_id = params[:developer_id]\n developer = Agents::Branches::AssignedAgent.unscope(where: :is_developer).where(is_developer: true, id: developer_id).last\n developer_details = developer.as_js...
[ { "docid": "bf50544d9374406b135d9deb4015cc11", "score": "0.668232", "text": "def print_curl_request\n stdout.puts \"curl #{request_curl.map(&:shellescape).join(' ')}\"\n 0\n end", "title": "" }, { "docid": "c2277f02763acd575b1214c1634c8bb4", "score": "0.5851948", "text":...
a14b4043da48fa11e200f3868d2f6aca
Update this member's boosting timestamp
[ { "docid": "e00d88d43ecaebc167d45d9e051b3902", "score": "0.76620567", "text": "def update_boosting_since(time)\n @boosting_since = time\n end", "title": "" } ]
[ { "docid": "0d08f7391278b3e53c6b5aac9d868f91", "score": "0.6259688", "text": "def update!\n @last_update = Time.at 0\n update\n end", "title": "" }, { "docid": "e212a0082565df4b8be9e03a9b4b4cc8", "score": "0.625194", "text": "def run_update\n Morrow.instance_eval { @u...
f5d7a961d5a630df5715093a2b065c91
POST /enderecos POST /enderecos.json
[ { "docid": "e0264ee35077d54e8cf874465babaa11", "score": "0.55841875", "text": "def create\n @endereco = Endereco.new(params[:endereco])\n\n respond_to do |format|\n if @endereco.save\n format.html { redirect_to @endereco, notice: 'Endereco was successfully created.' }\n format.j...
[ { "docid": "b31a151999b85213a30ac8489abd15ea", "score": "0.6064908", "text": "def create\n @endereco = Endereco.new(endereco_params)\n\n if @endereco.save\n render json: @endereco.to_json(include: {cidade: {include: {estado: {include: :pais}}}})\n else\n render json: @endereco.errors,...
1c039b0a8032dca120c06ef32e6e46b1
TODO: add parameter version
[ { "docid": "a54db2ac61c9d141e0da3aa0a74c6ebc", "score": "0.0", "text": "def flatten\n Enumerator.new { |out|\n each { |e|\n if e.respond_to? :flatten\n e.flatten.each { |child| out << e }\n else\n out << e\n ...
[ { "docid": "c9f1af465866d59613fd9e2e2442c2f0", "score": "0.77088654", "text": "def param; end", "title": "" }, { "docid": "c9f1af465866d59613fd9e2e2442c2f0", "score": "0.77088654", "text": "def param; end", "title": "" }, { "docid": "c9f1af465866d59613fd9e2e2442c2f0", ...
03900cb5ecffd9f4ad0a8e85f54e9559
Returns the attempting times left for current answer. The max attempting times will be returned if question don't have the limit.
[ { "docid": "995e2da675999dfaa75eb49a8dc9ed9b", "score": "0.8796639", "text": "def attempting_times_left\n @times_left ||= begin\n return MAX_ATTEMPTING_TIMES unless question.actable.attempt_limit\n\n times = question.actable.attempt_limit - submission.evaluated_or_graded_answers(question).s...
[ { "docid": "103f9668654fa2841825bf55a48bea31", "score": "0.6924874", "text": "def remaining_misses\n @guess_limit - incorrect_guesses.size\n end", "title": "" }, { "docid": "b6bbc69031c094c43a6a7633e8c5f47c", "score": "0.66822785", "text": "def attempts\n (@seconds / dela...
930ff41372c863d85afe64e9852b3a1b
PUT /courses/1 PUT /courses/1.json
[ { "docid": "112b348f5d4641aeb4efafa1f85badef", "score": "0.0", "text": "def update\n @course = Course.find(params[:id])\n \n params[:course][:started_at].gsub!(\"/\",\".\") \n params[:course][:ended_at].gsub!(\"/\",\".\") \n\n respond_to do |format|\n if @course.update_attributes(pa...
[ { "docid": "b4b030568b02e5ba2a8d9955805c74d3", "score": "0.71953833", "text": "def update\n @course.update(course_params)\n render_jsonapi_response(@course)\n end", "title": "" }, { "docid": "f4ee234e733003945ea81d485f1df4a8", "score": "0.7169085", "text": "def update\n @co...
c0b8f22aa74e492801aafcd0172f0cd8
GET /cuisines or /cuisines.json
[ { "docid": "60dd137527546a9ef7e428b9bfbf4e2e", "score": "0.674264", "text": "def index\n @cuisines = Cuisine.all\n end", "title": "" } ]
[ { "docid": "38f086a9ec89fcdfdfc9a88fa18fe709", "score": "0.72994286", "text": "def index\n\t\tcuisines = Cuisine.all\n\t render json: cuisines\n\tend", "title": "" }, { "docid": "741185ac40029aa9755288d082bdc72d", "score": "0.7284831", "text": "def fetch_cuisines\n puts \"Fet...
fdf91fc9146f28cd64d18493788f1890
based on what the object is enrich the object
[ { "docid": "36dc10fed02479449dbcd7bf673d00b8", "score": "0.6111264", "text": "def enrich_object(object)\n movie_lookup(object) if object.class.to_s == \"Movie\" and $config[\"themoviedb\"][\"default\"] == true\nend", "title": "" } ]
[ { "docid": "b3bd310b6051dafb4a5637a65fe1c273", "score": "0.6292859", "text": "def extend_object(obj) end", "title": "" }, { "docid": "9612ddd40a0098e081fb8e0b25b6f11f", "score": "0.62067705", "text": "def write_object(object)\n extend_for(super)\n end", "title": "" ...
6ffb3fdd090fe43da44e793aa9b25cff
GET /forums/topics/1 GET /forums/topics/1.xml
[ { "docid": "3d2a6769bbc6c663e048880beb676d71", "score": "0.7469726", "text": "def show\n @forums_topic = Forums::Topic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @forums_topic }\n end\n end", "title": "" } ]
[ { "docid": "cfde97d9e27c12e3e0a08d7b3f572e66", "score": "0.7670386", "text": "def index\r\n @topics = @forum.topics\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @topics }\r\n end\r\n end", "title": "" }, { "docid": "fbbcf494...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "a6b9063cb238f6338d899958b0d2b5c7", "score": "0.0", "text": "def series_params\n params.require(:series).permit(:name, :value, :enabled, :first_number)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74968386", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958337", "text": "def strong_params\n params.require(:request).permit(param_whit...
c9f12e43f9e164e4465b6525c421f339
DELETE /trademarks/1 DELETE /trademarks/1.json
[ { "docid": "1e36a60e0d01bf8446045a6b21163ec6", "score": "0.74340105", "text": "def destroy\n @trademark.destroy\n respond_to do |format|\n #format.html { redirect_to trademarks_url, notice: 'trademark was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "96bd091ca01a5b968e753403c001b541", "score": "0.7180356", "text": "def destroy\n @trade = Trade.find(params[:id])\n @trade.destroy\n\n respond_to do |format|\n format.html { redirect_to trades_url }\n format.json { head :no_content }\n end\n end", "title": "" }, ...
c7f24778cc4932f96e4ee46bed20ae0a
does a standard merge_if_exists, but always attempts to save the result
[ { "docid": "37ade9b21b214a504e56c81e8c5bda70", "score": "0.87591755", "text": "def merge_if_exists!\n t = merge_if_exists || self\n t.save!\n end", "title": "" } ]
[ { "docid": "ef796641c375e334a8597612f8329af1", "score": "0.6724064", "text": "def merge_if_exists\n # Get the existing tracker item for the master / protocol pair in the new record (self)\n # If it exists then we handle saving the new record and getting the appropriate response.\n # If it doesn...
25b78ef490913d96e487ffda51d12431
Updates multiple users in the database
[ { "docid": "52b679c5f06e2d0365a823c724f942be", "score": "0.7129177", "text": "def update_multiple\n\t\tdb = UserInformation.all\n\t\tupdated_users_count = 0\n\t\tmax_handles_to_update = 100\n\n\t\t# Returns if DB is empty\n\t\tif db.length == 0\n\t\t\treturn \"DB is empty\"\n\t\tend\n\n\t\toldest_entry ...
[ { "docid": "ac66d695695de1040c5ba28f965ad0e2", "score": "0.78689337", "text": "def update_multiple\n\n User.update(params[:user].keys, params[:user].values)\n flash[:notice] = 'Users successfully updated'\n redirect_to :action => \"list\"\n\n end", "title": "" }, { "docid": "af03b3...
33bc4f3dd647703689efc2d9c7501778
location is now optional
[ { "docid": "ca15a75d8cdeda2da6769f2034a2a322", "score": "0.0", "text": "def tweet(message, lat = nil, long = nil, reply_id = nil)\r\n #\r\nend", "title": "" } ]
[ { "docid": "6844b71c2f86351b764d4c06ed39e5b9", "score": "0.7926173", "text": "def location\n\t\t@location\n\tend", "title": "" }, { "docid": "7735b51f66aa92f7e741e618f8bfad85", "score": "0.7895039", "text": "def set_location\n\n end", "title": "" }, { "docid": "5aa40b4...
559748630d67173e4950d80896810e78
Retrieve all domain verification records for an account
[ { "docid": "10896d0f39c90d4551e5acafa755fe6c", "score": "0.6407968", "text": "def verified_domains()\n _params = {}\n return @master.call 'helper/verified-domains', _params\n end", "title": "" } ]
[ { "docid": "edcb424b802c7a9612db62d05c8e00f6", "score": "0.71353585", "text": "def verification_dns_records\n return @verification_dns_records\n end", "title": "" }, { "docid": "c3e1cc10120dbbb7fca797424a1a314d", "score": "0.67381537", "text": "def list_doma...
d7db440a1bc10f98f3d5c01e43339643
PATCH/PUT /contacts/1 PATCH/PUT /contacts/1.json
[ { "docid": "ef62751da664a2db3b8780c9e39d456f", "score": "0.0", "text": "def update\n @contact.user = @user\n\n #TODO: Not sure why, but attorney_type is NOT beign emptied out when Contact Type is of something\n # else besides Attorney. Need to look into this when there is a chance since Attorne...
[ { "docid": "14e83361af7c6352a945eed0a3cccad2", "score": "0.7059103", "text": "def update\n @contact.update(contact_params)\n if @contact.valid?\n render json: @contact\n end\n end", "title": "" }, { "docid": "4c970020715250be770177427135ee49", "score": "0.6981991", "te...
953be2a11a8f91adcc429d1a1d78949a
The result of a call to get_all_internal is cached using the "kind" object as a key.
[ { "docid": "2e78230beeb66e0d26ee241482c3bc56", "score": "0.71434903", "text": "def all_cache_key(kind)\n kind\n end", "title": "" } ]
[ { "docid": "70f58ee2f034a9dc4de1a6a29e66df94", "score": "0.59066236", "text": "def hs_items_of_kind(kind)\n\treturn $alls[kind]\nend", "title": "" }, { "docid": "17434edd5951afbe1b50235c3ff9960c", "score": "0.5736121", "text": "def cached_all_instances\n if cache_enabled\n # ...
7ff4bf27ad9a6fa8a62419418a272622
POST /admin/company_types POST /admin/company_types.json
[ { "docid": "3ca0370d6122b8ff823a7f04ed1cf5b7", "score": "0.7275821", "text": "def create\n @admin_company_type = Admin::CompanyType.new(admin_company_type_params)\n\n respond_to do |format|\n if @admin_company_type.save\n format.html { redirect_to @admin_company_type, notice: 'Company ...
[ { "docid": "ca0f4d6b33d54feb3f83b0e3b1d5a27a", "score": "0.7236412", "text": "def create\n @company_type = CompanyType.new(company_type_params)\n\n if @company_type.save\n render json: @company_type, status: :created, location: @company_type\n else\n render json: @company_type.errors,...
8ac6f0df0d99f41547984f006091a336
return: 0(self is fluid) or >0(real width)
[ { "docid": "e56e57503be75ea585dbf1fa118b72c8", "score": "0.6052292", "text": "def width\n # it is root and fluid\n return 0 if self.root? && html_attribute_values(\"page_width\").unset?\n # it is root and fixed\n return html_attribute_values(\"page_width\")['pvalue'] if self....
[ { "docid": "03e72c1737a10cd5b391c93521a4bdeb", "score": "0.6761902", "text": "def wider?\n width > height\n end", "title": "" }, { "docid": "465b36ef634d043535b867d3943e156b", "score": "0.6751528", "text": "def narrow_width\n @narrow_width || 1\n end", "ti...
61f2429c5b9754be4883e3905be2f391
Back in the good old days, you used to be able to write a darn near uncrackable code by simply taking each letter of a message and incrementing it by a fixed number, so "abc" by 2 would look like "cde", wrapping around back to "a" when you pass "z". Write a function, `caesar_cipher(str, shift)` which will take a messag...
[ { "docid": "6b59f66a069dd9b4ff689a4f2500e460", "score": "0.82753277", "text": "def caesar_cipher(str, shift)\r\n \r\n list = (\"a\"..\"z\").to_a\r\n letters = str.split(\"\")\r\n \r\n result = []\r\n \r\n \r\n i = 0\r\n \r\n while i < letters.length\r\n puts \"here\"\r\n ...
[ { "docid": "bc94134fd2f0293769543c637bb2147d", "score": "0.88632244", "text": "def caesar_cipher(str, shift)\n alpha = (\"a\"..\"z\").to_a \n new_message = \"\"\n letters = str.split('')\n letters.each do |l|\n if alpha.include?(l)\n og_idx = alpha.index(l)\n new_idx = (og_idx + shift) ...
d6d7097ba6eb7b681746a562a49e069f
mode: ruby vi: set ft=ruby :
[ { "docid": "b7672329e599d1393d15f1d8e3edaeb8", "score": "0.0", "text": "def bubble_sort_by ary\n (ary.length-2).downto(0) do |k|\n swapped = false\n for i in 0..k\n if (yield ary[i], ary[i+1]) > 0\n ary[i], ary[i+1] = ary[i+1], ary[i]\n swapped = true\n end\n end\n b...
[ { "docid": "6ec4d2a5b4f632fb51c1a97fab50239b", "score": "0.57417554", "text": "def pygment_code_block(block)\n write_data block, 'code.rb', false\n system 'pygmentize -o block.html code.rb'\n File.open('block.html', 'r').read\n end", "title": "" }, { "docid": "ec2907787e72211b44cc2...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "d48506867cd81c208df68f66b3225000", "score": "0.0", "text": "def set_appointment\n @appointment = Appointment.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;...
7b5cb93d4862d140b3a15a9a211a475c
Raise an exception if the active PostgreSQL version doesn't support renaming enum values.
[ { "docid": "bec3590d0938da7ef2102d4fe9cc12b2", "score": "0.8636358", "text": "def ensure_renaming_enum_values_is_supported!\n return if ActiveRecord::Base.connection.postgresql_version >= 100_000\n\n raise NotImplementedError, 'PostgreSQL 10.0+ is required to enable renaming of enum va...
[ { "docid": "7e1870640938827e2443156c6c8d0a9d", "score": "0.70000905", "text": "def rename_enum(enum, new_name)\n _process_enum_change_sql(\"ALTER TYPE #{quote_schema_table(enum)} RENAME TO #{quote_schema_table(new_name)}\")\n end", "title": "" }, { "docid": "87ad306b893ab61f8fc05...
3dc40e04093275355466ace2c7d9a6ce
DELETE /specks/1 DELETE /specks/1.json
[ { "docid": "261ffeb4dcbcfb3635657e535b0bf548", "score": "0.75650686", "text": "def destroy\n @speck.destroy\n respond_to do |format|\n format.html { redirect_to specks_url, notice: 'Speck was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" ...
[ { "docid": "d8ce549aadf750a77d36a82670dcd1db", "score": "0.7236278", "text": "def destroy\n @sculpture.destroy\n respond_to do |format|\n format.html { redirect_to sculptures_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "32e7f24368d6a34...
4c670070df28de9c6c79f88ba1c7b184
Get device session steps of all device sessions in run.
[ { "docid": "1c616519ab3ba211b1e4f4f81833b59b", "score": "0.5141819", "text": "def get_all_test_run_device_session_steps_using_get1_with_http_info(run_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdminApi.get_all_test_run_device_session_step...
[ { "docid": "f817a2ab49242157f37069b1cbf7e2f4", "score": "0.6379229", "text": "def steps\n self.step_flows.includes(:current_step).collect(&:current_step)\n end", "title": "" }, { "docid": "b59e910b27248f6b368f17b1ec3cdaf7", "score": "0.63376635", "text": "def get_all_test_run_dev...
9531bf3aa468ec9aa5403f484573a97a
pages added during a test scenario
[ { "docid": "57ea5a33a5f2d4feb17b0e067e467a04", "score": "0.6700495", "text": "def custom_pages\n @custom_pages ||= []\n end", "title": "" } ]
[ { "docid": "30a387583ac6e0c8e58e093c5aaf78ec", "score": "0.7490574", "text": "def pages_to_add; end", "title": "" }, { "docid": "f22917587660ff69f20073d472bb07fe", "score": "0.7116708", "text": "def pages; end", "title": "" }, { "docid": "f22917587660ff69f20073d472bb07fe"...
86ac2d372244733c7ce2c0d460f3b965
GET /mutuelles GET /mutuelles.json
[ { "docid": "a16c86032c77bf632d0f7cc18996132b", "score": "0.685663", "text": "def index\n @mutuelles = Mutuelle.all\n end", "title": "" } ]
[ { "docid": "827b79962f678ee429ffbebf65299cf5", "score": "0.66265863", "text": "def get_mutant(m_id)\n\n get_request = API_URL + \"mutants/#{m_id}\"\n @response = RestClient.get(get_request){|response, request, result| response }\n\n @parsed_response = JSON.parse(@response)\n @parsed_response[\"statu...
c94426815d360a5ff4f78a0cecf388ce
In a PresenceConstraint, each role in "each XYZ" must occur in exactly one readings_list
[ { "docid": "e2e4bc5ad6a1d6f5f8bdee283ab1ca9b", "score": "0.0", "text": "def loose_binding\n # loose_bind_wherever_possible\n end", "title": "" } ]
[ { "docid": "3e3d04ecdc49e885963935a4c461f06d", "score": "0.59592015", "text": "def alternate_readings readings\n readings.map do |reading|\n reading.role_sequence.all_role_ref.sort_by{|rr| rr.role.ordinal}\n end.transpose.each do |role_refs|\n role_refs_have_same_player r...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "2859cb0764574371ac328e50f0a48469", "score": "0.0", "text": "def set_selectf\n @selectf = Selectf.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;...
416006ec707167302e19a10684e4961e
def update_task_list(task_list_id, args) end
[ { "docid": "1bda0c4b73f50b080651f38af25fb5fb", "score": "0.0", "text": "def task_list(task_list_id)\n response = get \"/tasklists/#{task_list_id}.json\"\n response.body['todo-list']\n end", "title": "" } ]
[ { "docid": "cf74786826a5210b02583f4569bd240b", "score": "0.85168356", "text": "def update_task_list(task_list_id,**task_list_info)\n google = Deed::Google_api.new\n task_list_data = google.task_list(task_list_id)\n task_list_data.update!(task_list_info)\n tasks_client = Google::Apis:...
d7996881a2e236020256dbdb02f591df
Utility method to determine if an Object contains valid fields or not Returns true/false Boolean
[ { "docid": "e640fe0e345283e6fcb49654c3033f5a", "score": "0.0", "text": "def valid?\n valid = true\n\n if self.vocabulary.nil? || self.vocabulary == \"\"\n valid = false\n end\n\n if self.answer.nil? || self.answer == \"\"\n valid = false\n end\n\n # vocabulary = DATABASE.exec...
[ { "docid": "10898f42b5d2f739bd3decca5231dad5", "score": "0.79950964", "text": "def valid?\n @fields.size > 0\n end", "title": "" }, { "docid": "05432646c0491b2c32a7ca0246e39f47", "score": "0.7596711", "text": "def valid?\n !self.class.definition.keys.map do |field_sym|...
4b638bcc25ee2400a2e47dc198844a2a
get_price Parameters:: (car_container) params: car_container Return:: the price of the car in text with format '$12,345', or 1 if no price found Author::
[ { "docid": "873490ee31bc0000b001e4154b232aaa", "score": "0.7949401", "text": "def get_price(car_container)\n # Todo: Put your code here to get the price of the car\n \nend", "title": "" } ]
[ { "docid": "c0e3a596075fba5c8004507844d6b5f0", "score": "0.67887694", "text": "def price\n price_get(nil).try(:price_amount)\n end", "title": "" }, { "docid": "5824e222190140a051eae9f901e7332c", "score": "0.6500364", "text": "def price\n if object.price.present?\n h.m...
17011c91b14121c7f0ad2bc327e3fd56
Returns the argument portion of an AT command split into an array. This isn't as robust as a real modem, but works for RubyGSM.
[ { "docid": "3f5c140c555a480109025b15e8eccdc4", "score": "0.0", "text": "def parse_args(str)\n\t\t\t\tstr.to_s.split(\",\").collect do |arg|\n\t\t\t\t\targ.strip.gsub('\"', \"\")\n\t\t\t\tend\n\t\t\tend", "title": "" } ]
[ { "docid": "2858b095c6263754f338f9def5c1cd56", "score": "0.6254008", "text": "def get_arguments(cmd)\n (main_args, sub_command, sub_args) = split_command(cmd)\n int_sub_command = '' #sub_command\n until sub_args.empty? do\n (int_main_args, int_sub_command, sub_args) = split_command(sub_args)\n en...
c006f143d79d732133c0f5ea1f977cf5
DELETE /estimations/1 or /estimations/1.json
[ { "docid": "01436ac2d1248aa3d5f9df41af994d6e", "score": "0.63735104", "text": "def destroy\n @estimation.destroy\n respond_to do |format|\n format.html { redirect_to estimations_url, notice: \"Estimation was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",...
[ { "docid": "af1688301d038ffb930d1d978db7d546", "score": "0.6871274", "text": "def destroy\n @estimate.destroy\n\n respond_to do |format|\n format.html { redirect_to estimates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "247db414c7c78f3...
181f346b9bf4ddfde8b6771b1b74aa93
Rename this if more options will apear(time range, convert etc)
[ { "docid": "b84fa485f0fb8395452496f02f0846d6", "score": "0.0", "text": "def call\n query_params = {\n access_key: SECRET,\n base: params[:base_currency],\n symbols: params[:exchange_currency]\n }.to_query\n\n url = \"#{URL_BASE}/#{params[:exchange_date]}?#{query_params}\"\n\n ...
[ { "docid": "1cb0350d082a3f838bb31573d784d8dd", "score": "0.58681315", "text": "def change(options); end", "title": "" }, { "docid": "1cb0350d082a3f838bb31573d784d8dd", "score": "0.58681315", "text": "def change(options); end", "title": "" }, { "docid": "1cb0350d082a3f838b...
d5bb659d0cde16885f86542456702fd7
GET /returns/new GET /returns/new.xml
[ { "docid": "00fd5f36cd8a0e763c328de7dbfabfd7", "score": "0.6760903", "text": "def new\n @return = Return.new\n @return.charges = 0\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @return }\n end\n end", "title": "" } ]
[ { "docid": "afa429c920e975a4eb1ec6f76c54ee7c", "score": "0.67309105", "text": "def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end", "title": "" }, { "docid": "16b9569dda70acebb63f5bd8a1a2b0...
0d8b3f901d2774fb2e6e9c709423a980
GET /admission_requests/1 GET /admission_requests/1.json
[ { "docid": "0150e3b613a99ea6e5c3630815930d67", "score": "0.58187085", "text": "def show\n if @admission_request.user_id != current_user.id\n redirect_to root_path\n end\n end", "title": "" } ]
[ { "docid": "19c0a2dd92057c458cda105ecbdf7b13", "score": "0.6515865", "text": "def requests\n @profile = Profile.find(params[:id])\n @requests = Appointment.find_all_by_requester_id(current_user.id)\n end", "title": "" }, { "docid": "4c9268ac41ef4f7a2536ceff2c7d003c", "score": "0.6...
b4d02ea99e5a503be5722b4d8c0499f5
7. Write a method to collect all holidays with BBQ.
[ { "docid": "df69ccd76dfdd1222b53a404356344db", "score": "0.76825744", "text": "def holidays_with_bbqs(holiday_supplies) #=> [:fourth_of_july, :memorial_day]\n holiday_supplies.map do |season, holidays|\n holidays.map do |holiday, supplies|\n holiday if supplies.include?('BBQ')\n end\...
[ { "docid": "fbeed34afc62cbdb98eb616c077b124b", "score": "0.78764373", "text": "def all_holidays_with_bbq(holiday_hash)\n # return an array of holiday names (as symbols) where supply lists\n # include the string \"BBQ\"\n bbq = []\n holiday_hash.each do |season, holidays|\n holidays.each do |even...
f1b103e25fe1916f6ece7bbbd2b8c102
DELETE /cards/1 DELETE /cards/1.json
[ { "docid": "2526592d1445ecf4ce5d1f462ab4824b", "score": "0.7781162", "text": "def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url, notice: t('view.cards.correctly_deleted') }\n format.json { head :ok }\n end\...
[ { "docid": "27f165312ca9d32a7ac8257d8bb8504e", "score": "0.7972564", "text": "def delete_cards\n params[:_json].each do |card|\n if card[:id].nil?\n Card.destroy(card[:id])\n end\n end\n end", "title": "" }, { "docid": "695a0de9f48ae263a2919c5e71175064", ...
44bf2cd05e46695f8fd1b0d21754244d
Used to validate that the current user can comment on topic. Override to provide application specific commenting validation
[ { "docid": "c4414325ad43a203829416afc26a6b3a", "score": "0.5892409", "text": "def validate_create(topic)\n true\n end", "title": "" } ]
[ { "docid": "d62a070d1d3f636f40f475264fa3bcb9", "score": "0.6912307", "text": "def allow_comment?(user) \n # for now, we allow everyone\n return true \n end", "title": "" }, { "docid": "a0bee04891274f820df5f71cb49e966d", "score": "0.67382985", "text": "def can_create_comment?(p...
41c0b903645aeac5b34b7a8aca8a7df3
return no. rows for this question
[ { "docid": "8f14a260e6e622f31b0050f60876cb1c", "score": "0.0", "text": "def col_options(question)\n question.question_cells.select { |cell| cell.type =~ /Rating|TextBox|Comment/ }.collect do |cell|\n [cell.col, cell.col]\n end\n end", "title": "" } ]
[ { "docid": "b628c72be1dad4a7601404d3398bcd82", "score": "0.7644153", "text": "def rows_count\n @rows.size\n end", "title": "" }, { "docid": "5efc62a479629a331d9b1a09358ecbfd", "score": "0.7575606", "text": "def row_count\n @rows.length;\n end", "title": "" }, ...
6ce1c6f68fc5d421c90a078166aaf09e
Returns all positions that are on the board, in the format: [:a3, :a4, :b2, :b3, .. :k2, :k3]
[ { "docid": "c45ce715c13c829782f518b465a9e1a4", "score": "0.7412269", "text": "def get_all_positions\n\n positions = []\n POSITION_NUMBERS.each do |number|\n POSITION_LETTERS.each do |letter|\n positions << eval(\":#{letter}#{number}\")\n end\n end\n positions -= POSITIONS_NO...
[ { "docid": "6f162b10ff1ec32a5c6db2b2de365132", "score": "0.76549524", "text": "def board_positions\n positions = []\n for i in 0...@letters.length\n positions << @numbers.map { |number| @letters[i] + number }\n end\n positions\n end", "title": "" }, { "docid": "4002cdc46fc5...
58430cafa5b3de5f37ed28c4a3d04a45
DELETE /portfolios/1 DELETE /portfolios/1.json
[ { "docid": "b06c4437d6c9295ce830c46fa71d153b", "score": "0.70598924", "text": "def destroy\n @portfolio.destroy\n respond_to do |format|\n format.html { redirect_to portfolios_url, notice: 'Portfolio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "e37ecc077bb46e512e3ad92e7cef3e44", "score": "0.74619246", "text": "def delete()\n\n client.delete(\"/portfolios/#{gid}\") && true\n end", "title": "" }, { "docid": "04b6b4ecb0730f001e8c236dbaee5f4f", "score": "0.7404306", "text": "def destroy\n @portfolio.d...
22062ba24be0ac6a2f52297fd7f8ac03
Update a 'fabric.FcoeUplinkPcRole' resource.
[ { "docid": "6053e5f119b5bf89fb533e69d88c7db1", "score": "0.67983294", "text": "def patch_fabric_fcoe_uplink_pc_role(moid, fabric_fcoe_uplink_pc_role, opts = {})\n data, _status_code, _headers = patch_fabric_fcoe_uplink_pc_role_with_http_info(moid, fabric_fcoe_uplink_pc_role, opts)\n data\n ...
[ { "docid": "2f73474508694760cb7bbfa154bc9b6b", "score": "0.7381982", "text": "def update_fabric_uplink_pc_role(moid, fabric_uplink_pc_role, opts = {})\n data, _status_code, _headers = update_fabric_uplink_pc_role_with_http_info(moid, fabric_uplink_pc_role, opts)\n data\n end", "title": ...
5fac9494a78d2115fc518f46be1d1a6f
Get Battle Screen XCoordinate
[ { "docid": "762ddb331424e442b59cbff2ed56c187", "score": "0.75508505", "text": "def screen_x\n return $data_troops[@troop_id].members[@member_index%8].x\n end", "title": "" } ]
[ { "docid": "68a15eee89c5dbd720127dd5423379e8", "score": "0.8305357", "text": "def screen_x\n x = ((@real_x - $game_map.display_x + 3) / 4)\n return x\n end", "title": "" }, { "docid": "249546f78bcd2cc61d3f39b79ef95db9", "score": "0.8293783", "text": "def screen_x\n return (...
96119a19f291d58df904fea47dae0673
............ parsing methods ...........
[ { "docid": "dd9ff9eb3940f4a0ed74f4b08bbe90d6", "score": "0.0", "text": "def parse str\n begin\n @str=str\n @tokens=Lexer.new.tokenize(str)\n @tokens=remove_comments()\n warnings=@tokens.select{|tok| tok.is_a? :lexer_warning}\n show_lexer_warnings(warnings)\n ...
[ { "docid": "cfc64655d8a635c2b0e52549825348ed", "score": "0.84699625", "text": "def parse; end", "title": "" }, { "docid": "cfc64655d8a635c2b0e52549825348ed", "score": "0.84699625", "text": "def parse; end", "title": "" }, { "docid": "5c992738078fd55d4beaf0f584d51e39", ...
48adf736816e4cc3d32ccfe64af41a9f
iterate over all defined key/value pairs
[ { "docid": "0771c375f48480d813bfe69951c0e777", "score": "0.5964567", "text": "def each\n @yaml.each do |k, v|\n yield k, v\n end\n end", "title": "" } ]
[ { "docid": "09939eb6158e4bfa94b887a067c209bf", "score": "0.6945496", "text": "def iterate_through_hash\n add_a_key_value_pair.each {|key, value|\n puts \"The #{key} summer olympics took place in #{value}.\"}\nend", "title": "" }, { "docid": "ad01680680dbc8644d44c1cd0e145095", "score"...
1a5be698bfe3c959ffb99e0319bf9002
GET /classtimes/1 GET /classtimes/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "a3de7c8b43cee32f1dc630ec98d44576", "score": "0.7090996", "text": "def index\n @class_times = ClassTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @class_times }\n end\n end", "title": "" }, { "docid": "be4a81c...
15bcd8b8d5c53895268a48ff734f86ce
Apply all process callbacks added through CarrierWave.process source://carrierwave//lib/carrierwave/uploader/processing.rb71
[ { "docid": "b8704c363440cec778b61a7dd5d7edd7", "score": "0.0", "text": "def process!(new_file = T.unsafe(nil)); end", "title": "" } ]
[ { "docid": "0929b5725be8d834c4b71858b80fc6ad", "score": "0.6491021", "text": "def process\n post_process\n end", "title": "" }, { "docid": "875bd3323cbd25a9ba038abd9dd8f6a3", "score": "0.64593405", "text": "def finalize_redaction\n @model.process_and_upload\n end", "title...
ceaf7bb3173b13988f19214e19c104fc
Removes one specific document from the index.
[ { "docid": "f4cc06fc51fecc9033436ad436a28b7c", "score": "0.0", "text": "def delete(id)\n @strategy.delete_document(id)\n end", "title": "" } ]
[ { "docid": "3ba3557a40d4c2239f84248554949e9b", "score": "0.78692776", "text": "def remove_from_index\n terms = [\n { :field => \"id\", :value => self.id.to_s },\n { :field => \"class\", :value => self.class.to_s }\n ]\n ENGINE.delete_documents(terms)\n e...
12da87de84446c75bed6c24849a8cc18
Initialize a new SslscanWrapper::Scanner object Examples scan = SslscanWrapper::Scanner.new do |s| s.ipv4 = true end Returns a SslscanWrapper::Scanner object
[ { "docid": "d27ab74f4a965cd62967650a571d271b", "score": "0.67090225", "text": "def initialize\n @command = 'sslscan'\n @port = 443\n yield self if block_given?\n end", "title": "" } ]
[ { "docid": "8c4b80a1530716fb0486d1a3903ccc93", "score": "0.5704899", "text": "def scan\n scan_result = Rex::SSLScan::Result.new\n scan_result.openssl_sslv2 = sslv2\n # If we can't get any SSL connection, then don't bother testing\n # individual ciphers.\n if test_ssl == :rejected and test...
90c8a1a925a595e1a63c68776882d13c
displays all articles in ranked order
[ { "docid": "fe630cdad58f67329e73a4b41667debb", "score": "0.6379154", "text": "def index\n @index = Article.article_index\n \t@user = current_user\n \t@articles = Article.find(:all)\n \t# Rank by score, or the second index\n \t@rankList = rankArticles(@articles).sort_by {|e| [e[1]]}\n\n \t@known_...
[ { "docid": "ab5dd060afda1b89fbbf4d4ae3ce6a96", "score": "0.69859254", "text": "def index\n @publications = Publication.all.order('rank')\n end", "title": "" }, { "docid": "aed161c3fb5c04264c8ed8c96addc532", "score": "0.6962111", "text": "def index\n #@articles = Article.all\n ...
ae42adce73cdbedb3df928eaa602c27e
GET /overriding_charges/new GET /overriding_charges/new.xml
[ { "docid": "c3f22f69186e73f098c154d3edd066c1", "score": "0.78937835", "text": "def new\n @overriding_charge = OverridingCharge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @overriding_charge }\n end\n end", "title": "" } ]
[ { "docid": "4aa52d37200f2b32e8a979cb062ea4aa", "score": "0.70803785", "text": "def create\n @overriding_charge = OverridingCharge.new(params[:overriding_charge])\n\n respond_to do |format|\n if @overriding_charge.save\n format.html { redirect_to(@overriding_charge, :notice => 'Overridi...
d84f72bddfdf25049ad41cecd84e4560
Return metadata in Hash form.
[ { "docid": "cb8a60b5f85f3e0914304629c1813f14", "score": "0.0", "text": "def to_h\n read!\n @data.dup\n end", "title": "" } ]
[ { "docid": "f388a4a715de9b4f80d470103614b757", "score": "0.7841268", "text": "def metadata\n hash.inject([]){ |list, data| list << MetaData.new(data[0], data[1][0]) }\n end", "title": "" }, { "docid": "5fdf4279ab56653d24c6e9026fb4ee39", "score": "0.7602452", "text": "def meta...
a4e2ed9f0020a71cc8ea85288a96cb52
Checks that the current deadline is expired
[ { "docid": "e70e5bcd3fc9f48372562d9230f30b5f", "score": "0.7316294", "text": "def check!\n return unless cancelled?\n\n raise DeadlineExpired, reason\n end", "title": "" } ]
[ { "docid": "4bd1504a033c976464b5cc8b0b57b3d4", "score": "0.8584673", "text": "def expired?\n self.deadline.try(:<, Time.now.utc.to_date) && !self.done?\n end", "title": "" }, { "docid": "aee68b124220cd6455f4fcabe3439a30", "score": "0.8200356", "text": "def expired?\n valid_unt...
82963ede6be3bcd07a5f7b661e7963a0
returns hostname without any subdomains
[ { "docid": "d81a273358fba135b2630c69f6a69452", "score": "0.6333229", "text": "def get_url_host_base(host)\n host_split = host.split '.'\n\n # check for hostnames without periods, like \"localhost\"\n if host_split.size == 1\n return host\n end\n\n host_split.pop(2).join('.')\n\n end...
[ { "docid": "76cd2818c0a4181d46b378b31b87796b", "score": "0.80082446", "text": "def host_without_subdomain\n parts = request.host_with_port.split('.').last(2)\n parts.join('.')\n end", "title": "" }, { "docid": "07bd13145826f37fdb0846ffbca15d5a", "score": "0.74856645", "text": ...
0dc45f667621f0eb29aecb5b2dc60c51
The login button id
[ { "docid": "99d246c0ef4fd50fe2dd1559a4d6a519", "score": "0.67928606", "text": "def login_button\n \"UIButtonLabel text:'Login'\"\n end", "title": "" } ]
[ { "docid": "771f3ea184426a50da7d0457fdc4a349", "score": "0.74895823", "text": "def sign_in_button\n\t\t@browser.button(id: @button_id)\n\tend", "title": "" }, { "docid": "63df0d82843e71ea84484a3761c9aac2", "score": "0.7158183", "text": "def sign_in_button\n $tracer.trace(__method_...
f4079158d94bc3e1e298cc1d26987ff4
GET /smallmobunits/new GET /smallmobunits/new.json
[ { "docid": "30d5b34cd9ebceb7f2ae34ef17d693b8", "score": "0.8262701", "text": "def new\n @smallmobunit = Smallmobunit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @smallmobunit }\n end\n end", "title": "" } ]
[ { "docid": "d6be484fbc7886f0c9eee9d1ac4f64c3", "score": "0.7797172", "text": "def create\n @smallmobunit = Smallmobunit.new(params[:smallmobunit])\n\n respond_to do |format|\n if @smallmobunit.save\n format.html { redirect_to @smallmobunit, notice: 'Smallmobunit was successfully create...
bc43842e17a0fd83fcaeb568c7630a68
We've made this a separate function because it's going to be what we're going to be modifying most often. The data service will return to us a JSON payload as a regular order of business. What's going to change is how we manipulate that result. This example does very little.
[ { "docid": "255d4c4355d4ecc92dd190152d401a49", "score": "0.0", "text": "def processJSON(json)\n # \"Pretty Print\" the JSON response\n pp json\nend", "title": "" } ]
[ { "docid": "c64127c6f3122533cc28fed136406fec", "score": "0.68154114", "text": "def postprocessing\n # change the resulting @json object here\n end", "title": "" }, { "docid": "4d62200ef6c21592c891b6a2e989b133", "score": "0.62570274", "text": "def convert_api_data(data)\r\n @resu...