query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "137da1e530029a309e8e03aa0102fa5f", "score": "0.0", "text": "def set_car_image\n @car_image = CarImage.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.6032574", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015663", "text": "def...
46e4d68a6a8362d9f4cbf17906b3392b
Retrieve a contentdocument from the index. Content documents are pages on GOV.UK that have a base path and are returned in searches. This excludes best bets, recommendedlinks, and contacts.
[ { "docid": "14efcdb7fd96bd5c85c21523e3b3c174", "score": "0.0", "text": "def get_content(base_path)\n request_url = \"#{base_url}/content?link=#{base_path}\"\n get_json(request_url)\n end", "title": "" } ]
[ { "docid": "90639393f42c743899268ae736a343b2", "score": "0.6538816", "text": "def documents(opts = {})\n # Query the special built-in _all_docs view\n query_docs(File.join(uri, \"_all_docs\"), opts).collect do |doc|\n # Regular documents\n if doc[\"crumb_type\"]\n # Eval...
360a0fe06e86b52521639eb752f10901
The full URL to the Snoop API. Based on the +:host+ option.
[ { "docid": "f1cdc0b0d2606c23e8a840635510804d", "score": "0.66344947", "text": "def endpoint\n @endpoint ||=\n begin\n self.host = ('https://' << host) if host !~ %r{\\Ahttps?://}\n api = \"api/v1/projects/#{project_id}\"\n URI.join(host, api)\n end\n end"...
[ { "docid": "ac4bca7773dbb024fe73b672d6fbe90e", "score": "0.77816784", "text": "def url\n \"http://#{host}\"\n end", "title": "" }, { "docid": "7a549ca8fd4fb8fd8afc39e48260984a", "score": "0.76284903", "text": "def url\n protocol + host_with_port + fullpath\n e...
500de4cdcba76fcda996f13169537553
GET /turnos/1 GET /turnos/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "3476a4eecc8e4781eccf7ee9d15cfc23", "score": "0.7358695", "text": "def index\n @turnos = Turno.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turnos }\n end\n end", "title": "" }, { "docid": "327d61360dff580b71680c9a...
6b0f4f74ea9686236e2694bcea2859be
Reset the profiling system to the original state
[ { "docid": "8a5eb5ab16e3ce993ce9ccde060352a3", "score": "0.0", "text": "def clear\n @profilers = []\n end", "title": "" } ]
[ { "docid": "50944f1cc30e943a2ef4eb9027a4ce55", "score": "0.7352868", "text": "def reset\n @enabled = proc { |_env| Rails.env.development? || Rails.env.test? }\n @flamegraph_enabled = true\n @flamegraph_sample_rate = 0.5\n @logger = RailsMiniProfiler::Logger.new(Rails.logger)\n @...
5c5e72002b854e260e212b1475a93855
Kills a thread by index
[ { "docid": "2e24e72347d6142f2e0498fa353f9d80", "score": "0.768064", "text": "def kill(idx)\n\t\tself[idx].kill rescue false\n\tend", "title": "" } ]
[ { "docid": "6dcba3c5a62a3a32a99090cad2be111c", "score": "0.68591857", "text": "def kill_thread\n # TODO: ideally this would be unshift, but Queues don't have that. Come up with an alternative.\n @queue << Directive::SUICIDE_PILL\n end", "title": "" }, { "docid": "8119b849867dbf...
75069019903de2f0686f2e7f6e869295
Get a user's tweets from a specific time range
[ { "docid": "5c796926c11a9020e12e5867898eccab", "score": "0.6384824", "text": "def during_storm_tweets(args ={})\n\t\tstart_date \t= args[:start_date] || TIMES[:event]\n\t\tend_date \t= args[:end_date] || TIMES[:two_days]\n\n\t\ttweets.select{ |tweet| tweet.date > start_date and tweet.date < end_date...
[ { "docid": "f92c20e2dbbc68b925b0441247fc69b0", "score": "0.69652545", "text": "def user_tweets(user_hash, opts = {})\n client = self.client(user_hash)\n user_name = user_hash['name']\n\n opts = @default_user_tweets_options.merge(opts)\n\n expected_count = opts['count'] || 20\n max_id = ni...
e182983ee5c685f48ac4681069871ccc
Transaction rollback to a given (previously created) savepoint. If no savepoint name given rollback to the last created one. Called from 'rollback_to_savepoint' in AbstractAdapter
[ { "docid": "91de9701c02951b2cbbfda2c26533809", "score": "0.8339665", "text": "def exec_rollback_to_savepoint(name = current_savepoint_name)\n log(\"ROLLBACK TO SAVEPOINT #{name}\", 'TRANSACTION') { @connection.rollback_savepoint(name) }\n end", "title": "" } ]
[ { "docid": "a58a18c3fa420b83f264c6d1931e6557", "score": "0.71942616", "text": "def rollback_transaction(conn, opts=OPTS)\n if in_savepoint?(conn)\n log_connection_yield('Transaction.rollback_savepoint', conn){conn.rollback(savepoint_obj(conn))}\n else\n log_connection_yie...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "258ff37f96b981976cbbaaa10e50bfca", "score": "0.0", "text": "def set_blog\n @blog = Blog.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60326946", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015941", "text": "de...
3f88b15e5f10d223937b9dc6beac85c0
Decide whether the opponent should use an item on the Jermon.
[ { "docid": "b63c5ff08648bd99bdce53c9f581431f", "score": "0.6829702", "text": "def pbEnemyShouldUseItem?(index)\n item=pbEnemyItemToUse(index)\n if item>0\n pbRegisterItem(index,item,nil)\n return true\n end\n return false\n end", "title": "" } ]
[ { "docid": "c6ff6cbb8e727632a417386ceadc3f2b", "score": "0.73313886", "text": "def item_can_use?(item)\n return false unless item.is_a?(RPG::Item)\n return false if inventory_number(item) == 0\n if $game_temp.in_battle\n return item.battle_ok?\n else\n return item.menu_ok?\n end...
8bcf1cd912d007696d2a84d6b574876e
SAVE =begin Saves the record by calling update or creating the record ORD.create_class :a a = A.new a.test = 'test' a.save a = A.first a.test = 'test' a.save =end
[ { "docid": "131fcecf374de1d427efe37da56aa2d6", "score": "0.6109059", "text": "def save\n\t\ttransfer_content from: if rid.rid?\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdb.update self, attributes, version\n\t\t\t\t\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdb.create_record self, attributes: attribut...
[ { "docid": "bc17face5cbe4a2ba1822c5f1754e03d", "score": "0.69771904", "text": "def save; record.save; end", "title": "" }, { "docid": "76aedfbab539024db9651d70af6e54be", "score": "0.6851733", "text": "def save\n # Insert OR Update object values into DB\n # DB.execute(\"INSERT I...
5c706b2a71bcff3018cc8a8fdd088f20
Removes `!!merge` tag left over from yq in the circleci/config.yml file
[ { "docid": "65751c2792c806210bf1e48e181fb419", "score": "0.7600571", "text": "def remove_unused_yq_tags root_folder\n circle_ci_search_and_replace root_folder, \"!!merge \", \"\"\nend", "title": "" } ]
[ { "docid": "6e15e152860b140511b8c0b2a886c0f8", "score": "0.5793756", "text": "def keep_old\n Utils::Inreplace.inreplace(\".circleci/config.yml\") do |s|\n s.sub! /brew test-bot$/, \"brew test-bot --keep-old\"\n s.sub! /ci-upload$/, \"ci-upload?keep-old=1\"\n end\n safe_system \"git\",...
da207c16abe5d31d45bf0bc24d2c69b7
Creates a single new employees used in Xero payrun
[ { "docid": "f919bb0a603e15a61ed6e3b64e1d3163", "score": "0.0", "text": "def update_or_create_employees_with_http_info(xero_tenant_id, employees, options = {})\n opts = options.dup\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AccountingApi.update_or_c...
[ { "docid": "f9cd1f8014d46cb4bd6016b2528fe666", "score": "0.68259495", "text": "def create_new_employee(db, first_name, last_name, ssn, gender, street_address, city, state_abbr, zip, phone_number, title, email, years, center_ref)\n db.execute(\"INSERT INTO EMPLOYEE(first_name, last_name, ssn, gender, st...
bc8e89649e44713a0cc4b4e73977cb3a
Move to the next symbol as configured
[ { "docid": "f3e92358863e8728e64c36ad876c7e67", "score": "0.7171523", "text": "def next_symbol\n ### TODO: candidate for pulling out into method on Aggregator\n ### TODO: candidate for optimization\n @current_symbol_index += 1\n\n if @current_symbol_index >= @symbols.length\n @current_sy...
[ { "docid": "3be6b00a9b78b0ded02e966b7156ef08", "score": "0.64123255", "text": "def next_move\n\t\tif @next_move.nil?\n\t\t\t@next_move = determine_next_move\n\t\tend\n\n\t\t@next_move\n\tend", "title": "" }, { "docid": "b383ed491bb6660a9f32ce09bca532fa", "score": "0.6391038", "text":...
8803833f2baedba200386a1600a2aa84
Schedule automatic updates in 24 and 48 hours.
[ { "docid": "818d95d9ab3c1f669a6e95c1264a1378", "score": "0.89318", "text": "def schedule_updates\n schedule_updates_in(24.hours, 48.hours)\n end", "title": "" } ]
[ { "docid": "94f8bd4655f1d2390d425ff539fff56c", "score": "0.87795436", "text": "def schedule_updates\n schedule_update_in(48.hours)\n end", "title": "" }, { "docid": "7489caf7d7e27dc1d1ffd79386e4f310", "score": "0.6532503", "text": "def refresh; schedule_update end", "titl...
72860565bbb8a618bbd61abbca5db592
There are a lot of ways to refactor, but that would mainly be with the way my TDD has been running the code I feel that for now, the code is as clean and as easy to understand as it can be. 1. DRIVER TESTS GO BELOW THIS LINE
[ { "docid": "d2d90384746e16579b4f456caeafd2b5", "score": "0.0", "text": "def assert\n\traise \"The Assertion Failed!\" unless yield\nend", "title": "" } ]
[ { "docid": "329fbe415d9cde1f188261f949358ffe", "score": "0.64769924", "text": "def main_test_harness\n test__dnd_backstabber_attack\n test__bag_of_lost_coins_leads_to_lottery_ticket\n test__dice_battle__naruto_vs_sasuke\n\n puts \"\\n----- Extra Testing -----\\n\\n\"\n test__bag_cloning\n...
20f9b67854a2fa08152cbd6453065da0
DELETE /line_cases/1 DELETE /line_cases/1.json
[ { "docid": "7e06f6240ab462c0963b5384599e5bb4", "score": "0.73088264", "text": "def destroy\n @line_case.destroy\n respond_to do |format|\n format.html { redirect_to line_cases_url, notice: 'Line case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "7070e4dc3849fac5852c0271c9b6d7cc", "score": "0.69665664", "text": "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/...
97cffe798cad7f97db349e364bc70d91
is card face down in deck?
[ { "docid": "b6d58bf26f89e8da620dd86e9ffabf4e", "score": "0.640884", "text": "def facedown?\n faceup_position.blank? && !(facedown_position.blank?)\n end", "title": "" } ]
[ { "docid": "afccb586ba18080c042385976d1859fc", "score": "0.76151747", "text": "def dealer_bj?\n cards[1].face = 'up'\n puts say(\"The face down card is #{cards[1].suit} #{cards[1].value}\")\n if points.include?(21)\n true\n else\n false\n end\n end", "title": "" }, { ...
840769d041d44b813b4e55856bed7e82
GET /lines/new GET /lines/new.json
[ { "docid": "4cddf732f347521182d5d8b6461f8d86", "score": "0.7333658", "text": "def new\n @line = Line.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end", "title": "" } ]
[ { "docid": "6314121ab19bc04234f04747139eaafd", "score": "0.6948097", "text": "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { }\n end\n end", "title": "" }, { "docid": "292e4d6a72500022ec7275696a3c072e", "sco...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "417ba403c529a7747606ccee6636ee74", "score": "0.0", "text": "def credit_card_debt_params\n params.require(:credit_card_debt).permit(\n :card_name, :balance, :card_number, :payee_name, \n :payee_address1, :payee_address2, :payee_city, :payee_state, :payee_zip\n )\n e...
[ { "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...
f864b303a2c075d099e39a384cbe5d3b
Returns a cache key for the given +yard_object+
[ { "docid": "37589fda89b6127a02f987233959158e", "score": "0.82592565", "text": "def cache_key(yard_object)\n yard_object.path\n end", "title": "" } ]
[ { "docid": "051b263ff22017b317d0501ae5a78641", "score": "0.73016644", "text": "def get_cache_key(key)\n \"#{object_key}:#{key}\"\n end", "title": "" }, { "docid": "f64a21bac2ff244b87847d3d4b5a28e1", "score": "0.7238121", "text": "def cache_key(object)\n instance = nil\n ...
deb49d9ceccfb303fcd945720f25a99f
GET /containments/1 GET /containments/1.json
[ { "docid": "3ee958fde8897eb73124e001f6d589ed", "score": "0.65778047", "text": "def show\n @containment = Containment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @containment }\n end\n end", "title": "" } ]
[ { "docid": "c3beb91bab207069931643f40388e729", "score": "0.74983644", "text": "def show\n @contain = Contain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contain }\n end\n end", "title": "" }, { "docid": "e449fb8...
6791b9ce5ff56d1e9b635c981bae27b7
Should return team winner (First position of scoreboard) First: return the first element of the enumerable
[ { "docid": "b3261d83849716a6d49e7344629bb721", "score": "0.7703216", "text": "def winner\n scoreboard.first\n end", "title": "" } ]
[ { "docid": "556a1a5b8fc20ba7bbc067aeda0a6751", "score": "0.76773393", "text": "def winner\n @board.sort_by {|player, board_position| board_position}.last.first\n end", "title": "" }, { "docid": "b34400214044c26ddd719319c7a1a9ef", "score": "0.7389846", "text": "def winner\n #Wi...
0c7b54a260d4585755279bf8117aca93
hipotecar hipoteca la propieddad ip del jugador actual
[ { "docid": "d97d248f183f03b5e63c29aba88a6260", "score": "0.0", "text": "def hipotecar\n get_jugador_actual.hipotecar;\n end", "title": "" } ]
[ { "docid": "b8137feb76a3fa6b8d524cbf7dca31e5", "score": "0.74636763", "text": "def ip; end", "title": "" }, { "docid": "b8137feb76a3fa6b8d524cbf7dca31e5", "score": "0.74636763", "text": "def ip; end", "title": "" }, { "docid": "a717d341fe2795fea71210fee7c9eb30", "scor...
32ae97030c9948ad56cad7981015e00f
callseq: make_absolute_uri(:script=>string, :path_info=>string, :query=>query, :fragment=>string) > URI make_absolute_uri returns a absolute URI which base URI is the URI of the web application is invoked. The argument is same as make_relative_uri.
[ { "docid": "fd34f0621104a456f0b2ca2447103093", "score": "0.709956", "text": "def make_absolute_uri(hash={})\n @urigen.make_absolute_uri(hash)\n end", "title": "" } ]
[ { "docid": "0cbaff592727b92965e4285574f2115d", "score": "0.7019164", "text": "def uri(addr = nil, absolute = true, add_script_name = true)\n return addr if addr =~ /\\A[A-z][A-z0-9\\+\\.\\-]*:/\n uri = [host = \"\"]\n if absolute\n host << 'http'\n host << 's' if request.sec...
0f706c695daaa9b05436ffaa86c3ccc7
find the action plan previous to this action plan
[ { "docid": "4f74186ddf522fcd29975afdee5edaae", "score": "0.8933134", "text": "def previous_action_plan\n index_for_me = enrollment.action_plans.index(self)\n return nil if index_for_me == 0 # first, no other action item\n enrollment.action_plans[index_for_me-1]\n end", "title": "" } ]
[ { "docid": "83e1112ea8de785f96e8b4e19f509414", "score": "0.7250572", "text": "def previous\n self.class.first(\n conditions: ['contract_id = ? AND id != ? AND effective_from <= ?', contract_id, id, effective_from],\n order: 'effective_from DESC',\n )\n end", "title": "" }, { ...
5ff179412069b9879939f5b39aebc439
POST /messages POST /messages.json
[ { "docid": "5f3a2ba939742bc027513ea12f9aad0e", "score": "0.0", "text": "def create\n @message = Message.new(message_params)\n @client = Client.find params[:message][:client_id]\n @message.phone_number = @client.main_phone.number\n respond_to do |format|\n if @message.save\n Messa...
[ { "docid": "c31738c4d3e8abb88223bb78078be929", "score": "0.76781225", "text": "def post_messages(options={})\n post(\"1/messages\", options)\n end", "title": "" }, { "docid": "f0e30f164be0ab5b3abd6b7675410795", "score": "0.7493141", "text": "def message(message)\n po...
0d1ff8879aff3816217f52d1caa3d83a
ordered from closest to farthest parent
[ { "docid": "2d8e9fdf6c657edb8dc93d10a472921c", "score": "0.0", "text": "def parent_shape_composites\n if @parent_shape_composites.nil?\n if parent.is_a?(Drawable)\n @parent_shape_composites = []\n elsif !parent.container?\n @parent_shape_composite...
[ { "docid": "8026a1225df49d6ba0728c1a6b18e3d4", "score": "0.67704797", "text": "def bubble_up()\n\t\ti = @elements.length - 1\n\t\twhile(i > 0)\n\t\t\t# compare with its parent. swap if parent is less than it\n\t\t\tif @elements[(i-1)/2][@orderBy] >= @elements[i][@orderBy]\n\t\t\t\tbreak\n\t\t\telse\n\t\...
7c7ed5a8b05f73a2c3285369e02a2279
Elementweise Differenz von zwei Vektoren
[ { "docid": "ea677a026f910896c4f9aeba31a1b63e", "score": "0.6093708", "text": "def -(rhs)\n Vektor[*zip(rhs).map {|x,y| x-y}]\n end", "title": "" } ]
[ { "docid": "6b24b19b2b1b5f3fbd6d4d57850a7ce5", "score": "0.7152149", "text": "def difference\n end", "title": "" }, { "docid": "b34b7891b297e3feef43605072834148", "score": "0.67467433", "text": "def diff(v)\n # return CAS.declare :\"d#{@name}[#{v}]\", @x\n ret = []\n ...
5501ccfd94a6a09122e06ec56710f855
GET /orders or /orders.json
[ { "docid": "d0e0ac3a2f34732f9d3e286ccf06bc40", "score": "0.0", "text": "def index\n @orders = Order.all\n end", "title": "" } ]
[ { "docid": "8fe2d6ec8a1d47ca8c318cf923eb35b7", "score": "0.8252667", "text": "def orders\n client.get \"orders\"\n end", "title": "" }, { "docid": "0018a9a547b20cd7a770a6e2cd109f33", "score": "0.8164434", "text": "def orders\n get(\"orders\")\n end", "title": "" }, { ...
54ec73940e0828206cb9fef23345dc68
Return which authentication policies to apply E.g.: OpenID::PAPE::AUTH_MULTI_FACTOR, OpenID::PAPE::AUTH_PHISHING_RESISTANT
[ { "docid": "a1ada30ae9a5c0bc57e4e9b926d88c4b", "score": "0.7495458", "text": "def auth_policies\n []\n end", "title": "" } ]
[ { "docid": "a827e8a9635dcdf585c03f77207b01fc", "score": "0.6340721", "text": "def policies_with_access\n #### TODO -- Memoize this and put it in the session?\n user_access_filters = []\n user_access_filters += apply_policy_group_permissions(discovery_permissions)\n user_acces...
f9c9d08491bbc39ca8d15200e39a4e59
allows setting config options directly on this object: s.timeout = 10
[ { "docid": "b9deca452d4c8a9db8d42be9d64fa895", "score": "0.0", "text": "def method_missing name, *args, &block\n options.send(name, *args, &block)\n end", "title": "" } ]
[ { "docid": "93bbc2a36b8b5e43ca5415300e76a70c", "score": "0.7600315", "text": "def configure_timeout(options, env)\n req = request_options(env)\n options[:inactivity_timeout] = request_timeout(:read, req)\n options[:connect_timeout] = request_timeout(:open, req)\n end", ...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "70eea435e5fdf4b086abe85736037469", "score": "0.0", "text": "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @operations = args[:operations] if args.key?(:operations)\n end", "title": "" } ]
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
7453bea0858dcf7377d72f47f4999124
expects one argument: the array to rotate returns the first element before array is rotated
[ { "docid": "0fc8b3d78fc5b3c63adee2b0076ebcb8", "score": "0.8304911", "text": "def rotate( array )\n val = array.shift\n array.push( val )\n return val\n end", "title": "" } ]
[ { "docid": "ee6d20a5f5e348e22d47944e56a7e389", "score": "0.86160475", "text": "def rotate_array(array)\n rotated = array[1..-1]\n first = array.first\n rotated.push(first)\nend", "title": "" }, { "docid": "7d14d30cc1a417aada6d090ae827b936", "score": "0.8304545", "text": "def rotat...
51ec9f227a1a505b30bb5cd789edc989
PATCH/PUT /reservations/1 PATCH/PUT /reservations/1.json
[ { "docid": "4fa7e8120d83d6413ddbadb301175980", "score": "0.6718256", "text": "def update\n puts @reservation.inspect\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n ...
[ { "docid": "69b34af08c0d10a3aafec87affd34647", "score": "0.7111349", "text": "def update\n if @reservation.update(reservation_params)\n render json: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid...
578199c76dcc3957804d968de89330d2
GET /provincials GET /provincials.json
[ { "docid": "cb864b67956fe9af4a5dee2ee6068088", "score": "0.7214334", "text": "def index\n @provincials = Provincial.all\n end", "title": "" } ]
[ { "docid": "f6da93430580131a75011d90e04bbb75", "score": "0.7022847", "text": "def index\n @provins = Provin.all\n end", "title": "" }, { "docid": "49af107886e0012f625f6bdc193ff604", "score": "0.6912495", "text": "def index\n @provincia = Provincium.all\n end", "title": ""...
f9752976a3a5fbc8190a1a98c196d116
POST /fields POST /fields.xml
[ { "docid": "18e19bfba9c4173462075e6d076da73f", "score": "0.5488531", "text": "def create\n @field = Field.new(params[:field])\n\n respond_to do |format|\n if @field.save\n flash[:notice] = 'Field was successfully created.'\n format.html { redirect_to(@field) }\n format.xm...
[ { "docid": "ee4a99fc5e640771516799003a2c12e1", "score": "0.620014", "text": "def test_post_field\n filename = 'GetField.docx'\n remote_name = 'TestPostField.docx'\n dest_name = remote_test_out + remote_name\n index = 0\n body = Field.new({ :FieldCode => '{ NUMPAGES }', :NodeId =...
354811e75204c3040fd6671214ef3a90
create a menu within a menu add menu method which could be used from blocks add 20100910 12:20 simplifying
[ { "docid": "c17955543965bccc8fc0390c8ed8f83a", "score": "0.78641593", "text": "def menu text, &block\n #$log.debug \"YYYY inside M: menu text #{text} \"\n m = Menu.new text, &block \n add m\n return m\n end", "title": "" } ]
[ { "docid": "aeb59164f3946feb92898e283330371a", "score": "0.75228053", "text": "def menu text, &block\n m = Menu.new text, &block \n m.color = @color\n m.bgcolor = @bgcolor\n add m\n return m\n end", "title": "" }, { "docid": "5d47b3eac04537ad4c5b202a2318b0db", ...
0e732d0b641623b150ac76570f8b9796
Sample error message returned by ActiveRecord for Sqlite Unique exception: 'SQLite3::ConstraintException: UNIQUE constraint failed: things.code, things.score: INSERT INTO "things" ("name", "test", "code", "score") VALUES (?, ?, ?, ?)' Step1: extract column names from above message on which unique constraint failed. Ste...
[ { "docid": "3188193d09636367f631b19e5db76490", "score": "0.47718403", "text": "def index_error?(index, error_message)\n column_names = error_message.scan(%r{(?<=#{@table_name}\\.)\\w+})\n column_names.include?(index.field)\n end", "title": "" } ]
[ { "docid": "e8d38ee209824cbc98f98acdca5f387b", "score": "0.63600355", "text": "def save_detecting_duplicate_entry_constraint_violation\n begin\n save\n rescue ActiveRecord::StatementInvalid => e\n # Would that rails gave us the nested exception to check...\n if e.message =~ /.*[Dd]u...
675afea88b43b98798c1b0ea54d30cb0
skip_before_filter :current_tenant skip_around_filter :scope_current_tenant
[ { "docid": "1649c681e8e90567fab12fd4bebe0120", "score": "0.0", "text": "def sort\r\n ContentImage.sort(params[:content_image])\r\n render :nothing => true\r\n end", "title": "" } ]
[ { "docid": "91f8ef45b8f66186067f0c1c3c4620fa", "score": "0.71698445", "text": "def set_current_tenant_through_filter\n self.class_eval do\n helper_method :current_tenant\n \n def set_current_tenant(current_tenant_object)\n ActsAsTenant.current_tenant = current_tenant_o...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "6f0919867f9bcc307749faf709d4f7cb", "score": "0.0", "text": "def set_telefono\n @telefono = Telefono.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;...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "86bf38ddcbfd36bf76367607deafdb89", "score": "0.0", "text": "def gw_calculation_params\n params.require(:gw_calculation).permit(:course, :mon, :tue, :wed, :thr, :fri)\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...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "f5bdc6457555faae85bd364b599d5f97", "score": "0.0", "text": "def set_site\n @site = Site.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...
f7327fd1e95c06e418d479e14c3d3898
GET /messages/1 GET /messages/1.xml
[ { "docid": "1cd641a637fb86c641fa0870dd8362ff", "score": "0.6168534", "text": "def show\n\t\t@user = logged_in_user\n\t\t@message = Message.find(params[:id]).get_first_message\n\t\t@user.mark_read_level_id(@message.get_current_message)\n\t\t@message_list = @message.get_all_messages\n\t\t@new_message = Me...
[ { "docid": "dbc96cdcfe96d0a5cfff134d321e521f", "score": "0.7135446", "text": "def messages\n get_data('/messages')\n end", "title": "" }, { "docid": "0036aa1aa4ca40eb741a872b9794f65e", "score": "0.70756936", "text": "def show\n @message = Message.find(params[:id])\n\n respo...
2307ce5aa3ea1af62b76dec9bdc935a3
GET /scouters/new GET /scouters/new.xml
[ { "docid": "28b35eb217a695568013e874f0d95e7c", "score": "0.66796213", "text": "def new\n @scouter = Scouter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scouter }\n end\n end", "title": "" } ]
[ { "docid": "2aee7b4423785691680a305f27f41d78", "score": "0.6937997", "text": "def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end", "title": "" }, { "docid": "2aee7b4423785691680a30...
69670619b61894b6fe603bb04a03c715
Method to retrieve search results for different search terms and parameters no_results checks if results for tickets, users or organizations has values or not
[ { "docid": "7ab859c3ed5c183c5a74a63701c1914d", "score": "0.74683434", "text": "def search_results\n begin\n \tsearch_text = params[:search_text].strip\n search_ticket_param = params[:ticketSearchField].downcase\n search_user_param = params[:userSearchField].downcase\n search_organiz...
[ { "docid": "400003c956f3f76f7de330bce13ccb3a", "score": "0.6909242", "text": "def perform_search\n if query.present?\n do_searches unless email_found\n end\n results\n end", "title": "" }, { "docid": "58292c7efbc26902d0e5dcb256bedda4", "score": "0.6879882", "text": "de...
dbda63affc3988a3fdfb0220e4a2d3be
Returns a new Array by removing items from self for which block is true. An Array is also returned when invoked on subclasses. See reject!
[ { "docid": "6c67a90c857302cdb7e161fc8fa9cbf7", "score": "0.81481534", "text": "def reject(&block)\n Array.new(self).reject!(&block) || self\n end", "title": "" } ]
[ { "docid": "d2ced4ba712b801c3efc0d15fda1e553", "score": "0.7461299", "text": "def reject(&block)\n return to_enum :reject unless block_given?\n Array.new(self).reject!(&block) || self\n end", "title": "" }, { "docid": "d14335a2ee4392b0dc5c3739370f2238", "score": "0.7441376", "...
106f23a616128b158a1010601bd571f8
Duck typing the String method to_s
[ { "docid": "58410b97c1f6903c5ff6df63ef2a06e7", "score": "0.0", "text": "def to_s\n @name\n end", "title": "" } ]
[ { "docid": "8b1fb58f6afe0db985d2335dcf091a8f", "score": "0.8122887", "text": "def to_s(*) end", "title": "" }, { "docid": "8b1fb58f6afe0db985d2335dcf091a8f", "score": "0.8122887", "text": "def to_s(*) end", "title": "" }, { "docid": "8b1fb58f6afe0db985d2335dcf091a8f", ...
a6fe6aa2c77dbd951d83688f86f888bd
this return revenue in pln ( brutto )
[ { "docid": "b61d54841372561bf15d548bf2a9367c", "score": "0.71053606", "text": "def revenue\n invoice_lines.sum('revenue_frozen')\n end", "title": "" } ]
[ { "docid": "4c93d919b9adc7396a487fcd789d6afe", "score": "0.77493256", "text": "def revenue\n collect_money = [] # store an empty array\n collect_money = sales.collect { |sale| sale.amount } # set up the method. collecting the amount\n sum_money = collect_money.inject(0, :+) # adding toget...
d6fdb9a9811b79f39314a9cd75ae89ef
def if_team_won_or_lost(points) if points == 0 return "lost" else
[ { "docid": "699b002b3b05db76c6632727638443d8", "score": "0.0", "text": "def update_points(var)\n if var == \"won\"\n @points += 1\n end\n end", "title": "" } ]
[ { "docid": "bdb83da2f1322e969af99ac8ccf39f53", "score": "0.7583352", "text": "def outcome\n if has_won == true\n \"Won\"\n else\n \"Lost\"\n end\n end", "title": "" }, { "docid": "62720a4bd168f54ebad776401a92356c", "score": "0.7388267", "text": "def win_or_lose(ga...
8bd201ae9614a7cc78685404b0e3e616
arrays iterate through the array for individual elements array indexes can be used to select elements in groups Further Exploration
[ { "docid": "c1f5afdf1285df5c4e38bce53a967dc2", "score": "0.0", "text": "def rotate_string(string)\n new_string = string.chars\n rotate_array(new_string)\nend", "title": "" } ]
[ { "docid": "69538d9fc62af919d95380f9ee1fdd3e", "score": "0.6582629", "text": "def acct_groups(array)\n array.each_slice(4) do |a, b, c, d|\n p [a, b, c, d]\n end\nend", "title": "" }, { "docid": "654ca0aeaba4e61d7301ea2fc49685e9", "score": "0.62056535", "text": "def a_g_c(array)...
4f060ccf78c5a7b8a47f8f0c6b488ae6
GET /api/v1/branches GET /api/v1/branches.json
[ { "docid": "c5206ab4eb167f7c8b5445704fbc3d2c", "score": "0.7357427", "text": "def index\n @branches = Branch.all\n end", "title": "" } ]
[ { "docid": "2695f265ee3aac4aed7f07bde49fab5a", "score": "0.81355417", "text": "def index\n @branches = Api::V1::Branch.all\n\n render json: @branches\n end", "title": "" }, { "docid": "18ad2bbe60dc0c21e4d9458c5ed0a47a", "score": "0.811996", "text": "def branches\n client....
57ed953652b637186f4be284954182ba
Determine which layout to use based on the authorized state
[ { "docid": "02b18386443a84c5ea0a7f6e513a7c23", "score": "0.7406791", "text": "def layout_by_resource\n if user_signed_in?\n \"application\"\n else\n \"unauthorized\"\n end\n end", "title": "" } ]
[ { "docid": "fb81ed6f16dfdf4dc731bb19ca3ada25", "score": "0.77337676", "text": "def resolve_layout\n if current_admin || current_loan_manager || current_accountant\n 'application'\n else\n 'public' # show Public Layout to Client\n end\n end", "title": "" }, { ...
9adcd3e329cdade8ab4623e020ee1d9a
Compare status based on priority and state: unavailable status is always less valuable than others Raises an error if the JIDs aren't the same
[ { "docid": "fc0e9d86cbdac9fea5642cc538c16d09", "score": "0.6333866", "text": "def <=>(o)\n if self.from || o.from\n unless self.from.stripped == o.from.stripped\n raise ArgumentError, \"Cannot compare status from different JIDs: #{[self.from, o.from].inspect}\"\n end\...
[ { "docid": "cfac159a364afa922a7c7e10ec0eefab", "score": "0.5910642", "text": "def global_status\n status_counts = @count.values_at(*BareTest::StatusOrder)\n most_important_status = BareTest::StatusOrder.zip(status_counts) { |status, count|\n break status if count > 0\n } ||...
a418fadbf52dc2529b367db16408e7d6
This method is called after the grid has rendered text to the cell The plugin provider should simply simply provide html closing tags for the tags opened during 'before_cell_render_styling'
[ { "docid": "e705dd00eccaca5a82b6f47f7daaaef7", "score": "0.7538379", "text": "def after_cell_render_styling(column_name,cell_value,record)\n style_close = \"</font>\"\n \n end", "title": "" } ]
[ { "docid": "ca1eca16493f5945e9f6f4279dda9457", "score": "0.73463935", "text": "def after_cell_render_styling(column_name,cell_value,record)\n \"</font>\"\n end", "title": "" }, { "docid": "4c814a934e8282e47912f2acd3d130c4", "score": "0.73246896", "text": "def after_cell_r...
d82cf30aef5bb9e7ea3ca7691aed4195
DSL keyword spec. Entry point of the DSL processing
[ { "docid": "91875b9f565d89e179f884c1a760b405", "score": "0.0", "text": "def spec(id, &block)\n @id = id\n self.instance_eval(&block) \n end", "title": "" } ]
[ { "docid": "37e70ac9b47986846c1d71dda17a9789", "score": "0.66770536", "text": "def keyword\n\n end", "title": "" }, { "docid": "b25d99fdbc59d9cabd5496c720e57dd0", "score": "0.65510625", "text": "def with_any_keywords; end", "title": "" }, { "docid": "53b4c22a3f0b3f33f322...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "8997837e0c107b2634c756316c3cf4a8", "score": "0.0", "text": "def canvas_params\n params.require(:canvas).permit(:name, :slug)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7497917", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69572496", "text": "def strong_params\n params.require(:request).permit(param_whit...
06da5ad6139b5800cb33fbcca70cd93d
GET /measurements/new GET /measurements/new.xml
[ { "docid": "5a3cff24a2a64fda62cc20f621d93c8c", "score": "0.76939315", "text": "def new\n @measurement = Measurement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @measurement }\n end\n end", "title": "" } ]
[ { "docid": "715d5fc6981f7fccce6abd5ce0460e7d", "score": "0.70565104", "text": "def new\n @measurement = Measurement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @measurement }\n end\n end", "title": "" }, { "docid": ...
c677e2ccb36ab955c74a7bce3764b9f6
POST /people POST /people.json
[ { "docid": "bdfa044343eb56d75c9b723bb032c18a", "score": "0.0", "text": "def create\n _create_or_update(@person)\n end", "title": "" } ]
[ { "docid": "b15085b8ebe0f929720fc799ccb1766b", "score": "0.6787028", "text": "def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v1_person_url(@person)\n else\n render json: @person.errors...
be951311cec65688d45b984ef868ece5
generates a number of deaths, which is the population mulitplied by a factor/rate that depends on population_density. Number of deaths increase with population density.
[ { "docid": "04018e15cfce18d6b61a451d4236b50a", "score": "0.0", "text": "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif...
[ { "docid": "8227d20c0bbe50f59fe75892385ac576", "score": "0.7791415", "text": "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n x = 0.4\n elsif @population_density >= 150\n x = 0.3...
319e6b2beb65b90ce440af5e3e9f370a
Returns the value of attribute values. source://activerecord//lib/arel/nodes/update_statement.rb6
[ { "docid": "69768ace328ed4e595fbcb17d9035356", "score": "0.0", "text": "def values; end", "title": "" } ]
[ { "docid": "6b32d767cf3380d70246db4e7e434013", "score": "0.6667639", "text": "def updateValuesSyntax\n str = String.new \n @SQLAttributes.each do |attribute| \n if !@Keys.include? attribute[0]\n str += attribute[0] + \"=?,\"\n end \n end \n str.chop! \n return str\n end"...
8814a8e8bc547d31c5da400386d7841d
DELETE /discussions/1 DELETE /discussions/1.xml
[ { "docid": "ebb200b44b29ae02384cd7cba4a29b1f", "score": "0.718931", "text": "def destroy\n @project = Project.find(params[:project_id])\n @discussion = @project.discussions.find(params[:id])\n @discussion.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_discussions...
[ { "docid": "ae130cea634fbb92e9efb7119423ab9c", "score": "0.74875945", "text": "def destroy\n @discussion = Discussion.find(params[:id])\n @discussion.destroy\n\n respond_to do |format|\n format.html { redirect_to(discussions_url) }\n format.xml { head :ok }\n ...
a25e8ff644e5b0e704336443699ab18b
Converts the given integer size in bytes into a string with 'K', 'M', 'G' suffix, as appropriate. reverse of interpret_size in
[ { "docid": "71baf569ab3e6f6c40695dcc54d65a5e", "score": "0.80713695", "text": "def reverse_interpret_size(size)\n size = size.to_i\n if size < 1024\n \"#{size}\"\n elsif size < 1024 * 1024\n \"#{size/1024}K\"\n elsif size < 1024 * 1024 * 1024\n \"#{...
[ { "docid": "4022fea0001093d4d143ebda231cf11c", "score": "0.78684586", "text": "def size_str\n\t\tif size > 1073741823\n\t\t\t\"~#{size.quo(1073741824).ceil} GB\"\n\t\telsif size > 1048575\n\t\t\t\"~#{size.quo(1048576).ceil} MB\"\n\t\telsif size > 1023\n\t\t\t\"~#{size.quo(1024).ceil} KB\"\n\t\telse\n\t\...
1e1114d2cb455ceb83607bf7bba2d246
Mark the task with the given id as finished. Will create a new task if the given task is the latest task of an active task generator. If new task is created returns the same as TaskGenerator::new else returns nothing
[ { "docid": "ac932a42ec2c7bbb76e2ea5e85e6123f", "score": "0.67990834", "text": "def mark_finished\n task = Task.find(params[:task][:id])\n if task.nil?\n render :json => {:errors => \"Invalid task\"}, :status => 400\n else\n task_actor = task.task_actors.find_by_user_id(view_context.cu...
[ { "docid": "d26b4be797063b54ba7702c80afb3c34", "score": "0.6542146", "text": "def complete!(task_id)\n @tasks[task_id - 1].complete!\n end", "title": "" }, { "docid": "d26b4be797063b54ba7702c80afb3c34", "score": "0.6542146", "text": "def complete!(task_id)\n @tasks[task_...
f61ad6cb02299aee0223e10fd1b9be16
DELETE /bookings/1 DELETE /bookings/1.json
[ { "docid": "ec7bb8165ccc197abe930e52b7559a0c", "score": "0.70330614", "text": "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to home_path, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": ...
[ { "docid": "899ffdf005df064f4dbab155002fe202", "score": "0.7660707", "text": "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end", "title": "...
a65f29ae28fafcbf7230ea85ccc180b0
skip space and comment
[ { "docid": "9bbc1220f2498cfa05f641c08af5cc86", "score": "0.7288038", "text": "def skipSpaceComments(strm)\n while(!strm.eof?()) do\n case (c=strm.getc())\n when (?\\ ) ,(?\\n), (?\\t), (?\\r)\n next ;\n when (?;)\n strm.gets() ;\n else\n strm.ungetc(c) ;\n ...
[ { "docid": "6022f97b8708fd4c1afb0004ca360ecb", "score": "0.75001925", "text": "def skip_whitespace\n while @char =~ /[\\s,;#]/\n # Comments begin with a semicolon and extend to the end of the line\n # Treat #! as a comment for shebang lines\n if @char == ';' || (@char == '#' &&...
b876c0a0e51d49ad6266cba3dbe9d040
Get the string prefix for tagging versions of this package. Only makes any sense if the package is in a recognized repo, and will error out if that's not the case. The most basic prefix is "v" for packages located at the root of the repository.
[ { "docid": "8f85051065b7bc7391da5f94ac4cf9e0", "score": "0.8411623", "text": "def version_tag_prefix\n if root_path == repo.root_path\n 'v'\n else\n (repo_rel_path / 'v').to_s\n end\n end", "title": "" } ]
[ { "docid": "7ccbb617cb434fb83c7bae97a5764e8a", "score": "0.70594865", "text": "def prefix_tag(tag)\n tag = Origen::VersionString.new(tag)\n if tag.semantic?\n tag.prefixed\n else\n tag\n end\n end", "title": "" }, { "docid": "b34bd899bd5233d...
cec83f7c15555033933dc4f7584cdcc9
Public: Dead letter exchange for the Retrier object. Returns Bunny::Exchange object for dead letter exchange.
[ { "docid": "8a56ea4f27d4ca953dc2985a9980a320", "score": "0.7595737", "text": "def dead_letter_exchange\n @dead_letter_exchange ||= Hightops.connection.channel.exchange(dlx_naming.to_s, type: 'direct', durable: true)\n end", "title": "" } ]
[ { "docid": "1ebce29aa7c9d1c03406582922a81470", "score": "0.589071", "text": "def exchange\n @exchange ||= channel.direct(exchange_name, durable: true)\n end", "title": "" }, { "docid": "6c813bf9e3924777263405864bf8e8d3", "score": "0.5699769", "text": "def dead_letter_addr...
914002eee59afb292454edb8de890cb3
Customize authorize_params through request params. It will override those hard coded options during middleware initialization.
[ { "docid": "b36843b19daf6453dbe69119dceb6c21", "score": "0.8598764", "text": "def authorize_params\n options.authorize_options.each do |option|\n if o = request.params[option.to_s]\n options[option] = o\n end\n end\n super\n end", "title": "" ...
[ { "docid": "16515fa07a4ef8bdb602d511efe61abb", "score": "0.84131604", "text": "def authorize_params\n super.tap do |params|\n options[:authorize_options].each do |k|\n params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])\n end\n ...
7d6956655f38ad7ad27005f3871624d7
my custom fields are :name, :heard_how
[ { "docid": "41455e36d455b4c86327e43f51207d56", "score": "0.0", "text": "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) do |u|\n u.permit(:first_name, :last_name, :user_name, :captcha, :captcha_key,\n :email, :password, :password_confirmation)\n end\n d...
[ { "docid": "3181709b354c41933b58a635ddc069c1", "score": "0.6477025", "text": "def field_name\n self.well_info.field_name\n end", "title": "" }, { "docid": "ff78478305f12e0c5200f4f443b6c209", "score": "0.63329405", "text": "def add_custom_field(name, value)\n add_field na...
60636a1ef1f13f18eeae8e0f8cc01ce6
Replaces all '/' to '_'
[ { "docid": "b1fa4a43233963297801be2689c91068", "score": "0.71680063", "text": "def to_underscore\n downcase.gsub(%r{/}, '_')\n end", "title": "" } ]
[ { "docid": "0e3fbff446d0db7d20a737305dc15c63", "score": "0.77395064", "text": "def underscore\n gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').tr('-', '_').downcase\n end", "title": "" }, { "docid": "94924d7b879b10c6c1a90a40db450e67",...
70a83173fd9883674d8f4c840ab1bf69
POST /recipes POST /recipes.json
[ { "docid": "1c8e4a61039992ca1239bdee537d9d3e", "score": "0.63783526", "text": "def create\n @recipe = Recipe.new(params[:recipe])\n\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { rend...
[ { "docid": "2265ab00fdbd2a0fb84d9531097c7299", "score": "0.7513961", "text": "def create\n recipe = Recipe.create(recipe_params)\n render json: recipe\n end", "title": "" }, { "docid": "ad4704923a3f82c6ef4181756a27386b", "score": "0.7252413", "text": "def create\n ...
00cb4f1f1bf0b26955a33e1488f5a91a
Roo gem to access and manipulate excel files
[ { "docid": "0ba5007755ed2559725a6b4c5450182e", "score": "0.0", "text": "def all_digits(str)\n str[/[0-9]+/] == str\nend", "title": "" } ]
[ { "docid": "b5108773c5b685455bca846127cc1eb5", "score": "0.72649497", "text": "def spreadsheet\n Roo::Spreadsheet.open(file_path, extension: extension.to_sym())\n rescue => ex\n log \"Error => [#{ex.message}]\"\n raise ex\n end", "title": "" }, { "docid": "5509862f021f08c35bbc969...
ee3450e2cc65e7d148532c64e79538b9
display all the attendance records
[ { "docid": "e893bae8c88244f6acc0a2ea1638067e", "score": "0.7372989", "text": "def attendance_details\n @studm = Student.all\n end", "title": "" } ]
[ { "docid": "a017ecfd78174ab5bc9f30ec6c7ecb22", "score": "0.7738607", "text": "def index\n @attendances = Attendance.all\n end", "title": "" }, { "docid": "a017ecfd78174ab5bc9f30ec6c7ecb22", "score": "0.7738607", "text": "def index\n @attendances = Attendance.all\n end", "...
4c33f1d9dcdc3c6d6bf272c02cd5a57a
given that a attribute is a association, and the associated serializer has same scope defined, checks if a nested association is present
[ { "docid": "7715621d55fa87316ce65bd7ca339ae4", "score": "0.86012524", "text": "def attribute_has_nested_associated?(attribute)\n attribute = attribute.to_s\n if attribute_is_association?(attribute)\n assoc_scope = attribute_assoc_scope(attribute)\n assoc_scope && assoc_sc...
[ { "docid": "d6a8309d4ac96a68618253680c847ff5", "score": "0.6847659", "text": "def child_is_association(attr)\n\t\t\treturn !model_class.reflect_on_all_associations(:has_and_belongs_to_many).select{|a| a.name == attr.to_sym}.empty?\n\t\tend", "title": "" }, { "docid": "40bd30fb5e63c3ad37ff32f...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "95ad243bfcb1fea39a80558874f0b71d", "score": "0.0", "text": "def clothing_params\n params.fetch(:clothing, {})\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title"...
41989f1d5e53c6eab6f0fc3ad52d5659
A TimeOrDateTime instance representing the UTC time when this transition occurs.
[ { "docid": "bf9e06061124d73432966724f266c4eb", "score": "0.0", "text": "def at\n # Thread-safety: It is possible that the value of @at may be calculated\n # multiple times in concurrently executing threads. It is not worth the\n # overhead of locking to ensure that @at is only calculated ...
[ { "docid": "2bdf7b2b7f6cf32bb32c80fd3b55713b", "score": "0.7291975", "text": "def time\n @time ||= incorporate_utc_offset(@utc, utc_offset)\n end", "title": "" }, { "docid": "82fd1876d3e723b4ec3e13fb6d9dd0f4", "score": "0.6761552", "text": "def to_time\n t = ::Time.at ut...
420a91964d0709975536fd9b3f400f3c
DELETE /stores_in_groups/1 DELETE /stores_in_groups/1.xml
[ { "docid": "af0a5f85a746933defd2df8f4f24bf2f", "score": "0.7877102", "text": "def destroy\n @stores_in_group = StoresInGroup.find(params[:id])\n @stores_in_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(stores_in_groups_url) }\n format.xml { head :ok }\n end\...
[ { "docid": "b623ff235636f9ee259280dea2b10f1e", "score": "0.7524084", "text": "def destroy\n @store_group = StoreGroup.find(params[:id])\n @store_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(store_groups_url) }\n format.xml { head :ok }\n end\n end", "t...
f99feeabb0c0318113619e9490f4d420
DELETE /contacts/1 DELETE /contacts/1.json
[ { "docid": "6dad58b99fd8c04ef8eff167bdffb05e", "score": "0.7427848", "text": "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to admin_contacts_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "17bbac4c2997ecb6a6d6dceb6947218c", "score": "0.78873235", "text": "def destroy\n puts \"delete contact\"\n contact = Contact.find(params[:id])\n contact.destroy\n render json: contact\n end", "title": "" }, { "docid": "db31580cc47cc5b92920ab8f13760712", "score": ...
f2de9cc41af6cdec12137e7ee67bbf4f
Invokes a lookup on all AddressBook objects and prints a subset of the result to the console. The attributes that are selected for print are defined in AddressBook::SUMMARY
[ { "docid": "d09e0dba9eafb6407d8371b68b14cad6", "score": "0.72170866", "text": "def print_summary(pattern = {})\n @address_books.each do |address_book|\n puts \"\\n#{address_book.title}\"\n address_book.lookup(pattern).each do |contact|\n address_book.print_summary(contact)\n ...
[ { "docid": "a6d7e0ee9f31b9e0ba4b0bf630a19499", "score": "0.7712651", "text": "def print_all(pattern = {})\n @address_books.each do |address_book|\n puts \"\\n#{address_book.title}\"\n address_book.lookup(pattern).each do |contact|\n address_book.print_all(contact)\n en...
9847e095a7a849c6729c523a0b6e5497
grocery_list = new_grocery_list("apples yogurt milk")
[ { "docid": "f17525b4ece3312a33f02f3b5907e4c3", "score": "0.0", "text": "def add_item(hash, item, quantity)\n hash[item] = hash[item].to_i + quantity\n hash\nend", "title": "" } ]
[ { "docid": "104f2ccc434308c3960cb2dde115681e", "score": "0.78105384", "text": "def create_grocerylist(food, grocery_list)\n\tfood_list = food.split(' ')\n\tfood_list.each do |grocery|\n\t\tgrocery_list[grocery] = 1\n\tend \n\tgrocery_list\nend", "title": "" }, { "docid": "7cc622e84e01ff48aa...
4e447e2b3031d40cbebf4c1311294e93
A simple function as a default function performed for each node in bfs()
[ { "docid": "b7e89998d4889c7df51b769361685933", "score": "0.0", "text": "def goalNode?(node)\n node.name == 'Goal'\nend", "title": "" } ]
[ { "docid": "230668f15d927c5299118bc81814fa02", "score": "0.7542408", "text": "def bfs\n # raise NotImplementedError\n end", "title": "" }, { "docid": "ffb35a2b1876cbadffc46c1db334f3d9", "score": "0.7431704", "text": "def bfs\n raise NotImplementedError\n end", "title": ""...
9d592b4ab220f4726796f8c4fc943efd
Signature: words(s) Indice : Regarder la documentation de string Retourne les mots de la string s
[ { "docid": "b5b92ea46f83e368ebfa1e47f288bc22", "score": "0.7323653", "text": "def words(s)\n s.split\nend", "title": "" } ]
[ { "docid": "c24c183fca5178187324fa0ab9595650", "score": "0.73548716", "text": "def e_words(str)\r\n \r\nend", "title": "" }, { "docid": "8328952fd9ccfb68a081d8ab5803abbe", "score": "0.69770455", "text": "def words\n message.split\n end", "title": "" }, { "docid": "934...
137de7e43a982912d8acf77913e13d7b
Adds errors to Array Returns Array
[ { "docid": "ef863b579861857cc23b6c2b332ba4f4", "score": "0.0", "text": "def set_errors\n \t@errors = []\n if !self.user_id # same as: if self.user_id == nil\n \t@errors << \"Must be logged in to add or edit the Bechdel rating.\"\n \tend\n end", "title": "" } ]
[ { "docid": "cb29d87f347357839ab0a742b4f3c397", "score": "0.7847991", "text": "def errors\n @errors || Array.new\n end", "title": "" }, { "docid": "2f6fc7fa6bb7d459c478894ab2947e8c", "score": "0.77385336", "text": "def errors\n each_error.to_a\n e...
5893765d60facdbe1885bfb708771e05
PATCH/PUT /about_us_sections/1 or /about_us_sections/1.json
[ { "docid": "4002f355942fca6b52af3ebe25c62156", "score": "0.7246782", "text": "def update\n respond_to do |format|\n if @about_us_section.update(about_us_section_params)\n format.html { redirect_to @about_us_section, notice: \"About us section was successfully updated.\" }\n format....
[ { "docid": "f574efee659ab9d566c91f90b28a7435", "score": "0.7246009", "text": "def update\n @home = Home.first\n @about = About.first\n\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to admin_section_...
d2fc831d41845f771f7852267c6044c9
POST /templates POST /templates.json
[ { "docid": "77a0a11bae869d783fe53b131738c282", "score": "0.61499006", "text": "def create\n @template = Template.new(template_params)\n @template.last_execute_at = nil\n @template.status = 100\n @template.count = 0\n respond_to do |format|\n if @template.save\n current_user.te...
[ { "docid": "5ca8e16e8e307d08122c232c05b59c92", "score": "0.69342095", "text": "def create(values)\n @client.call(method: :post, path: 'templates', body_values: values)\n end", "title": "" }, { "docid": "02d40ffd34632b276b3a900afa1cebd8", "score": "0.6561349", "text": "def...
d1c581ebc2c9b4185355d7575dc599fe
This method verifies if the given 'film' is already visited. If so, it returns true. If not, it returns false.
[ { "docid": "4aa73016b378087db1d3ea81a82453ab", "score": "0.7546035", "text": "def included_film?(film)\n bool = false\n if @path.include?(film) # if current path includes film\n bool = true\n end\n unless @paths.empty?\n for path in @paths\n if path.include?(film) # if any p...
[ { "docid": "bad285311bcee0ae4eaa8c497fc22f26", "score": "0.7009141", "text": "def contain_that_film?(film)\n\t\tanswer = false\n\t\tOleg.all.each { |elem| answer = true if elem.filmTitle == film }\n\t\tanswer\n\tend", "title": "" }, { "docid": "c19c97e5e1129f48c50067227e8459c6", "score...
2c0704b1a1ec470334f9d6b3c91b777f
List of dependencies. This list is a starting point, and you can add more either now or later. For each gem, we'll include the latest version in the final .gems manifest. Feel free to change it at will.
[ { "docid": "277844da90cffcf5c7922051e69284ab", "score": "0.63745505", "text": "def gems\n [\n \"cuba\", # Required.\n \"mote\", # Required, but you can change it later.\n \"cuba-contrib\", # Optional, provides some nice helpers.\n \"rack-protection\", # Optional, but rec...
[ { "docid": "1ebfb0379a805abd450119da5d1207c2", "score": "0.7944011", "text": "def dependencies(*list)\n @dependencies ||= []\n @dependencies += list\n list.each do |dep|\n if dep =~ /^gem:\\s*(.*)\\s*$/\n dep = $1.split(/\\s+/)\n raise(ArgumentError, 'Invalid gem ...
79587977a174230f31238ad11d8ac834
I was told not to use rspec because it wasn't running on my computer, and I also had trouble using cloud 9 but this code passed on CoderPad.
[ { "docid": "42c7e2e5942d35ac4a9428b885646a4f", "score": "0.0", "text": "def simple_string\n old_string = \"Ruby is cool\"\n new_string = old_string.reverse.upcase\n puts new_string\nend", "title": "" } ]
[ { "docid": "072514f3348fe62556dcdfd4b06e3d08", "score": "0.62474746", "text": "def spec; end", "title": "" }, { "docid": "072514f3348fe62556dcdfd4b06e3d08", "score": "0.62474746", "text": "def spec; end", "title": "" }, { "docid": "445279b59ad39e276a6808385d0815a0", "...
d45abe83b3f02a1855c1b942c17d117e
Return the timestamp of the last log entry.
[ { "docid": "6469b9fd67619746ecfca57b657abd9a", "score": "0.7400126", "text": "def last_written_at\n entry = read(1).first\n entry.time if entry\n end", "title": "" } ]
[ { "docid": "8b5518e43b95ec0d9e5651d748381e63", "score": "0.774459", "text": "def last_timestamp\n lines.last.first\n rescue\n 0\n end", "title": "" }, { "docid": "316e89e37d721999d93539193263dbc8", "score": "0.7710828", "text": "def last_entry_time\n last_entry =...
41bcde8d16215ff162f0ad42d26ae177
Add and remove favorite profiles for current_user
[ { "docid": "348bf2c1a5fb12e5ba01a24f0216f282", "score": "0.6511555", "text": "def favorite\n\n current_user.toggle_favorite_profile(@profile)\n\n respond_to do |format|\n format.html {\n redirect_to :back\n }\n format.js\n end\n end", "title": "" } ]
[ { "docid": "18b3d1a29cbb8642602e256ef4e3a60d", "score": "0.72197574", "text": "def switch_favourite\n if session[:user_id].nil?\n return \n end\n \n user = User.find(session[:user_id])\n user2 = User.find(params[:user_id])\n \n if user.get_favourites.include? user2\n user....
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "ea5d423e9d6dbf88bcac80b682b92e89", "score": "0.0", "text": "def user_params\r\n params.require(:user).permit(:user_id,:password, :role_id, :email, :username, :user_area_interest_area_interest_id,:nombre,:cedula,:direccion,:sex_id,:telefono,:fecha_nacimiento,:civil_status_id,:avatar,:line...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74968386", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958337", "text": "def strong_params\n params.require(:request).permit(param_whit...
a0d39c7fe37e0fa3a897d09df8509145
Creates a new collection of nodes for the given state machine. By default, the collection is empty. Configuration options: :index One or more attributes to automatically generate hashed indices for in order to perform quick lookups. Default is to index by the :name attribute
[ { "docid": "d1705c9b8f6cbd20355596b79f07e3f1", "score": "0.0", "text": "def initialize(machine, options = T.unsafe(nil)); end", "title": "" } ]
[ { "docid": "906de2237d612d331c521da9c502d724", "score": "0.5445394", "text": "def index\n @newnodes = Newnode.all\n end", "title": "" }, { "docid": "4194176a74919d41255ed4ec6a18754f", "score": "0.53894025", "text": "def initialize\n @index = \"1\"\n @attributes = []...
caf1909396deaf9fac321b9d652df3cd
PATCH/PUT /appointments/1 PATCH/PUT /appointments/1.json
[ { "docid": "0408236f23545a2dcfea04bc34c1f172", "score": "0.64363366", "text": "def update\n respond_to do |format|\n\n if @appointment.update(appointment_params)\n format.html { redirect_to @appointment, notice: 'Appointment was successfully updated.' }\n format.json { render :show...
[ { "docid": "12837c0a4589d71607cc2f7b7e22d78c", "score": "0.7734758", "text": "def update\n begin\n @appointment = Appointment.find(params[:id])\n rescue\n respond_info('error', 'internal_server_error', 'Update Appointment Failed', :internal_server_error)\n return\n end\n if @a...
c04f27d1ba81446126547f56a8739393
DELETE /batches/1 or /batches/1.json
[ { "docid": "3cb5099f629eabfabb7503d491ceba3b", "score": "0.708966", "text": "def destroy\n @batch.destroy\n respond_to do |format|\n format.html { redirect_to batches_url, notice: \"Batch was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": ""...
[ { "docid": "9a899aeb967b09008213e90956fbd571", "score": "0.74597734", "text": "def destroy\n @batch.destroy\n\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "19fe7e5c963e5c27637...
ed2ff390cb555b21c9cdd6cc0e3469fe
Gets the contentWebUrl property value. The content web URL for the learning content. Required.
[ { "docid": "c384ac6dddc2e5e0b28b59efc8fecb19", "score": "0.8273369", "text": "def content_web_url\n return @content_web_url\n end", "title": "" } ]
[ { "docid": "9ccd6457c8d7a85c15178490b9089dce", "score": "0.7706158", "text": "def content_web_url=(value)\n @content_web_url = value\n end", "title": "" }, { "docid": "e6ca46d7415514e25d7eedc3ebbff412", "score": "0.7655804", "text": "def content_url\n ...
c5c9419a597f83ef064d4dde46e46e28
Attempts to evaluate AST for node defnintions if there are any.
[ { "docid": "6d9511a6594775227edbcacce5138fe0", "score": "0.5483414", "text": "def evaluate_ast_node\n internal_compiler.evaluate_ast_node\n end", "title": "" } ]
[ { "docid": "afb86051c681f7ed192fd1de212431b2", "score": "0.6225774", "text": "def visit_def(node); end", "title": "" }, { "docid": "8dffdc2d39a5b3c36c46acd8794898ca", "score": "0.61462516", "text": "def check_def(node)\n defs = node.children.compact.select{|n| n.type == :de...
f2e4841aed851faeac021e14b9de1b2a
all methods that follow will be made private: not accessible for outside objects
[ { "docid": "4a93f9cb11b47ccb4c06972b51767362", "score": "0.0", "text": "def fetch_md5\n # Create a hash digest for the current file.\n digest = Digest::MD5.new\n File.open(@path, 'r') do |handle|\n while buffer = handle.read(1024)\n digest << buffer\n end\n end...
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.83411914", "text": "def private; end", "title": "" }, { "docid": "530e65cba197567f73b8125444ac33cc", "score": "0.7993807", "text": "def private_method\n end", "title": "" }, { "docid": "9033a4004eb88fe2a1f0a7...
cce4046051f454b7b388b114a9a51b09
Registers the current plugin with the system. Returns nothing.
[ { "docid": "ce1c8e0911001ac1d20822974ec86cb0", "score": "0.57557416", "text": "def inherited(plgn)\n super\n Twke::PluginManager.register(plgn)\n end", "title": "" } ]
[ { "docid": "b082f1b1719f42fb57855f9d9b0b6ebf", "score": "0.74269766", "text": "def register(plugin, id); end", "title": "" }, { "docid": "98251c2bd40568685b025ee0253073b2", "score": "0.7259205", "text": "def register_plugin(plugin)\n @plugins << plugin.new\n end", "title": ""...
501ce74925cb091dbdaefa1e19e19729
CHECK in Fridge we didn't have a to_json, so I didn't put one here ...
[ { "docid": "59a1235cdf2635fae739cde5406a350c", "score": "0.0", "text": "def create\n decoded_token = JWT.decode book_params[:swipeChefToken], \"spaghetti\", true, { algorithm: 'HS256' }\n\n if decoded_token\n\n user_id = decoded_token[0]['id'].to_i\n\n @book = Book.find_or_create_by(user...
[ { "docid": "7fce5d6042e17cdb11dfa81f0930d589", "score": "0.7808573", "text": "def to_json\n raise StandardError, \"Not implemented!\"\n end", "title": "" }, { "docid": "8f6945fcb933fb88fa550fe9d6794d85", "score": "0.73848605", "text": "def get_json\n return to_json()\nend", ...