query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
f12a111b5e0a64503299176d7683634a
GET /musics/1 GET /musics/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "12affb45658dd5ef203da290de947dea", "score": "0.76331794", "text": "def index\n @musics = current_api_user.musics.select(:title,:id)\n render json: @musics\n end", "title": "" }, { "docid": "f5f2f17d6c235ad415246e14e48154cc", "score": "0.72257", "text": "def index\n...
b08fc25764b3ce9400e232bf74eabc54
Return a nice, humanreadable date (for e.g. a due date or request deadline) For shortterm loans, also include the time.
[ { "docid": "470af8dcec079079450e81ba376b0147", "score": "0.6531322", "text": "def today_with_time_or_date(date, short_term: false)\n return unless date\n\n return l(date, format: :time_today) if short_term && date.today?\n return l(date, format: :time_tomorrow) if short_term && date.to_date == ...
[ { "docid": "3defedc29e0271bbc7360f093c280602", "score": "0.704865", "text": "def show_date(time)\n\t\tif time > Time.now.beginning_of_day\n\t\t\treturn \"#{time_ago_in_words(time)} ago\"\n\t\telse\n\t\t\treturn time.strftime(\"%b %d, %Y\")\n\t\tend\n\tend", "title": "" }, { "docid": "60845ef...
d80123faeb07f5cce4be7ac0754f7cff
:callseq: size Returns the number of values currently stored.
[ { "docid": "deccbbf4dcae6c355e1861feb5b4d2f1", "score": "0.0", "text": "def size() @vlets.length; end", "title": "" } ]
[ { "docid": "2586adf433b4e820b2d60c41b99f98c7", "score": "0.8778685", "text": "def size\n @values.length\n end", "title": "" }, { "docid": "78d179a780cbcc4d93bdb8bab62704c0", "score": "0.87344545", "text": "def size\n values.size\n end", "title": "" }, { "docid": "...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "d2f42e669ed09c27105498b1d50b3b56", "score": "0.0", "text": "def set_prospect\n @prospect = Prospect.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;...
e8b593272523809afa33e9d8801f2a20
Similarity measure using Pearson correlation
[ { "docid": "494484a12b78524320393b92e394a81e", "score": "0.7326691", "text": "def pearson_correlation_similarity(user, other_user)\n co_rated_items = []\n dividend = multiplicand = multiplier = 0\n\n user_item_matrix[user].each_key do |item|\n if user_item_matrix[other_user].has_key?(item)...
[ { "docid": "e2196d13ebc63d6527c375d380a511f4", "score": "0.71581995", "text": "def pearson_corr(target_user_ratings, other_user_ratings)\n target_rating_hash = Hash[target_user_ratings.pluck(:movie_id).zip(target_user_ratings.pluck(:rating_value))]\n other_rating_hash = Hash[other_user_ratings.plu...
5260de64ea14959c864e0d831bb71f82
renders a YAHOO.widget.Layout widget with the given options valid options are described in
[ { "docid": "5994a1275e85dec1ef75310bb3915326", "score": "0.820592", "text": "def yui_layout(options)\n yui 'layout' do |js|\n js << %Q[var layout = new YAHOO.widget.Layout(#{options.to_json});]\n js << %Q[layout.render();]\n end\n end", "title": "" } ]
[ { "docid": "2c7c67487af74479a718f01d50b68c28", "score": "0.65624195", "text": "def initialize(layout, options={})\n @layout = layout\n @options = options\n end", "title": "" }, { "docid": "75f8d6061854649ba29aeae482b0fbe1", "score": "0.6226115", "text": "def render(optio...
7efbd82263d759cdb5dfb4159cff0a27
Allow query to be colorized in the terminal
[ { "docid": "d336e264653c7156df7ba4f1bccf8250", "score": "0.6186286", "text": "def colorize_text(text)\n return text unless ActiveRecordQueryTrace.colorize\n # Try to convert the choosen color from string to integer or try\n # to use the colorize as the color code\n colors = {...
[ { "docid": "172c2da2254dffd3dd9fd93f2fcb1499", "score": "0.7179974", "text": "def format_query(query)\n query.map{ |k, v| \"#{k}: #{color(v, BOLD, true)}\" if v.present? }.compact.join(', ')\n end", "title": "" }, { "docid": "b5dc277bc886be4039e562107ef675d7", "score": "0.68565786", ...
33372b390f2878325dd42836ac50278d
DOES NOT REALLY BELONG HERE
[ { "docid": "9e04d15b2f3ae52f44972f435739e086", "score": "0.0", "text": "def body_as_html\n markdown = MarkdownPresenter.new(body)\n markdown.convert_to_html\n end", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.7417949", "text": "def private; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.69707763", "text": "def probers; end", "title": "" }, { "docid": "65ffca17e416f77c52ce148aeafbd826", ...
9d192c2a2b301c45f0d1aff40eb75fa9
Hash of Global Options
[ { "docid": "176b3909e11a86312ca1423438aa67e6", "score": "0.0", "text": "def global_slop\n @global_slop ||= Slop::Options.new.tap do |slop|\n slop.bool '-h', '--help', 'Display help documentation'\n slop.bool '--version', 'Display version information'\n end\n end", "title":...
[ { "docid": "8a0a5fe080e54b315e9939755a7377ed", "score": "0.81758606", "text": "def global_opts\n @config.find_all {|k,v| GLOBAL_OPTIONS.include?(k) }\n end", "title": "" }, { "docid": "b5741b0c6829843b316802a194125fed", "score": "0.77260816", "text": "def get_options\n [...
60114f0c20578bcc0dc5853b13b525e1
extend Benchmark with an `ams` method
[ { "docid": "dfb8086911416f645d8ec1eddb049530", "score": "0.0", "text": "def ams(label = nil, time:, disable_gc: true, warmup: 3, &block)\n fail ArgumentError.new, 'block should be passed' unless block_given?\n\n if disable_gc\n GC.disable\n else\n GC.enable\n end\n\n ...
[ { "docid": "99ba3cefa71d03c97caf96fab6962145", "score": "0.58887094", "text": "def method_missing(method, *args, &block)\n return benchmark(method, \"\", *args) {adapter.send(method, *args, &block)} if @adapter.respond_to?(method)\n super\n end", "title": "" }, { "docid": "5128...
0603f593a17d5a0aa45068c3b84983c0
9 = VIIII no prepend items I = 1 V = 5 X = 10 L = 50 C = 100 D = 500 M = 1000
[ { "docid": "088b8f55cc099c8642ced608cfef8887", "score": "0.0", "text": "def old_school num\n numeral = ''\n \n\n numeral += 'M'*(num/1000)\n num = num % 1000\n numeral += 'D'*(num/500)\n num = num % 500\n numeral += 'C'*(num/100)\n num = num % 100\n numeral += 'L'*(num/50)\n num = num % 50\n ...
[ { "docid": "5b710e1b4d061b3d2d7e8200d72cea97", "score": "0.5736598", "text": "def make_quantity_list(item_list)\n index = 0\n while index < item_list.length\n item_list[index] = 1\n index = index+1\n end\n return item_list\nend", "title": "" }, { "docid": "5e9ad4ff37c081225769c89f...
17547086d29223f4af1eedef296c3331
This function can be used to set all data series as graphable. They'll all be graphed when calling a chart function of the Rchart class. There is no change on Data, only the "Graphable" attribute is modified Generate some data... chart_data.add_point([2,4,9,5,1,0],"Serie1") chart_data.add_point([(1,1,2,2,3,3],"Serie2")...
[ { "docid": "74b1be444e30987655a1ccf69c53c582", "score": "0.5782457", "text": "def add_all_series\n\t\t@data_description[\"values\"] = []\n\t\tif(!@data[0].nil?)\n\t\t\t@data[0].each do |k,v|\n\t\t\t\tif (k != \"name\" )\n\t\t\t\t\t@data_description[\"values\"].push(k)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\...
[ { "docid": "fbd2c7e98a4e5a1c276727676f71d69c", "score": "0.5942466", "text": "def add_data_series(data_series)\n @data_series << data_series\n end", "title": "" }, { "docid": "fbd2c7e98a4e5a1c276727676f71d69c", "score": "0.5942466", "text": "def add_data_series(data_series)\n...
09c0d072b1c32b73f53e66764d26cb7a
A collection of column breaks added to this worksheet add_page_break
[ { "docid": "e4fe8cc21f37f8b76b6c7434b48a0170", "score": "0.65535665", "text": "def col_breaks; end", "title": "" } ]
[ { "docid": "3dfe09dfec1d2973263a6ee4ab3afb89", "score": "0.7828375", "text": "def add_page_break(cell); end", "title": "" }, { "docid": "b8160f3cfeeead4fa506489fc10c0717", "score": "0.72933865", "text": "def add_page_break(cell)\n DataTypeValidator.validate :worksheet_page_break...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "46ac22c2ace1f3decdaa33bb204b3607", "score": "0.0", "text": "def subject_params\n params.require(type.underscore.to_sym).permit(:title, :subtitle, :type, :parent_id, :first_page, \n :last_page, :page_count, :volume, :published_date, :abbr, :edition, :language, :publisher, \n ...
[ { "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...
54e9e2307cf1e53567caffbb9ee0bf5f
DELETE /apps/1 DELETE /apps/1.json
[ { "docid": "99fe48b7f710c16f4dde6d98b0b28c13", "score": "0.70852554", "text": "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n redirect_to apps_path\n end", "title": "" } ]
[ { "docid": "9d3132fa4d9f52107547a6a1974a50ab", "score": "0.80307215", "text": "def delete_app name\n try_json delete(\"/app/#{name}\")\n end", "title": "" }, { "docid": "6bac329c89711953ca6bc8811a7cd45a", "score": "0.79621595", "text": "def delete_app name\n\t\t\tdelete(\"/ap...
8bca4248431e4ccfaea0158862a64caa
the API needs different login_required logic: throws an exception if the user is not logged in
[ { "docid": "d410d479a1ffdf1fa108e5f20a36d506", "score": "0.0", "text": "def login_required\n raise NotLoggedIn unless logged_in?\n @session_id = request.session_options[:id]\n end", "title": "" } ]
[ { "docid": "1c3d63bc5c9ebf377fb903bc3e984ca7", "score": "0.81728745", "text": "def login_required!\n error 401, 'You need to log in first.' unless logged_in?\n end", "title": "" }, { "docid": "0d8b082fb9826e1452608be841a34501", "score": "0.80659664", "text": "def login_requir...
ebde44a5a42331ef18ba950f109e0736
Handle a disconnect notice from Mongrel2 via the given +request+. Its return value is ignored.
[ { "docid": "63f9d5a45d861a071dd10d914fe82e89", "score": "0.7667312", "text": "def handle_disconnect( request )\n\t\tself.log.info \"Connection %d closed.\" % [ request.conn_id ]\n\t\tself.connection_times[ request.sender_id ].delete( request.conn_id )\n\t\tself.connections.delete( request.sender_id )\n\...
[ { "docid": "b29529caeac6069e8f8d9d67250a3adc", "score": "0.82799155", "text": "def handle_disconnect( request )\n\t\tself.log.info \"Unhandled disconnect notice.\"\n\t\treturn nil\n\tend", "title": "" }, { "docid": "8ae343d26001f1ac474a028ecfea7b03", "score": "0.76870257", "text": "d...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "60f29e1dc882df1d018e0a42ebd2ba39", "score": "0.0", "text": "def galeri_video_params\n params.require(:galeri_video).permit(:judul, :keterangan, :pengguna_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...
86176137d15c0360f7506f8f9cde0948
POST /report_payments POST /report_payments.xml
[ { "docid": "73493617a6175a5596f62cd7cc78c5da", "score": "0.5512117", "text": "def create\n if params[:csv]\n startdate = session[:startdate]\n enddate = session[:enddate]\n sort = session[:sort]\n if startdate == enddate\n\tcsv_string = \"\\\"Payments\\\", #{startdate}\\n\"\n ...
[ { "docid": "67af5c08016760e5459c4ac166532674", "score": "0.6533878", "text": "def payment_request\n @payment = Payment.create(payment_params)\n sepa_direct_debit = SEPA::DirectDebit.new(recipient_params)\n sepa_direct_debit.add_transaction(debtor_params)\n # with this xml request will be set...
64919168d5d6a4dc73c8691723c7adcd
Validate user if new record? Method to determine if value is too long or if user in current user hash is already in JSON file
[ { "docid": "959a42a41661384453670f78452da2ed", "score": "0.5586756", "text": "def check_values(user_hash)\n flag = 0\n feedback = \"\"\n detail = \"\"\n user_hash.each do |key, value|\n flag = 2 if key == \"age\" && value.to_i > 120\n (flag = 3; detail = key) if key !~ /quote/ && value.length ...
[ { "docid": "1b75280913b8f964bfac0f6c6ba0cc96", "score": "0.606445", "text": "def validate_user_data\n return unless @options[:user_data]\n\n raise LengthError.new \"user_data can't be longer than 2,500 characters, you provided #{@options[:user_data].length} characters\" if @options[:user_d...
a379cad2bf86df90c44eef10cf55ad4b
Returns all countries that matched valid patterns
[ { "docid": "cb075456e0e19e35894486e4779ca0a0", "score": "0.0", "text": "def countries\n @phone.countries\n end", "title": "" } ]
[ { "docid": "273fa4e476490e73f386643844a06791", "score": "0.72745365", "text": "def valid_countries\n @valid_countries ||= countries.select do |iso2|\n @data[iso2][:valid].any?\n end\n end", "title": "" }, { "docid": "53a8fb219669029da480e7019579691e", "score": "0.6805...
953e0dd4db21c6eef16ccaa7104e4336
GET /result_figures/1 GET /result_figures/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "0190cae57a22a375541813a5fca33535", "score": "0.73584104", "text": "def index\n @result_figures = ResultFigure.all\n end", "title": "" }, { "docid": "0e0a7e37c2806be735c994ee72091df3", "score": "0.6896259", "text": "def get_figures\n get(FIGURES)\n end", "title...
d27ba19f0d0319f53e3e98a66346650e
you can change the validation here
[ { "docid": "68d100602761181ef45417b0665ef243", "score": "0.0", "text": "def email_ucd?(email)\n if email.length > 50\n then print_error(\"Email too long\")\n elsif !email.end_with?\"ucdconnect.ie\"\n then print_error(\"Invalid email! Please enter your UCD connect email.\")\n else ...
[ { "docid": "d6fb659d501db05b55eb36a1822cbd08", "score": "0.8241142", "text": "def validate\r\n end", "title": "" }, { "docid": "763ba48a1b721f2d3dc15192eb3224bc", "score": "0.8181869", "text": "def validation\n #\n end", "title": "" }, { "docid": "5b6d6ef79ae2c83d4...
ee8b3d0d20757f093b902e4af54e39d7
Perform block read of the file
[ { "docid": "e84035ead27ab63f97735acec2d92d36", "score": "0.7790047", "text": "def read_file(block=0)\n Rula.log(Logger::DEBUG,\"Reading file #{filename} block #{block}\",self)\n return nil if(block >= @file_size)\n return nil if(block < 0)\n file_handle = File.open(@filename,'rb')\n ...
[ { "docid": "334986f840d53ac973b9d985a59b2648", "score": "0.74156225", "text": "def read(block)\n @filemgr.read(block, @contents)\n end", "title": "" }, { "docid": "24daeebf7ac654accebcab72529cf634", "score": "0.7273949", "text": "def read_chunk\n #puts(\"Reading #{BLOCK_SIZE...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "b55bb0bcca931a39440a4c6a998be283", "score": "0.0", "text": "def set_order\n @order = Order.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...
740b10632ae4461a3d8388c13749ad2b
Creates an appropriate backend object
[ { "docid": "986d9b641138febbe05100d2b8c64968", "score": "0.6721683", "text": "def backend_for(shoes_object, *args)\n backend_class(shoes_object).new(shoes_object, *args)\n end", "title": "" } ]
[ { "docid": "1c2dfc18513e5ae86e2c223ebb50db74", "score": "0.8179426", "text": "def create backend, opts = {}\n default.create backend, opts\n end", "title": "" }, { "docid": "ecfde9195f28d4bb14425a541270e3c0", "score": "0.7455143", "text": "def backend\n @@backe...
5419e9d145bb7c00ca0fe7b0c87e1632
Create External Interface Variable
[ { "docid": "f2d02293b4fd92759b2f486878e25274", "score": "0.71958584", "text": "def create_external_variable(name, initial_value = 0)\n external_variable = OpenStudio::Model::ExternalInterfaceVariable.new(@model, create_ems_str(name),\n ...
[ { "docid": "bbaed4042a782be751dc25fc48ac7f65", "score": "0.70653105", "text": "def create_external_variable(name, initial_value = 0)\n new_external_variable_string = \"\n ExternalInterface:Variable,\n #{create_ems_str(name)}, !- Name,\n #{initial_value}; !-...
a8a295b2ebdde99681c099b15ee34c35
Internal: default prefix on Datadog for repository creation
[ { "docid": "8a636427cfd6b9070efda5a4506bb27e", "score": "0.6408277", "text": "def default_root_prefix\n \"exercise_repo\"\n end", "title": "" } ]
[ { "docid": "e789d3546dde6ad1aa259533592c5a3b", "score": "0.68345124", "text": "def name_prefix\n DEFAULT_NAME_PREFIX\n end", "title": "" }, { "docid": "b5626067279ac80d387e264d3f4914a4", "score": "0.6596312", "text": "def prefix()\n #This is a stub, used for indexi...
3c57ef7a393f34d0342139eba06e5da7
If the card is above 11 (i.e. a face card), returns 10.
[ { "docid": "eda84dec070a85f8fbcc06ce6dac1193", "score": "0.7525758", "text": "def evaluate_non_ace_card(card)\n card.face_card? ? 10 : card.value\n end", "title": "" } ]
[ { "docid": "58d93de64e5638bbb31cb09fcd6f63c3", "score": "0.7452658", "text": "def face_value(card)\n case card\n when \"T\"\n return 10\n when \"J\"\n return 11\n when \"Q\"\n return 12\n when \"K\"\n return 13\n when \"A\"\n return 14\n else\n return card.to_i\n end\nend", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "518b4fd6ab05bfdf31bf8932b6f7bb00", "score": "0.0", "text": "def set_user\n @user = User.find(params[:id])\n end", "title": "" } ]
[ { "docid": "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...
9acd5fa7e46456acbaaa3c48618deabc
PATCH/PUT /bloques/1 PATCH/PUT /bloques/1.json
[ { "docid": "699c56ce0cc16d58c3b2f5f7c51ae67e", "score": "0.6961007", "text": "def update\n @bloque = Bloque.find(params[:id])\n\n if @bloque.update(params[:bloque])\n head :no_content\n else\n render json: @bloque.errors, status: :unprocessable_entity\n end\n end", "title": ""...
[ { "docid": "e694bf0cad4bbfdac6e2b3afb798f836", "score": "0.60684013", "text": "def update\n respond_to do |format|\n if @bloqueo.update(bloqueo_params)\n format.html { redirect_to @bloqueo, notice: 'Bloqueo was successfully updated.' }\n format.json { render :show, status: :ok, loc...
9f7eb5ac6b2f3d22ca077deff13922b4
Process each of the numbers is the area within a nested loop.
[ { "docid": "f2a6fbf493daa5c24fa677863743b790", "score": "0.0", "text": "def list_primes( highest_num )\n $n.each do |num|\n $o_count += 1\n prime = true\n\n $n.each do |divider_num|\n $o_count += 1\n\n if divider_num > 1 && divider_num < num\n if num % divider_num == 0\n ...
[ { "docid": "3404e879b5de358ee50534aebff87fcb", "score": "0.62789816", "text": "def each( )\n @ranges.each do |range|\n range.each do |number|\n yield( number )\n end\n end\n end", "title": "" }, { "docid": "2e63f9c0cbc590f29d0a57ba06a7...
72dc98d679f454bee8d5e9fd76b48fb4
Added functions Returns the content of the file TODO Add error handling in case file is alreay open
[ { "docid": "72c2f57ebfca3f4dd2001571f1c7e9f7", "score": "0.6663483", "text": "def read\n return File.open(self, 'r'){|f| f.read} \n end", "title": "" } ]
[ { "docid": "a2f5585509878658478126d96d28eb97", "score": "0.749206", "text": "def read_content_from_file(file_path)\n \n end", "title": "" }, { "docid": "664f347f665c413192b69323f2664537", "score": "0.7437396", "text": "def read(filepath); end", "title": "" }, { ...
c1ec1e6aed6fcf62c129d1bde42599c3
Append job id's to the .conflux/jobs.txt file to keep track of which jobs have already ran.
[ { "docid": "1d006144238f727f3cbefaf0f6a6663a", "score": "0.6979587", "text": "def mark_succeeded_jobs_as_performed\n File.open(conflux_jobs_path, 'a') do |f|\n input = @succeeded_jobs.join(',')\n input = \",#{input}\" unless File.read(f).empty?\n f << input\n end\n end"...
[ { "docid": "4d856a1d138d3b49d5a53118cb53e165", "score": "0.62252647", "text": "def conflux_jobs_path\n File.join(conflux_folder_path, 'jobs.txt')\n end", "title": "" }, { "docid": "fee6f4a20760421e7f257a46ec207c17", "score": "0.6076986", "text": "def past_jobs\n File.exi...
7cab503df700b73841db80f0955ceb8c
dont used out of class Route
[ { "docid": "f1e792df1266f0b7effa73134ea44be8", "score": "0.0", "text": "def put_stations_name\n @stations.each(&:info)\n end", "title": "" } ]
[ { "docid": "a9ad1702a9f85d5c8973d5d10b964244", "score": "0.78830534", "text": "def _routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.77449596", "text": "def routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", ...
6a17da22803bbe26ce588f10d0ad9b77
For a page to list all admins (GET) Named route: admins_path
[ { "docid": "cd23f6be9bff8bd3015eef6a0b1e44b5", "score": "0.7829839", "text": "def index\n @admins = Admin.all\n end", "title": "" } ]
[ { "docid": "065b7806022985c1e6c3606ef37190cf", "score": "0.7663596", "text": "def index\n @admins = Admin.page(params[:page]).per(20)\n end", "title": "" }, { "docid": "e6e1baf092165eb96c3bd67dc672ebfe", "score": "0.76580673", "text": "def index\n @admin_admins = Admin::Admin....
6e7292867e916c596853ad06c793c5ac
GET /kakikos/1 def show
[ { "docid": "85d9ea1d5abaa81d5c151b923cd8fdd8", "score": "0.0", "text": "def create\n @kakiko = Kakiko.new(kakiko_params)#属性を設定してモデルオブジェクトを生成\n @kakiko.user_id = current_user.id#user_id属性を追加\n @kakiko.tag = params[:kakiko][:tag]\n @kakiko.name = params[:kakiko][:name]\n if @kakiko.save#sav...
[ { "docid": "da6fbd159095527bc05fff4f3f644d2c", "score": "0.7896949", "text": "def show\n @kisalli = Kisalli.find_by_key(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kisalli }\n end\n end", "title": "" }, { "docid": "9...
6e882e042eb8823c98849045c0278d77
Gets the given user's name(s) from redis. If it's not in redis, makes an API request to Slack to get it, and caches it in redis for a month. Options: use_real_name => returns the users full name instead of just the first name
[ { "docid": "3d7e595293240e03fd173f0ddc8f201e", "score": "0.7513269", "text": "def get_slack_name(user_id, options = {})\n options = { :use_real_name => false }.merge(options)\n key = \"slack_user_names:2:#{user_id}\"\n names = $redis.get(key)\n if names.nil?\n names = get_slack_names_hash(user_id...
[ { "docid": "1599cd6b2c264d3f6cf1ca69d69990b1", "score": "0.6591913", "text": "def user_name\n @user_name ||= SlackUtils::SingletonClient.instance.find_user_name(@user_id)\n end", "title": "" }, { "docid": "db6edd6e056c203e021fdb0351ecd501", "score": "0.62732005", "text": "def...
ed0adcb2620256c0ffb0c7b90d3341f8
find ElectiveGroup which we have selected create subject object and pass required parameters from private method subject_params, create action is saving our new Elective Subject to the database.
[ { "docid": "c5b91c5f985452613f5021ce642e17f9", "score": "0.762971", "text": "def create2(eg_id)\n @elective_group = ElectiveGroup.shod eg_id if eg_id\n @subject = @elective_group.subjects.new(subject_params) if eg_id\n @elective_subjects ||= @elective_group.subjects if eg_id\n @subject.save\...
[ { "docid": "9b5c21cf9b69a498dca96351bc987217", "score": "0.77327317", "text": "def create\n @batch = Batch.shod(params[:batch_id])\n subject_data\n @subject = @batch.subjects.new(subject_params)\n create2(params[:elective_group_id])\n flash[:notice] = t('subject_create')\n end", "tit...
1d63c64684c5bb23b09bc512a41d28dd
Footer, for style purposes! Array length, for student count!
[ { "docid": "017ab34a964d89ac51147ed389f64b6f", "score": "0.72140515", "text": "def footer\n unless @villains.empty?\n puts \" \"\n ln = \"Overall, we have #{@villains.length} dastardly student#{plural}!\"\n puts ln.center(66)\n end\n puts \"~|-------------------------------------------------...
[ { "docid": "e4289b7869df2077cf9d6f68e5be34ea", "score": "0.8220489", "text": "def print_footer\n\tputs \"Overall, we have #{@students.length} potential students.\"\nend", "title": "" }, { "docid": "f5aeea4422a0aac0a3b774c8bf6000d3", "score": "0.81629974", "text": "def print_footer\n ...
9bd2b2dba2725f7ac1945ccb984e22ee
Sends a command and receives an ACK from the remote.
[ { "docid": "ad9d4a95051811ba2deb5ffdbc637ca4", "score": "0.70455045", "text": "def send_cmd(cmd)\n full_cmd = '$' + cmd + '#' + checksum(cmd)\n vprint_status('Sending cmd: '+full_cmd)\n sock.put(full_cmd)\n read_ack\n end", "title": "" } ]
[ { "docid": "4e53664cafdfd77f0587417fa3b3c01b", "score": "0.7164357", "text": "def send_ack\n sock.put('+')\n vprint_status('Sending ack...')\n end", "title": "" }, { "docid": "d0235ddbbbf2452ab5dfef57018a78db", "score": "0.7059389", "text": "def send_command(command)\n @c...
82dd17cae05ef6906299d7e36a1c7769
=== Description Set password for the given user. === Parameters new_password:: String
[ { "docid": "a9cb2f1d92ab3df49dc42829f3b16959", "score": "0.87923056", "text": "def set_password(new_password)\n UserPassword.new(:id => id, :new_password => new_password).post\n end", "title": "" } ]
[ { "docid": "1f7d27f14515658e8f21d6ea0f1efa2b", "score": "0.8347052", "text": "def change_password(new_password)\n put(\"\", {:password => new_password})\n @password = new_password\n end", "title": "" }, { "docid": "b5e481259b0c53383393843d8c9484b3", "score": "0.82663286", ...
e14dfd37997e6d1fce859095805f1a43
PATCH/PUT /graus_formacao/1 PATCH/PUT /graus_formacao/1.json
[ { "docid": "5f5f1e3a0caf41133e6fed2b11220686", "score": "0.71221465", "text": "def update\n respond_to do |format|\n if @grau_formacao.update(grau_formacao_params)\n format.html { redirect_to @grau_formacao, notice: 'Grau formacao was successfully updated.' }\n format.json { render...
[ { "docid": "ac9229526c1019056095681dbf3df0d0", "score": "0.70129937", "text": "def update\n @forma_entrega = FormaEntrega.find(params[:id])\n\n respond_to do |format|\n if @forma_entrega.update_attributes(params[:forma_entrega])\n format.html { redirect_to @forma_entrega, notice: 'Form...
1b069b66e1638d706defc47e31feea37
Speed of Spread method takes the population density and state as its arguments and calcuates the projected speed (in months) that the virus would spread.
[ { "docid": "36a8ca25746f9895405c69492f690b8b", "score": "0.8337134", "text": "def speed_of_spread\n # (population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed ...
[ { "docid": "d15548cc05c9302e41087b61fa1229d5", "score": "0.84881413", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n STATE_FORMULA.each do |...
e0b19d3ec500b34bdb809389fe23a90a
should return 1 because difference between all sum and small sum is [7, 5, 1, 7], and min is 1
[ { "docid": "65673130a863d847af2d6cd0a1ccc122", "score": "0.78081554", "text": "def solution(a)\n sum_all = a.inject(:+) - a[0]\n sum_small = a[0]\n p = 1\n i = 0\n diff = []\n\n while p < a.length\n diff << (sum_all - sum_small).abs\n sum_all -= a[p]\n i += 1\n sum_small += a[i]\n p...
[ { "docid": "7c16ada37406c3b773ae538b425e23d6", "score": "0.7639711", "text": "def smallest_gte_s(arr, s)\r\n sum = s\r\n smallest_size = 1.0/0\r\n start = 0\r\n curr_sum = 0\r\n\r\n arr.each_with_index do |val, idx|\r\n curr_sum += val\r\n\r\n while curr_sum >= sum\r\n\r\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.0", "text": "def set_profile\n @profile = Profile.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...
dcb6446fdf7fc5ca9bc5feb8f5bbb3db
Yields chain to block, bounded by open/close if not already open
[ { "docid": "28563b6349220c69ae3698757e33e55c", "score": "0.7186122", "text": "def filter\n opened = unless open?\n open\n true\n end\n\n yield @chain\n\n ensure\n close if opened\n end", "title": "" ...
[ { "docid": "2417ccb9a788ab554da372a44e77c195", "score": "0.73242295", "text": "def autoclose_open_blocks_and_return\n ( rslt = close_block; chain rslt; pipe_2_variable ) while @head.size > 1\n return close_block\n end", "title": "" }, { "docid": "03faef80939fdbf32fe995784d8fccf0", ...
31292ff765cbeb8924e26cf2750534aa
Running mode of the debugger. Can be either: :attached => Attached to a running program through the `byebug` method. :standalone => Started through `byebug` script. :off => Ignoring any `byebug` method calls. source://byebug//lib/byebug/core.rb41
[ { "docid": "62861377e3a9d9e93d71729382857822", "score": "0.0", "text": "def mode=(_arg0); end", "title": "" } ]
[ { "docid": "404ac6fd3adc46996d04106f5f1df61a", "score": "0.66736495", "text": "def debug_mode; end", "title": "" }, { "docid": "a739db23304c197351f449d4906ca13f", "score": "0.66196436", "text": "def debug_mode\n self.class.debug_mode || false\n end", "title": "" }, ...
816c66fe42c45f7382e62a3715b8bb3c
Clear the caches. Returns nothing.
[ { "docid": "19818e0adaa433c181e15a34f8e44efc", "score": "0.7154643", "text": "def clear_caches\n config.repositories.each do |repository|\n Smeagol::Cache.new(Gollum::Wiki.new(repository.path)).clear()\n end\n end", "title": "" } ]
[ { "docid": "36314b2a780ebabe061f016820768a47", "score": "0.83021796", "text": "def clear\n delete_cache_files\n @cache.clear\n end", "title": "" }, { "docid": "06299326358430f14b18730c311914e8", "score": "0.82837975", "text": "def clear\n cache.clear\n end", ...
e045dc32c7ed91a65adb25ebfe1c4a8b
GET /network_details/new GET /network_details/new.xml
[ { "docid": "4f7f463f4022cc0fac1a8955aa43908f", "score": "0.7707469", "text": "def new\n @network_detail = Subnet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @network_detail }\n end\n end", "title": "" } ]
[ { "docid": "dbe12fc5e926888af2759bfa3d0c99b5", "score": "0.78541595", "text": "def new\n @network_model = NetworkModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @network_model }\n end\n end", "title": "" }, { "docid": "c6cb...
c5545e214e91ba45793a1983cf196f88
POST /taxonomies POST /taxonomies.json
[ { "docid": "60cba4acbebe8c93a7b4f3709ccb2345", "score": "0.68120223", "text": "def create\n @taxonomy = Taxonomy.new(taxonomy_params)\n\n if @taxonomy.save\n render :show, status: :created, location: @taxonomy\n else\n render json: @taxonomy.errors, status: :unprocessable_entity\n ...
[ { "docid": "15885c56c42bbc095bcf55e0ddabb832", "score": "0.70087284", "text": "def create\n @taxonomy = Taxonomy.new(params[:taxonomy])\n\n respond_to do |format|\n if @taxonomy.save\n format.html { redirect_to admin_taxonomies_path, notice: 'Taxonomy was successfully created.' }\n ...
a64c90b3e733e5275f4506c9ded59dc8
Get official name of location
[ { "docid": "a85574404783c125650c6a5fa176260c", "score": "0.62486434", "text": "def get_city_poly_name(location)\n res = RestClient.get(\"https://nominatim.openstreetmap.org/search.php?q=#{location}&polygon_geojson=1&polygon_threshold=0.003&format=jsonv2\")\n return JSON.parse(res)[0][\"display_nam...
[ { "docid": "002be22e264f0bba4ff248e076eae2ab", "score": "0.8188174", "text": "def location_name\n LOCATIONS[location.to_s]\n end", "title": "" }, { "docid": "002be22e264f0bba4ff248e076eae2ab", "score": "0.8188174", "text": "def location_name\n LOCATIONS[location.to_s]\n end",...
30bac3e77872a4ebb83f5a78527fa35b
Correctly parses methods with explicit classes. Todo: Doesn't correctly parse global methods, methods without a class.
[ { "docid": "c830486d24e2712cc0f280504f6696eb", "score": "0.0", "text": "def rdoc_parse_file(file)\n\tclass_hash = {}\n\tRDoc::TopLevel::reset\n\tcontent = File.open(file, \"r\") {|f| f.read}\n\tcapital_p = RDoc::ParserFactory.parser_for(RDoc::TopLevel.new(file),file,content,Options.instance,RDoc::Stats....
[ { "docid": "67b32b4432d8107e256781bbd4e652de", "score": "0.6816184", "text": "def parse_class(_node)\n class_name = _node.attribute(\"name\").to_s\n completions = [create_completion(class_name, class_name)]\n\n # Traverse class methods\n _node.each_element(\"method\") do |method|\n # Pr...
59308decaef4b53b0de0d530106f7f0c
Manage a single project using +id+ as parameter
[ { "docid": "4c0d61d23425db8ec53ac7f7c1387ba1", "score": "0.0", "text": "def manage\n# logger.debug( \"* Manage Project ID: #{params[:id]}\" )\n @project_id = params[:id]\n project = Project.find_by_id( @project_id )\n redirect_to( projects_path() ) and return unless project\n\n @project_n...
[ { "docid": "e4f1aeeb6d1aa2b39bc8f6325daace3b", "score": "0.795271", "text": "def set_project\n # support ye olde website URLs and future project ids\n if params[:id] =~ /^\\d{1,6}/\n @project = Project.find(params[:id])\n else\n @project = Project.friendly.find(params[:id])\n end\n...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "ef4ec18548e9f9032b5ac0f257343051", "score": "0.0", "text": "def set_uev\n @uev = Uev.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...
ab54a74b979abf9058eaef69c5c88bad
Mostly a spec method
[ { "docid": "ca3d51a5b1b9f947316213817ea3fbfe", "score": "0.0", "text": "def ==(oth)\n\n @excluded_symbols == oth.instance_variable_get(:@excluded_symbols) &&\n @accepted_patterns == oth.instance_variable_get(:@accepted_patterns) &&\n @excluded_patterns == oth.instance_variable_get(:...
[ { "docid": "072514f3348fe62556dcdfd4b06e3d08", "score": "0.8500562", "text": "def spec; end", "title": "" }, { "docid": "072514f3348fe62556dcdfd4b06e3d08", "score": "0.8500562", "text": "def spec; end", "title": "" }, { "docid": "072514f3348fe62556dcdfd4b06e3d08", "sc...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "4ecef1f286a12e86cd2f44121d86a244", "score": "0.0", "text": "def answer_history_params\n params.require(:answer_history).permit(:question_id, :answer_id)\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...
5daef04a0b92aa66ee7a331b81db4e8b
Baseline implementation for the set_shielded_instance_integrity_policy REST call
[ { "docid": "c3f9cca78aeb11e9dd3ac92c2dff7379", "score": "0.8100861", "text": "def set_shielded_instance_integrity_policy request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_set_shi...
[ { "docid": "cd4685be00c5cf5d4214a5c46c54f9e3", "score": "0.7897939", "text": "def set_shielded_instance_integrity_policy request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/instances/#{request_pb.instance}/setShieldedInstanceIntegrity...
c4b87333cd7bd54b5ef086553d74d924
Whether this column should currently be displayed
[ { "docid": "d8b3adff6cf218bcba4ea3c0b4a56103", "score": "0.647998", "text": "def visible?\n @visible\n end", "title": "" } ]
[ { "docid": "742ff9f011783f31972024c1c638044d", "score": "0.7227984", "text": "def should_render_col_az?\n false\n end", "title": "" }, { "docid": "84cfd009fb244a98e193fce9fa93dc91", "score": "0.70145446", "text": "def column_hidden\n return @column_hidden\n ...
2bc3119d8b94879541cdf4c3538b0c9d
GET /reservations/1 GET /reservations/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "15aba820a67960cca8fe4ac5e21c1111", "score": "0.7758194", "text": "def index\n render json: reservations\n end", "title": "" }, { "docid": "6bba0a4222ce4fc964cc8dd559e822e5", "score": "0.7455302", "text": "def index\n @reservations = Reservation.all\n\n respond_t...
7f3b0c9108b58e91a00a0f13120bb765
GET /time_offs GET /time_offs.json
[ { "docid": "81ca19660d0634c0b41197e3e1ae131a", "score": "0.6311489", "text": "def index\n respond_to do |format|\n format.html\n format.json {\n\n render :json => TimeOff.joins('LEFT OUTER JOIN request_types ON time_offs.request_type_id = request_types.id')\n ...
[ { "docid": "cd505547aada08ee1984489e670d8c13", "score": "0.70674956", "text": "def index\n set_user\n @time_offs = TimeOff.all\n end", "title": "" }, { "docid": "365d549df7127dda18fb8d10765e0d19", "score": "0.6257343", "text": "def show\n @time_off_request = TimeOffRequest....
26c958760631afb27d331d3e0e542d69
return a specific key from the user configuration in config/piwik.yml ==== Returns Mixed:: requested_key or nil
[ { "docid": "9e4bceb8a75d7b2453bb6c90a54cb7b2", "score": "0.52944463", "text": "def user_configuration_from_key( *keys )\n keys.inject(user_configuration) do |hash, key|\n hash[key] if hash\n end\n end", "title": "" } ]
[ { "docid": "ab352cda75ef9ca12619ff50211fec5a", "score": "0.6041112", "text": "def get_config key, default = nil\n name_key = my_short_name.to_sym\n\n if Bot::Conf.has_key? name_key\n if Bot::Conf[name_key].has_key? key\n return Bot::Conf[name_key][key]\n end\n end\n...
4e97680e26e497732ea22f6f2f89952b
Set the value of the ThreadLink input for this Choreo.
[ { "docid": "fdcaac8595e3ae87e69797700b5be785", "score": "0.7785344", "text": "def set_ThreadLink(value)\n set_input(\"ThreadLink\", value)\n end", "title": "" } ]
[ { "docid": "51a79d337766befa6488438443abc36f", "score": "0.5801722", "text": "def set(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n thread = args.first\n options.merge!(:thread => thread) if ([:ident, :link] & options.keys).empty?\n response = get('threads/set', options)...
95a34ec53456283940914c703569aa88
matches the clicked liqueur to the db, adds it to the current_user's ingredients_users join table redirects back to previous view(should be liqueurs)
[ { "docid": "af467d7626ad7fae68790b5931a86ef9", "score": "0.7013657", "text": "def create\n\t\t@liqueur = Ingredient.find(params[:id]) # match the liqueur in the db from the liqueur in the view\n\t\t# @user = current_user # set the current user\n\t\t# @user.ingredients.build\n\t\t# debugger\n\t\tcurrent_...
[ { "docid": "1b0e0c8fcc9704609829d072ca5203ad", "score": "0.74368805", "text": "def create\n\t\t@liquor = Ingredient.find(params[:id]) # match the liquor in the db from the liquor in the view\n\t\t@user = current_user # set the current user\n\t\t@user.ingredients << @liquor\n\t\t# debugger\n\t\t# env[\"H...
3462f52710dc98455322e0f0566c73c6
retorna la cantidad que falta por devolver del pedido
[ { "docid": "fba5f7a3b7c7da9e6df6da51e7aeb80d", "score": "0.6798601", "text": "def cantidad_por_remunerar(articulo)\n self.cantidad_del_articulo_pedido(articulo)-self.cantidad_devuelta_del_articulo_pedido(articulo)\n end", "title": "" } ]
[ { "docid": "e909dfaac42ff9872cfae424efab4e1c", "score": "0.6607537", "text": "def cantidad_de_pedido_mayor?\n self.lista_de_articulos.each do |registro|\n articulo = Articulo.find(registro.articulo_id)\n if registro.cantidad && registro.cantidad > articulo.cantidad\n return errors.a...
92a799ce0b03b4575d53e6cef82b40cc
Build an instance of NotificationInstance
[ { "docid": "066fa96274d9cfede95afc9bf9b2816e", "score": "0.70784485", "text": "def get_instance(payload)\n NotificationInstance.new(@version, payload, service_sid: @solution[:service_sid], )\n end", "title": "" } ]
[ { "docid": "d35a43badf3fdc38448e2d80300a3a2f", "score": "0.74192315", "text": "def build\n case os\n when 'ios' then ios_notification\n when 'android' then android_notification\n else Null.new\n end\n end", "title": "" }, { "docid": "2c9834e104c4480481b244b229...
9762c88ff8e1491d1d9be4ec1c1f72c2
Creates a new report file in the 'report_filename'. This file contains a line for each test of the following example format: (this is a single line despite explicit wrapping) Avg: 0.0555555 Min: 0.0498765 Max: 0.0612345 Last: 0.0499421 Description: The test name Note however the timings are to 9 decimal places, and pad...
[ { "docid": "b5fec731185ebee22e02a4f64329ff59", "score": "0.52380496", "text": "def create_new_report!; end", "title": "" } ]
[ { "docid": "12f90744430bfa39b6d092e80e7ca570", "score": "0.68583536", "text": "def create_new_report!\n File.write(report_filename, report_title + report_body)\n end", "title": "" }, { "docid": "66c0eaef6aae25dc7bacc86ba4d2d300", "score": "0.6270862", "text": "def build_r...
c7996ab61af8c3a9baadea0f2b034186
get field data len by metadata or from stream
[ { "docid": "819b5bd3b9cf8affda8dcfe33332c085", "score": "0.7775915", "text": "def get_len(field_info=nil)\r\n if field_info.nil?\r\n @raw_io.read(4).unpack('I')[0]\r\n else\r\n field_info[:max_length]\r\n end\r\n end", "title": "" } ]
[ { "docid": "872b6506224af93b91525e1aca147815", "score": "0.7101482", "text": "def data_length\n return @content.length \n end", "title": "" }, { "docid": "d643a5d7a153376978f2b4d192ad374c", "score": "0.6987902", "text": "def length(record)\n if record[:header][:lengths].includ...
d0f0eb91c3d197a6c5f75bd3460a047d
my solution is actually quite short and simple compared to theirs =begin input: string output: hash rules: three keys percentage lowercase uppercase neither string will contain at least one char algorithm: init hash init upper, lower, neither vars split string into array of chars iterate on arry of characters if char i...
[ { "docid": "3a307a345bc6e073b5a200ab8681fd6b", "score": "0.0", "text": "def calculate_percent(str, criteria)\n size = str.size.to_f\n percent = str.count(criteria)/size * 100\n percent.round(2)\nend", "title": "" } ]
[ { "docid": "c18d06504e504e6fbcc60e10b80d01ff", "score": "0.6800023", "text": "def letter_hash s\n s.each_char.to_a.sort.join('')\nend", "title": "" }, { "docid": "fe80010311469f3d7657693126d7cc6c", "score": "0.6768043", "text": "def letter_case_count(string)\n hash = { lowercase: 0...
65129147f2b9e1ed4b4787ca5d18b471
get the thumb url of the video
[ { "docid": "e4f71b9fab4ecc72a5d75137856c66c9", "score": "0.77812034", "text": "def thumburl\n thumb_path\n end", "title": "" } ]
[ { "docid": "ca156bf8497ab155a3763069bf6f6df7", "score": "0.8671986", "text": "def thumbnail_url\n if video_processing\n \"\"\n else\n video.thumb.url\n end\n end", "title": "" }, { "docid": "51fc8fae9d0e43d001153430b0242b34", "score": "0.8010469", "text": "def you...
79985fde6b457f917aa307e4d2fe0b02
Generate an random id
[ { "docid": "88ed2a9d1c3b7724daff21074c125681", "score": "0.7905712", "text": "def generate_id\n [*('A'..'Z'), *('a'..'z'), *('0'..'9')].sample(16).join\n end", "title": "" } ]
[ { "docid": "5e84924b05d18328a1c2af621c7387dd", "score": "0.899976", "text": "def generate_id\n rand(2**32..2**64-1)\n end", "title": "" }, { "docid": "5ff710854c90b29bad0a4b9edaad7df7", "score": "0.8948754", "text": "def generate_id\n generate_random_string_id\n end", ...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "9d57f6e1609e2eba5625d1898c056bfc", "score": "0.0", "text": "def movie_params\n params.require(:movie).permit(:nombre, :descripcion, :img_url, :dias_presentacion, reservations: [])\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": "...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "8406eff0a2d2cdc4a05f4890123913ff", "score": "0.0", "text": "def set_admin\n authorize current_admin, policy_class: Admin::SecretaryPolicy\n @secretary = Admin.where(id: params[:id], admin_role: :secretary).first\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339844", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6014297", "text": "de...
710590110c3c35414a134d0f13d01e97
Flags this line as skipped
[ { "docid": "60787459261f5cfec62a9e47992d2352", "score": "0.719059", "text": "def skipped!\n @skipped = true\n end", "title": "" } ]
[ { "docid": "c8cba600b8176679eac01aa50303e1fa", "score": "0.8070471", "text": "def skipped_lines; end", "title": "" }, { "docid": "c8cba600b8176679eac01aa50303e1fa", "score": "0.8070471", "text": "def skipped_lines; end", "title": "" }, { "docid": "e6a1cefb43651e79fde6cfb2...
4fad2b2c04aa36c9677562ecb8da8abf
Calculates the difference (in bytes) between a file and its last tracked state. Supplements the builtin status method so that its output will include deltas.
[ { "docid": "4076fcf7ebe31c398d5a05d0af3e0b05", "score": "0.6994751", "text": "def calculate_delta(file, st)\n state, mode, size, time = dirstate.files[file].to_a\n st && size >= 0 ? (size - st.size).abs : 0 # increase the delta, but don't forget to check that it's not nil\n end", ...
[ { "docid": "a0eb4c565f383188c0022a1bde471b4e", "score": "0.6896971", "text": "def calculate_delta(file, st)\n 0\n end", "title": "" }, { "docid": "a0eb4c565f383188c0022a1bde471b4e", "score": "0.6896971", "text": "def calculate_delta(file, st)\n 0\n ...
a6599dc1325da8f4a0bacda559774370
Parses a given string and adds them to the current dictionary.
[ { "docid": "9cf3e1d05f00913bd2765a551a638c55", "score": "0.7451729", "text": "def parse_string(string)\n @dictionary.parse_source(string, false)\n end", "title": "" } ]
[ { "docid": "0d45d2e44d51ed3632b14a7cccf00ef0", "score": "0.69823194", "text": "def parse(string)\n attributes = {}\n string.split(\"\\n\").each do |line|\n line.strip!\n next if line.empty?\n next if line =~ /^#/\n if line =~ /^([^=]+)=(.*)$/\n key = $1.str...
6ddb1c16aee9a04fa6c7b1d5138001ca
has_many :images, autosave: true
[ { "docid": "7e305cb042120fb3f921c0067e5d6469", "score": "0.0", "text": "def get_lat\n geo[:lat] || \"21.0333333\"\n end", "title": "" } ]
[ { "docid": "a571aeb1caa3aa389e99ffb4e2727f92", "score": "0.7118414", "text": "def reflect_on_all_autosave_associations; end", "title": "" }, { "docid": "fa3cb9fb6d3672bfc4e5d2f5415bcbc1", "score": "0.69209397", "text": "def save_images\n images.each { |n| n.should_destroy? ? n.des...
91c9043506f82f24d940fb87a5ce795c
POST /prayers POST /prayers.json
[ { "docid": "1b043fe33f7bfb16acbfd79a6076464f", "score": "0.6843449", "text": "def create\n @prayer = Prayer.new(prayer_params)\n\n respond_to do |format|\n if @prayer.save\n format.html { redirect_to @prayer, notice: 'Prayer was successfully created.' }\n format.json { render :s...
[ { "docid": "cd6358c6e9fb8133770ea6ed8eb12514", "score": "0.69455713", "text": "def index\n @prayers = Prayer.all\n render json: @prayers, status: 200 # you've got a serializer. Maybe you should use it.\n end", "title": "" }, { "docid": "90ce0c043f3237578aa17108c0a97d71", "score": ...
aeedb1b21c9bf9a7c380edf48778c0c3
GET /main_contents/1 GET /main_contents/1.json
[ { "docid": "249faffef14b2a8e7dfc2403675d3eb2", "score": "0.7036147", "text": "def show\n @main_content = MainContent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @main_content }\n end\n end", "title": "" } ]
[ { "docid": "a95292659d6d19c49fb5bc60cea5765e", "score": "0.6917102", "text": "def index\n @contents = Content.all\n render json: @contents\n end", "title": "" }, { "docid": "2f2e218879b1941ae0de576fc6e474ca", "score": "0.6709073", "text": "def index\n @contents = Content.al...
7d351968af951078406754dc3321f9ca
invokes the begin import action for the desktop applet import process. returns the URL of the applet that should be displayed to the user within the appropriate applet tag throws an exception if an invalid service is invoked.
[ { "docid": "31704c887f91780923d47badaf437fab", "score": "0.0", "text": "def begin_import_username_password(source_name, username, password, user_id)\n # we need to pass in all params to the call\n params = {:service => source_name, :user_id => user_id, :username => username, :password => passw...
[ { "docid": "29411575a172e1df5587d461251490d4", "score": "0.6327482", "text": "def begin_import(source_name, username = nil, password = nil, user_id = '', redirect_url = nil, opts = {})\n id = nil\n consent_url = nil\n applet_tag = nil\n @options.update(opts)\n\n # look at the gi...
13fc17afede31fd876b03d557719f1ee
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: initialize hash add each item set default quantity print the list to the console [we can use the print method we will create] output: hash Method toadd an item to a list input: item name and optional quantity steps: 1. Receive in...
[ { "docid": "4edec18a1c32a9a86cf4b443e87542f1", "score": "0.0", "text": "def new_list(list)\n grocery_list = {}\n unless list.nil?\n list_array = list.split(\" \")\n list_array.each do |item|\n grocery_list[item] = 1\n end\n print_list(grocery_list)\n return grocery_list\n else\n ...
[ { "docid": "44dac6ffcaabfad5c3edf84ee92c72a4", "score": "0.83366305", "text": "def add_item(item, hash)\n if hash.include?(item)\n return hash\n else\n hash[item] = 1\n return hash\nend\n\n\ndef add_item(item, quantity, hash)\n if hash.include?(item)\n update_quantity(item, quantity, hash)\n ...
26de9ef8ff810c7c9f2a2f348641ee41
the basic strategy of checking for the winner revolves around the value property of the tile each tile has a value: 1 for 'X', 0 for blank tiles, and 1 for 'O' if the values in any row, column, or diagonal have an absolute total equal to the size of the board, then we have a winner. i reuse the check_rows function in t...
[ { "docid": "94b25660f260ce98ad47133a32d9a056", "score": "0.0", "text": "def check_for_horizontal(player = nil) # passes in the whole board array - rows\n check_rows(@board, player)\n end", "title": "" } ]
[ { "docid": "94c731cff4ce9792347c45a84160ecc6", "score": "0.7668149", "text": "def check_board\t\n # Winner checker\n @winner = false\n \n # Board's status\n @empty_board = false\n\n # Checking the rows\n 3.times do |x|\n if !@winner\n ...
815a793a6a4139a5001ac0c4937b48e2
call this with String to decode and it will return the decoded version based on cipher sued to initialize
[ { "docid": "dc9de3ebd9f94220f63a36e5ec2e2c35", "score": "0.6875545", "text": "def decypherString(decodeString)\n @decodedString = \"\"\n\n charArrayDecodeString = decodeString.chars\n\n charArrayDecodeString.each_with_index do |element,index|\n @decodedString += charSwap element\n end\n...
[ { "docid": "8781ea0832b6e22ac14353fe82d42e44", "score": "0.7688355", "text": "def decode(str)\n str = Base64.urlsafe_decode64 str\n des = OpenSSL::Cipher::Cipher.new ALG\n des.pkcs5_keyivgen KEY, DES_KEY\n des.decrypt\n des.update(str) + des.final\n end", "title": "" },...
13d9839b3d8261943fbaf51035c13424
Calculate the pairwise score and side/color use.
[ { "docid": "754390c936b4136927324f69f6978ee3", "score": "0.0", "text": "def score_versus\n @all_players = Array.new\n @versus_hash = Hash.new do |vh, vk|\n vh[vk] = Hash.new do |h, k|\n h[k] = Versus.new(vk, k)\n end\n end\n Game.find(:all, :order => \"played_at\").each do |...
[ { "docid": "bcbcdeab87e462261146802a335902a9", "score": "0.6722063", "text": "def score_tadpole\n color_score = (255 - (blue-red).abs) - green\n limb_score = limbs.prime? ? 255 : 0\n weight_score = (420 - weight).abs * 0.3\n puts [weight_score, limb_score, color_score].inspect\n [-50, wei...
f768d039ec12410b60a5b3509b40ff19
Test creation of verification
[ { "docid": "6e83524ab661964b4bbc8b3b5c4d1b9c", "score": "0.64999515", "text": "def test_create_verification\n verification = @twizo.create_verification(nil)\n\n test_recipient = NUMBER1\n\n verification.params.recipient = test_recipient\n\n verification = verification.send\n puts verifica...
[ { "docid": "334b0940330fadf4d636e9f632278c6c", "score": "0.78965545", "text": "def verify\n end", "title": "" }, { "docid": "00c94b8b71ed19aa1315b363aac6bb92", "score": "0.7782761", "text": "def verify\n\n end", "title": "" }, { "docid": "1477aa237723f7dd728d26c...
0ccdc373b94afbd003dc89d6a79cf75c
Prepare connections to a given set of nodes. Useful to prefetch metadata or open bulk connections. [API] This method is optional
[ { "docid": "be132b1e27d3f9e9abef30e3911c81c7", "score": "0.6080311", "text": "def with_connection_to(nodes, no_exception: false)\n @calls << [:with_connection_to, nodes, { no_exception: no_exception }]\n yield @connected_nodes.nil? ? nodes : @connected_nodes\n end", "title": "" } ]
[ { "docid": "7b61fcb17f9ab84045437b5f0aec6620", "score": "0.6384696", "text": "def __rebuild_connections(arguments={})\n @hosts = arguments[:hosts] || []\n @options = arguments[:options] || {}\n __close_connections\n @connections = __build_connections\n ...
db3050879d27115b92ac4246812363e9
Create landing page for project +p+
[ { "docid": "2a5abb29175f57b105d6ef9a41897140", "score": "0.77630687", "text": "def generate_project_page(p)\n # Redirect page\n write_file(p, '../index.html') { build_from_template('redirect.html') }\n\n # Summaries\n summaries = Dir[\"#{p.path}/*.tsv\"].map do |i|\n b = File.basename(i...
[ { "docid": "4710932ad363269f581da6060c153607", "score": "0.7371354", "text": "def create_empty_page(p)\n cli.say 'Creating project page'\n FileUtils.mkdir_p(browse_file(p, '.'))\n %w[favicon-32.png style.css].each do |i|\n FileUtils.cp(template_file(i), browse_file(p, i))\n end\n wri...
6db93ad2808fb0602a96ddf6cabce122
Model fields as an ActiveSupport::OrderedHash.
[ { "docid": "721799d2f5cca43c28c2828fe3d0aa0e", "score": "0.78872913", "text": "def model_fields\n ActiveSupport::OrderedHash.new.tap do |hash|\n properties.map do |u|\n hash[u.name] = TYPES.fetch properties.find{|property| property.name == u.name}.primitive\n ...
[ { "docid": "691bcb56c3787e813d89ae041e34b192", "score": "0.71627945", "text": "def to_hash\n @fields\n end", "title": "" }, { "docid": "aa6f4c97e704ff7f89b0735626ae8ecc", "score": "0.7151945", "text": "def save_hash_field_order; end", "title": "" }, { "docid": "cc...
2d0f0fe405f960dd78f9403627acb760
Return true if the tiny_tds gem is present. Implies this project can run using sql server database
[ { "docid": "07aeff946f4693a937f8eeee8e50e00f", "score": "0.8166093", "text": "def tiny_tds_defined?\n unless @tiny_tds_loaded\n @tiny_tds_loaded = true\n begin\n require 'tiny_tds'\n rescue LoadError\n # Ignored\n end\n end\n Object.const_defi...
[ { "docid": "7913536917c5f22df3bd74aac82bf218", "score": "0.73991245", "text": "def sqlserver?\n true\n end", "title": "" }, { "docid": "16fecd4a44150bd87f9f1b6136b04cb8", "score": "0.7190445", "text": "def is_multi_database_project?\n tiny_tds_defined? && pg_defined?...
8c9907f3c4d820db62d254689f845fc0
POST /approved_appointments POST /approved_appointments.json
[ { "docid": "43f4a47274a87cb2600d7e1d7924a51d", "score": "0.7588368", "text": "def create\n @approved_appointment = ApprovedAppointment.new(approved_appointment_params)\n\n respond_to do |format|\n if @approved_appointment.save\n format.html { redirect_to @approved_appointment, notice: ...
[ { "docid": "81a8ad5f5a77599edc06419afb696ef8", "score": "0.7444224", "text": "def create\n @appointment = params_post_appt\n\n respond_to do |format|\n if @appointment.save\n current_user.account.appointments << @appointment\n\n format.html { redirect_to root_path, notice: 'Appo...
52e40beb8cb70b3af99c6b0a63fa58d6
Return all instances of the current JSONModel's record type. FIXME: This will need some sort of pagination support.
[ { "docid": "30d5ec9516eb5e3f0f3feebcbf461ed5", "score": "0.0", "text": "def all(params = {}, opts = {})\n uri = my_url(nil, opts)\n\n uri.query = URI.encode_www_form(params)\n\n response = self._get_response(uri)\n\n if response.code == '200'\n json_list = JSON(respo...
[ { "docid": "032144c228277e5d3010a7339bb479e2", "score": "0.6994117", "text": "def all\n instance_variable_get(:@_collection).list_records.map do |rec|\n new(JSON.parse(rec))\n end\n end", "title": "" }, { "docid": "b1cea1869050d682c886582587a51ac8", "score": "...
988397f038c3d73b519b99474aff2595
Public: Tries to find the app in different stores. app_store_id given application itunes store id.
[ { "docid": "6379ee144e6753066b6d4c468ba5cb39", "score": "0.6209334", "text": "def find(app_store_id)\n country_codes.each do |country_code|\n begin\n return lookup!(id: app_store_id, country: country_code, lang: language_code)\n rescue NoResultsError\n next\n ...
[ { "docid": "caae1c3a89bcf895c92b9e69002b4c53", "score": "0.6228523", "text": "def get_review_app_by_app_id(app_id_or_app_name)\n @client.review_app.get_review_app_by_app_id(app_id_or_app_name)\n end", "title": "" }, { "docid": "3b2702be7bbf97126a679a8300943535", "score": "0.60421...
83461d2cf6df541d501984eabd41ecc0
Initializes a new encoder instance. If no configuration object is passed or is +nil+, the value of +JWTEasy.configuration+ is used as the configuration object
[ { "docid": "a5cfb4e6dfc3a27c7c23b42ef5751e4e", "score": "0.5524522", "text": "def initialize(token, configuration = nil)\n @token = token\n @configuration = configuration || JWTEasy.configuration\n @headers = {}\n end", "title": "" } ]
[ { "docid": "ec8244c2af99a8cdeb26e88c66c7857f", "score": "0.5861677", "text": "def encode(encoder, options = T.unsafe(nil)); end", "title": "" }, { "docid": "ec8244c2af99a8cdeb26e88c66c7857f", "score": "0.5861677", "text": "def encode(encoder, options = T.unsafe(nil)); end", "titl...
9fcb180e111298361eccb4468f8a6b83
Constructor: calls the query times function
[ { "docid": "2fe58559776c8263cc5d3c5cc21dbec4", "score": "0.0", "text": "def initialize(mongo_dest)\n\t\tputs \"Initialized OSMHistory\"\n\n\t\tcase mongo_dest\n\t\twhen :local\n\t\t\t@host = 'localhost'\n\t\t\t@port = 27017\n\t\twhen :ea \n\t\t\t@host = 'epic-analytics.cs.colorado.edu'\n\t\t\t@port = 27...
[ { "docid": "1529230e2dd5080484ded27be660a067", "score": "0.6464585", "text": "def initialize(queries: [])\n @queries = queries\n end", "title": "" }, { "docid": "db2c67ac1787d3379e6a8a84fc012452", "score": "0.6364524", "text": "def initialize\n self[:start_time] = Time.n...
db354df7deb55d55ba70029606b32a97
Get a list of Public Invitations Returns a list of public invitations. Can be filtered using the request parameters to provide a subset of results. >Note: >This request is paginated and will only provide a limited amount of resources at a time. If there are more results to be collected, a &x60;more&x60; token provided ...
[ { "docid": "e73f2da8d50fce0927d9a496826b1bba", "score": "0.7244138", "text": "def get_public_invitations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InvitationsApi.get_public_invitations ...'\n end\n # resource path\n ...
[ { "docid": "e07c1605dc79cfe28ae0fa6b30f6576c", "score": "0.7619352", "text": "def get_public_invitations(opts = {})\n data, _status_code, _headers = get_public_invitations_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "aa16fdbf3033132579ced2adea12568c", "scor...
094865c2430f108f4d02371b56dbf60d
Converts numeric `timeout` into a packed socket option value
[ { "docid": "f08f1c6c3bd8ed34b93d72f6493840ad", "score": "0.777354", "text": "def sock_timeout\n @sock_timeout ||= begin\n secs = Integer(timeout)\n usecs = Integer((timeout - secs) * 1_000_000)\n [secs, usecs].pack(\"l_2\")\n end\n end", "title": "" }...
[ { "docid": "4a56f2993472d35196a83ed2ff5eca5e", "score": "0.7916132", "text": "def get_socket_timeout(timeout)\n secs = Integer(timeout)\n usecs = Integer((timeout - secs) * 1_000_000)\n timeval = [secs, usecs].pack(\"l_2\")\n return timeval\n end", "title": "" }, { "do...
60cf79f938f05188b442173c90891e1c
Perform Author: Dhananjay Date: 01/06/2019 Reviewed By:
[ { "docid": "0313ac14bccee384574fddbef78705b1", "score": "0.0", "text": "def perform(params)\n\n init_params(params)\n\n send_secure_data_access_link\n\n notify_devs\n\n end", "title": "" } ]
[ { "docid": "2e1660eb495fe3e7c3e08cba5b66b12b", "score": "0.58831185", "text": "def review; end", "title": "" }, { "docid": "a50cab5351863d3cda1f4f41d5672671", "score": "0.5862238", "text": "def review\n end", "title": "" }, { "docid": "677e08f38b5583bc2aea49bea3b86989", ...
a55a5393516792bb7b0e918292d7be66
Retrieve the stories data from API We can pass the limit and type of stories to retrieve For default we get the top stories retrieve_stories_data(10) => Get first 10 top stories retrieve_stories_data(10, :new) => Get first 10 new stories
[ { "docid": "3d2a006f131e27822d8e14e57f413fac", "score": "0.82242715", "text": "def retrieve_stories_data(limit = nil, type = :top)\n response = send(\"#{type}_stories\")\n\n return [] unless response.code == 200\n\n stories = limit ? response.first(limit) : response\n\n all_stories = []\n\n ...
[ { "docid": "35da7be4bfac69b5267f0fd31b065e3d", "score": "0.73226935", "text": "def stories(params={})\n Endpoints::Stories.new(client).get(id, params)\n end", "title": "" }, { "docid": "41fe26370effed25f1b3018bd38253cc", "score": "0.71421504", "text": "def get_stories\n ...
f0d77a1bc7fb61a950bb6230bd7a20a6
References are stored in camel case in the project file
[ { "docid": "3a30e935772703a0000927c692563e7a", "score": "0.0", "text": "def attribute_name(name)\n camelized = name.to_s.gsub(/[^\\w]/, '').gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n camelized[0].chr.downcase + camelized[1..-1]\n end", "title": "" ...
[ { "docid": "4104be86d2114c731cfe5060ff790fe6", "score": "0.6441362", "text": "def paket_refs\n File.join @proj_path_base, 'paket.references'\n end", "title": "" }, { "docid": "46a7287e5ad2a5786b85c3a6dfe7d7ae", "score": "0.64063287", "text": "def lookup name\n const_...
6e841b0b58eb63f0f9b7a7353c57d1e2
Reservation management current year confirmed
[ { "docid": "704a11eadf1d9ea5423c48aa0a93e782", "score": "0.0", "text": "def reservation_search_confirmed(limit, offset, first_year_date)\n extra_condition = \"WHERE b.status in (2,3,4) and b.creation_date >= ?\"\n repository.adapter.select(query_strategy.query_reservation_search(...
[ { "docid": "3bdbc28f95716c18afa2db09958cfecf", "score": "0.63992834", "text": "def current_planning_year_year\n current_fiscal_year_year + 1\n end", "title": "" }, { "docid": "cd26110720dd2b6ab247e3e565c72e6e", "score": "0.63340694", "text": "def start_new_year\n clean_associa...