query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "9038934ee7065e23a661fc1cab46fb51", "score": "0.0", "text": "def update!(**args)\n @previous_transaction = args[:previous_transaction] if args.key?(:previous_transaction)\n end", "title": "" } ]
[ { "docid": "184b1b1ed771473d3eb9f338c0734c38", "score": "0.73066413", "text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end", "title": "" }, { "docid": "5076c5a88404ae72986f958710f5687a", "score": "0.72631145", "text": "def update...
db61a8faff2bffe375fcc0ae29c9644b
Prints number of concepts with descriptions containing the search term
[ { "docid": "1d585014dfe602a5153da2a884908c67", "score": "0.6306796", "text": "def get_concepts_by_string(search_term)\n url = URI(\"#{BASE_URL}#{EDITION}/#{VERSION}/concepts?term=#{search_term}&activeFilter=true&offset=0&limit=50\")\n response = Net::HTTP.get(url)\n data = JSON.parse(response)\n put...
[ { "docid": "3b3459fece752e33d01fb5e398b56178", "score": "0.6350957", "text": "def number_of_inspirational_concepts(login=nil)\n count_by_frbr(login, :is_inspired_by, :how_many_concepts?) \n end", "title": "" }, { "docid": "5226e73431cd8ddf4bf906594966836d", "score": "0.63...
2161db305cde0c5ad84dfe681b0a60d6
Initialize a filter object with the given options. Filters are intended to be used immutably, and all methods on same return new, immutable filters.
[ { "docid": "16b16d5cad31a84e5d8c5d5dba3032bf", "score": "0.0", "text": "def initialize(options={})\n @options = options.freeze\n end", "title": "" } ]
[ { "docid": "ae910eb982c28fdf1940068c3ccc6ecf", "score": "0.7310695", "text": "def initialize(options={})\n @infile = options[:infile]\n @outfile = options[:outfile]\n @key_filter = ColumnFilter.new(options[:key], df: options[:df])\n @row_filter = RowFilter.new(options[:rows], ...
79d0b8e55cea7729f65c2fdd205d6d85
Get the data.yml file to be used to save application specific data
[ { "docid": "0e51f5b980cdcf3e6285b3ed3be25667", "score": "0.7857239", "text": "def data_file\n @data_file ||= FileData.new(\"data.yml\")\n end", "title": "" } ]
[ { "docid": "2e6d84fd48acb32d0adad968dfaf4e35", "score": "0.76013404", "text": "def data_path name\n File.join File.dirname(__FILE__), 'data', \"#{ name }.yml\"\nend", "title": "" }, { "docid": "759f3cfe3767b092e799339a0165dab6", "score": "0.71849364", "text": "def data\n YAML::...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "88552cb9e9ffc0695b79bb1f4cacc1e4", "score": "0.0", "text": "def request_params\n params.require(:request).permit(:customer_id, :runner_id, :image, :location, :destination, :value, :item_description, :earliest_pickup, :latest_pickup, :earliest_delivery, :latest_delivery, :location_lat, ...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title"...
4b5c2b029cf185cee411190c8215a170
merges all matching results collected by the enforcer into a single decision.
[ { "docid": "1db2fe868bd01feb0e87bfead0e39a15", "score": "0.4920013", "text": "def merge_effects(expr, effects, results); end", "title": "" } ]
[ { "docid": "41e99ab02c51581e6490b17f3263a84c", "score": "0.57634425", "text": "def merged_result; end", "title": "" }, { "docid": "a15d50d0ebff2c6ddbd509c664464199", "score": "0.5627759", "text": "def tweak_results!\n # if the race is between a major party and opposing minor party...
6b64f11ac841dab3f13294d5656c18c9
Public: Deletes a node at the appropriate location in the tree without disturbing Binary search tree property NOTE: Uses SUCCESSOR transplant i.e next largest element to the deletable node t Tree structure z Node to be DELETED Examples NOTE: Based on the mock tree structure at LINE:61 with an inserted node J TREE struc...
[ { "docid": "c824252519ad8c65454d625acf7e756e", "score": "0.7246379", "text": "def tree_delete(t, z)\n return if z.nil?\n if z.left.nil?\n transplant(t, z, z.right)\n elsif z.right.nil?\n transplant(t, z, z.left)\n else\n y = BinarySearchTree::tree_minimum(z.right...
[ { "docid": "3904f816609a75fab98e9fe52b6a6ff4", "score": "0.7375817", "text": "def delete(node)\n # Cases:\n # 0) root is nil\n return if @root.nil?\n\n # check if node object exists in tree\n found = _search(@root, node) do |n, key|\n return -1 if n.item < key.item\n return 0 if...
d95326b3f1b736005e0228b32b13a8ca
First decode the base64encoded string, trim the iv from the front, then decrypt
[ { "docid": "9cdce1a5d111d0dc664dcf34b87e92ca", "score": "0.6715493", "text": "def decode_and_decrypt(cipher, encoded, key)\n\t \t\tiv_enc_len = Base64.decode64(encoded[0,4]).to_i\n\t\t\tiv = Base64.decode64(encoded[4, iv_enc_len])\n\t\t\tdecrypt(cipher, Base64.decode64(encoded[4 + iv_enc_len, encoded.le...
[ { "docid": "bebeb1d322ab651c7a8e83ee9db99508", "score": "0.73306215", "text": "def p_decrypt_string(ciphertext, key, iv, algorithm)\n cipher = p_cipher(algorithm)\n cipher.key = key\n cipher.iv = iv\n cipher.decrypt\n # decrypt ciphertext\n encoded_plain = ciphe...
2bf5bc781136244b7bb32689403e7d52
Convert an hour into a number of timesteps
[ { "docid": "603bb2c08c64fbd99bc95a53e6c5f017", "score": "0.71209794", "text": "def convertHour2Ts(hour)\n\t\treturn Integer(((hour * 60 ) * @nbTSInOneDay) / 1440)\n\tend", "title": "" } ]
[ { "docid": "760f7a65210fa0b7cde341e45cd0fbc4", "score": "0.6774059", "text": "def rational_hour(seconds); end", "title": "" }, { "docid": "d1eb21fad08f8679e1900233a028870f", "score": "0.6727747", "text": "def step_number\n @step_number ||= (@time.to_f/60.0*sign.tempo).floor\n ...
21e4f24936cb19485cb87e7bc519c7a1
An array of intials
[ { "docid": "6f4b9e5d7402772250bd0ea3aae88e9c", "score": "0.0", "text": "def customer_initials\n @customer_initials ||= ('a'..'z').to_a\n end", "title": "" } ]
[ { "docid": "e027d5a5c264efda9a5c237486a8e095", "score": "0.67013973", "text": "def ary(n); Array.new(n){rand}; end", "title": "" }, { "docid": "7017f0f1b3af3f4ca65e26ba8092e1a7", "score": "0.65758115", "text": "def make_array\n <<-CODE\n next_int;\n t1 = array_new(state, _in...
991726ed4b76d71c3eac611a4a322cdc
Auth mechanism properties extractor.
[ { "docid": "5ef1d367979c88d4fef2c9685f2f9d6d", "score": "0.6795525", "text": "def convert_auth_mech_props(name, value)\n properties = hash_extractor('authMechanismProperties', value)\n if properties\n properties.each do |k, v|\n if k.to_s.downcase == 'canonicalize_host_...
[ { "docid": "844f246cb2b30b308c32f55da7d6566e", "score": "0.64657277", "text": "def auth_mech_props(value)\n properties = hash_extractor(value)\n if properties[:canonicalize_host_name]\n properties.merge!(canonicalize_host_name:\n properties[:canonicalize_host_...
05e75a4eb94b9b52db1d5f5adc9e0432
Returns the list of assets that are scheduled for replacement/rehabilitation in the given fiscal years.
[ { "docid": "35491e1ee604d04fa4b7487dbe657e27", "score": "0.5083944", "text": "def index\n\n add_breadcrumb \"Fund Projects\", scheduler_index_path(:start_year => @start_year)\n\n current_index = @years.index(@start_year)\n if current_index == 0\n @prev_record_path = \"#\"\n else\n ...
[ { "docid": "0cfcfd751c7470394b3a4f7fb773f1c8", "score": "0.6398322", "text": "def fiscal_years\n (cf0925s.map(&:fiscal_year) | invoices.map(&:fiscal_year))\n .sort { |x, y| y <=> x }\n .uniq\n end", "title": "" }, { "docid": "3ffdb65c248b5c62bda8c7d4a8d1ffac", "score": "0.6...
1e0e8a7474657649b08a96ba8815f0dc
DELETE /orders/1 DELETE /orders/1.json
[ { "docid": "cd71fa2a09f1526312ea55c27236ea33", "score": "0.0", "text": "def destroy\n @order.destroy\n\n head :no_content\n end", "title": "" } ]
[ { "docid": "d95245ee8d8e63ffab2dfbac802158ee", "score": "0.80881315", "text": "def destroy\n delete(\"/orders/#{id}/delete\")\n end", "title": "" }, { "docid": "8e531349d930fb6fede4efc401d68904", "score": "0.7670353", "text": "def destroy\n @order.destroy\n\n render jso...
b93da2e30ca57b92a132a96c01f35294
Wrappers for the main HTTP verbs
[ { "docid": "dc617cd355882d1807869f9a01df5387", "score": "0.0", "text": "def get(path, timestamp=nil, options={}, authenticate=true)\n path = \"#{path}?#{URI.encode_www_form(options)}\" if !options.empty?\n http_request :get, path, timestamp, options, authenticate\n end", "title": "" }...
[ { "docid": "ce5d7f595c600d6ca74ae76f2ed5673f", "score": "0.6703208", "text": "def route\n \"#{@http_verb.to_s.upcase} #{@url}\"\n end", "title": "" }, { "docid": "4776d5116576e94baa815ed60fa64a3a", "score": "0.6653223", "text": "def request(verb, uri, opts = T.unsafe(nil)); e...
b10685d45d594279ee66082652f91361
set headers from file
[ { "docid": "8a6b4a8ddf241958913fdabe56399d69", "score": "0.7629946", "text": "def headers_from_file(fn)\n clear_headers\n headers_from_array(File.read(fn).split(\"\\n\"))\n return \"headers set from #{fn}\"\n end", "title": "" } ]
[ { "docid": "704cb755ec247da07077eec34b38df2b", "score": "0.72032773", "text": "def parse_headers_file(filepath)\n Typhoeus::Response::Header.new(File.read(filepath))\nend", "title": "" }, { "docid": "ee3394262110c733e19bbb5b3b29e96d", "score": "0.6715406", "text": "def header(path, ...
316b175b27916e81cda4a4e635a602e7
returns a gateway instance unless there is one assigned globally in the environment files e.g. config.after_initialize do ... CreditCardPayment.gateway = ActiveMerchant::Billing::BogusGateway.new ... end
[ { "docid": "319de2d03d879c2429dbde5c89d3cbff", "score": "0.622535", "text": "def gateway(file_name=nil)\n unless @@gateway\n yml_config = config(file_name)\n \n options = {}\n options.merge!({\n :login => yml_config[:api_username],\n :password => yml_c...
[ { "docid": "bcc65a451557079a815b857cf7747486", "score": "0.7757823", "text": "def gateway\n @gateway ||= PaymentGateway.instance.gateway()\n end", "title": "" }, { "docid": "937266560201a1a5afe320b48927da55", "score": "0.75011086", "text": "def gateway\n gateway_options = op...
fe1b31bcf2456f9c4db147a760813949
POST /daily_bill_details POST /daily_bill_details.json
[ { "docid": "841f940d259fd1af0f3e67967dd5bc47", "score": "0.5880515", "text": "def create\n travel_request_id = params[:daily_bill_detail][:travel_request_id]\n expence_date = params[:daily_bill_detail][:expence_date]\n e_place = params[:daily_bill_detail][:e_place]\n expence_opestion_id = pa...
[ { "docid": "429bce7a666653a74e4d45164ede6ca0", "score": "0.6717167", "text": "def create\n @bill_detail = BillDetail.new(bill_detail_params)\n\n respond_to do |format|\n if @bill_detail.save\n format.html { redirect_to @bill_detail, notice: 'Bill detail was successfully created.' }\n ...
d1e113f11bbd5f4972e70886cdb5e947
Creates an instance of Ddt and creates DdtAnswer for related DdtQuestions.
[ { "docid": "1fd13ab6245ec9b9e49806d178702910", "score": "0.71904194", "text": "def create_one(test_detail)\n test_detail.study.ddt_questions.each do | ddt_question|\n answer = DdtAnswer.new\n ddt_answers << answer\n answer.ddt_question = ddt_question\n answer.save\n end\n end"...
[ { "docid": "3da8ad19cc6466bdcd92ef6a76636275", "score": "0.640629", "text": "def setup_answers\n create :answer, question: @question1, response_id: @response.id, answer: 1, comments: 'True_1'\n create :answer, question: @question2, response_id: @response.id, answer: 0, comments: 'False_2'\n create :a...
4240540425738100fc0d8c64aff63124
Zwraca kontakt z rostera i jego subskrypcje
[ { "docid": "2aa9cd503298aa4d1b5e5ed6367d8353", "score": "0.6213319", "text": "def subskrypcja\n rost && rost.subscription\n end", "title": "" } ]
[ { "docid": "52ff1971a3d15dcbf952f4206e115956", "score": "0.6068548", "text": "def hacer_ruido\n\t\treturn super\n\tend", "title": "" }, { "docid": "a7c3ff6e9a70757ad110a0a6920415c1", "score": "0.5878232", "text": "def boruvka\n end", "title": "" }, { "docid": "3b44e74011...
53db03cd26be54002b25f4c027564fb1
PUT /publics/1 PUT /publics/1.json
[ { "docid": "73f851a9698c61d9328d7c9e16b33359", "score": "0.67284393", "text": "def update\n @public = Public.find(params[:id])\n\n respond_to do |format|\n if @public.update_attributes(params[:public])\n format.html { redirect_to preview_url, notice: 'Public was successfully updated.' ...
[ { "docid": "d37b39a795a6e081d6480942ece1c538", "score": "0.6430781", "text": "def put!\n request! :put\n end", "title": "" }, { "docid": "e4a1486ba1b5fdba9347db423e081378", "score": "0.6306919", "text": "def update\n respond_to do |format|\n if @publico.update(publico_par...
61c06eaf82d8ab599af3886e5b040808
Complete the 'waiter' function below. The function is expected to return an INTEGER_ARRAY. The function accepts following parameters: 1. INTEGER_ARRAY number 2. INTEGER q
[ { "docid": "adfed88470b7301471bf765cde119d88", "score": "0.58014345", "text": "def waiter(number, q)\n stack = number.reverse\n answers = []\n\n Prime.take(q).each do |prime|\n other_stack = []\n\n while stack.size > 0\n target = stack.pop\n if target % prime == 0\n answers.pus...
[ { "docid": "f5541a3a755cf0b16672e04937967ea7", "score": "0.5767264", "text": "def wait(on=nil)\n []\n end", "title": "" }, { "docid": "0f1d7e51935ce26992b39d40f45311ef", "score": "0.5734446", "text": "def wait(arg0)\n end", "title": "" }, { "docid": "f991cf98ac...
e02e9ab8ac56dc1532109a0cebf9ef90
del_item(list1, "bananas") p list1
[ { "docid": "54e05d7bb5ca844fa8b1572cd81ec8a2", "score": "0.0", "text": "def update_quantity(list1, item, quantity)\n\tlist1[item] = quantity\nend", "title": "" } ]
[ { "docid": "d68185f7da9858b9872bd1ef1ead5b1b", "score": "0.85634935", "text": "def rem_item(list, individual_item)\r\n\tlist.delete(individual_item)\r\n\tp list\r\nend", "title": "" }, { "docid": "a01682725a62e33608ff4d480e0875b6", "score": "0.84304935", "text": "def delete_item(list...
507ba1c44ed44c3de5309057dfc562b5
PUT /personal_statistics/1 PUT /personal_statistics/1.json
[ { "docid": "013c38508c7abe03ab654b226aa772c2", "score": "0.6978241", "text": "def update\n @personal_statistic = PersonalStatistic.find(params[:id])\n\n respond_to do |format|\n if @personal_statistic.update_attributes(params[:personal_statistic])\n format.html { redirect_to @personal_...
[ { "docid": "4275b620ba1e3bb3cbdabd17d409e07f", "score": "0.6609172", "text": "def set_personal_statistic\n @personal_statistic = PersonalStatistic.find(params[:id])\n end", "title": "" }, { "docid": "f86576413b29af953de9278de726059f", "score": "0.639121", "text": "def update\...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b4f602f6f4b0df06c32111d69dfe3486", "score": "0.0", "text": "def mensagem_params\n params.require(:mensagem).permit(:datarecebimento, :mensagem)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496205", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957069", "text": "def strong_params\n params.require(:request).permit(param_white...
ecfbc8626a374b77e69112bb87ab4f79
DELETE /groups/1 DELETE /groups/1.xml
[ { "docid": "40654a65a2b95b5bc95467153376e544", "score": "0.6985918", "text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.xml { head :ok }\n end\n rescue\n flash[:error] = 'An erro...
[ { "docid": "d93dba43205965e12eb3729f0526fa37", "score": "0.7686738", "text": "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "2bf918e6acc5f25c168675f2060ed95a", ...
e7e1dbc4be789e5e27e306bf6c308064
GET /course_terms/1 GET /course_terms/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "6d13f51aab2524f44588eb85dc0eecc8", "score": "0.7454877", "text": "def getTerms\n request \"/Common/getTerms.json\"\n end", "title": "" }, { "docid": "ea1bf81d925e48a64897ffbbd0f5abb3", "score": "0.708624", "text": "def index\n @course_terms = CourseTerm.all\n ...
9b6acc2513ae2d0b0427a798a99e16ce
FIXME: Why is this public?!
[ { "docid": "08d47ea899d417eeefaa4f592c67e864", "score": "0.0", "text": "def sources\n @sources ||= begin\n sources = @repo.packages(q: '$Architecture (source)')\n Aptly::Ext::LatestVersionFilter.filter(sources)\n end\n end", "title": "" } ]
[ { "docid": "b6b2bcc0062aeb115edab7b10cbe6930", "score": "0.697587", "text": "def desired; end", "title": "" }, { "docid": "6a6ed5368f43a25fb9264e65117fa7d1", "score": "0.6765578", "text": "def internal; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", ...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "f05c65eeebb3fb0fe350682992a79aec", "score": "0.0", "text": "def update!(**args)\n @enabled = args[:enabled] if args.key?(:enabled)\n @strength = args[:strength] if args.key?(:strength)\n end", "title": "" } ]
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
db63bbf1fce9f8157895ba84b61758ca
Initlaizing the Person class. Each person needs a name and an emotion
[ { "docid": "7912dd7c44087ae377dc83c838e0a678", "score": "0.0", "text": "def emotions\n @emotions\n end", "title": "" } ]
[ { "docid": "3ebc0f3c43fa06605d6a70628266f302", "score": "0.7600088", "text": "def initialize(name)\n @name = name\n @emotion = @@human_emotions\n end", "title": "" }, { "docid": "8856a16e4e18e32c8f123c407f3c190c", "score": "0.718869", "text": "def initialize (name)\n...
05244fa487e8d8f1791266939af53692
PUT /tutorial_media_types/1 PUT /tutorial_media_types/1.xml
[ { "docid": "2bbfc383e6615e3c2132f45353dcdbd0", "score": "0.72213155", "text": "def update\n @tutorial_media_type = TutorialMediaType.find(params[:id])\n\n respond_to do |format|\n if @tutorial_media_type.update_attributes(params[:tutorial_media_type])\n format.html { redirect_to(@tutor...
[ { "docid": "f6e17fc53ea98003901e468733a03108", "score": "0.63904834", "text": "def update(data)\n result = @client.api_request(:method => \"mediatype.update\", :params => data)\n result.empty? ? nil : result['mediatypeids'][0].to_i\n end", "title": "" }, { "docid": "50acb81a5503...
77ec87da6b4c491e14012a6c1159ffae
A second is 1000 milliseconds
[ { "docid": "6519e8b82196e3865442f1c92514a20b", "score": "0.0", "text": "def initialize(time)\n match = @@regex.match(time)\n @hour = match[1].to_i\n @minute = match[2].to_i\n @second = match[3].to_i\n @millisecond = match[4].to_i\n end", "title": "" } ]
[ { "docid": "9ec6963d48aa8ef376e9da4a808e940c", "score": "0.7966537", "text": "def in_milliseconds; end", "title": "" }, { "docid": "5710a4f7737bdd05fcd7c0bc0c6b0f82", "score": "0.7861885", "text": "def milliseconds(); end", "title": "" }, { "docid": "08e20f26217cf53ad7538...
e3b2e31c78b3d484456ac03afa14ad80
initialize a new account, use raise to avoid a negative begining balance
[ { "docid": "3f52a4cf522c45af72357cd122a68386", "score": "0.71508795", "text": "def initialize(account_number, initial_balance, open_date)\n if initial_balance < 0\n raise ArgumentError, \"negative initial balance warning\"\n end\n @account_number = account_number\n @current_ba...
[ { "docid": "13eb18fc1bcf17642258c37e8322d2a1", "score": "0.768159", "text": "def initialize (account_hash)\n super\n @rate\n @maximum_transactions = 6\n @transactions = 0\n @minimum_balance = 10000\n if @balance < @minimum_balance\n raise ArgumentError.new(\"You need a balance abo...
65ecddad61f869d0e314d25fdbad15b2
More code from tools/reg.rb
[ { "docid": "5ab64f94e0685e0f9c63d7359b8dd732", "score": "0.0", "text": "def get_hboot_key(sam, bootkey)\n\t\tnum = \"0123456789012345678901234567890123456789\\0\"\n\t\tqwerty = \"!@#\\$%^&*()qwertyUIOPAzxcvbnmQQQQQQQQQQQQ)(*@&%\\0\"\n\t\taccount_path = \"\\\\SAM\\\\Domains\\\\Account\"\n\t\taccounts = s...
[ { "docid": "1c53466e9cac189998146240b4cf8da1", "score": "0.6554773", "text": "def get_reg( reg, pos, line )\n raise \"This doesn't look like a register: \\'#{reg}\\'\\n**#{line} in #{$file}\\n\" unless reg =~ /^\\$[a-z]?(\\d{1,2})_?.*?$/ \n num = $1.to_i # num is register number\n #print \"reg: #{reg...
239d800eb6359eb68edbc0338d61c155
Gets current bid (in credits) of an agent Returns nil if agent didn't bid on this auction.
[ { "docid": "efd507d6f85bbccf93dc938a8f69fd10", "score": "0.69777936", "text": "def get_bid_of(bidder)\r\n assert_kind_of(Agent, bidder)\r\n self.bids.each do |price, agent|\r\n return price if (agent == bidder)\r\n end\r\n\r\n nil\r\n end", "title": "" } ]
[ { "docid": "e265fadf5afe8c7758bb45894936cd92", "score": "0.64195365", "text": "def get_bet_on_hand(hand)\n return hand.get_bet_amount\n end", "title": "" }, { "docid": "d8904e21d3e1f56444cc7410dae224fa", "score": "0.6266407", "text": "def current_bid\n return nil if 0==b...
442eec13a68b616747c8e2442f73a331
This method returns true if a year is a leap year
[ { "docid": "8d0e28822f1fd71c4dedc50f9d813854", "score": "0.0", "text": "def leap_year?(year)\n return true if year % 400 == 0\n return false if year % 100 == 0\n return true if year % 4 == 0\n false\nend", "title": "" } ]
[ { "docid": "1d498dc9eedaa9cddeb27086dca777e1", "score": "0.9159492", "text": "def leap_year?\n year % 4 == 0 and not year % 100 == 0 or year % 400 == 0\n end", "title": "" }, { "docid": "a24ad29dd0a8a2c2a88755d6b2d09c17", "score": "0.90942913", "text": "def leap_year?\n\t...
796d66da0980e5dc7e7423fce2bb018e
END Aggregate Grouping Helping Methods Overide this method to avoid the new session call for api requests that use the before filter authenticate_app_api_request. This can be usefull for apps that dont need connect metadata call, or credentials, to operate for api requests
[ { "docid": "294ec1a4ec393101dc6a85f8c81cc289", "score": "0.5739795", "text": "def new_session_for_api_requests(params: {})\n return true\n end", "title": "" } ]
[ { "docid": "2ea691817e883a5b04e21005144b591c", "score": "0.72107744", "text": "def authenticate_api\n \t@application = find_application\n \traise UNAUTHORIZED_ACCESS if @application.blank?\n end", "title": "" }, { "docid": "3d3aa389d9b9e96d181eebc82e454af3", "score": "0.6789589", ...
6c10f102637446447371b0d4cf3cbcbd
Removes all the unwanted characters (commas, semicolons, dashes, etc). These might be useful if the context is to be kept but right now we don't deal with that.
[ { "docid": "150149f794b97bed7889cf10f8dd5bd3", "score": "0.71331936", "text": "def strip_characters # :nodoc:\n @text.gsub!(/[.,;]([ ])?/, $1 || ' ')\n# @text.gsub!(/\\b(a|p) m\\b/, \"\\\\1\" + 'm') # TODO Move to a matcher\n @text.rstrip!\n end", "title": "" } ]
[ { "docid": "24fbbb332f4a5312c75e16be3b16709b", "score": "0.7283274", "text": "def remove_punctuations\n\n line_array=@text_to_process.split(\"\\n\")\n\n for line in line_array do\n\n line.gsub!(\",\",\"\")\n line.gsub!(\";\",\"\")\n\n\n line.gsub!(\"{\",\"\")\n ...
5dfb1f2571db580ae8a6c2bcd01eaf77
Unload all plugins and reload it.
[ { "docid": "877de58d725feea8025792dcf8554b81", "score": "0.83082736", "text": "def force_reload\n\t\t\tcall(:on_unload)\n\t\t\t@plugins.clear\n\t\t\treload\n\t\tend", "title": "" } ]
[ { "docid": "68253efaf8983030755d3f33067064ed", "score": "0.81645226", "text": "def unload_all\n @last_unload = []\n loaded_safe.each do |plugin|\n unload_one plugin\n @last_unload << plugin\n end\n unload_one TWG::Core\n end", "title": "" }, { "docid": "e...
e6509a5a6fc0d58c35643cc77b222342
We call to_a in order to duplicate cells instances we need it because something else could be in execution and could delete while we are trying to access them
[ { "docid": "b23f1e38683458cfb24395927e74b010", "score": "0.0", "text": "def reset_cells\n live_cells.to_a.each { |v| grid.unfill_cell v }\n @current_generation = 0\n `$(#{self}).trigger('reset')`\n end", "title": "" } ]
[ { "docid": "9daa3aff4bbc09ec2c86965076c75639", "score": "0.64745873", "text": "def new_cells\n self.cells.select {|x| !x.is_identical}\n end", "title": "" }, { "docid": "793fad47bc0a0b8c2878bb41d9d74b33", "score": "0.6341053", "text": "def to_a ; data.dup ;end"...
c2ecca04a2d0a1a4594aaca2ec5b89f7
finds displacement on the same line
[ { "docid": "cdd66b6ad9c9c10768c4c0b5a3fa0ac0", "score": "0.753271", "text": "def displacement(x,y)\n @lines[@common[0]].index(y) - @lines[@common[0]].find_index(x)\nend", "title": "" } ]
[ { "docid": "1e38f9bf5d5cd561ac8a13982b03538f", "score": "0.69840044", "text": "def distance_to_line(line)\n end", "title": "" }, { "docid": "6fe6f13cd0bbfa8601eeb0a6f26f29e1", "score": "0.6488309", "text": "def line_for_position(position); end", "title": "" }, { "docid":...
59456b94e6e1573eeebdc462bf615ed3
FOR INFO SOURCE ID ATTRIBUTES expects obj to have :id
[ { "docid": "cc6ee73ccd1a0885e6fc60714bd1e387", "score": "0.73259073", "text": "def parse_info_source_attributes(o)\n obj = o.stringify_keys\n\n ids = obj[\"id\"] || {}\n infoatts = INFO_SOURCE_ATTRIBUTES.inject({}) do |hsh, att_name|\n source_name = att_name.to_s.match( /\\w+?(?=_i...
[ { "docid": "bb8af3551684e58fead6945324e3e2b7", "score": "0.6795829", "text": "def id\n @obj['id']\n end", "title": "" }, { "docid": "8c70826e60a07822a9e298ae02ba11ce", "score": "0.6635087", "text": "def id\n obj.id\n end", "title": "" }, { "docid": "9a8d12...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "c7bbbd03424cead6cef002fb438fc1ea", "score": "0.0", "text": "def set_folder\n @folder = Folder.find_by!(id: params[:id], user_id: current_user.id)\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.61637366", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60446453", "text": "def action_hoo...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "eb6473c413f41b656fe6d669793f07de", "score": "0.0", "text": "def set_member\n @member = Member.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...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "8f827cc7571318169647e069a2d1833a", "score": "0.0", "text": "def set_detalle_orden_presupuesto\n @detalle_orden_presupuesto = DetalleOrdenPresupuesto.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...
66787a9df89828c963ed93dc6529047d
lexer rule t__61! (T__61) (in Mig.g)
[ { "docid": "c3b0b1ff8a6815d20780ba60e613ddb6", "score": "0.64240974", "text": "def t__61!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 22 )\n\n\n\n type = T__61\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -...
[ { "docid": "a31665535ad69b4a4f95ffcc62dba933", "score": "0.76422244", "text": "def t__65!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 43)\n\n type = T__65\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - ...
c5fbd729d61cb4cc2078c49313beeeb0
Parses the XML into an array broken up by each event. Example of returned array
[ { "docid": "0e5340ebffd9d08a9a76994a5ee0c470", "score": "0.0", "text": "def parse_service(xml)\n doc = Nokogiri::XML(xml)\n raise(USPSResponseError, doc.search('Description').inner_html) unless doc.xpath(\"Error\").empty?\n doc.search(\"Days\").inner_html\n end", "title": "" } ]
[ { "docid": "d7ec39977c24224b58565dd40d53194b", "score": "0.80652726", "text": "def parse_events(xml) #:nodoc:\n if xml.is_a? String\n events = Nokogiri::XML(xml)\n else\n events = xml\n end\n parsed_events = Array.new\n events.xpath(\"//events/event\").each do |event...
e43df4e24ddfa9395d8d36f2c5f72512
PATCH/PUT /viewerships/1 PATCH/PUT /viewerships/1.json
[ { "docid": "de687115bf2cf16ba46a30f9d91e2e2f", "score": "0.7407409", "text": "def update\n respond_to do |format|\n if @viewership.update(viewership_params)\n format.html { redirect_to @viewership, notice: 'Viewership was successfully updated.' }\n format.json { render :show, statu...
[ { "docid": "f61fe68c0ddd55ecc7ae234270525564", "score": "0.67707735", "text": "def update\n respond_to do |format|\n if @officership.update(officership_params)\n format.html { redirect_to @officership, notice: 'Officership was successfully updated.' }\n format.json { render :show, ...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "7ef73f13104c91e7208ce5e6d3c6657f", "score": "0.0", "text": "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @description = args[:description] if args.key?(:description)\n @filter = args[:filter] if args.key?(:filter)\n ...
[ { "docid": "184b1b1ed771473d3eb9f338c0734c38", "score": "0.73066413", "text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end", "title": "" }, { "docid": "5076c5a88404ae72986f958710f5687a", "score": "0.72631145", "text": "def update...
0ac0c53206964c8a09fc61e9421da1a4
set a formatter object, if you wish to override default one
[ { "docid": "c695500424c1c47b2fbaf76a590b4dbc", "score": "0.8312556", "text": "def formatter fmt\n @formatter = fmt\n end", "title": "" } ]
[ { "docid": "6d1c419e423372fe87331147ecd65a35", "score": "0.826299", "text": "def formatter=(formatter)\n @formatter.formatter = formatter\n end", "title": "" }, { "docid": "f71f8efb45eeb4f61b49decb93fa4a72", "score": "0.8158408", "text": "def use_formatter(formatter)\n @fo...
87d26f2246262a88ed24a04f77d2bda2
Return the largest integral value not greater than the argument.
[ { "docid": "6c63f075b617744cb9b37add02747cce", "score": "0.0", "text": "def floor\n round :floor\n end", "title": "" } ]
[ { "docid": "014692b0d5ffaa00d182d6c4f29fbcbd", "score": "0.7236585", "text": "def largestNumber(n)\n 10 ** n - 1\nend", "title": "" }, { "docid": "06b2420e09a6a968bce5a15f9bd7fb88", "score": "0.7087619", "text": "def largest(a)\n a.reduce(-Float::INFINITY) do |memo, n|\n n > m...
b2f0aa899c474b3795570fddc609d9e6
Author: Karim ElNaggar Description: delete a trophy selected by id Params id the id of the trophy Success: refreshes the page and displays notification Failure: refreshes the page with error displayed
[ { "docid": "7eab2e8f4f71eb89658d8d1a022977b3", "score": "0.79990655", "text": "def delete_trophy\n params[:id] = params[:id].strip\n status_trophy = Trophy.find_by_id(params[:id])\n if status_trophy.present?\n name = status_trophy.name\n status_trophy.delete\n flash[:success] = \...
[ { "docid": "c1286e6ffbae17ae3612b54cffd0f6cf", "score": "0.80620193", "text": "def delete_trophy\n params[:id] = params[:id].strip\n status_trophy = Trophy.find_by_id(params[:id])\n if status_trophy.present?\n name = status_trophy.name\n status_trophy.delete\n flash[:success] = \...
f5afdd1be32b7c64026f9c9984e3fd55
GET /smbs/1 GET /smbs/1.json
[ { "docid": "d085802d495946ec8ae608223002a492", "score": "0.5002771", "text": "def show\n if (params[:customer_id].present? or params[:friend_id].present?)\n @smb = @selector.smbs.find_by_auth_token(params[:id]) \n else\n @smb = Smb.find_by_auth_token(params[:id])\n end\n # if curre...
[ { "docid": "821dbd4b9dd9b32b030996da15075b35", "score": "0.6205667", "text": "def smb_direct\n\tself.scanner_smb_directs ||= {}\n\tself.scanner_smb_directs[Thread.current.to_s]\nend", "title": "" }, { "docid": "bfb603479220e1588efa6a56b8367538", "score": "0.6177606", "text": "def smb...
e03a2951652f7ee1e7d5927402b313f0
BIFF RECORDS write_number($row, $col, $num, $format) Write a double to the specified row and column (zero indexed). An integer can be written as a double. Excel will display an integer. $format is optional. Returns 0 : normal termination 1 : insufficient number of arguments 2 : row or column out of range
[ { "docid": "fbee6a00756c55db03b05cdcc74d97f7", "score": "0.82881147", "text": "def write_number(*args)\n # Check for a cell reference in A1 notation and substitute row and column\n if args[0] =~ /^\\D/\n args = substitute_cellref(*args)\n end\n\n return -1 if (args.size < 3) ...
[ { "docid": "29ee2ec1336f39bda259b50cf76c1fde", "score": "0.686431", "text": "def write_number number\n if number >= MIN_INTEGER && number <= MAX_INTEGER #check valid range for 29 bits\n write_integer number\n else #overflow to a double\n write_double number \n end\n end",...
928e6e83472777288dc1f2a6cceb3268
Append lines to a (text) file. This will make sure a newline is present between the old content and the new.
[ { "docid": "e172d95c75c744d39afc22cea7b6e6f9", "score": "0.77497315", "text": "def append_lines_to_file(file_name, file_content)\n file_name = expand_path(file_name)\n\n last = File.open(file_name) do |f|\n f.seek(-3, IO::SEEK_END)\n f.read\n end\n\n File.op...
[ { "docid": "87620da8f59fd43d4fa9da188371218a", "score": "0.7257635", "text": "def add_extra_lines\n @file_name_with_extension = ask_for_file\n @file = File.open(file_name_with_extension, 'a')\n add_lines\n @file.close\n puts \"New lines added to file\"\n print_file\n end", "title"...
94cf3c4fe82a58fe2a2731863087c31c
returns nil if validation completes returns an error string or array of string when validation fails
[ { "docid": "ba0609f2184d448c05dd9d731b9d1e3f", "score": "0.0", "text": "def validate_date_pairs\n if @report_options[:start_date_from] > @report_options[:start_date_to] && \n @report_options[:end_date_from] <= @report_options[:end_date_to] && !report_options[:start_date_to].blank?\n error...
[ { "docid": "ce3449e4b402e33f2f86e6c942b99a54", "score": "0.7105786", "text": "def validation_result; end", "title": "" }, { "docid": "d2196734e7e3ee41b90e606b3ac2e486", "score": "0.70460683", "text": "def validation_error(type, what, reason); end", "title": "" }, { "docid...
5468d49c95bd8a25890c41144f494833
DELETE /tag_relations/1 DELETE /tag_relations/1.json
[ { "docid": "0ffaf81ca54987ffecca86ff1c705090", "score": "0.76224715", "text": "def destroy\n @tag_relation.destroy\n respond_to do |format|\n format.html { redirect_to tag_relations_url, notice: 'Tag relation was successfully destroyed.' }\n format.json { head :no_content }\n end\n e...
[ { "docid": "b05867848bab27ea3abae475aab3c99c", "score": "0.73881453", "text": "def destroy\n @tag_relationship.destroy\n respond_to do |format|\n format.html { redirect_to tag_relationships_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "...
e17a853e0b8ad1310704a07ba0cd969a
To ensure uniqueness without case sensitivity we first downcase the username. We do this here and not in SQL is that it will otherwise bypass indexes using LOWER: SELECT 1 FROM "refinery_users" WHERE LOWER("refinery_users"."username") = LOWER('UsErNAME') LIMIT 1
[ { "docid": "3e3ca1b1ca5f0e3e6dad83da70c84848", "score": "0.7090557", "text": "def downcase_username\n self.username = self.username.downcase if self.username?\n end", "title": "" } ]
[ { "docid": "423c2845e09c9d71605d4e6b14501f9f", "score": "0.7029664", "text": "def find_lowercase_user\n User.find_by(username: uppercase_user.uid.downcase) || User.create(uid: uppercase_user.uid.downcase, username: uppercase_user.uid.downcase)\n end", "title": "" }, { "docid": "9ee4b...
9c1da61e3f7bfe93f2441f4f12c4784f
completes a display of the board for a visual reference
[ { "docid": "c491babf0f1d828a2a2be698f005b935", "score": "0.0", "text": "def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]}\"\n puts '-----------'\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]}\"\n puts '-----------'\n puts \" #{@board[6]} | #{@board[7]} | #{@boar...
[ { "docid": "aaf62332150fb94644f996d2400637a3", "score": "0.66793156", "text": "def clear_then_display\n print \"\\e[2J\"\n print \"\\e[H\"\n show_board\n end", "title": "" }, { "docid": "9ab40243f11ec7d94a82e770f89f5d67", "score": "0.64572674", "text": "def undisplay\n ...
4be0a65027b1837531aab324b657a468
Returns an external iterator for the bins. See +Iterator+
[ { "docid": "ce2fc1a9102cb965f473854474c83d56", "score": "0.5734396", "text": "def to_iter\n Iterator.new @entries, @capacity\n end", "title": "" } ]
[ { "docid": "de9e165b9c77cccd4a4cb29332a86dc2", "score": "0.60934526", "text": "def input_bins\n return @input_bins\n end", "title": "" }, { "docid": "047f111a4de6f4826ec3637d17ea3b02", "score": "0.6033888", "text": "def each\n @bins.each_key do |b|\n ...
d23e9a68934028082c5a63b50ca42dc7
GET /guide_ranges/new GET /guide_ranges/new.json
[ { "docid": "d64fe9ffe4c9090280e5c74d6a7517bc", "score": "0.786804", "text": "def new\n @guide_range = GuideRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guide_range.as_json(:root => true) }\n end\n end", "title": "" } ]
[ { "docid": "771a8ab3777c2ca47d1b9b250cd52a68", "score": "0.76227146", "text": "def create\n @guide_range = GuideRange.new(params[:guide_range])\n\n respond_to do |format|\n if @guide_range.save\n format.html { redirect_to @guide_range, notice: 'Guide range was successfully created.' }\...
9bc8c604e1e518f6939056552f6c508c
Returns +true+ if the Id's revision ID is the DEFAULT_ID
[ { "docid": "70b74bbabd022ddd01618cdaa1ed9c5c", "score": "0.7981047", "text": "def default?\n\t\treturn self.id == DEFAULT_ID\n\tend", "title": "" } ]
[ { "docid": "2c5a971c35aa5158284803cc0f29ef75", "score": "0.7799487", "text": "def default?\n id == DEFAULT_INSTANCE_ID\n end", "title": "" }, { "docid": "e4d8e01d42980f0ccc5bfb1806266b51", "score": "0.69013906", "text": "def default_version?\n @default.present?\n end", "t...
1c116cdf047b0ec97634e2dfb219870c
Import allowed values for attribute Upload a CSV file containing a list of [picklist values]( for the specified attribute. The file should be sent as multipart data. The import replaces the previous list of allowed values for this attribute, if any. The CSV file must only contain the following column: `item` (required)...
[ { "docid": "04c23e1be01643bb755f6623c96a7c2d", "score": "0.60266703", "text": "def import_allowed_list(attribute_id, opts = {})\n data, _status_code, _headers = import_allowed_list_with_http_info(attribute_id, opts)\n data\n end", "title": "" } ]
[ { "docid": "0eddd4ef3eee532434c5756936976bb7", "score": "0.61590385", "text": "def import\n if current_user.items.import(params[:file]) == false\n #False encountered means atleast one invalid item\n flash[:danger] = \"Error Encountered. No Items Imported. Please check CSV File.\"\n red...
318fd908dd79b84a0338e53770af2650
making it so the user can't fuck up the board.
[ { "docid": "8219aaa6e4b79e6f573163acd208472c", "score": "0.0", "text": "def playwin()\n for row in @orig_rzones[0]\n rowvals=[]\n for coord in row\n rowvals.push(@grid[coord[0]][coord[1]])\n end\n for cell_val in (1..9)\n if rowvals.include?(cell_val) == false\n return fals...
[ { "docid": "3362e3e36c36cdbabc51bbf68374f007", "score": "0.65823364", "text": "def cant_go_there\r\n clear_screen\r\n\r\n show_room_information\r\n puts \"#{@@tab}You can't go there.\\n\\n\"\r\n actions\r\n check_user_action\r\n end", "title": "" }, { "docid": "8873ef198a4643...
db9643452938b894c4e2247f5b942b48
Removes a connection from the pool.
[ { "docid": "000b1984fa47ea03ddca1b5580f9d063", "score": "0.0", "text": "def rm(connection)\n @tasks << -> do\n @selector.deregister(connection.io)\n end\n\n start\n end", "title": "" } ]
[ { "docid": "1fba948ac3fdea4fc0d55d4c3c22f03f", "score": "0.88186467", "text": "def remove connection\n finish connection\n @pool.remove(connection)\n end", "title": "" }, { "docid": "afec96cf8636c0b8fc2cb33172436393", "score": "0.8114151", "text": "def remove_connection(name)\...
1428b79a345720e5a8e3ee7670eabd95
that lie between 1 and some other number, and then computes the sum of those multiples. For instance, if the supplied number is 20, the result should be 98 (3 + 5 + 6 + 9 + 10 + 12 + 15 + 18 + 20). You may assume that the number passed in is an integer greater than 1.
[ { "docid": "eb62fde6ff4c2b9a7e5b49aa07db4426", "score": "0.0", "text": "def multisum(num)\nlist = Array(1..num)\nresult = []\nlist.each do |x|\n if x % 3 == 0 || x % 5 == 0\n result.push(x)\n end\nend\nresult.inject(:+)\nend", "title": "" } ]
[ { "docid": "3970bd593b68c012989ce2a0fa671743", "score": "0.78267264", "text": "def multisum(number)\n sum = 0\n # adds each value in the range to our sum variable if the value is a multiple of 3 or 5.\n 1.upto(number) do |num|\n if num % 3 == 0 || num % 5 == 0 # true if the given number is a...
7b718b0d37ff4f777447424be2e72cf8
Execute a command with an array of arguments and return the result as a hash.
[ { "docid": "11620bac18d8e5b400f5f5a0ee54c2cd", "score": "0.7169291", "text": "def execute_command(command, args = [])\n # Convert each element of the args array to a string.\n args = args.reject { |a| a.empty? }.map(&:to_s)\n # Execute the command with the arguments passed as a variable length argume...
[ { "docid": "dd05fa431c9077edd9922d181b90594c", "score": "0.71236247", "text": "def execute_command(command, args = [])\n # Convert each element of the array to a string.\n args = args.map(&:to_s)\n # Execute the command with the arguments passed as a variable length argument list using the asterisk o...
48c311324e3b0a7870d2e070807f2321
Get past gitTag. 'back' is how many tags back you want to go
[ { "docid": "48e02b0332b6de4b0f51e4c0ade505db", "score": "0.81688356", "text": "def getPastGitTag(back = 1)\n remote = getMainGitRemote\n tags = sh(\"git ls-remote --tags --quiet #{remote} | cut -d '/' -f3\", log: false).split\n semver_tags = tags.grep(/^[0-9]+.[0-9]+.[0-9]+$/) # only keep semver tags...
[ { "docid": "7f398bd75a9577f47c44fb082d2ee38c", "score": "0.6201401", "text": "def latest_tag\n\t\t# Index 0 is HEAD\n\t\t# Index 1 is most recent tag or first commit\n\t\t@list[1]\n\tend", "title": "" }, { "docid": "0185cfeee09160a4e5eaea69592ada52", "score": "0.617081", "text": "def...
3aea8498668ae39c743619c18eb51516
Define the available commandline options and parse the given commandline accordingly
[ { "docid": "1e211a00cdbb0a010283db89ac3cc687", "score": "0.7096601", "text": "def parse_command_line args\n args.options do |opt|\n opt.on(\"rutema v#{Version::STRING}\")\n opt.on(\"Options:\")\n opt.on(\"--config FILE\", \"-c FILE\",String,\"Loads the configuration from FILE\"...
[ { "docid": "8175e3c963fc5365f17b891df03206b6", "score": "0.77646977", "text": "def parse_command_line\n prepend_environment_options\n options = options_with_defaults\n\n OptionParser.new do |parser|\n\n parser.on(\"-h\", \"--help\", \"Show help\") do |_help_requested|\n ARGV << 'h' ...
4bc26a8aae6da7c05ef5a6c5ab0f2eea
This helper function returns the current instance of the course
[ { "docid": "78bcb018afa6be5b08eccd9e319775d1", "score": "0.74739015", "text": "def course\n self\n end", "title": "" } ]
[ { "docid": "94b7f29dbc9444579c387ee5c0b6d16b", "score": "0.799706", "text": "def current_course\n @course\n end", "title": "" }, { "docid": "798d2de7d1a74741fea3ee7016879c26", "score": "0.7542334", "text": "def current_course\n @course = Course.find(params[:id])\n end", "...
c0f4fbfb41fdb56eb6654a603b1fd1cc
Get the insights for customer&39;s personal accounts
[ { "docid": "490cb884ff297c59fdf2e307729b8b4b", "score": "0.61040735", "text": "def public_version_customers_customer_id_insights_current_personal_get_with_http_info(customer_id, version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReportsApi.p...
[ { "docid": "cf7c918f2d77e34a47d133723aac4fa5", "score": "0.65144324", "text": "def get_insights\n @insights ||= get_request('/me/insights')\n begin\n return @insights['data']\n rescue\n return @insights\n end\n end", "title": "" }, { "docid": "d2a82e0416e18863f4b686f50...
e870c9d414ebccfdae4690e1acd12b7b
=begin def paper_mastercard render(:layout => false) end =end
[ { "docid": "f846114a8b37b80f2303fcd5201454d7", "score": "0.0", "text": "def create_filing_number\n patient = Patient.find(session[:patient_id])\n patient.set_filing_number\n archived_patient = patient.patient_to_be_archived\n unless archived_patient.blank?\n message = printing_message(p...
[ { "docid": "14f73811f079d91e599f2cc884cad1b5", "score": "0.6698413", "text": "def show\n render layout: 'card_without_aside'\n end", "title": "" }, { "docid": "dfaadca25c4826bd3b07c292811a0aac", "score": "0.6426737", "text": "def preview \r\n render :layout => false\r\n en...
2af6b3d54b28c670dffd72682c622e30
DELETE /customers/1 DELETE /customers/1.xml
[ { "docid": "8d2fcdeb757770c63383fff3fc4d5d24", "score": "0.7007504", "text": "def destroy\n find_customer\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to('/customers/overview') }\n format.xml { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "bc1e005bc3aafd621456123dd15eae93", "score": "0.7133065", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end", "title": "" ...
5a1b541393d41f55c65b0bdb3655c020
Title: Count of positives / sum of negatives v3
[ { "docid": "4eee3a4afa551a10e775cc5dcbc6a387", "score": "0.6868293", "text": "def count_positives_sum_negatives(lst)\n lst.any? ? lst.partition(&:positive?).then { |p, n| [p.count, n.sum] } : []\nend", "title": "" } ]
[ { "docid": "9918b7af334483cc4b436ac50c0305bc", "score": "0.7418992", "text": "def count_positives_sum_negatives(lst)\n positives, negatives = lst.partition(&:positive?)\n [positives.count, negatives.inject(0, :+)]\nend", "title": "" }, { "docid": "4e9934958931335338c9ca0b5647e7af", "sc...
05de90f4b6e0c2e80a99cf0d5189c8d8
POST /shopping_carts POST /shopping_carts.json
[ { "docid": "bb7fd0a59a000161564e1a02be8cac16", "score": "0.7201911", "text": "def create\n @shopping_cart = ShoppingCart.new(shopping_cart_params)\n\n respond_to do |format|\n if @shopping_cart.save\n format.html { redirect_to @shopping_cart, notice: 'Shopping cart was successfully cre...
[ { "docid": "2ed05351f8959b1c59c31fd25ed18632", "score": "0.7489929", "text": "def create\n response, status = BeyondApi::Request.post(@session,\n \"/carts\")\n\n handle_response(response, status)\n end", "title": "" }, { "docid": "...
a28e478681ac9d29c5dd796aa824781d
PATCH/PUT /users/1 PATCH/PUT /users/1.json
[ { "docid": "ad480593d1f14214cb1f700d30ed6bab", "score": "0.0", "text": "def update\n respond_to do |format|\n prev_country_code = @user.country_code\n if current_user.super_admin? and @user.update(user_params)\n # country_code update handling\n if user_params['country_code'].p...
[ { "docid": "f0686f191a0def3b6c3ad6edfbcf2f03", "score": "0.7243395", "text": "def update_user(email)\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/users/2.json'\n ).to_s\n\n puts RestClient.patch(\n url,\n { user: { email: email } }\n ...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "4954d164a2c732f7b445ffa15aa4ca83", "score": "0.0", "text": "def invoice_params\n params.require(:invoice).permit(:title, :description, :category, :amount, :user_id, :created_at, :public)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.69485277", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6813547", "text": "def strong_params\n params.require(:listing_member).permi...
b8de4a58cfdad4c4019fb9d6601478f3
PATCH/PUT /plan_tables/1 PATCH/PUT /plan_tables/1.json
[ { "docid": "36a8ccb9026f7e204f8494069bc050ac", "score": "0.72349083", "text": "def update\n respond_to do |format|\n if @plan_table.update(plan_table_params)\n format.html { redirect_to @plan_table, notice: 'Plan table was successfully updated.' }\n format.json { render :show, stat...
[ { "docid": "a6fe8effb634ca0799fddeb27f27c257", "score": "0.65457106", "text": "def update\n if @plan.update(plan_params)\n render json: @plan\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "09f1fe090d3daf269e9b5b9...
f741d1b1d64d6c17806570405c936475
6min(distracted), 45sec Write a method that doubles each element in an array. Assume all elements of the array are integers.
[ { "docid": "51f9092285a4801634f28a772bf29e40", "score": "0.61146945", "text": "def doubler(array)\n array.map { |ele| ele * 2 }\nend", "title": "" } ]
[ { "docid": "c438ddbedb1dcee6b2646faa0fbd9a5d", "score": "0.7427472", "text": "def calculate_doubles(array)\r\nend", "title": "" }, { "docid": "6a554b6f6b696ba9c4fae79f347d68aa", "score": "0.74145734", "text": "def calculate_doubles(array)\nend", "title": "" }, { "docid": ...
7551654fbebe7e156a858026a8626487
Update a 'workflow.SolutionDefinition' resource.
[ { "docid": "9a022b5f1c1072bd5a687d722f292dd2", "score": "0.65909624", "text": "def update_workflow_solution_definition(moid, workflow_solution_definition, opts = {})\n data, _status_code, _headers = update_workflow_solution_definition_with_http_info(moid, workflow_solution_definition, opts)\n ...
[ { "docid": "3e9d6e642d907776df97e6e83a0353e3", "score": "0.6494531", "text": "def update\n @solution = Solution.find(params[:id])\n\n respond_to do |format|\n if @solution.update_attributes(params[:solution])\n flash[:notice] = 'Solution was successfully updated.'\n format.html ...
70a83173fd9883674d8f4c840ab1bf69
POST /recipes POST /recipes.json
[ { "docid": "5b426daf7dd44cea4f326575391d6dff", "score": "0.6375752", "text": "def create\n @recipe = Recipe.new(recipe_params)\n # dirty solution because ingredients don´t pass thru the permit function (see the private recipe_params instance method )\n # so we iterate a second time over the ori...
[ { "docid": "157b34128c4f2861fbdde82a945ba482", "score": "0.7498557", "text": "def create\n @recipe = Recipe.new(recipe_params)\n @recipe.save\n render json: @recipe\n end", "title": "" }, { "docid": "283b9f69073c07cbd21c19e496fe7278", "score": "0.71480393", "text": "def cre...
bd08221acecec1ed8a57508cbfbee4f2
p factor(9) p factor(20)
[ { "docid": "5376fe020f53ba6fc5f5ec5648c5315f", "score": "0.0", "text": "def bubble_sort(arr)\n arr.length.times do\n arr.length.times do |i|\n next if i == arr.length-1\n if arr[i + 1] < arr[i]\n arr[i], arr[i+1] = arr[i+1], arr[i]\n end\n end\n end\n arr\nend", "titl...
[ { "docid": "228d5a1ed78075d561d1d97fadee6353", "score": "0.72691673", "text": "def print_factors(n)\n puts n.to_s() + \" \" + self.factors(n).inspect()+\"\\n\"\nend", "title": "" }, { "docid": "aeaa92e920adfc1bdfdb8456bf23f5f2", "score": "0.71987116", "text": "def factors(num)\nend"...
d754f914011edb27e050538b394a7437
Creates a new instance in address of this model.
[ { "docid": "ba52741b118cfc35a02edf63cfd355ab", "score": "0.0", "text": "def marina_prototype_create_address_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MarinaApi.marina_prototype_create_address ...\"\n end\n # ver...
[ { "docid": "f8e6e28f80d7d15df8a03997bd7701db", "score": "0.78118587", "text": "def create\n data = self.class.create_address(self)\n self.id = data.id\n data\n end", "title": "" }, { "docid": "7f6955cc317b0133b7e494040533eafe", "score": "0.7617505", "text": "def new...
05ad1c572b2029dcd411aebcb77f335c
Configuration to determine if the work sould be automatically advanced, will default to true.
[ { "docid": "95d048e59644ff8c551a02b1d96bbf17", "score": "0.685933", "text": "def should_advance_work?\n get_configuration 'auto_advance_work', @work_type_config.dig('hydra_endpoint', 'workflow_actions'), @config.dig('workflow_actions')\n rescue\n true\n end", "title": "" } ]
[ { "docid": "fd39307a1da78dab0baff5cab2d3b83d", "score": "0.70056623", "text": "def advanced\n @options[:advanced]\n end", "title": "" }, { "docid": "14d1c44a3c6991e219a0b14ed027d12f", "score": "0.61902446", "text": "def advanced_state?\n @advanced_state.present?\n ...
6eade283fdb2a00158795813dea7e61e
Returns a slice of vector
[ { "docid": "8c9ac93c552174d4bea8fd8c32a39918", "score": "0.8102655", "text": "def slice(*args)\n Vector[*to_a.slice(*args)]\n end", "title": "" } ]
[ { "docid": "b5dc4dc3a37166df55e52e66e677680e", "score": "0.7113923", "text": "def slice(first, len)\n first = length + first if first < 0\n raise 'first must be valid index' unless 0 <= first and first < length\n last = first + len - 1\n raise 'last must be valid index' unless 0 <= last and ...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "89acb7dd4c43ade5d907c213dd1b1f9e", "score": "0.0", "text": "def learning_module_params\n params[:learning_module][:posted_by_id] = current_admin.id\n params[:learning_module][:custom_posted_by] = nil if params[:learning_module][:custom_posted_by].blank?\n params.require(:learn...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title"...
2ee9eb5d2f99204c23dbdac0883df8a9
Constructs permissions hash based on defined role_names and permission_types filtered by class name
[ { "docid": "8a82304238cbaa37df257d4c86aa0333", "score": "0.6553065", "text": "def build_default_permissions_hash\n default_permissions = { 'group' => { 'public' => 'read' } }\n roles = RoleMapper.role_names.select{ |role| role.split('_').last == class_name.downcase }\n roles.each do |role...
[ { "docid": "3e0746a5b20d3c479110cdc721bb053c", "score": "0.61775565", "text": "def format_permissions_hash params, permissions = Array.new\n params[\"users\"].each { |k,v| permissions << {:type => \"user\", :name => k, :access => v} } unless params[\"users\"].nil?\n params[\"groups\"].each { |k,...
0e4ce37fa11d19e2df52ffe57e44ea96
create Description: This method creates a new design directory in the database. Parameters from params ['new_design_directory'] Contains the information used to make the update. Return value: None Additional information:
[ { "docid": "99c1d5a9760036d046bfd6d9f1f0b660", "score": "0.74562144", "text": "def create\n\n @design_directory = DesignDirectory.create(params[:new_design_directory])\n\n if @design_directory.errors.empty?\n flash['notice'] = \"Design Directory #{@design_directory[:name]} added\"\n redi...
[ { "docid": "477fd0214493959afb5fa13bab0935f9", "score": "0.6403856", "text": "def create\n logger.info \"got params --- : #{params[:design_directory].inspect}\"\n @design_directory = DesignDirectory.new(params[:design_directory])\n unless session[:registered_user_id].nil? then\n logger.in...
ae934ec93c604c8d8a3d4e79ac0edf95
check if we're on the index path of a resource
[ { "docid": "437a4b830b11b0c71b8a4ca0ee2bfcb4", "score": "0.0", "text": "def current_controller?(path)\n \"/#{controller_name}\" == path\n end", "title": "" } ]
[ { "docid": "06cc46db365cf2ef9688fb3d7647ce91", "score": "0.7602863", "text": "def index?\n self == '/'\n end", "title": "" }, { "docid": "a2c040e03cc72b164152f257be0eb1c8", "score": "0.7524241", "text": "def index?\n File.basename(path, '.*') == 'index'\n end", "title...
dbed75817d60fe4d816ed09c567a3983
Set the saturation, value: 0% to 100%.
[ { "docid": "a3294ae85be3b49f04a3af904bcd37a1", "score": "0.74566257", "text": "def saturation(value)\n raise ArgumentError, \"Please supply a saturation value between 0-100.\" if value.negative? || value > 100\n\n @command.execute(zone_id, [0x31, 0x00, 0x00, 0x08, 0x02, value, 0x00, 0x00, ...
[ { "docid": "744b5be575eee5c26672ce4b2c868af7", "score": "0.82918537", "text": "def saturation=(ss)\n @s = Color.normalize(ss / 100.0)\n end", "title": "" }, { "docid": "bc04f2185ae1a9762d062e2c8063c6e8", "score": "0.8248415", "text": "def saturation=(ss)\n @s = ColorLib.normal...
0ba2cd4841ef824ccd27fc2f70f3e9f4
for storage, we want to strip out anything nonnumeric
[ { "docid": "8d3732d5869172d5e4681e5f709c08b2", "score": "0.59625065", "text": "def format_phone_for_storage(phone)\n return phone if phone.blank?\n phone.gsub(/[^0-9]/, '')\n end", "title": "" } ]
[ { "docid": "4eaa606503ababbbdfd23fc612d8d963", "score": "0.7758354", "text": "def strip_non_digits\n country_code.gsub!(/[^\\d]/, '') unless country_code.blank?\n local_number.gsub!(/[^\\d]/, '') unless local_number.blank?\n extension.gsub!(/[^\\d]/, '') unless extension.blank?\n end",...
fd223ccf8959c639c6b1467c09a58b2e
Prompts the user for a message to agree/decline
[ { "docid": "c23b9b7dcd162c5d745fbea5e22fed66", "score": "0.74196786", "text": "def ask(message, default=true)\r\n Capistrano::CLI.ui.agree(message)\r\n end", "title": "" } ]
[ { "docid": "b6efe3651d2ffe0b84d4cbc8c2fac3ca", "score": "0.7593737", "text": "def prompt_user(message)\n \"yes\"\n end", "title": "" }, { "docid": "4e35b5bbdf3a6af50b5cedbed4d4fbe1", "score": "0.7326024", "text": "def confirm_with(answer)\n ask 'Please confirm', answer\n...
92aa7579561a4569902f4e269485f38f
if there's a session id, find the user and assign it to current_user
[ { "docid": "a316e5f8ea05d97c3d09999c790a1abc", "score": "0.0", "text": "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n rescue ActiveRecord::RecordNotFound\n end", "title": "" } ]
[ { "docid": "264c82a248b2c1c56f5db82af19c5e21", "score": "0.81368816", "text": "def set_current_user\n if User.exists?(session[:userid]) # If there is a user_id currently stored in the session hash...\n @current_user = User.find(session[:userid]) # ...find and save that user in @current_user\n e...
22d991c5701b64221f6629097541396e
GET /fournisseurs/1 GET /fournisseurs/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "0de35831f7d677c5b200daa818ca23f9", "score": "0.7098831", "text": "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "title": "" }, { "docid": "9070fd68a2dd1f7a4d58b48cfecfc4d9", "score": "0.703202", "text": "def index\n render json: @fiestas\n en...
96774b05fc2dde8aba5b21d026c1e5b9
timeline: show list of tweets
[ { "docid": "589b082f7e45f818732dbea9b0badafa", "score": "0.7609709", "text": "def timeline\n tweets = []\n following.merge(my_info).each do |nick,url|\n tweets.concat timeline_for_user(nick,url)\n end\n tweeets = tweets[-timeline_limit, timeline_limit].sort_by { |h| h[:date] }\n (timeline_sort =...
[ { "docid": "3c25e90deeedb5c7f9c66a7c6b89158a", "score": "0.8187575", "text": "def display_timeline\n timeline_search_results = []\n TWITTER.home_timeline.each do |tweet|\n timeline_search_results << [tweet.user.name, tweet.text]\n # binding.pry\n end\n timeline_search_results\n en...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "696820c7f43d2e3e2fcd20d4d0a5c4c9", "score": "0.0", "text": "def truck_location_params\n params.require(:truck_location).permit(:truck_id, :location_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...
b02bb2d8a7971353aaf3f33eed448e3a
GET /api_consoles GET /api_consoles.json
[ { "docid": "b84e103f51449909f15b566690fb7ccd", "score": "0.7941422", "text": "def index\n @api_consoles = ApiConsole.all\n end", "title": "" } ]
[ { "docid": "15a7ea784f37fb08359f367188dc34b3", "score": "0.7927737", "text": "def index\n @consoles = Console.all\n\n render json: @consoles\n end", "title": "" }, { "docid": "d7c0bf8459c67204cddc1a1f23874a2a", "score": "0.7396243", "text": "def fetch_developer_api_console_det...
f90e9240d8757c3971526e195041e605
this method writes average files considering data as :name =[mark..mark]
[ { "docid": "743faceaf37ea43f7a4cfa65374631e1", "score": "0.72830045", "text": "def genenate_average_files\n puts 'genenate_average_files'\n puts @data\n @data.each do |key, e|\n final = get_avg(e)\n puts \"#{key} #{final}\"\n write_avg(key, final)\n end\n end", "title": "...
[ { "docid": "ef3f7addfdcfcd4fdff24aee202dc46c", "score": "0.6709053", "text": "def genenate_averages_file\n puts 'genenate_averages_file'\n puts @data\n file = File.open('averages.file', 'w')\n @data.each do |key, e|\n final = get_avg(e)\n puts \"#{key} #{final}\"\n file.puts(\...
6fdc098dc26b61ff89971d007b76c545
PATCH/PUT /the_applications/1 PATCH/PUT /the_applications/1.json
[ { "docid": "7a5371ab489603d702681eebd292993e", "score": "0.67573", "text": "def update\n respond_to do |format|\n if @the_application.update(the_application_params)\n format.html { redirect_to user_path(@current_user), notice: 'The application was successfully updated.' }\n format....
[ { "docid": "fa9b25fc88fe47caede8d93d908f16e9", "score": "0.77289927", "text": "def patch_application(application_id, request)\n start.uri('/api/application')\n .url_segment(application_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .patch()\n .go...
76805b636613e34de1332acb468d9b08
DELETE /faceapis/1 DELETE /faceapis/1.json
[ { "docid": "bd0fb84971e8708f10a173e2104bfa3a", "score": "0.8115896", "text": "def destroy\n @faceapi.destroy\n respond_to do |format|\n format.html { redirect_to faceapis_url, notice: 'Faceapi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title"...
[ { "docid": "acfe9f9f1e91f23075b0de622e7fa87c", "score": "0.7432163", "text": "def face_info_delete(face_uid)\n @client.post \"/service_json_ssl.svc/FaceInfo_Delete\", {face_uid:face_uid}\n end", "title": "" }, { "docid": "10f20ce06826b69913fddc1e69efc458", "score": "0.7365393", ...
6f960ce78c05fdc75ffcb0082f7c8991
Returns the default help message describing the bot's command repertoire. Commands are sorted alphabetically by name, and are displayed according to the bot's and the commands's _public_ attribute.
[ { "docid": "fbb8e41b0c5580ad2839cbc24ab1843c", "score": "0.75650364", "text": "def help_message(sender, command_name) #:nodoc:\n if command_name.nil? || command_name.length == 0\n # Display help for all commands\n help_message = \"I understand the following commands:\\n\\n\"\n ...
[ { "docid": "845b43000b0d026f910a047ff6e708e7", "score": "0.77908456", "text": "def default_help\n s = ['Wavefront CLI',\n '',\n 'Usage:',\n \" #{CMD} command [options]\",\n \" #{CMD} --version\",\n \" #{CMD} --help\",\n '',\n 'Commands:']\n\n...