query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
bf2e4a06b1c4f6ef69795a2f730ce03b
Returns: nil if the status is :direct all the URLs if the status is :redirected or :too_many_redirects or :unknown_host the error message if the status is :failed
[ { "docid": "d4e77b5722ee20d2771bca8feeab6d17", "score": "0.5990806", "text": "def details_body\n case code\n when :direct then\n nil\n when :redirected then\n uris.map { |uri| \"- #{uri}\\n\" }.join\n when :failed then\n return nil unles...
[ { "docid": "b41ba6b156cb1077e1be703a8eec1427", "score": "0.6844475", "text": "def checkUrls\n urls = %w|http://invalidurl http://bigthink.com/devpatnaik/visionary-businesses-must-play-to-their-strengths http://bigthink.com/ideas/1311|\n\t\turls.each { |url|\n\t\t\trequest = head(url)\n\t\...
e34572443e1f9bc268a2e2629a0ca7ce
Returns `true` if the column is of type :string.
[ { "docid": "52042f698847ef3fdc66106260bde54f", "score": "0.7000754", "text": "def text?\n type == :string\n end", "title": "" } ]
[ { "docid": "d2dbacb5804e2a907a92c288ffbf3422", "score": "0.88009787", "text": "def is_string?\n columns.all? { |col| col.is_string? }\n end", "title": "" }, { "docid": "63523a461ce86a7e71a93b0ded575311", "score": "0.8778952", "text": "def string_column?(column)\n [:s...
20fee10c1022fe52a9be34e8d8bec782
Determine whether the input is prime
[ { "docid": "87dcf948f37bb892ba8bce3e8e6eba36", "score": "0.0", "text": "def isPrime?(num)\n return false if num <= 1\n\n i = 2\n while i <= (Math.sqrt(num)).floor\n if (num % i) == 0\n return false\n end\n i += 1\n end \n\n return true\nend", "title": "" } ]
[ { "docid": "e50c1994a3bf1193a6523c71eb79dd6b", "score": "0.83260375", "text": "def is_prime(input)\n\t\n\tlimit = Math.sqrt(input)\n\tcounter = 2\n\twhile(counter <= limit)\n\t\tif input % counter == 0\n\t\t\treturn false\n\t\tend\n\t\t\n\t\tcounter += 1\n\tend\n\n\treturn true\nend", "title": "" ...
649dd214333f033b516a2255f459985d
PATCH/PUT /products/1 PATCH/PUT /products/1.json
[ { "docid": "548ef22ec86b5397cf18ad15d6e97cf4", "score": "0.0", "text": "def update\n if check_user_permission(@product.project)\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: \"Product was successfully updated.\" }\n ...
[ { "docid": "fa2eeaa45445dd76141374dc13ffab6d", "score": "0.7269931", "text": "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "title": "" }, { ...
2dcf19aed84121c680533dc333a4e976
POST /cinemas_movies POST /cinemas_movies.json
[ { "docid": "0c41b90a1df9c1fdef161132866a06b9", "score": "0.7459792", "text": "def create\n @cinemas_movie = CinemasMovie.new(params[:cinemas_movie])\n\n respond_to do |format|\n if @cinemas_movie.save\n format.html { redirect_to @cinemas_movie, :notice => 'Cinemas Movie was successfull...
[ { "docid": "7eac079e007824e967c65e53adc699d8", "score": "0.7126701", "text": "def create\n @cinema_movie = CinemaMovie.new(cinema_movie_params)\n\n respond_to do |format|\n if @cinema_movie.save\n format.html { redirect_to @cinema_movie, notice: 'Cinema movie was successfully created.'...
5564beac419f4338f3afcefffdbeb611
Replace Legacy Sub Category
[ { "docid": "374003affe61b26c79c696e465f0b81a", "score": "0.0", "text": "def procurement_categories_id_subcategories_subcategory_id_put_with_http_info(id, subcategory_id, sub_category, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LegacySubCateg...
[ { "docid": "2699ad4599666e0a6837a626700b8453", "score": "0.614792", "text": "def remove_unused_categories\n old_categories = categories\n\n initialize_core_attributes to_a\n self.categories = old_categories & categories\n self.base_category = @cat_hash.keys.first unless\n cate...
4f9285cafb5045238e0d1a4a6a20fac5
set the lock on the index
[ { "docid": "c9a8a2e62483797dab783337fd089feb", "score": "0.5926407", "text": "def set_lock\n if File.exists? lock_file_name\n false\n else\n FileUtils.touch lock_file_name\n true\n end\n end", "title": "" } ]
[ { "docid": "3be9c80c270b9a8c600fe94c0c7bd863", "score": "0.75323033", "text": "def lock\n request_body = {\"index\" => {\"blocks\" => {\"write\" => true}}}.to_json\n @client.put(\"_settings\", request_body, content_type: :json)\n end", "title": "" }, { "docid": "cb7ac3c170b3d37a...
b80d9dfd527ae42673f46636c405f8b4
StringIOfsync strio.fsync > 0 Returns 0. Just for compatibility to IO.
[ { "docid": "b2ff3a7bddee0c3ff753bf2b47d76f79", "score": "0.5779527", "text": "def fsync\n end", "title": "" } ]
[ { "docid": "37ecf627dd5edbea1f5a41b614e93ed1", "score": "0.66455406", "text": "def fsync(f)\n File.open(f, &:fsync)\nend", "title": "" }, { "docid": "cf78fe57450f88d3e4b298cc377dcbc0", "score": "0.6323907", "text": "def sync\n @data_file.fsync\n end", "title": "" }, { ...
ba52b2891c8deafd353e01c1a69fd111
Return data of current record as Hash. The hash key is field name. === Argument with_table :: if true, hash key is "table_name.field_name". === Return [Array of Hash] record data
[ { "docid": "b29b73eacb3f307ffe65bc987fa1c6a0", "score": "0.73002654", "text": "def fetch_hash(with_table=nil)\n row = fetch\n return nil unless row\n if with_table and @fieldname_with_table.nil?\n @fieldname_with_table = @fields.map{|f| [f.table, f.name].join(\".\")}\n end\n ...
[ { "docid": "7fdcb8f1f2acceab9fbf9666fadd3a4f", "score": "0.60022897", "text": "def db_fields_for_table(table_name)\n db_fields = {}\n result = @db.schema(table_name).each do |col|\n db_fields[col[0].to_sym] = col[1]\n end\n\n db_fields\n end", "title": "" ...
912c0e0cf8816366872f1b29941d2de1
DELETE /events/1 DELETE /events/1.json
[ { "docid": "719d95795d2387010ba4e115b9bb1feb", "score": "0.0", "text": "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'El evento se ha eliminado.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "ca8002b7f734bce1f1a27f7ec6e59e9d", "score": "0.80864286", "text": "def destroy # DELETE /api/events/:id\n @event.destroy\n render :json => \"Event deleted\", :status => 201\n end", "title": "" }, { "docid": "3281a9c9361cdbd7e683034a763917de", "score": "0.7834...
8b70ddc25de3dd6f7394b6a4ff7205bf
Return the sequence of letters on the reflector.
[ { "docid": "a1662cb328428921a86e65cd6c2ffd50", "score": "0.76369154", "text": "def letters\n @letters.join(\"\")\n end", "title": "" } ]
[ { "docid": "6904287be86270335fd041bc33b815a0", "score": "0.72158295", "text": "def letters\n # the_letters = []\n letter_regex = /[a-z]/i\n # for i in 0..self.length - 1\n # character = self[i]\n # if (character.match(letter_regex))\n # the_letters << character\n # end\n ...
7a57a31ed35d2bba61ba4e70dba3e030
Item List Deletion id : id of item bag
[ { "docid": "6ba7f00753d7e0b26acd2f918c03ef78", "score": "0.69033086", "text": "def delete(id)\n for j in 0..2999\n @itembags[id][j] = 0\n end\n @itembags[id][0] = -1\n end", "title": "" } ]
[ { "docid": "e12aa69bc18135117a0968d7cef5e79b", "score": "0.79497117", "text": "def delete\n Item.delete([@id])\n end", "title": "" }, { "docid": "509491d76fe329854a0afc8d363ed16f", "score": "0.7531349", "text": "def delete(id)\n items.delete(id.to_s)\n end", "titl...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "5fe6dda327eb3676b655de6bb0a5b20a", "score": "0.0", "text": "def set_question_set\n @question_set = QuestionSet.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;...
390e10bcbba4e668ca8020f9094038e0
GET /couches/1 GET /couches/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "80503600e18dfa0cd53951fd68a61813", "score": "0.7672022", "text": "def index\n @couches = Couche.all\n end", "title": "" }, { "docid": "5155bc5ad055fd0ae3f3235858b7a2ed", "score": "0.71981436", "text": "def index\n @couches = Couch.all\n end", "title": "" }, ...
d7c6e9fe51bed11bd3095f70d8edaa01
get_page_url Check the web page title is as expected
[ { "docid": "6fa37cb267633ca2535fcb17a202bcad", "score": "0.0", "text": "def validate_page_title\n if @driver.title != @expectedResult then\n failedTest #fw3_global_methods\n fail_message = \"[FAIL] Title was #{@driver.title}, but we expected #{@expectedResult}\"\n ...
[ { "docid": "443134517fa8193bd00d84f9820ed50b", "score": "0.7434391", "text": "def get_set_url_title\n self.original_url.strip!\n begin\n # tries to fetch the relevant information from the page; for now only title is being stored.\n # TODO: may include the category of the page\n self...
43d6eb0b23979779f08c84426cc475d1
Change settings of the profile.
[ { "docid": "468bcde1448e3004d7928c3e6c82753a", "score": "0.0", "text": "def users_id_user_profiles_me_put(id_user, opts = {})\n data, _status_code, _headers = users_id_user_profiles_me_put_with_http_info(id_user, opts)\n data\n end", "title": "" } ]
[ { "docid": "75f20e78d0fc4e123ee97c4d75e42cf8", "score": "0.72895604", "text": "def set_profile\n @profile = current_client.profile\n end", "title": "" }, { "docid": "ad23e53d402025d7ff0e6ea7350f19ba", "score": "0.72411126", "text": "def set_profile\n @profile = current_u...
3bfea1bfd6bb286e341b8b8722e4d7b4
Monochromatic representation of image
[ { "docid": "ae5e639bf7fe5ae616b029cd54f492e1", "score": "0.6106396", "text": "def mono(img)\n MiniMagick::Tool::Convert.new do |m|\n m << img.path\n m.colorspace('Gray')\n m.depth(Inkblot.color_depth)\n m << ('bmp3:' << img.path)\n end\n end", "...
[ { "docid": "9e28a3e449b477170c54f19a5831cbbd", "score": "0.6288812", "text": "def imshow; end", "title": "" }, { "docid": "09a00c02db2b5fb0f42d55a92bf63a87", "score": "0.6092148", "text": "def matrix_image(m, width)\n puts(\"matrix image #{width}\")\n s = m.to_a.each_slice(widt...
8b604e492413231af3a97e8a0a19f97b
DYNAMICALLY CREATES RACES FOR WEBSITE VIEWER ACCOUNT BASED ON IF ANY RACES ARE RETURN WITHIN THE LAST TWO MONTHS
[ { "docid": "2d745863b86e2f3d5765544941d19684", "score": "0.64138377", "text": "def dynamically_create_website_viewer_races\n\t\t@runs = self.runs\n\t\t@races = @runs.return_races\n\t\t@recent_races = @races.of_month + @races.of_month(Date.current-1.month)\n\n\t\t# See if any races have occured in the pa...
[ { "docid": "a1ab6aed68601f673938af5e3e14afff", "score": "0.60612655", "text": "def second_premium_collection_month\n return unless initial_draw_date\n initial_draw_date.advance(months: 3).strftime('%m/%Y')\n end", "title": "" }, { "docid": "cf5556f60259a983f1e699ac4f1b288e", "scor...
ff7df345a61314363d95066eb99a3e6d
just show the environment variables
[ { "docid": "894cea4933bc51f5f2f8f16f7fc02e33", "score": "0.5881944", "text": "def read_environment\n\n end", "title": "" } ]
[ { "docid": "144f56b1a50a9a8d1810de8fb2624fd1", "score": "0.7987698", "text": "def show_env_values\n show_entries(env_values, ENV_FEATURED)\n end", "title": "" }, { "docid": "0ec0bc3f503b04f3235edf9cf6a26934", "score": "0.79222393", "text": "def show\n\trequire 'console/logger'\n\...
919eb4f46792c352d3baddd1b8b3b1c8
Active Storage method for model
[ { "docid": "7c99059f160a24324c9e40a581c22a2a", "score": "0.0", "text": "def get_content_type\n ma = self\n file = ma.files.first\n get_structured_content_type(file)\n # file_content_type = file.content_type\n # mime_type_array = file_content_type.split(\"/\")\n ...
[ { "docid": "640a5d02748d5285b2203b566fc46264", "score": "0.7001478", "text": "def blob\n active_storage_blob\n end", "title": "" }, { "docid": "da7f456fc8fdcae1837c8f4c308f4d64", "score": "0.6890979", "text": "def storage\n @storage\n end", "title": "" }, { ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "1c4c13497c9a596a806a80cbc67451e1", "score": "0.0", "text": "def emails_mail_group_params\n params.require(:emails_mail_group).permit(:email_id, :mail_group_id, :status, :company_id, :user_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...
8ad41338a6466cf04614eab8f295c3be
remarks : [Hash] A collection of Profile descriptions associated with the Agent
[ { "docid": "89102a772aec33e0154eb0c6adff2de1", "score": "0.0", "text": "def remarks\n self.dig_for_array(\"remarks\")\n end", "title": "" } ]
[ { "docid": "8a267ad510969155c874bf0ff418d285", "score": "0.7254169", "text": "def descriptions\n\t\t@profile[:descriptions]\n\tend", "title": "" }, { "docid": "8860c0c2bdaf0e433e884f40c8cd0ac4", "score": "0.68722963", "text": "def profiles; end", "title": "" }, { "docid":...
400d175100c38bc5f46e0ca2d9e04bee
GET /personal_finances/1 GET /personal_finances/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "69f90e8c4ce76081e2b2ba150a643f2d", "score": "0.71865404", "text": "def index\n @personal_finances = PersonalFinance.all\n end", "title": "" }, { "docid": "bb1b6b5f644c2c06fe6767a7c63212fa", "score": "0.6138856", "text": "def get_financials\n render json: [current_u...
0c473bf798b0d26493b7fb891bbd5bd0
delegate to recording spec
[ { "docid": "5a0cc0be97436ccf50c13e9029668aac", "score": "0.0", "text": "def record_to_current_resource_dir?\n @record_to_current_resource_dir\n end", "title": "" } ]
[ { "docid": "5360f31114df84669811272081aca68b", "score": "0.73217744", "text": "def recorder; end", "title": "" }, { "docid": "39548f794539a410804192457daa8e61", "score": "0.7280026", "text": "def begin_recording; end", "title": "" }, { "docid": "71e097f657c9c15ecc2e68fe1e...
eb43a8906ca2109081a2de8a62494f6b
POST /dashboards POST /dashboards.json
[ { "docid": "09b70858a107a11ee56212de717782ee", "score": "0.7243963", "text": "def create\n @dashboard = Dashboard.new(dashboard_params)\n\n respond_to do |format|\n if @dashboard.save\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully created.' }\n forma...
[ { "docid": "d2046698d9ce20821af731908a6606f7", "score": "0.726553", "text": "def create\n @dashboard = Dashboard.new(params[:dashboard])\n\n respond_to do |format|\n if @dashboard.save\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully created.' }\n form...
51e9c3e64f70cad79c7e1a2f5e408c78
Converts a binary file to YAML for use in test fixtures.
[ { "docid": "27c7efaffed799c06d2a3062d8c27144", "score": "0.80498636", "text": "def binary_to_yaml(filename)\n data = File.open(filename,'rb').read\n \"!binary | #{[data].pack('m').gsub(/\\n/, \"\\n \")}\\n\"\n end", "title": "" } ]
[ { "docid": "bdb88e259ec9ac41a893697643ff7598", "score": "0.6945932", "text": "def load\n marshal_load(YAML.load_file(file) || {})\n end", "title": "" }, { "docid": "831bba093b913df339927e706f48a71d", "score": "0.68559206", "text": "def from_yaml(filename); end", "title": "" ...
dcf08f2ff03526b3c408316489f93f70
Read a &39;os.Catalog&39; resource.
[ { "docid": "1db7c330dc4e897b6143ffb0adad02cc", "score": "0.0", "text": "def get_os_catalog_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OsApi.get_os_catalog_list ...'\n end\n allowable_values = [\"allpages\", \"non...
[ { "docid": "661674966559a7a0a3f6e30b513b54a6", "score": "0.69471043", "text": "def read_catalog_from_file(context)\n file_path = catalog_dump_file_path(context)\n return unless File.exists? file_path\n debug \"Read catalog from: '#{file_path}'\"\n File.read file_path\n end", "...
7df602bb62797e339be5f3a307fe01f8
The RR's domain specific part (the DFI, AA, Rsvd, RD, Area, ID, and SEL fields).
[ { "docid": "7a7e6bb6af7a71743e0b40bb50fdb913", "score": "0.54970473", "text": "def dsp\n ret = [@dfi,@aa,rsvd,@rd,@area,@id,@sel].join('')\n return ret\n end", "title": "" } ]
[ { "docid": "551df4993dd81bcc2c638abe74459777", "score": "0.566304", "text": "def domain=(_arg0); end", "title": "" }, { "docid": "551df4993dd81bcc2c638abe74459777", "score": "0.5661648", "text": "def domain=(_arg0); end", "title": "" }, { "docid": "84da284b276d5ad2809cfd5...
3d8d59c3f14e5594b82cedd23c76d29a
CLOB value should be compared using DBMS_LOB.SUBSTR function NOTE: just first 32767 bytes will be compared!
[ { "docid": "6f8abfe6a00e8206bc8efe01440a219b", "score": "0.0", "text": "def inequality_operator(property, operand)\n if property.type == Types::Text\n operand.nil? ? 'IS NOT' : 'DBMS_LOB.SUBSTR(%s) <> ?'\n else\n operand.nil? ? 'IS NOT' : '<>'\n end\n ...
[ { "docid": "37853f8dfecb120e67a41ecbd8c3c59f", "score": "0.58146554", "text": "def uses_clob_for_text?\n false\n end", "title": "" }, { "docid": "89f3d242ae91c2508be20009569c4620", "score": "0.55207044", "text": "def convert_varchar2_to_clob(table_name, column_name, temp_colu...
976f65f0da10470c5cbdaed089652584
8 hours difference between CST and UTC.
[ { "docid": "f50068ee491a92b8bf9ade45a61232b9", "score": "0.0", "text": "def timestamp_to_time num\n Time.at(num / 1000.0 + AssumedTimezoneAdjust, num % 1000).utc\n end", "title": "" } ]
[ { "docid": "ed8bd86baea69abe8f184fee52f42af9", "score": "0.64583", "text": "def utc_convert\n\t\thour = @hours + UTC_HOUR_OFFSET[@selected_timezone]\n\t\tif hour.to_s[0] == \"-\"\n\t\t\thour + 24\n\t\telse\n\t\t\thour\n\t\tend\n\tend", "title": "" }, { "docid": "dd1598a3da6c0645c317302c476c7...
1d85f1af5f840a4b1e111777e23c6fc6
add functionality for checking for ".bot" within the player name as a flag to make a bot to play against
[ { "docid": "e0e57a4bb8d8055b73c7cd0735a3dcd0", "score": "0.0", "text": "def create_players(num)\n name_array = Array.new\n player_array = Array.new\n count = 1\n while count <= num\n valid_name = false \n while valid_name == false\n print \"What is player number #{co...
[ { "docid": "4383ac908c927a77858d11ee7e59d3da", "score": "0.6635775", "text": "def is_bot?\n !!self.bot_name\n end", "title": "" }, { "docid": "7931efefe1ef813c3f3286b3ad9cf1d0", "score": "0.62944585", "text": "def add_ai_player\n @bots << setup_player(:bot => true)\n end"...
1a6ea46c1f58480f9b6daefebcaeeb99
Default attributes that every instance of this resource should be initialized with. Optionally, override this method in a subclass.
[ { "docid": "41d33e0b466c6c204777ab8edc4fc09c", "score": "0.7153325", "text": "def default_attributes; end", "title": "" } ]
[ { "docid": "321ec8f70b6b61ef3af0b268b0e74e37", "score": "0.7504616", "text": "def initialize(*args, &block)\n args[0] = DEFAULT_ATTRIBUTES.merge(args[0].try(:to_h) || {})\n super(*args, &block)\n end", "title": "" }, { "docid": "e05b04aac515b0b5da6a487d0cafe1d1", "score": "0...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "11eb6765d2bb784ad296100636f9f9a6", "score": "0.0", "text": "def invoice_params\n params.require(:invoice).permit(:period, :days, :suppliernumber, :suppliername, :suppliersite, :invoicenumber, :invoiceorcreditmemoamount, :invoicedate, :salestax, :string, :freightchkremit, :msgcreditmemor...
[ { "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...
c7192127ce9f0b5eade5adced4050824
delete all torrents which where completely downloaded
[ { "docid": "6a512619a60844232bd0a12c32638cb9", "score": "0.7443191", "text": "def remove_finished_torrents\n list.each do |torrent|\n remove(torrent['id']) if torrent['percentDone'] >= 1\n end\n end", "title": "" } ]
[ { "docid": "b8ed2e08b6692c8b432d30a113b3d295", "score": "0.7402282", "text": "def prune\n Dir.glob(File.join(torrents_local_path, \"*.torrent\")).each do |file|\n File.delete(file) if (File.atime(File.expand_path(file)) < (Time.now - (60 * 60 * 24 * 31)))\n end\n end", "title": "" ...
b534cf31bce3253139361b17a2c880ed
Sign in a user bypassing the warden callbacks and stores the user straight in session. This option is useful in cases the user is already signed in, but we want to refresh the credentials in session. Examples:
[ { "docid": "7732fd24b94220e975c99e6c37e4f36e", "score": "0.0", "text": "def bypass_sign_in(resource, scope: nil)\n scope ||= Devise::Mapping.find_scope!(resource)\n expire_data_after_sign_in!\n warden.session_serializer.store(resource, scope)\n end", "title": "" } ]
[ { "docid": "078efee338682c55b1ea85dc102b1f8b", "score": "0.7636918", "text": "def sign_in(user)\n reset_session\n user.did_sign_in!(ip_address: request.remote_ip)\n session[:user_id] = user.id\n Current.user = user\n refresh_user_session_validity_expiration\n end", "title": "" }, ...
9656b77e97135953f38b1a356a6ac795
Build a new transformation component instance.
[ { "docid": "d0ed3bb0c6a3090a14b1c124d9e28285", "score": "0.74041253", "text": "def build_component\n TransformationComponent.new((params[:transformation_component] || {}).merge(:reagent => Reagent.new(:item_lookup_id => item_id)))\n end", "title": "" } ]
[ { "docid": "c432e1435647f0c510f072c8ae0af7ec", "score": "0.6609211", "text": "def new\n respond_with(transformation_component)\n end", "title": "" }, { "docid": "543c0cc1c4d87e900bac65ae774b2511", "score": "0.6397227", "text": "def create\n transformation_component.valid?\n ...
6a848d534522cf337abfb67219637896
GET /ambits/1 GET /ambits/1.xml
[ { "docid": "3575a6d2ad7f41a5ba22c6ed6e0330f1", "score": "0.6251927", "text": "def show\n @ambit = Ambit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ambit }\n end\n end", "title": "" } ]
[ { "docid": "70a16acac8493d719940143a77276110", "score": "0.60478216", "text": "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r...
d5f898b161c69342925f5c2c14e91b6c
Public: Calculates a year deposits for an asset. asset the asset name year the year to check Returns a double.
[ { "docid": "6a454d169c2bd826bcc7d72560ceefde", "score": "0.6569476", "text": "def asset_year_input(asset, year)\n (1..12).inject(0) do |sum, month|\n sum + (asset_month_input(asset, year, month) || 0)\n end\n end", "title": "" } ]
[ { "docid": "a09213321992e16f16f728621e5bd6c2", "score": "0.67117095", "text": "def year(input) = new_year(input).year - 1791", "title": "" }, { "docid": "c05a9710719ab337ca1bdf31baceee59", "score": "0.6511727", "text": "def asset_year_balance(asset, year)\n date = Date.new(year,...
0195bcc223654fe1801ddb893aac83ca
Override this method to implement custom caching mechanisms for
[ { "docid": "7abc5943fa85edf16ba3bbde70d48a23", "score": "0.7493562", "text": "def cache(data); end", "title": "" } ]
[ { "docid": "157d4a88a386243ea01f87cf394d4588", "score": "0.8000258", "text": "def cache; end", "title": "" }, { "docid": "157d4a88a386243ea01f87cf394d4588", "score": "0.8000258", "text": "def cache; end", "title": "" }, { "docid": "157d4a88a386243ea01f87cf394d4588", "...
2cc75047c984a674ab1b71a7ac23bab2
Specifies that the current project uses the entry The entry can be one of the three things: It can be another JavaProject, in which case it will be added as a classpath element. In this case, the project output and its classpath will be part of the current project classpath. It can also be a CottaDirectory or CottaFile...
[ { "docid": "61fb8bf60931e03e6f12b52fb16095c8", "score": "0.0", "text": "def uses(*entries)\n add_entry(@prod, entries)\n end", "title": "" } ]
[ { "docid": "8474b88bae5c3719b11da8ccc48390c8", "score": "0.56350577", "text": "def entry(path)\n return nil unless self.exist?(path)\n #noinspection RubyYardReturnMatch\n (self.class.name + '::' + (self.is_file?(path) ? 'File' : 'Dir')).\n constantize.new(path: en...
30a4d249caa99484af7e38ac17fa0de2
Converts the columns to a string.
[ { "docid": "fce38591656fafa81c02bcc045c6ca02", "score": "0.7573257", "text": "def columns_to_s # :nodoc:\n nameline = ' ' * indent\n barline = nameline.dup\n last_col = nil\n last_idx = nil\n columns.each_with_index { |col,idx|\n if (last_col)\n # This produces clean to_s out...
[ { "docid": "61b3bfdc945977b111d414b66d237493", "score": "0.80933285", "text": "def to_s\n columns.each{|c| \"#{c}: #{self.send(c)}\\n\"}\n end", "title": "" }, { "docid": "6bea3301765360393ee01a194e1cdccb", "score": "0.76913834", "text": "def to_s_columns(columns = T.unsafe(n...
f550539a6f056370f731cbe7a5cbfcee
Algorithm taken from RCF261613.2.3
[ { "docid": "577c99938ae4fbdc6060a4755d1b7607", "score": "0.0", "text": "def current_age\n age_value = header.age.to_i\n date_value = Time.httpdate(header.date)\n now = Time.now\n\n apparent_age = [0, response_time - date_value].max\n corrected_received_age = [apparent...
[ { "docid": "a6297b156d8e6a8eb671461d66a761f5", "score": "0.6245594", "text": "def algo4(a, e)\n b = 10\n kt = 4 # Of k <= 4, return to basecase. kt MUST be >= 3\n\n # See above\n def convert_trunc(y0, k, n)\n b = 10\n\n # Choose FP value alpha <= log_2(b)\n alpha = Math.log(b)/Math.log(2)\n...
cb0b08a394f56c7591d3b9c87706bd2a
Memoize the named method
[ { "docid": "b0a23ec210716c6b54f77a0e85aa7ada", "score": "0.7608073", "text": "def memoize_method(method_name, freezer)\n memoized_methods[method_name] = Memoizable::MethodBuilder\n .new(self, method_name, freezer).call\n end", "title": "" } ]
[ { "docid": "dd1b075ebec11fdea15304cf307c4085", "score": "0.80005455", "text": "def create_memoized_method\n descendant_exec(@method_name, @original_method) do |name, method|\n define_method(name) do ||\n memoized_method_cache.fetch(name, &method.bind(self))\n end\n end\n...
d403bf5bd7425de82051cb6ffbfb3daa
POST /recurrent_transactions POST /recurrent_transactions.json
[ { "docid": "025ab628fd0d9eea20b4f92a7e706d9c", "score": "0.7139802", "text": "def create\n @recurrent_transaction = RecurrentTransaction.new(recurrent_transaction_params)\n\n respond_to do |format|\n if @recurrent_transaction.save\n format.html { redirect_to @recurrent_transaction, not...
[ { "docid": "ef85acc7c583cff2d216f2bf8080ab6c", "score": "0.6614729", "text": "def index\n @recurrent_transactions = RecurrentTransaction.all\n end", "title": "" }, { "docid": "f1f6cd912db5d87b5feea6c93682d059", "score": "0.6484488", "text": "def push_transactions\n AirdropMint...
d5bbed396278f2034fc93525e18b12fa
warning: must return buildings.id unmapped. do not change that line!
[ { "docid": "9451a0c687d189a094d8292a0c5519d4", "score": "0.5403241", "text": "def buildings_search(query_params = nil)\n\t\t\t\tbuildings = Building.unarchived\n .joins(:company)\n .joins('left join neighborhoods on neighborhoods.id = buildings.neighborhood_id')\n .joins('left...
[ { "docid": "966e801566313dff5d4169e5ced83cd0", "score": "0.72021246", "text": "def building_ids\n @_building_ids ||= Building.where('ROUND(lat::numeric, 2) = ? AND ROUND(lon::numeric, 2) = ?', lat.round(2), lon.round(2)).pluck(:id)\n end", "title": "" }, { "docid": "6fa0c105da9d164a32706...
348866ce701db974d7b0918b82e9110f
Domain http url considering protocol e.g.
[ { "docid": "75b22d7bad6a1ad41ed55b28ea09ac10", "score": "0.82621366", "text": "def domain_with_protocol\n \"#{protocol}://#{domain}\"\n end", "title": "" } ]
[ { "docid": "c5154534fedc9301ad2cc7581626c202", "score": "0.7871872", "text": "def parse_domain\n url = self\n uri = URI.parse(url)\n uri = URI.parse(\"http://#{url}\") if uri.scheme.nil?\n host = (uri.host || self).downcase\n h = host.start_with?('www.') ? host[4..-1] : host\n \"#{h}#{...
0b4f3723f484dd0da7b34d6bd2276d77
GET /branches/new GET /branches/new.xml
[ { "docid": "2acc4bc0778d7d8e0fe6c8a01104c534", "score": "0.6161459", "text": "def new\n @branch = Branch.new\n @branch.client = Client.find(params[:client_id]) if params[:client_id]\n respond_with @branch\n end", "title": "" } ]
[ { "docid": "eab0d0a9c5d64ca11ddf79906d8d4825", "score": "0.76978487", "text": "def new\n @branch = Branch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @branch }\n end\n end", "title": "" }, { "docid": "570cf099b6dfc05316cd3685...
ed59882223e8108029849942e33dab38
returns the number of the first nonempty column
[ { "docid": "fb3e8a8f2a8a43ea0e13834567429a9f", "score": "0.63873875", "text": "def first_column\n @first_column ||= first_last_row_col[:first_column]\n end", "title": "" } ]
[ { "docid": "11af10133ca6eb96d65eda1e526dfd78", "score": "0.8321845", "text": "def column_size\n first_row = @rows[0]\n if first_row._equal?(nil)\n return 0\n end\n first_row.size\n end", "title": "" }, { "docid": "1d2d0bfcc68bfeebfc1eafe094494e96", "score": "0.75714666"...
54f96f8ad239440289489337691516da
DELETE /parents/1 DELETE /parents/1.json
[ { "docid": "4f05ddce57abe4adab718aef87ff3c2a", "score": "0.0", "text": "def destroy\n Subject.find(params[:id]).destroy\n redirect_to :action => 'index'\n end", "title": "" } ]
[ { "docid": "8ee5fb0fdaf84ddaf93aea40444b4099", "score": "0.77789885", "text": "def destroy\n @parent = Parent.find(params[:id])\n @parent.destroy\n\n respond_to do |format|\n format.html { redirect_to parents_url }\n format.json { head :no_content }\n end\n end", "title": "" ...
18057a8edc6b69ada146efc039662587
puts proc_ret puts lambda_ret Procs cannot have return in them, causes jumperror Lambdas are methods so its allowed
[ { "docid": "d24abdefcc527bcd583f79c77541b560", "score": "0.0", "text": "def generic_return(code)\n\tone, two = 1, 2\n\tputs code.call(one,two).class\n\tthree, four = code.call(one, two)\n\treturn \"Give me a #{three} and a #{four}\"\nend", "title": "" } ]
[ { "docid": "f29dfd290c21933cbee3d77099ba4ff2", "score": "0.7570337", "text": "def return_test\n l = lambda { return }\n l.call\n puts \"Still here!!\"\n p = Proc.new { return }\n p.call\n puts \"You won't see this message!\"\nend", "title": "" }, { "docid": "c5f86ef8ad7b855762c9768fa04...
27ab960eaf698f835d09cfad17c30772
The original in Devise is here:
[ { "docid": "7787e847031edebf27d2af198896b4f3", "score": "0.0", "text": "def assert_files(scope = nil)\n scope = \"devise\" if scope.nil?\n\n assert_file \"app/views/#{scope}/confirmations/new.html.erb\" do |content|\n assert_match(/Resend confirmation instructions/, content)\n assert_mat...
[ { "docid": "3e2c0bf20a756c573c9def8dd68002a3", "score": "0.7055563", "text": "def new\n super # no customization, simply call the devise standard implementation\n end", "title": "" }, { "docid": "cb28a7438f821f9783c8558ac44ac284", "score": "0.67456216", "text": "def devise_mappin...
12e1e71259b40efc5f05ed3b0a979651
Defines the 'level' function
[ { "docid": "03ce4079a0f0cdbd2adf3cec22396423", "score": "0.80731255", "text": "def level\n # function containts the '@level' variable\n @level\n end", "title": "" } ]
[ { "docid": "abe40c086ea6f5338c35a5895d63e45d", "score": "0.86145645", "text": "def level(*) end", "title": "" }, { "docid": "6f6adc144b2a2c2e90ff8f7f979d1e5f", "score": "0.8581777", "text": "def level() end", "title": "" }, { "docid": "130c4c2f21a4275f832e10de32737c14", ...
7a8286cb274b43f9626cf95569386209
Pry is included in case you'd like to run this file and test it, but you may remove it if you like.
[ { "docid": "46f5cff8a4800aa85f858a87e7dc7604", "score": "0.0", "text": "def fibonacci(n)\n # your code here :)\nend", "title": "" } ]
[ { "docid": "e9a0884d4c441c08e97d57633aa5031d", "score": "0.68810576", "text": "def pry\n # rubocop:disable Lint/Debugger\n binding.pry\n # rubocop:enable Lint/Debugger\n end", "title": "" }, { "docid": "187c5c3cc14790b076b20ce2e30422a3", "score": "0.65923727", "text": "def ...
58564ddcf4aeb2825a2646b2922f4f4f
GET /scenarios/new GET /scenarios/new.json
[ { "docid": "8739ce908ab485170791daef0ad40e3d", "score": "0.8121672", "text": "def new\n @scenario = Scenario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scenario }\n end\n end", "title": "" } ]
[ { "docid": "4e94851dac41f2278c3339931c235ef7", "score": "0.8031857", "text": "def new\n @scenario = Scenario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scenario }\n end\n end", "title": "" }, { "docid": "1c6c1852ecaf93d79602...
f66ffcd2483c49814c15a60dcb941b0c
Return the number of customers in the line for a specified priority.
[ { "docid": "6ec158efaa4084769c45844532098c09", "score": "0.7599271", "text": "def customer_count( priority )\r\n\t@hash[priority].size\t\r\n end", "title": "" } ]
[ { "docid": "2310d0fc6bba12f53c3f181ec4ab2e6b", "score": "0.6182834", "text": "def serve_customer( priority )\r\n\t@hash[priority].shift\r\n end", "title": "" }, { "docid": "723dcdeb7f6e1f0c011c5727a63c84cb", "score": "0.60538435", "text": "def get_line( priority ) \r\n\t@hash[prior...
b26c6140bc6ebe8808dd7a19a94ccc1a
Create prompts and assign them to players for rounds
[ { "docid": "a390d017c1328ff301a45edbee422e9c", "score": "0.7662195", "text": "def create_rounds\n player_prompts = {}\n total_rounds = self.players.length*2\n prompts = Prompt.all.sample(total_rounds)\n\n # Randomize rounds\n round_numbers = (1..total_rounds).to_a.shuffle\n\n prompts.e...
[ { "docid": "eafe99835b8bd2aefabcd26f7b5300d8", "score": "0.6903893", "text": "def spawn_pawns(name_array, receiver_instance, current_game, single_response)\n pawn_name_array = name_array.delete(receiver_instance.name)\n selection_response = @prompt.multi_select(\"Select your competition. Who do yo...
2519bbd480278d1f4c75f420fa35db57
a bird can create a nest
[ { "docid": "9d325e689f115460802606ef0f41af53", "score": "0.55745274", "text": "def create_nest(tree)\n Nest.new(self, tree)\n end", "title": "" } ]
[ { "docid": "33de321ae2c14da585be60c84164738b", "score": "0.6079994", "text": "def breed\n if correct_parents_given? && parents_are_compatable?\n create_new_creature_from_parents\n else\n nil\n end\n end", "title": "" }, { "docid": "47926cd35c49b8eea9c81d87f56577bf", "...
9c30bfa9e2d5ac38bb45c2fd220c4caa
Check if branche missed or not
[ { "docid": "7d73ca93aed82d814ee3609681895be5", "score": "0.6638707", "text": "def missed?; end", "title": "" } ]
[ { "docid": "3273cfb2727d3711680fd18726b9896d", "score": "0.6548631", "text": "def isBankrupt\n @money < 1\n end", "title": "" }, { "docid": "8ee0992cf8d60fc0a5a966c478f4b94e", "score": "0.653647", "text": "def bust?\n hand_total > BLACKJACK_AMOUNT\n end", "title": "" },...
f72cea722539edaf4ddabc7cb94fa252
POST /check_vehicle_statuses POST /check_vehicle_statuses.json
[ { "docid": "21f2791f6ec9d39fe0adec1df5470652", "score": "0.6267533", "text": "def create\n @check_vehicle_status = CheckVehicleStatus.new(check_vehicle_status_params)\n\n respond_to do |format|\n if @check_vehicle_status.save\n format.html { redirect_to @check_vehicle_status, notice: '...
[ { "docid": "7cdc30c3deb09950a9755358a0d57cd7", "score": "0.63810086", "text": "def index\n @check_vehicle_statuses = CheckVehicleStatus.all\n end", "title": "" }, { "docid": "e1d551ac9c8af8f22dd2915cdf22b981", "score": "0.6110485", "text": "def status\n sanitized = whitelist(p...
9c9e4278ece84f00da5f74a8aa5c8d89
Uses the device to generate a new signing key
[ { "docid": "6f8c4c2c831030729af723e96e415fa6", "score": "0.6410696", "text": "def generate_new_key()\n telnet_config = {\n 'Host' => @roku_ip_address,\n 'Port' => 8080\n }\n connection = Net::Telnet.new(telnet_config)\n connection.puts(\"genkey\")\n waitfor_config ...
[ { "docid": "b34a419b29355e3d4a75701e84b6892e", "score": "0.6954072", "text": "def generate_keys\n # check if we are replacing a digital certificate already generated\n replacing_key = true unless digital_certificate.nil?\n\n # generate the new key pair\n new_key = OpenSSL::PKey::RSA.generate...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "6a907bcc2b92a041273100825c432515", "score": "0.0", "text": "def team_params\n # params.require(:team).permit(:name, pokemons_attributes: [:name])\n params.require(:team).permit(:name)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74768823", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.71700543", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist...
f8e079edc9e9c7eba8ec347c8d369a46
A helper method to make the recursion work.
[ { "docid": "bea6cc51b6f61d110d919393e8740257", "score": "0.0", "text": "def write_entries(entries, path, io)\n entries.each do |e|\n zip_file_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join('.', zip_file_path)\n if File.directory?(disk_file_path)...
[ { "docid": "de76bcc464d7faf4d87154622495557a", "score": "0.78770757", "text": "def recursive => nil", "title": "" }, { "docid": "cec8cdd07b9ddbe218324e492d764349", "score": "0.6938556", "text": "def recursive_solution\n\n end", "title": "" }, { "docid": "bfcf730d9133d167...
ebbe33d2ef57ccb9584dfc3915bc2900
Returns the JSON representation of the arguments to this operation.
[ { "docid": "9128c0efc5f85871d54ed19dc516f490", "score": "0.0", "text": "def to_json\n to_hash.to_json\n end", "title": "" } ]
[ { "docid": "72628f9ef5f09b6ba7c0e6ef432b8bf8", "score": "0.72669196", "text": "def to_json(*args)\n to_arg.to_json(*args)\n end", "title": "" }, { "docid": "5348a1f1cafc8febb52881162a513f09", "score": "0.68925", "text": "def to_json(*_args)\n JSON.dump as_json\n e...
bbac418cbfbb7e19ffdf2a64759b2649
Use old vb_xxx config variables when set
[ { "docid": "37c891a83a7b838ece2207647b91f917", "score": "0.0", "text": "def vm_gui\n $vb_gui.nil? ? $vm_gui : $vb_gui\nend", "title": "" } ]
[ { "docid": "a8818a1aa59e19bdd7bccb9d0d67999c", "score": "0.64082956", "text": "def config=(value); end", "title": "" }, { "docid": "8a3e026cfef94f52d41646d2a7ccc63a", "score": "0.62273735", "text": "def config_common(config)\n config.vm.box_check_update = false\n # NOTE No new keys...
6fbb96667fa1f7b8c5865b2ba38d4569
callseq: File.dirname( filename ) => dir_name Returns all components of the _filename_ except the last one. The filename must be formed using forward slashes ("/") regardless of the separator used on the local file system.
[ { "docid": "e2a2e5d0ba05c711090175a117a2fcb6", "score": "0.7811404", "text": "def dirname( fn )\n ::File.dirname(fn).sub(%r/\\A[^\\/]+\\/?/o, '')\n end", "title": "" } ]
[ { "docid": "1cb8e514215b8fad13a68b2ede30a13d", "score": "0.7543703", "text": "def dirname\n File.dirname(filename)\n end", "title": "" }, { "docid": "0fdee1d6790974e5bb088c7a18471b9d", "score": "0.75131613", "text": "def dirname() Path::Name.new(File.dirname(path)) end", ...
81c3b387dd2495765b884859a6c6a3ea
CHECK 2: If obj in local dir and has a reqsRW, then remote must have contented for that obj.
[ { "docid": "ddad06f324155315bda24491196a9639", "score": "0.58434284", "text": "def local_reqsRW_remote_contended\n obj_ptr_re = /\\[\\d{1},(.*)\\]/\n reqsRW_re = /reqsRW:\\<(.*)\\>/\n contended_re = /contended\\:(.?)\\,/\n count = 0\n $arr_local_store.each do |local_file|\n local_file.each do |l...
[ { "docid": "cb64b8e10c13c730624e770175e5d3b7", "score": "0.5868945", "text": "def not_contended_with_reqs\n obj_ptr_re = /\\[\\d{1},(.*)\\]/\n reqsRW_re = /reqsRW:\\<(.*)\\>/\n locRW_re = /\\locRW\\:(.?)\\,/\n contended_re = /contended\\:(.?)\\,/\n count = 0\n $arr_local_store.each do |local_file|...
dcf85be90b5722d528fdb875a59b3dc0
PATCH/PUT /fitpartners/1 PATCH/PUT /fitpartners/1.json
[ { "docid": "a2a688e91bb7204894310bd69a720472", "score": "0.6804587", "text": "def update\n respond_to do |format|\n if @fitpartner.update(fitpartner_params)\n format.html { redirect_to @fitpartner, notice: 'Fitpartner was successfully updated.' }\n format.json { render :show, statu...
[ { "docid": "3fa85f9fae689b3118f25f07e18574de", "score": "0.6231964", "text": "def update\n @partner = Partner.find(params[:id])\n\n respond_to do |format|\n if @partner.update_attributes(params[:partner])\n format.html { redirect_to @partner, notice: 'Partner was successfully updated.'...
a663573fe055462d2ee0d500f54fc474
Get the global client override.
[ { "docid": "5c9b22460370bd35c5c3b7598d3de3b8", "score": "0.80426526", "text": "def client_override\n Thread.current[CLIENT_OVERRIDE_KEY]\n end", "title": "" } ]
[ { "docid": "6dfc2734503bc5d36d464f4278b7a19c", "score": "0.73535216", "text": "def global_client\n client = if Threaded.client_override\n Clients.with_name(Threaded.client_override)\n else\n Clients.default\n end\n if Threaded.da...
4e71784d0496dffbd77b6fa0a6118d6d
Set current user method: set the user performing the sign in as the current user user The User to be used as current user in the session
[ { "docid": "e9f7bb5b69df00c759648111f75c7de8", "score": "0.0", "text": "def current_user=(user)\n @current_user = user\n end", "title": "" } ]
[ { "docid": "a02d28217dd41f2334d1067b2f8c51f3", "score": "0.8682817", "text": "def set_current_user\n \t\tif session[:user_id]\n \t\t\tCurrent.user = User.find_by(id: session[:user_id])\n \t\tend\n \tend", "title": "" }, { "docid": "4937e4dcc920f7bb152b70ea09593cc6", "score": "0.86497...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "f03f760b8b31bb652fc437388be3b0ab", "score": "0.0", "text": "def set_sk\n @sk = Sk.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.603186", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015241", "text": "def ...
1a60fc2bd9810115f724696f856f0f03
Score for this post score = (10 + 10 total_votes + 10 num_comments_on_post) / elapsed_time elapsed_time = current time maximum(most recent comment update time, most recent post update time)
[ { "docid": "fa5490c78cc613c681b3c78f91e823c2", "score": "0.86118233", "text": "def score\n last_updated = self.updated_at\n num_votes_on_post = self.votes.count\n num_comments_on_post = self.comments.count\n num_of_votes_on_comments = 0\n unless self.comments.order('updated_at DESC').empt...
[ { "docid": "8fe31a5de6630fdd8b5f5198725c6782", "score": "0.79297876", "text": "def score\n # numerator controlls rating factor\n # Comments carry 10 times weightage as likes.\n # by default, all posts get a like\n #\n # denominator controlls freshness . We try to get a number of hours ela...
6000da9d6aa70c5d49a4441123d46b7c
DELETE /fines/1 DELETE /fines/1.json
[ { "docid": "17e1edae39ba9a397290706cdba72713", "score": "0.70419544", "text": "def destroy\n @fine.destroy\n respond_to do |format|\n format.html { redirect_to fines_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "687a1aeccedcfcd3773a6d309822f2a2", "score": "0.7107571", "text": "def destroy\n @fine = Fine.find(params[:id])\n @fine.destroy\n\n respond_to do |format|\n format.html { redirect_to fines_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "f5c258429e40ce9ec484c038c0e6a292", "score": "0.0", "text": "def set_category\n @category = Category.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...
50e64a5ebb62af2c45faecf7d59d32c9
status legend 0 unconfirmed 1 confirmed 2 backlogged
[ { "docid": "64968e1ce0ed6276d2fe9bc743990368", "score": "0.0", "text": "def backlogForm\n @product = Product.find(params[:id])\n @purchase_entry = PurchaseEntry.new()\n @purchase_orders = PurchaseOrder.all\n end", "title": "" } ]
[ { "docid": "a8081385c985c40517f86d5d86fde3d2", "score": "0.70110476", "text": "def status_colours\n { 'Ready for QA' => '#c5def5',\n 'Pending review' => '#fef2c0',\n 'Ready for merge' => '#bfe5bf',\n 'Requires further action' => '#eb6420',\n 'Open' => '#eb6420',\n 'No labels!...
3f53adff97a9773a8905ea858467a551
update the group's dashboard (only valid for non user dashboards)
[ { "docid": "21c19fa705ad87581be3be0b28f59467", "score": "0.64373595", "text": "def add_to_dashboard_order\n return if user_version? || group.nil?\n\n group.add_to_dashboard_order(id)\n group.save\n end", "title": "" } ]
[ { "docid": "4967d63a0f820b9c57911003c3abd8f3", "score": "0.71136916", "text": "def update\n return render_not_found('dashboard') unless dashboard\n authorize! :update_impac_dashboards, dashboard\n\n if dashboard.update(dashboard_update_params)\n render 'show'\n else\n render_bad_re...
d4fcf6ff20101bd46d9b122befcef5d6
Iterates over the lines in the collection
[ { "docid": "ba5f88060e0d86eaf98058b0925edfb7", "score": "0.0", "text": "def each(&b)\n @fragments.each(&b)\n end", "title": "" } ]
[ { "docid": "a28ddc2edba69e14ad67bde48775b0d9", "score": "0.7526689", "text": "def each(&block)\n lines.each(&block)\n end", "title": "" }, { "docid": "572af596969ec5b7849d0a42f0c55c8f", "score": "0.74877894", "text": "def each\n current_line = 1\n update do\n ...
51a1afee8d54dd4fce4ec646d3eeea61
Set max. ==== Description wind overall wind changes in time. A time of zero means there will be an immediate change. A wind level of zero is minimal changes and a wind level of one means that wind can change rapidly ==== Syntax time setWindForce wind ==== Parameters +time+ Number +wind+ Number ==== Returns Nothing ====...
[ { "docid": "258a44b9e3a897a8a1d89f907abf5792", "score": "0.6037049", "text": "def setWindForce _obj, _args\n \"_obj setWindForce _args;\" \n end", "title": "" } ]
[ { "docid": "df742fc395fe55706392215f98b258cf", "score": "0.5224547", "text": "def max_wind_resistance; end", "title": "" }, { "docid": "92f20fe6bd7546255f51597735259b18", "score": "0.5150891", "text": "def update_timestep=(timestep)\n timestep = AMS.clamp(timestep.to_f, 1/1200...
31b13a21fb61c9b51f09f2191b57ba10
helper to find path to rvm binary
[ { "docid": "6ef9b8c1cc569694708718ee49696131", "score": "0.7329034", "text": "def path_to_bin_rvm(options={})\n result = File.join(rvm_bin_path, \"rvm\")\n result << \" #{options[:with_ruby]} do\" if options[:with_ruby]\n result\n end", "title": "" } ]
[ { "docid": "739f863b3ed1af5d792063c7a2664160", "score": "0.7655121", "text": "def path_to_binary\n @path_to_binary ||= search_in_known_locations(\"vmrun\")\n end", "title": "" }, { "docid": "3e615c9cb2c3cb19480dbc624862360a", "score": "0.76012474", "text": "def rvm_bin(daemon...
e86863c412e6b2c185a31536b79c975e
GET /user/:user_id/activities/1 GET /user/:user_id/activities/1.json
[ { "docid": "81fbb6f9be1c98dd95bbe62c3f2ce8d1", "score": "0.0", "text": "def show\n\n end", "title": "" } ]
[ { "docid": "2e439739ef27e99ebd7f7b0d54f409e0", "score": "0.7830009", "text": "def activity(user_id: '-', date: Date.today)\n return get(\"#{API_URI}/#{ACTIVITY_API_VERSION}/user/#{user_id}/activities/date/#{date}.json\")\n end", "title": "" }, { "docid": "c6d913e53d086df65ec5eed38910...
49bfe1695d6d855f93b018548b155aaa
The Add method should return the sum of the input when called with a multiple positive integer numbers up to 1000.
[ { "docid": "fa3ef4dc219b11d80ae9098cc5f1320d", "score": "0.0", "text": "def test_Add_Should_ReturnSum_When_CalledWithTwoOrMoreIntegersWithCustomSeparatorDeclaration321\n # Arrange.\n @inputValue = '//[[][]]\\n0[0'\n @expectedResult = 0\n\n # Act.\n @actualResult = self...
[ { "docid": "8922b52992b7fc4494384f8720b929f3", "score": "0.7308956", "text": "def add(number)\n \n end", "title": "" }, { "docid": "576a7399151404eb24e394217876afcc", "score": "0.7226729", "text": "def add(numbers)\n\tnumbers.inject(:+)\nend", "title": "" }, { "...
6bdd18e43206f49c5d96ce7c9da432a1
returns related interests to a picture
[ { "docid": "33de7bf6b3068f5e7257b44c53482b1c", "score": "0.7206158", "text": "def related_interests\n links = PictureInterest.where(youtube_link_id: id)\n result = {}\n links.each do |link|\n interest = Translatable.wrap_language(Interest.find(link.interest_id), language_id)\n result[...
[ { "docid": "8cd78184d4316b69193fc9d64dc1bebd", "score": "0.6833194", "text": "def get_interests\n\t\t@si = SocietyInterest.where(society_id: self.id)\n\t\t@interests = []\n\t\t@si.each do |s|\n\t\t\t@interests << Interest.find_by_id(s.interest_id)\n\t\tend\n\t\treturn @interests\n end", "title": ""...
71186f22d46fcbe364fd42b3f4b7a0f4
Updates the MiGA::Dataset +dataset+ with the remotely available metadata, and optionally the Hash +metadata+.
[ { "docid": "5dbc806b5351f3ac5c3ba0105af27e5b", "score": "0.7651567", "text": "def update_metadata(dataset, metadata = {})\n metadata = get_metadata(metadata)\n metadata.each { |k, v| dataset.metadata[k] = v }\n dataset.save\n end", "title": "" } ]
[ { "docid": "5f5e02f0caee063d61f2e305c3201657", "score": "0.647581", "text": "def update!(**args)\n @metadata = args[:metadata] if args.key?(:metadata)\n end", "title": "" }, { "docid": "0bb7608514ecec423e08eeebe600d68b", "score": "0.6430786", "text": "def update\n ...
a1686f16752e65ed2e08d9a18c3402e3
Leap Years (Part 1) In the modern era under the Gregorian Calendar, leap years occur in every year that is evenly divisible by 4, unless the year is also divisible by 100. If the year is evenly divisible by 100, then it is not a leap year unless the year is evenly divisible by 400. Assume this rule is good for any year...
[ { "docid": "515e9b10954efb7fddbe9be9c8aa009e", "score": "0.0", "text": "def leap_year?(year)\n (year % 4 == 0 && year % 100 != 0) || year % 400 == 0\nend", "title": "" } ]
[ { "docid": "e8b69b95e8de665fb91ed1f703fb79a9", "score": "0.87347054", "text": "def leap_year?\n # Note: the order of these checks is important\n return true if divisible_by?(400)\n return false if divisible_by?(100)\n return true if divisible_by?(4)\n\n false\n end", "title": "" },...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "924e3de2b72298f52de7e789b892404f", "score": "0.0", "text": "def set_exercice\n @exercice = Exercice.friendly.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...
2bf95ab6a3318efb18c0322dd65cece3
GET /matter_categories GET /matter_categories.json
[ { "docid": "4049b8916f6826e3d573f8e66e5297ad", "score": "0.78155524", "text": "def index\n @matter_categories = MatterCategory.all\n end", "title": "" } ]
[ { "docid": "04779fc6a7223751fb3e79f2b7a6f82c", "score": "0.7776737", "text": "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "title": "" }, { "docid": "35802ecc80da3ace95df8f771700702b"...
3f52973818698070d105a2c20fdb77a5
Serializes information the current object
[ { "docid": "e7a0e8a9decffd6a9772e3fc42ddc3fd", "score": "0.0", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"phoneNumber\", @phone_number)\n writer.write_enum_...
[ { "docid": "d162e297d0f84ca205afa381c3f6a428", "score": "0.7830697", "text": "def serialize\n Marshal.dump(self)\n end", "title": "" }, { "docid": "762bca0e2db3ff19d91cc4521bb1e1d9", "score": "0.7645999", "text": "def serialize(object) end", "title": "" }, { "docid": ...
3a1a021ecc93cf171b4248a004446717
DELETE /charges/1 DELETE /charges/1.json
[ { "docid": "541448c60385f83271102413f0dc1854", "score": "0.7404667", "text": "def destroy\n @charge.destroy\n respond_to do |format|\n format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "...
[ { "docid": "eb77344aea6f0d8b4f1ce69fccbb8c2e", "score": "0.7688505", "text": "def destroy\n @charge = Charge.find(params[:id])\n @charge.destroy\n\n respond_to do |format|\n format.html { redirect_to charges_url }\n format.json { head :no_content }\n end\n end", "title": "" ...
17d57b80044bf3ec837032fc7730d596
XXX break down and move to o/class
[ { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.0", "text": "def initialize; end", "title": "" } ]
[ { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6237415", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6237415", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",...
111d767be135e8583c17aa317f2fda01
Updates the given +files+ in the archive, i.e. they are added if they are not already in the archive or have been modified.
[ { "docid": "b5b877b1457d4568d05eeb5dd135ea72", "score": "0.7877338", "text": "def update_archive(*files)\n raise Error, 'there must be at least one file specified' if files.empty?\n\n cmd = \"#{@tar_program} uf #{@archive_name} #{files.join(' ')}\"\n\n Open3.popen3(cmd) do |_ain, _a...
[ { "docid": "107826e6effc1950bdb696a7ba9902ed", "score": "0.7113674", "text": "def update(requested_files = nil, options = {})\n generate_file_list(requested_files).each do |file|\n if file.diff.changed?\n import_file(file.file_path)\n puts \"Updating #{file.file_path}\"\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "c99e58ad045bcc2e83813199ecebaee8", "score": "0.0", "text": "def set_player_position\n @player_position = PlayerPosition.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...
0380a0fbe07caf5b397e7f4cd440b096
GET /julgadores/1 GET /julgadores/1.json
[ { "docid": "3e8f387eee582c8630bd13e59397be71", "score": "0.6636606", "text": "def show\n @julgadore = Julgadore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @julgadore }\n end\n end", "title": "" } ]
[ { "docid": "ee876d6106639f4f59aa9d8aecc493c1", "score": "0.7222714", "text": "def show\n @jugador = Jugador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jugador }\n end\n end", "title": "" }, { "docid": "0d1f8e90...
9c7e7f940d34d403647a1c18a90ebd18
Return an Etag, an unique hash value for this resource.
[ { "docid": "57d18ea8cf98fdcdb9fc7d532830f1ca", "score": "0.6084176", "text": "def etag\n @bson['_id'].to_s\n end", "title": "" } ]
[ { "docid": "2a13e68dccca84595a32ac2d769f4660", "score": "0.67636114", "text": "def etag\n digest = Digest::SHA256.hexdigest(\"#{file.shrine_class}-#{file.storage_key}-#{file.id}\")\n\n %(W/\"#{digest.byteslice(0, 32)}\")\n end", "title": "" }, { "docid": "3dbdcfbc63a...
6c99ff4eb749eaf99f3d5ee006e5adf2
create album, return album or error message
[ { "docid": "7a78661ef5e0a64a2c61f6bec765b886", "score": "0.7487159", "text": "def create\n\t\talbum = Album.create(album_params)\n\n\t\tif !album.errors.any?\n\t\t\trender json: album\n\t\telse\n\t\t\trender json: {message: \"Error occurred\"}\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "1fbbd7825a9219805295160ec1bbd421", "score": "0.7677351", "text": "def album!(options = {})\n response = user.photos.createAlbum(:title => options[:name], :description => options[:message])\n Album.new(response, user)\n end", "title": "" }, { "docid": "1fbbd7825...
9b58f2faa1996b7bd3f4f8fef0397541
=========================== foreign key validations: ===========================
[ { "docid": "bc1d09bb6493ddaa397e7ad38c26f0ec", "score": "0.0", "text": "def set_stack_type\n\n stack_type = StackType.find_by_stack_type_code_and_id(self.stack_type_code, self.id)\n if stack_type != nil\n self.stack_type = stack_type\n return true\n else\n# errors.add_to_base(\"c...
[ { "docid": "00bc5acc5761e368c48c592feeb24adf", "score": "0.78554386", "text": "def all_foreign_keys_valid?; end", "title": "" }, { "docid": "7330684b27116a767104ceb96457b05d", "score": "0.75119627", "text": "def validate_foreign_key(from_table, to_table = nil, **options)\n f...
3b925ca174e4e050c8347c9ce606f883
get k vector nomral to the surface kp is the kvector componenent parallel to the surfaces
[ { "docid": "ae6b231e56105f791d2ac6657d374d38", "score": "0.4702661", "text": "def kz(λ_, ε_)\n\t\t_kz=CMath.sqrt(ε_*(2*PI/λ_)**2 - kx**2)\n\t\t_kz.real<0 ? -_kz : _kz\n\tend", "title": "" } ]
[ { "docid": "9653488d3d5027e8188179645bd416ba", "score": "0.5952488", "text": "def coeff\r\n coefficient(self.k)\r\n end", "title": "" }, { "docid": "340cc23261d53b218d55246019ab4a14", "score": "0.5652799", "text": "def []( k )\n DBC.require 0 <= k && k < taille, \"*** k ...
57b61d6e2689f68f75b4f5666cee41b3
Returns new instance of current object on next page
[ { "docid": "a8fedd1aa74f0578807f54d6ba239d03", "score": "0.5857312", "text": "def next_page\n url = @entity[:next]\n return unless url\n\n query = URI.decode_www_form(URI(url).query).to_h\n query = query.to_h { |k, v| [k.to_sym, v] }\n self.class.list(**query...
[ { "docid": "1ff04e764968db4890ba10a39cd6ef0e", "score": "0.66904366", "text": "def next\n self.class.new(next_review_attrs)\n end", "title": "" }, { "docid": "1b0547f70c465deb84a5615f8dda35e7", "score": "0.6536273", "text": "def new_next\n @item = Item.new_next(current_user)\n...
f3c12438a1b48dba2bb14517a8a87d66
Retrieves all of the user actions that are currently inactive.
[ { "docid": "63d188e07fab7e2bc672af5d192bd7a5", "score": "0.86532897", "text": "def retrieve_inactive_user_actions()\n start.uri('/api/user-action')\n .url_parameter('inactive', true)\n .get()\n .go()\n end", "title": "" } ]
[ { "docid": "170928b6fc15726ce07661e969b40663", "score": "0.87031114", "text": "def retrieve_inactive_user_actions()\n start.uri('/api/user-action')\n .url_parameter('inactive', true)\n .get()\n .go()\n end", "title": "" }, { "docid": "c18573acb08068ae1d1bcb...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "2fa3708ce10e35d49436f02c45e6dc72", "score": "0.0", "text": "def txdotstreet_params\n params.require(:txdotstreet).permit(:intersection, :name, :callback, :unitassigned, :problem, :city, :state, :needed, :comment)\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...
ea3d051d0af737c15bf08b1ea4f44645
PATCH/PUT /post8s/1 PATCH/PUT /post8s/1.json
[ { "docid": "4d3def2c7afed09b09f76ce4c783c7b9", "score": "0.5966017", "text": "def update\n respond_to do |format|\n if @post8.update(post8_params)\n format.html { redirect_to @post8, notice: 'Post8 was successfully updated.' }\n format.json { render :show, status: :ok, location: @p...
[ { "docid": "b4cc3ee2207b39abaf779a6078bbaf3a", "score": "0.6141311", "text": "def patch\n PATCH\n end", "title": "" }, { "docid": "b4cc3ee2207b39abaf779a6078bbaf3a", "score": "0.6141311", "text": "def patch\n PATCH\n end", "title": "" }, { "docid": "d5eaea...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "c4752bc8d9ce0938ab4b3fa9742a347d", "score": "0.0", "text": "def set_locale\n @locale = Locale.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;...