query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
bca6d7d591217954bc890507ad8ed33f
Discards all connections in the pool (even if they're currently leased!), along with the pool itself. Any further interaction with the pool (except spec and schema_cache) is undefined. See AbstractAdapterdiscard! source://activerecord//lib/active_record/connection_adapters/abstract/connection_pool.rb277
[ { "docid": "af8e5d5601161d29b23f91caf587b8ae", "score": "0.0", "text": "def discard!; end", "title": "" } ]
[ { "docid": "50d875c6d9b02bf4050fec6d41ef978b", "score": "0.74516356", "text": "def discard! # :nodoc:\n synchronize do\n return if @connections.nil? # already discarded\n @connections.each do |conn|\n conn.discard!\n end\n @connections = @available =...
cfd50a176c923a22c44ef373dc2a9a16
Test Status PASS Remove a workspace NOT owned by user from their associated workspaces
[ { "docid": "abbe6e256717ce3114866d83eeea6a96", "score": "0.6313711", "text": "def unassign_workspace\n @users_workspace = UsersWorkspace.includes(:user, :workspace).find_by(users_workspace_params)\n\n if @users_workspace.nil?\n render json: [\"Workspace is not assigned to user\"], status: 404...
[ { "docid": "73330f9b93fa1ca1459e8a33082ea5ee", "score": "0.66850114", "text": "def userremove\n MWorkspace.find_by(\"user_id=? and workspace_id=?\", params[:userremove], session[:workspace_id]).delete\n redirect_to managemember_path\n end", "title": "" }, { "docid": "6c31a647c690b1ae2...
81b90e5f875db1ec6391e3df8b8399ec
Inserta los gramos de un alimento a un plato
[ { "docid": "aa65ec0f0d48cc06049e3a587c4c211a", "score": "0.7766091", "text": "def insert_gramos(gramos)\n\t\t@listaGr.push(gramos)\n\tend", "title": "" } ]
[ { "docid": "eafb8d065a6abca84813dd3367b7ca22", "score": "0.72207433", "text": "def alimento(options = {})\n alimento = options[:descripcion]\n nombre_alimento = alimento.nombre\n @lista_alimentos.insert_head(alimento)\n alimento = \"(#{nombre_alimento})\"\n alimento << \"(#{options[:gramo...
1097a7e7758f08d32addfc88ea3fdcab
GET /users GET /users.json
[ { "docid": "6c84f9adc858b1e18399b4a16fef6a71", "score": "0.0", "text": "def index\n @users = User.order(:created_at).reverse_order\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "title": "" } ]
[ { "docid": "8a29471646191d84def95f7af1e081bf", "score": "0.82109934", "text": "def users(args = {})\n get(\"/users.json\",args)\n end", "title": "" }, { "docid": "fd6f331d604ba2ad8967a7e5ed218329", "score": "0.7873764", "text": "def show\n begin\n user = User.find...
0a84b0f467fa6471370e7928821614a6
An array of all extension modules of this match.
[ { "docid": "08018bef0f9afc52b69897e23ac24b3f", "score": "0.7132137", "text": "def extensions\n @extensions ||= []\n end", "title": "" } ]
[ { "docid": "71c8f76bdeba0b13bfc1d58e60e3032d", "score": "0.7826067", "text": "def all_extensions\n r = []\n manager.Get.each do |ext|\n r << ext\n end\n r\n end", "title": "" }, { "docid": "5ff2e9235477d9b45beeaaef37a40581", "score": ...
b5afa99d0c6e35424fe8d128db490e25
GET /systems/new GET /systems/new.xml
[ { "docid": "9723fda62b32edfe42095eaf074ed6fa", "score": "0.7743613", "text": "def new\n @system = System.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @system }\n end\n end", "title": "" } ]
[ { "docid": "5825ebdb373d0c7b32ad5a6974f535ad", "score": "0.7176912", "text": "def new\n @system = System.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @system }\n end\n end", "title": "" }, { "docid": "bd931f23718d666253d6e63a...
5dee0d0fe97f05b572ab12e300c45996
def show friends1 = User.find_by(id: params[:id]).friends_they_added friends2 = User.find_by(id: params[:id]).friends_who_added_them
[ { "docid": "e65fab917a5e4a415791470f1c87c59d", "score": "0.0", "text": "def destroy\n @friendship = Friend.find_by(id: params[:id])\n if @friendship.destroy\n render :show\n else\n render json: @friendship.errors.full_messages, status: :unprocessable_entity\n ...
[ { "docid": "28818360dec6ca6a5c0de3d0fd5ce682", "score": "0.78153986", "text": "def show\n id = params[:id].to_i\n id_a = Friendship.find(:all, :conditions => ['a = ? and status > 0', id])\n id_b = Friendship.find(:all, :conditions => ['b = ? and status > 0', id])\n ids = []\n id_a.each do...
90eaf2ccbe590c6742c6ce4c19356add
Formats a +number+ into a US phone number (e.g., (555) 1239876). You can customize the format in the +options+ hash. ==== Options :area_code Adds parentheses around the area code. :delimiter Specifies the delimiter to use (defaults to ""). :extension Specifies an extension to add to the end of the generated number. :co...
[ { "docid": "71e7cc39fac557a3ddf915160cd46a9b", "score": "0.90165216", "text": "def number_to_phone(number, options = {})\n return unless number\n options = options.symbolize_keys\n\n number = number.to_s.strip\n area_code = options[:area_code]\n delimiter = options[:...
[ { "docid": "962ca6ead264517b733951d6a4c7f7a3", "score": "0.89203596", "text": "def number_to_phone(number, options = {})\n return unless number\n\n begin\n Float(number)\n rescue ArgumentError, TypeError\n raise InvalidNumberError, number\n end if options[:r...
4e6ff7e0fe5cf4f1d9c78bfdfbe0e6e9
GET /brains/1 GET /brains/1.json
[ { "docid": "963dc7a6eef3fdde1e4caa982e2b42bd", "score": "0.67562133", "text": "def show\n @brain = Brain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brain }\n end\n end", "title": "" } ]
[ { "docid": "62eaf11f5bec288c48c36ef4c7a8bf80", "score": "0.6536637", "text": "def show\n @rainbow = Rainbow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rainbow }\n end\n end", "title": "" }, { "docid": "8ef701f1...
5bd02d20772f1e1f76d0f8f34e325260
GET /problems/new GET /problems/new.json
[ { "docid": "f139cc8ecee7339cbc98670c1cc1291c", "score": "0.8293029", "text": "def new\n @problem = @idea.problems.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "title": "" } ]
[ { "docid": "1ba9dca240b7316ceebe1b7b02171f3d", "score": "0.7952167", "text": "def new\n @problem = Problem.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @problem }\n end\n end", "title": "" }, { "docid": "9da1b4c9c88b5fc81...
3ff7e89a3ea1ec90a7f0b9788d4a0aad
GET /chats/1 GET /chats/1.json
[ { "docid": "7729478adb93fddbc438199935cb5cd7", "score": "0.0", "text": "def show\n # Chatのidを指定しDBから指定したChat idのMessageにアクセス。\n # message_typeからtextかimageを出力するか決定し、userと一緒に出力\n \n @chat_id = params[:id].to_i\n chat = Chat.find(@chat_id)\n\n @my_id = current_user.id\n\n if @my_id !=...
[ { "docid": "ec0b23afb9d9bc3fde2779a5d7f8959c", "score": "0.7811604", "text": "def index\n @chats = Chat.all\n render json: { chats: @chats }\n end", "title": "" }, { "docid": "4942c513eeac4743bcbe323385d604d1", "score": "0.7689674", "text": "def index\n @chats = Chat.where(...
869edcd4d7895526092ded27b5f57eba
Public: User POSTs a public key, we store against some generated magic words and log the user in.
[ { "docid": "c0d8a3512a3cd2a31f2d1e0b04d6297a", "score": "0.0", "text": "def create\n @user = User.create user_params\n session[:user_id] = @user.id\n\n redirect_to messages_path\n end", "title": "" } ]
[ { "docid": "41aa9ee22094525b40bf16661278347e", "score": "0.6791198", "text": "def public_key(*) end", "title": "" }, { "docid": "41aa9ee22094525b40bf16661278347e", "score": "0.6791198", "text": "def public_key(*) end", "title": "" }, { "docid": "41aa9ee22094525b40bf166612...
083050dc683b572eb6fff9da4e7baf91
wraps a valid asyn JSON container around 'content' bonus feature: It adds a title setting test just for shits n gigs
[ { "docid": "2064fcdcd4b0a405d7b00e5d993155e4", "score": "0.6295553", "text": "def body_wrap content\n\n puts \"Bodywrapping content: \" + content.to_s\n\n cmds = Array.new\n\n cmds << {'verb' => 'set_content', 'noun' => content}\n # debug hack\n cmds << {'verb' => 'set_title', 'noun' => 'done.'}\n\...
[ { "docid": "a9a6260eaf86d9926bfc5d9bb945806f", "score": "0.5997312", "text": "def serve_api_content name\n yield if block_given?\n @title = t name.to_s\n json title: @title, body: t(\"static_content.#{name.to_s}.body\")\n end", "title": "" }, { "docid": "bde81b67dd7aa22e340...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "c20ded4df458657f5ebbef061d23ae1f", "score": "0.0", "text": "def update!(**args)\n @content = args[:content] if args.key?(:content)\n @name = args[:name] if args.key?(:name)\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...
05559f90505ac949bde31ba8f61a0648
Sign the current user out.
[ { "docid": "e555a82d1e166edd231e500893154de0", "score": "0.8307162", "text": "def sign_out\n @username = nil\n @current_user = nil\n\n @token = nil\n end", "title": "" } ]
[ { "docid": "3735e54bcd2685ccb50e1c5acfcb879f", "score": "0.8830482", "text": "def sign_out\n raise Robe::UserError, 'there is no current user to sign out' unless user?\n user.sign_out\n end", "title": "" }, { "docid": "990cb7c509336d2f88ebfe501ec93fd8", "score": "0.882...
753bb6bb40783aa460e40bbd09958b67
TODO this is an improvisation. I will have to get a better way of doing this Make sure that any updates to this should also be made to encounter model / get_mapped_concept_name
[ { "docid": "f7af1f9e1cea7f5fa3c4cfc125d311a5", "score": "0.71210414", "text": "def get_mapped_concept_name(concept_name)\n mapped_concepts = {\n 'eye infection, acute' => 'Red eye',\n 'acute eye infection' => 'Red eye',\n 'acute red...
[ { "docid": "164ff765994c72ec48e4e28c704c833a", "score": "0.7119848", "text": "def get_mapped_concept_name(concept_name)\n mapped_concepts = {\n 'eye infection, acute' => 'Red eye',\n 'acute eye infection' => 'Red eye',\n 'acute red ...
d26d15c8353f064d0c4a1edef3e52f94
the other node connected to node a with this edge
[ { "docid": "00753d2399d6a9d0496cb9d6b85a96cd", "score": "0.0", "text": "def other a\n @a.hash == a.hash ? @b :\n @b.hash == a.hash ? @a : nil\n end", "title": "" } ]
[ { "docid": "1e114e73875f94eed798f2d1e2bdc815", "score": "0.69937027", "text": "def edge\n return @edge\n end", "title": "" }, { "docid": "243b51d66c9cf6d91878390622d74370", "score": "0.6935771", "text": "def neighbor\n #perhaps dup to avoid messing up...
757e97305262f5e762f04b6cf247646a
From displays.rb String formatter for + and time
[ { "docid": "a4d27d57bd583dad13e0e592d4d95bd9", "score": "0.0", "text": "def show_minutes(min = 0.0)\r\n min.nil? ? min = 0.0 : min\r\n time = Time.utc(1, 1, 1, 0, 0, 0, 0.0)\r\n time = time + (min.abs * 60.0)\r\n if min < 0.0\r\n sign = \"-\"\r\n else\r\n sign = \"+\"\r\n end...
[ { "docid": "808fc0cf7d33feeb1f74995e59adc4c6", "score": "0.70471495", "text": "def format_time(time); end", "title": "" }, { "docid": "d5ab9b027a16c179ee7e422816af3415", "score": "0.69079334", "text": "def time_string; end", "title": "" }, { "docid": "fbc48a538e81c596e325...
ed90961cf238c9eba10ebc0997ac3e6f
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ =Convenience methods for permissions and user groups ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pass in a user object to be associated to the administrator user group The group will be created if it doesn't exist
[ { "docid": "3951f0d73d4b002d4395ea6a0af093d7", "score": "0.73463506", "text": "def make_user_administrator(usr)\n user_groups = usr.send(Lockdown.user_groups_hbtm_reference)\n user_groups << Lockdown.user_group_class.\n find_or_create_by_name(Lockdown.administrator_group_string)\n en...
[ { "docid": "92865b2deba4da39174f2b9da74f1905", "score": "0.7435398", "text": "def add_user_to_group(user, group)\n\t\t\tend", "title": "" }, { "docid": "bf0b4649cd51a411f9fabe087e7d7f2a", "score": "0.70590454", "text": "def add_user(user)\n UserGroup.create(user_id: user.id, group...
fcec1c0401764f25eee1a9f0202da711
GET /galaxia GET /galaxia.json
[ { "docid": "39c92ac7d8c7091988d4ee9119c23128", "score": "0.69928813", "text": "def index\n @galaxia = Galaxium.all\n end", "title": "" } ]
[ { "docid": "4e8d2962e1d438e096d65378b1df361e", "score": "0.7004994", "text": "def index\n @galeries = Galery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galeries }\n end\n end", "title": "" }, { "docid": "269570ad1a3a080cb6c...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "ba6f962b7d48e0a174b38264e6d1397c", "score": "0.0", "text": "def bill_params\n params.require(:bill).permit(\n :client_id, :historial_id, :number, :cae, :sale_point, :billed_date,\n :cae_due_date, :afip_response, :amount, :vat_amount, :vat, :bill_type,\n :paid_via,\n...
[ { "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"...
fd7bcebb69b523043c53a8dbcab39d5d
Function to check if a number is ugly or not
[ { "docid": "291698459999d26d3da2ab98c510814a", "score": "0.0", "text": "def isUgly(no)\n no = maxDivide(no,2)\n no = maxDivide(no,3)\n no = maxDivide(no,5)\n\n return (no == 1)\nend", "title": "" } ]
[ { "docid": "6864bb4c7c9611894b53ae4c35b4cb7c", "score": "0.74306756", "text": "def is_ugly(num)\n \n #Ugly number 必須大於0\n #1 = Ugly number\n #能一直被5整除下去,不能整除時往3去確認\n #能一直被3整除下去,不能整除時往2去確認\n #能一直被2整除,不能整除時餘數必須小於2(等於1)\n \n if num <= 0\n return false\n \n elsif num ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "d6500b485efa433ead57e1f83f630068", "score": "0.0", "text": "def set_entry\n @entry = current_user.entries.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...
56355cb1d2113925cd8f0b3e23a59ed9
DELETE /game_judges/1 DELETE /game_judges/1.json
[ { "docid": "89cfe6d277cde1d54a177bef31e71f6a", "score": "0.75366646", "text": "def destroy\n @game_judge.destroy\n respond_to do |format|\n format.html { redirect_to game_judges_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "28cebb5e17adc76ab16b17f086967a37", "score": "0.70878714", "text": "def destroy\n @judge = @competition.judges.find(params[:id])\n authorize @judge\n\n respond_to do |format|\n if @judge.destroy\n format.html { redirect_to competition_judges_path(@competition), notice: \"...
43173332180ade7dd544137dd299ef00
Public Print out the CSV data Example: csv = Ralphttp::CsvExport.new csv.add_header(%w(Title Name Location) csv.add_row(%(CEO Khan Nebula)) csv.print => Title,Name,Location => CEO,Khan,Nebula Returns String list in CSV format
[ { "docid": "cfc3864a8361ff2e19cdbb3e0024fce0", "score": "0.0", "text": "def print\n @data.unshift(@header)\n\n @data.each do |d|\n puts d\n end\n end", "title": "" } ]
[ { "docid": "a4f9960ee788a1bc06ed85192d47b7f3", "score": "0.77189624", "text": "def print_csv\n STDOUT.puts(csv_string)\n end", "title": "" }, { "docid": "1f8d507b0443f716914c5e3399888305", "score": "0.7283793", "text": "def csv_export(header, data, fields)\n CSV.generate do ...
5faded7ab7f97df6afa035ff650b7252
This helper will generate the correct permalink URL for the file path.
[ { "docid": "4f2b0c282f24103606b9350c9cd5ad77", "score": "0.0", "text": "def url_for(relative_path)\n if relative_path.respond_to?(:relative_url) # rubocop:disable Style/GuardClause\n return safe(relative_path.relative_url) # new resource engine\n elsif relative_path.respond_to?(:u...
[ { "docid": "d3e82aab35cfc56f6f80b26a310f1d39", "score": "0.79502773", "text": "def permalink\n if path\n File.basename(path)\n else\n name.to_url\n end\n end", "title": "" }, { "docid": "b58e8a879058c2680bced25a9fd4cadc", "score": "0.77084434", "text":...
42efc887dbc5996443d0423a0ba50ec5
export l2l arr of objects to csv
[ { "docid": "46ec19c710c6821c89d2126a4821be1b", "score": "0.6237908", "text": "def export_to_csv(file_name, arr)\n puts \"Exporting list...\"\n csv_headers = [\"CLS URN:\", \"Lead2Lease Count:\"]\n CSV.open(file_name, \"wb\") do |csv|\n csv << csv_headers\n end\n i = 0\n while i < arr.length\n ...
[ { "docid": "a85c1e53ff1c88cce4076d66a98a2eab", "score": "0.7289149", "text": "def convert_to_csv(obj_array)\n CSV.generate(headers: true) do |csv|\n csv << obj_array.first.keys\n\n obj_array.each do |object|\n csv << object.values\n end\n end\n end", "title": "" }, {...
c715767e01dde6d51800679f05675a9a
DELETE /tipocuenta/1 DELETE /tipocuenta/1.json
[ { "docid": "ae9096cf53535c07838d5a4cd00de073", "score": "0.73677945", "text": "def destroy\n @tipocuentum.destroy\n respond_to do |format|\n format.html { redirect_to tipocuenta_url, notice: 'Tipocuentum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "d6ad97a43f9a8f61f540399ee3bda394", "score": "0.74846035", "text": "def destroy\n @tipoveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tipoveiculos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "93ad4c3470...
ef1be57eba508f82c311e35a040bbf05
Use callbacks to share common setup or cons traints between actions.
[ { "docid": "9cd26580e00fe939229554f58c378f26", "score": "0.0", "text": "def set_salon\n @salon = Salon.where(id: params[:id]).first\n render :file => \"public/404.html\", :status => :not_found if @salon.nil?\n end", "title": "" } ]
[ { "docid": "6ce8a8e8407572b4509bb78db9bf8450", "score": "0.6284829", "text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "title": "" }, { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.61964715", "text": "def r...
38206168efcea6b1e2174dc1ccc42ff2
GET /reports GET /reports.json def index
[ { "docid": "17354236d762e5f45dfc307febf44044", "score": "0.0", "text": "def show\n\n respond_to do |format|\n @laboratory = Laboratory.find(@report.laboratory_id)\n pdf_options = @report.pdf_options\n opts = {:pdf => \"\", :javascript_delay => \"1000\", :disable_smart_shrinking => fals...
[ { "docid": "4b1bbf79725e0b23213cf21d2a96fdd9", "score": "0.86214304", "text": "def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "title": "" }, { "docid": "4b1bbf79725e0b23213c...
69beaa3e957d1fc356539d0314d703e1
Custom attribute writer method checking allowed values (enum).
[ { "docid": "d655aa0eb3d78eab9e17e267abae86ed", "score": "0.0", "text": "def robot1_auto=(robot1_auto)\n validator = EnumAttributeValidator.new('String', [\"Crossed\", \"Reached\", \"None\"])\n unless validator.valid?(robot1_auto)\n fail ArgumentError, \"invalid value for \\\"robot1_auto...
[ { "docid": "8146b840a980695b919bbb80892fcc0c", "score": "0.6161179", "text": "def valid?\n type_validator = EnumAttributeValidator.new('String', [\"GPA_CREDIT_PENDING\", \"GPA_CREDIT_PENDING_REVERSAL\", \"GPA_CREDIT_REVERSAL\", \"GPA_CREDIT\", \"GPA_DEBIT\", \"GPA_DEBIT_PENDING_REVERSAL\", \"GPA_DE...
e418b8826349c241956735fec842b6a8
join_string("Mary had a little lamb, ", "its fleece was white as snow" ) adding a string as a number
[ { "docid": "df3ac3770094aa89e461c5fd7f31f749", "score": "0.64119965", "text": "def add_string_as_number(string_1, string_2)\n string_a = string_1.to_i\n string_b = string_2.to_i\n return string_a + string_b\nend", "title": "" } ]
[ { "docid": "62529871487bae233bea93bf2a8e539d", "score": "0.6484046", "text": "def add_string_as_number(string_1, string_2)\n return string_1.to_i() + string_2.to_i()\nend", "title": "" }, { "docid": "cad2fbebaf48e18fff69645bd53dfeaa", "score": "0.6426722", "text": "def add_string_as...
ebafbc7cc239c0be36ad0671db23fbd4
GET /finanzens/1 GET /finanzens/1.json
[ { "docid": "fcfdd2bc0628f21fc4cf0db5c6e5c422", "score": "0.7339677", "text": "def show\n @finanzen = Finanzen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finanzen }\n end\n end", "title": "" } ]
[ { "docid": "5c79a8d91e6439afc4a5dcca25683b04", "score": "0.70377004", "text": "def show\n @feast = Feast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feast }\n end\n end", "title": "" }, { "docid": "fdabeb626fe5b...
06f59b7eb31cb149899509781f55c847
diagonal going up and right
[ { "docid": "460c90807301765cbe0d549c523900cb", "score": "0.0", "text": "def diagonal_right_win?\n result = false\n\n @state.each_with_index do |row, i|\n next if row.all? { |cell| cell.nil? }\n\n row.each_with_index do |cell, j|\n # only check for win if the cell isn't empty, and ...
[ { "docid": "7e64a0b5fa8dbe75a606419cb96aff91", "score": "0.8227089", "text": "def diagonal\n [up_left, up_right, down_left, down_right]\n end", "title": "" }, { "docid": "96a36459f9c241d7b97a2c3c540c6b52", "score": "0.793036", "text": "def diagonal\n end", "title": "" },...
b6ad3d00ab18a50cf64bf3c44d78bd27
POST /users POST /users.json
[ { "docid": "fd5884e795c689cb9dbf4e95df4626c3", "score": "0.0", "text": "def create_member\n @group = Group.find params[:group_id]\n @user = User.new(user_params)\n @user.password = 'password'\n respond_to do |format|\n if @user.save\n group = Group.find params[:group_id]\n ...
[ { "docid": "24c5e44d772da89269600975eeebdfda", "score": "0.71918935", "text": "def create\n @user = User.new(user_params)\n @user.save\n json_response(@user, :created)\n end", "title": "" }, { "docid": "6e1490da4a56756e02c8de2a503a156e", "score": "0.7185745", "text": "def c...
4bd453435a28a7ced77a575e6c5686a1
GET /newsscripts/new GET /newsscripts/new.json
[ { "docid": "55e58c125eca141c71a1d278e2e2dc23", "score": "0.80289763", "text": "def new\n @newsscript = Newsscript.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newsscript }\n end\n end", "title": "" } ]
[ { "docid": "e3999e02d3eb45b5baccc272b3db75e6", "score": "0.755758", "text": "def create\n @newsscript = Newsscript.new(params[:newsscript])\n\n respond_to do |format|\n if @newsscript.save\n format.html { redirect_to @newsscript, notice: 'Newsscript was successfully created.' }\n ...
a6478687d3086c009fcd333ca5d9efb2
Categories are not approved by default
[ { "docid": "d8244c7ccef4f851b0e2f4a9764b7234", "score": "0.0", "text": "def default_values\n self.approved ||= false\n end", "title": "" } ]
[ { "docid": "5dd95d870c641f7947c6d9c05ffaa6f1", "score": "0.65622073", "text": "def categories\n unless self.SUPPRESS_FROM_OPAC == 'T' or self.SUPPRESS_FROM_INDEX == 'T'\n add_category('opac')\n end\n @categories\n end", "title": "" }, { "docid": "36d8720f856aa8ffb8f6785f6cb821...
c80da1500981a558c2cea2cfede033a3
GET /vacations/new GET /vacations/new.json
[ { "docid": "5ab769b5c7ff03733651647229179388", "score": "0.7921211", "text": "def new\n @vacation = Vacation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @vacation }\n end\n end", "title": "" } ]
[ { "docid": "cdfffac2ac9cfacb419c3253b725e088", "score": "0.7987429", "text": "def new\n @vacation = Vacation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vacation }\n end\n end", "title": "" }, { "docid": "7c264e6f1dc864c487bc4...
61d87e62b6c7fe6de1131e07883fbd01
sends a command to the FIFOfile, which controlls the related mplayerinstance. Example: mp = MPlayer.new mp.run("pause) <send pausecommand to mplayer
[ { "docid": "2ec392f7049337c8e83c65dae2e9f982", "score": "0.6516142", "text": "def run(cmd)\n File.open(@options[:fifo],\"w+\") do |f|\n f.puts cmd\n end\n end", "title": "" } ]
[ { "docid": "685d1792ca177b58faf05814102c1462", "score": "0.6312351", "text": "def sendCommand\n if params[:command] == 'restart'\n @player.pending_action = 'reboot'\n elsif params[:command] == 'contentReload'\n @player.pending_action = 'forceReload'\n elsif params[:command] == 'clear'...
4d201f59d43e493128d14f2f3a9d0b2f
Cart Activity helps identify cart abandonment.
[ { "docid": "9a4c8fc9bc0e9de971e5b8fbf09c6b84", "score": "0.58954775", "text": "def cart_activity(action)\n response = client.create_cart_activity_event(cart_data(action))\n handle_error_response(response) if !response.success?\n\n response.success?\n end", "title": "" } ]
[ { "docid": "3152dae7bdee9fb2255025d4079ac889", "score": "0.5695068", "text": "def commerce_mark_cart_received(cart, status = 'paid')\n args = {cart: cart, status: status}; hooks_run('commerce_before_payment_completed', args)\n order = cart.convert_to_order(status)\n order.set_meta('locale', I18...
f600c9df9e9cc5c9aba81cc2c6b6c7ef
GET /urgencies/1 GET /urgencies/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "b9e0e068666f02c0650edbe1ca21e2a8", "score": "0.7375374", "text": "def index\n @urgencies = Urgency.all\n end", "title": "" }, { "docid": "d8910a7a089b540d2ca7b0d85e07f845", "score": "0.70004165", "text": "def index\n @request_urgencies = RequestUrgency.all\n end",...
4a7dd82042af6aab9bc16855ebd5ab3b
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIE...
[ { "docid": "145ea2c6fe43cf5a99ceb80265517cbb", "score": "0.829055", "text": "def get_bucket_metadata bucket_name:\n # The ID of your GCS bucket\n # bucket_name = \"your-unique-bucket-name\"\n\n require \"google/cloud/storage\"\n\n storage = Google::Cloud::Storage.new\n bucket = storage.bucket buck...
[ { "docid": "9acfe325218aaa1278577998f98ba9b7", "score": "0.6981621", "text": "def get_metadata(path)\n resp = @base_client.head_object(bucket: @bucket, key: path)\n resp.to_h\n end", "title": "" }, { "docid": "2208f3be6b02524294ba2cf5e86d0b54", "score": "0.677639", "text": "de...
1b85c34bd58662a05a02ad76446158f6
DELETE /seat_rooms/1 DELETE /seat_rooms/1.json
[ { "docid": "1ca10fab2a93fd0c0b8ea77cfe70b86b", "score": "0.759424", "text": "def destroy\n @seat_room.destroy\n respond_to do |format|\n format.html { redirect_to seat_rooms_url, notice: 'Seat room was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "t...
[ { "docid": "ad67a0c8e5afe3a7fb1676010d72b8db", "score": "0.7366019", "text": "def destroy\n @seat = Seat.find(params[:id])\n @seat.destroy\n\n respond_to do |format|\n format.html { redirect_to seats_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "doci...
88c984737b40cb2f531910c0ef0b8c00
GET /blog_photos/1 GET /blog_photos/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "9828e221f3c5c792d02107ce04dfd9fb", "score": "0.75891083", "text": "def show\n @photos = []\n unless @blog = Blog.find_by(id: params[:id])\n @blog = { url: params[:id] }\n end\n posts = HTTParty.post(\"https://api.tumblr.com/v2/blog/#{@blog.url}/posts?api_key=z3lrerYuy075yp74...
397be953b23d989bc00f4874903bf9eb
What is the difference between the sum of the squares and the square of the sums of 1..100
[ { "docid": "a916f5b31cb154fe005a699d97f38830", "score": "0.7750663", "text": "def six\n square_of_sum(100) - sum_of_squares(100)\nend", "title": "" } ]
[ { "docid": "5f161091a60ca5fab90b8180eaa2cb2c", "score": "0.8236432", "text": "def p6\n\trange = (1..100).to_a\n\tsquare_of_sum = range.reduce(:+) ** 2\n\tsum_of_square = (range.map{|x| x ** 2}).reduce(:+)\n\tsquare_of_sum - sum_of_square\nend", "title": "" }, { "docid": "baaaa7ae81e6ebb21003...
42a0bdf3bb81362eb3e423a5247c6883
FFmpeg expects a fraction of a second as the last element instead of number of frames. Use this method to get the timecode that adheres to that expectation. The return of this method can be fed to ffmpeg directly. Timecode.parse("00:00:10:24", 25).with_frames_as_fraction => "00:00:10.96"
[ { "docid": "9b1558fe2e859c7bea6480d6b96b5cc4", "score": "0.6498737", "text": "def with_frames_as_fraction\n vp = value_parts.dup\n vp[-1] = (100.0 / @fps) * vp[-1]\n WITH_FRACTIONS_OF_SECOND % vp\n end", "title": "" } ]
[ { "docid": "21999b1fe4454c8d48b73f1dc7329d76", "score": "0.6891175", "text": "def parse_with_fractional_seconds(tc_with_fractions_of_second, fps = DEFAULT_FPS)\n fraction_expr = /\\.(\\d+)$/\n fraction_part = ('.' + tc_with_fractions_of_second.scan(fraction_expr)[0][0]).to_f\n\n seconds_p...
b304a2a2b91b8359367d0426b3998e8e
Creates a new channel.
[ { "docid": "43dee073bef5fce957031a5020b81938", "score": "0.0", "text": "def initialize(name, ts)\n @name = Channel.to_lower(name)\n @ts = ts.to_i()\n # UID array of users in the chan, disregarding CUS\n @users = []\n\n @permanent = false\n \n # ban and exempt entries are arrays them...
[ { "docid": "24b453ec7d7a4fb2c34767196541c935", "score": "0.84859705", "text": "def create_channel(opts_={})\n Channel.new(self, opts_)\n end", "title": "" }, { "docid": "91815c14e1dfebe1b8cb52624bae1392", "score": "0.7988317", "text": "def create_channel(name , password = nil...
11335c2955a8c2673910e7fe3a00b195
Each segment is 8 bits long, meaning the order of these segments needs to be reversed, for example: 11111111 00000000 00001111 10101010 (byte1) (byte2) (byte3) (byte4) should become: 10101010 00001111 00000000 11111111 (byte4) (byte3) (byte2) (byte1) The total number of bits will always be a multiple of 8. The data is ...
[ { "docid": "94e3c1eac09927ea5d63559976f74704", "score": "0.6716375", "text": "def reverse_segments(arr)\n result = []\n (arr.size / 8).times do\n result << arr.shift(8)\n end\n result.reverse\nend", "title": "" } ]
[ { "docid": "32d5ea53052bb5424ab8a21c05dcd133", "score": "0.56540585", "text": "def ricks_data_reverse(data)\n new_data = []\n (data.length / 8).times do\n temp = []\n temp.push(data.pop(8))\n new_data += temp.reverse\n end\n new_data\nend", "title": "" }, { "docid": "3a887876743...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "27099c7f8ee958a19a8c1ae13e3a3848", "score": "0.0", "text": "def set_subscriber\n @subscriber = current_subscriber\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...
203fced2406a7a131e81c13b74486be2
Create a new config based off an existing one. This is useful when the caller wants to override the global configuration source://stripe//lib/stripe/stripe_configuration.rb57
[ { "docid": "3e775f0e85124cd24b4ba6ce59d49c17", "score": "0.0", "text": "def reverse_duplicate_merge(hash); end", "title": "" } ]
[ { "docid": "609b08affee7c38cf14ceddd2eea046c", "score": "0.7190822", "text": "def create_config\n self.config = {} if !self.config\n self.config = default_config().merge(self.config)\n end", "title": "" }, { "docid": "ca3946ec94999fb4f33944d0a2beba66", "score": "0.66456175", "...
ec976d7e5bc3de854b4ac759d38f8ff0
PATCH/PUT /admin/categories/1 PATCH/PUT /admin/categories/1.json
[ { "docid": "0939ef7470ad6a8a2bc3c7f768bc99ed", "score": "0.0", "text": "def update\n if @category.update(admin_category_params)\n flash[:success] =\"Category was successfully updated.\"\n redirect_to admin_categories_path\n else\n flash[:error] = @member.errors.full_messag...
[ { "docid": "d042a4b8d67e19e968d8c4f929e81e33", "score": "0.7458408", "text": "def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end", "title": "" }, { "docid": "64342e33d137990e24b5fa224c350bd3", "sco...
04c71cf194ea2d0222363be2f5b466fb
POST /responses POST /responses.json
[ { "docid": "64a4c2cc112ec405f1fe88c740e0a5e5", "score": "0.5551878", "text": "def create\n @response = Response.new(response_params)\n #mine\n @survey = Survey.find(params[:survey_id])\n @response.ip = request.remote_ip\n @response.survey_id = @survey.id\n @response.survey_id = params[...
[ { "docid": "8133969096a3630059fa46752740d5ff", "score": "0.66384083", "text": "def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end", "title": "" }, { "docid": "899d9c2224d0d5b9c2ba76240e501d90", "score": "0.66362196", "text": "d...
77811e88fa65e43c51ef2c2555c454b0
PUT /event/categories/1 PUT /event/categories/1.json
[ { "docid": "2eeb120437448f0c54d8471401cdda78", "score": "0.6813474", "text": "def update\n @event_category = Event::Category.find(params[:id])\n\n respond_to do |format|\n if @event_category.update_attributes(params[:event_category])\n format.html { redirect_to @event_category, notice:...
[ { "docid": "9838bb2310584ae51451d2de18eec15c", "score": "0.7744688", "text": "def update\n @event = Event.find(params[:id])\n @event.categories.clear\n @event.categories << Category.find_by_name(params[:category][:name])\n\n respond_to do |format|\n if @event.update_attributes(params[:e...
57252721d0e04536fba1b0a22e2e5570
GET /contracts GET /contracts.json
[ { "docid": "07fe4d2909ea07c90b3012be770809f4", "score": "0.76267576", "text": "def index\n @contracts = Contract.all\n end", "title": "" } ]
[ { "docid": "f3bfec2b9bd23369873e7d7f86660512", "score": "0.8365447", "text": "def contracts(contracts = {}); JSON[Api::get_contracts(contracts, self)]; end", "title": "" }, { "docid": "13875ed8f836fc2a87bf85e5b36565a0", "score": "0.8050871", "text": "def index\n @contracts = Contr...
b828b322845f2823dea60374c744eee9
manager_list_by_design Description: This method manages the ordering of the list by the design number. Parameters from params order the desired order, either ascending or descending, of the list by the design number.
[ { "docid": "1c7221decfc20ad5be487442ffb205f9", "score": "0.69170225", "text": "def manager_list_by_design\n \n @sort_order = get_sort_order\n @sort_order[:design] = params[:order] == 'ASC' ? 'DESC' : 'ASC'\n flash[:sort_order] = @sort_order\n \n design_reviews = get_active_r...
[ { "docid": "5c66265089d80f9ceb6d37decd4d8665", "score": "0.6432038", "text": "def manager_list_by_designer\n \n @sort_order = get_sort_order\n @sort_order[:designer] = params[:order] == 'ASC' ? 'DESC' : 'ASC'\n flash[:sort_order] = @sort_order\n \n design_reviews = get_a...
e4ef338de0e5b0e84e9175820c39520b
PATCH/PUT /colour_pieces/1 PATCH/PUT /colour_pieces/1.json
[ { "docid": "02447c9269a77d40df4f45bd8ecd77f8", "score": "0.703177", "text": "def update\n respond_to do |format|\n if @colour_piece.update(colour_piece_params)\n format.html { redirect_to @colour_piece, notice: 'Colour piece was successfully updated.' }\n format.json { render :show...
[ { "docid": "2e33b72b33ced66c901dd4346c8dbe5d", "score": "0.677684", "text": "def update\n respond_to do |format|\n if @colored_piece.update(colored_piece_params)\n format.html { redirect_to @colored_piece, notice: 'Colored piece was successfully updated.' }\n format.json { render :...
88093f5426b7f407032d75c82cd43229
Reports the given exception to Haystack. exception An Exception instance. Returns nothing.
[ { "docid": "1f9d3e21af98f4b98064fe918f07e9a5", "score": "0.5801794", "text": "def report_exception(service_class, service_data, exception)\n backtrace = Array(exception.backtrace)[0..500]\n\n data = {\n 'app' => 'github-services',\n 'type' => 'exception',\n 'class' =>...
[ { "docid": "2388f8b7a5afb10855d4cfdb3b374118", "score": "0.6935503", "text": "def track_and_raise_exception(exception, extra = {})\n process_exception(exception, sentry: true, extra: extra)\n\n raise exception\n end", "title": "" }, { "docid": "dc04c4196126537c917549901e6f...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "9fa1723574ff841f97602c668d6fdb07", "score": "0.0", "text": "def anaprtment_params\n params.require(:anaprtment).permit(:district_number, :numberpp, :location, :source, :area, :number_rooms, :cost_analogue_usd, :floor, :storeys, :building_type, :category_repair, :cost_one)\n end", ...
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6980629", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.67819995", "text": "def strong_params\n params.requ...
d70faf1997bdf26dde2867cc0c1f2836
DELETE /learnwordlists/1 DELETE /learnwordlists/1.json
[ { "docid": "2798a455fbffaa9d63e0155e663eb532", "score": "0.78785414", "text": "def destroy\n @learnwordlist.destroy\n respond_to do |format|\n format.html { redirect_to learnwordlists_url, notice: 'Learnwordlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n...
[ { "docid": "e5139e32b461e206b6575571b157aebf", "score": "0.7729827", "text": "def destroy\n @word_list = WordList.find(params[:id])\n @word_list.destroy\n\n respond_to do |format|\n format.html { redirect_to word_lists_url }\n format.json { head :no_content }\n end\n end", "ti...
9c3b335fd221c59de2e9c4ca23009afa
Confirms a loggedin user as admin.
[ { "docid": "99628d4bb9c471aa9ada9a98304c7c75", "score": "0.0", "text": "def logged_in_admin\n unless current_user.admin\n flash[:danger] = \"Please log in as admin.\"\n redirect_to '/home'\n end\n end", "title": "" } ]
[ { "docid": "8397124a1d9c5aea9cf42f9e989030a4", "score": "0.8333657", "text": "def admin_user\n if user_signed_in? && current_user.adminrole?\n flash.now[:success] = \"Admin Access Granted\"\n else\n redirect_to root_path\n end\n end", "title": "" }, { "docid":...
08cf573e649e2f09743adea341202cbb
for authenticate Show all Employees data
[ { "docid": "222baa11ee23c7f32432929b9d9461b9", "score": "0.7223188", "text": "def index\n @employees = Employee.paginate(page: params[:page]).per_page(10) # pagination (gem 'will_paginate')\n @companies = Company.all\n end", "title": "" } ]
[ { "docid": "92e6a513b8be19869c9acfd9aad7e68b", "score": "0.7572297", "text": "def index\n @employees = Employee.where(\"users_id = ?\",current_user.id)\n end", "title": "" }, { "docid": "14c05e67d198304176572d24905e9d6a", "score": "0.7554283", "text": "def list \n @employees...
bed6fb39bb40533bed292853d4301d2c
Finds projects whose path matches the current_path
[ { "docid": "6fcb5dd0567f7bbb78876e42b6789d74", "score": "0.72527087", "text": "def existing_project\n existing_projects.find do |project_hash|\n project_hash[:Path] == current_path\n end\n end", "title": "" } ]
[ { "docid": "9d79ed58002585f5f246a47a3bb30a73", "score": "0.7914016", "text": "def projects_within_path(path)\n select { |project| project.path.start_with?(path) }\n end", "title": "" }, { "docid": "322adfc7cf5cf8ddbe2ba9bc4cff73b4", "score": "0.746884", "text": "def all_proje...
cbf01b775a21514fe265bdb44fe1949b
Attempt to constantize a string worker_class argument, always failing back to the original argument.
[ { "docid": "f434723cd40f08be49db1385d4b2254c", "score": "0.78931475", "text": "def worker_class_constantize(worker_class)\n return worker_class unless worker_class.is_a?(String)\n worker_class.constantize\n rescue NameError\n worker_class\n end", "title": "" } ]
[ { "docid": "42c438e141de24e2f32d46fce0cc344e", "score": "0.79713064", "text": "def worker_class_constantize(worker_class)\n return worker_class unless worker_class.is_a?(String)\n worker_class.constantize\n rescue NameError\n worker_class\n end", "title": "" ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "6e8eadb88c9e8077452cc72be7dd4573", "score": "0.0", "text": "def set_sc_event_run\n @sc_event_run = ScEventRun.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...
bbbf4d9ec1ed224c123c0b3ac56bf9f5
converts the WCAPI 'uid' into a Nanowrimo::Corefriendly 'id'
[ { "docid": "7c1ca027c877c9abfcc1d84d7ff94cea", "score": "0.67397183", "text": "def id\n @uid\n end", "title": "" } ]
[ { "docid": "f6450fbc507c654ad6308d35ce8871af", "score": "0.7124628", "text": "def uid\n# ustr = \"u#{user_id}t#{target_type}#{target_id}c#{created_at.strftime('%d%m%y%H%M%S')}\"\n # ustr.to_i(36)\n# ustr.hash.abs.to_i\n\n # Make a simple string of attributes concatenated together to act as a...
11cd5102450c8829cf0955be940aaaeb
Returns an unordered list representing the given outline.
[ { "docid": "4d5067e24d3184548b0287186f408c86", "score": "0.6600487", "text": "def format_outline(outline)\n return \"\" if outline.nil?\n if outline.text == \"References\"\n \"</ul><li><a href='##{outline.slug}'>#{outline.text}</a></li>#{format_outline(outline.sibling)}<ul>\"\n els...
[ { "docid": "5acebd6f87a8bec61a05bd6267aa3efc", "score": "0.6350325", "text": "def outline\n @outline ||= elements(:header).map do |element|\n OutlineElement.new(\n element.options[:level],\n element_text(element),\n Kramdown::Converter::Html.send(:new, document, { ...
d0a6c45eb592365990d63fdd7b18512d
PUT /request_types/1 PUT /request_types/1.json
[ { "docid": "41805d9382622af5fd2f9c6e35f198e3", "score": "0.5744904", "text": "def update\n if params[:move]\n move_position(@request_type, params[:move])\n return\n end\n\n respond_to do |format|\n if @request_type.update(request_type_params)\n format.html { redirect_to @r...
[ { "docid": "7e4a0277498a5dc6554b22256019a5d0", "score": "0.6930361", "text": "def update\n @request_type = RequestType.find(params[:id])\n\n respond_to do |format|\n if @request_type.update_attributes(params[:request_type])\n format.html { redirect_to @request_type, notice: 'Request ty...
620931acfd1a89a00e1482378541e55f
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value
[ { "docid": "25a8636255f6e4c5e0c6eac38d3fe98c", "score": "0.0", "text": "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsi...
[ { "docid": "a34f3dad821ba9744bc8d807b65489ad", "score": "0.6722121", "text": "def hash\n [value].hash\n end", "title": "" }, { "docid": "a34f3dad821ba9744bc8d807b65489ad", "score": "0.6722121", "text": "def hash\n [value].hash\n end", "title": "" }, { "doc...
247518a7d4bac00a88a7e45915a147d5
GET /stations/1/arrivals GET /stations/1/arrivals.json GET /stations/1/arrivals.xml
[ { "docid": "3c8636c319bd59c0ea020810643bd397", "score": "0.7134247", "text": "def arrivals\n @station = Station.find_by! uuid: params[:uuid]\n @arrival_board = @station.get_arrival_board\n\n respond_to do |format|\n format.html\n format.xml { render xml: @arrival_board }\n format...
[ { "docid": "3a77cd7f1cbd70ff2800579d0f2db6c6", "score": "0.68572974", "text": "def stations_list\n @route.get_stations_list\n end", "title": "" }, { "docid": "9a7f8ec2507e76a1c8232043a6ef1f04", "score": "0.67645746", "text": "def airport_arrivals(id, params={})\n perform_get...
0ae5c1e9409bfc992e5f746a31db176d
Set the value of the Name input for this Choreo.
[ { "docid": "556b2d3ed77dc127d19f7fa1a0d04847", "score": "0.0", "text": "def set_Name(value)\n set_input(\"Name\", value)\n end", "title": "" } ]
[ { "docid": "bd8df1d1ba74b7b21f005d968816a612", "score": "0.7494862", "text": "def set_Name(value)\n set_input(\"Name\", value)\n end", "title": "" }, { "docid": "bd8df1d1ba74b7b21f005d968816a612", "score": "0.7494862", "text": "def set_Name(value)\n set_input(\"Nam...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "50a8dee9f3ef19b74e3df13ae3984c19", "score": "0.0", "text": "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @msg = args[:msg] if args.key?(:msg)\n @num_occurrences = args[:num_occurrences] if args.key?(:num_occurrences)\n @oldest_time_stamp_in_us...
[ { "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...
72aadddf1eb05e909cfdb5cd3c85f08e
Replaces all slashes by backslashes.
[ { "docid": "cbe8e5ad29e7811a7de47f3635765299", "score": "0.5609693", "text": "def GetWindowsPath(path)\n return path.gsub(\"/\", \"\\\\\")\n end", "title": "" } ]
[ { "docid": "9d76bc47c832516e8eb06ef2189c2fff", "score": "0.8011091", "text": "def convert_slashes(path)\n path.gsub('/', '\\\\').gsub('\\\\', '\\\\\\\\\\\\\\\\') #eek\n end", "title": "" }, { "docid": "123460bd81f48c544c7a40b977debf67", "score": "0.7778968", "text": "def strip_sl...
38ae1dffa5e68515a7647e53eb738360
GET /sports/1 GET /sports/1.json
[ { "docid": "2cdf913aa217d47e417c1f6c4a5c598b", "score": "0.0", "text": "def show\n puts \"\\n******* show *******\"\n end", "title": "" } ]
[ { "docid": "556bb54c0078440af9101a489f88e6b2", "score": "0.79441696", "text": "def sports\n @sports = Sport.find(:all)\n\t respond_to do |format|\n\t\tformat.html # show.html.erb\n\t\tformat.json { render :json => @sports }\n\t end\nend", "title": "" }, { "docid": "c4d07a7b716657438c3e71...
62c2e23b26a3b427462409d203574177
contains the applicationlevel logic to determine if the monitor is in error
[ { "docid": "0751f1f0688a76262fa6545f0ce03940", "score": "0.0", "text": "def in_alert?\n return true if status == 'alert_new' || status == 'alert_still'\n false\n end", "title": "" } ]
[ { "docid": "39678cd42f6b9e2a802fdd26115c1f68", "score": "0.63757783", "text": "def error_log?\n @status.exitstatus & (1 << 6) != 0\n end", "title": "" }, { "docid": "07e9a08cbada9bb9a63a1e4788e9f8e6", "score": "0.63302", "text": "def error_log?\n @status.exitstatus & (1 <<...
c115b7d12d466e4466306b4f7f4de04d
Check for email on the configured interval, if a mail is found it is run through each of the email checker plugins. Any replies returned will be handed to the server's broadcast_mail method.
[ { "docid": "59ecf8ea1b03aa71f37724c8c1b14f65", "score": "0.80214435", "text": "def check\n # if the server doesn't support us, we just do nothing.\n return unless Config.server.respond_to?(:broadcast_message)\n\n info \"starting email checker loop\"\n\n Thread.new do\n ...
[ { "docid": "0ee01955e1b1f729108ab27e56f67188", "score": "0.63811874", "text": "def receive_emails_pop\n self.config_emails.each do |config_email|\n case (config_email.server_email)\n when 'pop.gmail.com'\n Net::POP3.enable_ssl(OpenSSL::SSL::VERIFY_NONE)\n else\n \...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "5799ce13152b8399841171bfe1146282", "score": "0.0", "text": "def mastery_params\n params.require(:mastery).permit(:name, :description, :image)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7497801", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957249", "text": "def strong_params\n params.require(:request).permit(param_white...
26392360525a8dfe5ee19702cb7b2874
GET /events GET /events.json
[ { "docid": "9adf3a9d00cdbde7f1c359e67d4c5883", "score": "0.0", "text": "def index\n @events = Event.all\n end", "title": "" } ]
[ { "docid": "5febda362ddaf472b8c6c6319cecc36f", "score": "0.83372355", "text": "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "title": "" }, { "docid": "6dfa825090a0345739db26145778532e", "score": "0...
8c524a346b2afe32237a3e49cafa0f09
Beware of using this method. If all attributes get removed during sanitation it returns the equivalent of all.
[ { "docid": "f6373b685fddb4c7f8c4a049f6083ae2", "score": "0.0", "text": "def where!(attributes)\n sanitized = sanitize_attributes(attributes)\n all.select do |record|\n sanitized.all? { |key, value| record.send(key) == value }\n end\n end", "title": "" } ]
[ { "docid": "4cd878ad72ac90164b2317166b7d7487", "score": "0.67700076", "text": "def sanitize_inputs\n attributes.each do |attr_name, attr_value|\n next unless attr_value.is_a? String\n self[attr_name] = strip_markup(attr_value).strip\n end\n end", "title": "" }, { "...
0c547ea5d837a392249aa153396fa13a
If no credentials entered this loads them from email.txt and passwords.txt
[ { "docid": "0ecc74796c0db0aef059a7aef3c393a3", "score": "0.6811183", "text": "def login_system (email,password,load_from_file)\r\n if load_from_file == true\r\n @password_from_file = File.readlines 'password.txt'\r\n @password_from_file.each_with_index{|line, i| puts \"#{i+1...
[ { "docid": "5572761daaec052a3a32d39b2aa4d0b7", "score": "0.69868916", "text": "def login_system (email,password,load_from_file)\n if load_from_file == true\n @password_from_file = File.readlines 'password.txt'\n @email_from_file = File.readlines 'email.txt'\n @email_for_password_reset ...
3efd0dd6198dcd9f2ee55112bf4cac22
returns an array with coordinates of the 1's
[ { "docid": "7b21c896e6c8c25422d34f4b286a8bca", "score": "0.70944625", "text": "def find_ones\n ones_arr = []\n\n @image.each_index do |row|\n @image[row].each_index do |column|\n if @image[row][column] == 1\n ones_arr << { :x => column, :y => row }\n end\n end\n ...
[ { "docid": "6a21b2b6ecf77cc5034d11a9ee17921e", "score": "0.7541579", "text": "def find_ones\n one_pixel = []\n @array.each_with_index do |row_array, row_index|\n row_array.each_with_index do |cell, col_index|\n if cell == 1\n one_pixel << [row_index, col_index]\n end\n ...
e7707c0dee3c9f9bc3da0b998fc6b9e7
Buyers can change the bid Story: Bid for items(
[ { "docid": "f5a5f0aa228bdea3b53a5eccb0edd9da", "score": "0.0", "text": "def edit\n @auction = Auction.find(params[:id])\n @item = Item.find(@auction.item_id)\n @search = Item.search(params[:search])\n end", "title": "" } ]
[ { "docid": "f77f8224c0c8d8961db5b8379964b6e9", "score": "0.74356073", "text": "def set_item\n @bid = Bid.find(params[:id])\n end", "title": "" }, { "docid": "d7cd7197abcd17fa94709d38c3d3ed91", "score": "0.6925903", "text": "def on_bid(bid)\r\n \r\n end", "title": ...
6344a38e58ec5bffeb11f5ebb9e6d8c0
Utility method to nil out values that are not white listed
[ { "docid": "8f91f726064e23d6ff6492cc3061eca1", "score": "0.0", "text": "def white_list(record, array_of_fields)\n hash_to_nil_fields = (record.attribute_names - array_of_fields).reduce({}) do |acc, field|\n acc[field] = nil\n acc\n end\n\n record.assign_attributes(hash_to_nil_fields)\...
[ { "docid": "fb9e149cd763c4d2bffdd70d7bed0a13", "score": "0.73140466", "text": "def remove_falsy_values(list)\n\tlist.select {|item| !!item}\n\t\nend", "title": "" }, { "docid": "cb7a5da7e9367726f6eea5f009565256", "score": "0.72938776", "text": "def remove_falsy_values(list)\n list...
71bff5fddefc03c2961a7f39f437a613
to send mail in callback
[ { "docid": "419f2d767b1a1923e74064762ed5b53d", "score": "0.0", "text": "def send_contact_detail_mail\n ContactMailer.send_contact_details(self).deliver_later\n end", "title": "" } ]
[ { "docid": "d7465313f04d55e4ec98a0c9a5863c32", "score": "0.7902259", "text": "def deliver_mail(mail); end", "title": "" }, { "docid": "a3711b90fb61adcda52eaa6ace0a2660", "score": "0.7539857", "text": "def send_email\n \n end", "title": "" }, { "docid": "8b5008d8e29a2f...
0973a9f53c320f9e547bd79a1143cf06
calculates the distance between two hashes: This can both be used between two nodes, a node and a tobestoredorread value or two values.
[ { "docid": "619f9cc96348f70a03fcc608035ef691", "score": "0.8053411", "text": "def calc_distance(hasha, hashb)\n\n\t\treturn hash_as_num(hasha) ^ hash_as_num(hashb) \n\tend", "title": "" } ]
[ { "docid": "101d87f3202b773cd0befb3fb39adab2", "score": "0.7079693", "text": "def distance_to other_dactylogram\n puts \"Computing distance to #{other_dactylogram.identifier}\"\n\n shared_metrics = self.metrics.keys & other_dactylogram.metrics.keys\n distance = shared_metrics.map do...
14f3990e712250ea765f6ec52394e4d6
before_action :login_check, only: [:new, :edit, :show, :destroy]
[ { "docid": "93cb7fb36b92b2bbaef27e1430b59b46", "score": "0.0", "text": "def index\n @product = Product.order(id: :desc).all\n end", "title": "" } ]
[ { "docid": "1584bf3a7aef4d139a94c1d8a3d10818", "score": "0.7655129", "text": "def check_login\n if logged_in?\n redirect_to action: \"index\"\n end\n end", "title": "" }, { "docid": "aa77e62755fe3509f4c4d08d1dd7f19b", "score": "0.7488947", "text": "def login_form\n end",...
a86f14570dd46105b24948bde9a78d52
Determines if a document or documents with the given attributes in a table exist.
[ { "docid": "2f40b4a208fd7c6a35b3cf9838b9450c", "score": "0.6555682", "text": "def matches?\n true.tap do\n table.hashes.each do |attributes|\n return false unless model.where(attributes).exists?\n end\n end\n end", "title": "" } ]
[ { "docid": "a91748a2b0586208e88da90a8b2d631c", "score": "0.74071336", "text": "def exists?(attributes = {})\n field = attributes.keys[0]\n value = attributes.values[0]\n record = find_by(field => value)\n\n record ? true : false\n end", "title": "" }, { "docid": "eac7c...
a5dc0ce751c6c0e2b51822876b591021
Provides operations to call the accrInt method.
[ { "docid": "4316e9b0a196d67bfda7b66c24a7c23e", "score": "0.6189307", "text": "def accr_int()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::AccrInt::AccrIntRequestBuilder.new(@path_parameters, @request_adapter)\n ...
[ { "docid": "d4cb2f38f36d12c44402a74dff8e9554", "score": "0.5696132", "text": "def accr_int_m()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::AccrIntM::AccrIntMRequestBuilder.new(@path_parameters, @request_adapter)\n ...
dd424794b57e885521e52fdd40801468
POST /comments POST /comments.json
[ { "docid": "6920420d9a48a8e7f562b11dce27df13", "score": "0.68296427", "text": "def create\n @comment = @post.comments.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to user_post_path(@user, @post), notice: 'Comment was successfully created.' ...
[ { "docid": "7b0a68ee4df9cfc8f7cc619d01d2577d", "score": "0.7545618", "text": "def create\n @comment = @post.comments.create!(comment_params)\n json_response(@comment, :created)\n end", "title": "" }, { "docid": "278b898b0e96dc8518cb54546e69f368", "score": "0.7373569", "t...
a4daf05b81b45ed69140afcabbebdba9
Reads a list of values from the server if a value does not exist return VALUE ''
[ { "docid": "5af6bac6468726b4639e565c71d2f136", "score": "0.4531408", "text": "def gets(aName,aKeyArray)\n j = 1\n cont = 0\n result = []\n while j < aKeyArray.length do\n i = searchKey(aName,aKeyArray[j])\n if i != '' then\n updateLastGet(i)\n su...
[ { "docid": "ad5afe5cc392f5a289c9228d41088e8c", "score": "0.612596", "text": "def read_values_from_body(value_names)\n values_from_body = []\n [value_names].flatten.each do |value_name|\n values_from_body += read_value_from_body(value_name).split(\",\")\n end\n values_from_body.compact.u...
f3fc709fd510e1b03407ae48adc57e96
POST /blocks POST /blocks.json
[ { "docid": "3f326e4c89a6d91e5da9d92188ba8d26", "score": "0.6725099", "text": "def create\n @block = Block.new(block_params)\n @block_types = BlockType.all().order('id DESC')\n @characters = Character.all().order(:name)\n \n last_block = Block.order('position DESC').limit(1).pluck(:positio...
[ { "docid": "10fe9a1d7e5a1e955cba1f7e84dcb174", "score": "0.77775085", "text": "def block(options = {})\n @req.post(\"/1.1/blocks/create.json\", options)\n end", "title": "" }, { "docid": "37cf8d0805fca0ed9968c0ddd6155e8c", "score": "0.76568806", "text": "def create\n @...
1bff337bdf2f2e5c0009dcdbb794aaeb
GET /surveys/1 GET /surveys/1.json
[ { "docid": "de054ae7014eb835d389449c0376b077", "score": "0.7255839", "text": "def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end", "title": "" } ]
[ { "docid": "cfefb4f387c9fa6fdf3f0524c0736d2c", "score": "0.77450866", "text": "def surveys\n person_id = params[:person_id]\n \n surveys = SurveyService.findSurveysForPerson person_id\n \n render json: surveys.to_json, :content_type => 'application/json'\n end", "title": "" }, { ...
558ab64fdb56d01ed466214879fa8d88
GET /orders GET /orders.json
[ { "docid": "f3a8f932c62f3c14c77c66c1e0d064c6", "score": "0.7660459", "text": "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html\n format.json\n end\n end", "title": "" } ]
[ { "docid": "0018a9a547b20cd7a770a6e2cd109f33", "score": "0.84540474", "text": "def orders\n get(\"orders\")\n end", "title": "" }, { "docid": "8fe2d6ec8a1d47ca8c318cf923eb35b7", "score": "0.84051067", "text": "def orders\n client.get \"orders\"\n end", "title": "" }, ...
86f4e61a3dea803b8b8f48f9a682681a
grep all the recursive child nodes with conditions, and yield the first match node.
[ { "docid": "0bd9030ce3fa7260ffdf7741a60d697c", "score": "0.56396675", "text": "def grep_node(options)\n result = CodeAnalyzer::Nil.new\n grep_nodes(options) do |node|\n result = node\n break\n end\n result\n end", "title": "" } ]
[ { "docid": "e228e256e6d225bae6b74c6b4c6eccb1", "score": "0.7183131", "text": "def grep_nodes(options)\n node_type = options[:node_type]\n subject = options[:subject]\n message = options[:message]\n arguments = options[:arguments]\n self.recursive_children do |child|\n if (!node_type ...
900234f0ce0aa57f8077d12754657524
Get properties of an image. Image data is passed as zeroindexed multipart/formdata content or as raw body stream.
[ { "docid": "f73c6c4b28b550ff1e9de7705e1f5f67", "score": "0.6907174", "text": "def extract_image_properties(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'ImagingResponse')\n end", "title": "" } ]
[ { "docid": "5dcd463d895a56c4dd1b96dbff03447d", "score": "0.70282894", "text": "def img_properties\n par = params[:image]\n if !par\n # json webservice call, not coming from rails form. Change all keys from camelcased to underscores\n par = params\n %w(pageUrl originalUrl calibrateLe...
176289defc2586b7cb851643874660db
DELETE /products/1 DELETE /products/1.json
[ { "docid": "8268b911222fa7ec34549f3ff19d45d3", "score": "0.0", "text": "def destroy\n @product.destroy\n render json: '[{\"message\":\"The product was Deleted\"}]', status: :ok\n rescue ActiveRecord::StatementInvalid\n render json: '[{\"error\":\"The Product part of a transfer\"...
[ { "docid": "e442cbe15cb1b95bb63528b31212142f", "score": "0.77169305", "text": "def destroy\n product = Product.find(params[:id])\n product.destroy\n\n render json: { deleted: params[:id] }\n end", "title": "" }, { "docid": "64fad427142859233816a0e8a205621b", "score": "0.7591891...
3d0651f2ba742407a0c960ef71dd7aa3
GET /graphics/1 GET /graphics/1.json
[ { "docid": "18b333e632d5eeaebd648073f8949844", "score": "0.0", "text": "def show; end", "title": "" } ]
[ { "docid": "517adaff2d78188a874dffbed12b8150", "score": "0.7641829", "text": "def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @graphic }\n end\n end", "title": "" }, { "docid": "b56d97c5...
d12f8b5f7283a49e1af4409b36078dc2
End of Object.self Identity (Blank operation)
[ { "docid": "64b691862eecb7547f713e1f75bf5536", "score": "0.0", "text": "def identity\n return self\n end", "title": "" } ]
[ { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.7454907", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.7454907", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "scor...
b6bca3c8e9ed649138c538b25ccccf47
DELETE /games/1 DELETE /games/1.json
[ { "docid": "56cb1ed1223eb848f738524b182c5f0c", "score": "0.0", "text": "def destroy\n @team = Team.find(params[:team_id])\n @game = @team.games.find(params[:id])\n @convocations = @game.convocations\n\n @convocations.each do |convocation|\n convocation.destroy\n end\n\n @game.dest...
[ { "docid": "fd4eb511cd5e957a76d59b08b0244ce9", "score": "0.7778522", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e556b38f3987e315b050212676687394...
d8aacdc005880d1360c0e9760b64df2d
PUT /lab_tests/1 PUT /lab_tests/1.xml
[ { "docid": "a2c7cbcc8e786137ce97eba7ad4d1033", "score": "0.6774839", "text": "def update\n @lab_test = @test_subject.lab_tests.find(params[:id])\n\n respond_to do |format|\n if @lab_test.update_attributes(params[:lab_test])\n flash[:notice] = 'Lab Test was successfully updated.'\n ...
[ { "docid": "9ddf960eb3f437e62b9b99d34992bc0f", "score": "0.7183864", "text": "def test_should_update_status_post_via_API_XML\r\n get \"/logout\"\r\n put \"/status_posts/1.xml\", :api_key => 'testapikey',\r\n :status_post => {:body => 'API Status Post 1' }\r\n assert_resp...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "0750f86d27b163da0c6a360660593082", "score": "0.0", "text": "def set_account_request_from_token\n @account_request = AccountRequest.get_by_identity_token(params[:token])\n\n # Use confirmation timestamp instead\n if @account_request.nil? || @account_request.confirmed? || @account_req...
[ { "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;...