query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
e659e374f9df85d7ab80e1d34d61869b
Returns the value of the `id` attribute.
[ { "docid": "84607347a1c54679a8961c8525fed15e", "score": "0.0", "text": "def id\n @id\n end", "title": "" } ]
[ { "docid": "d800b257bfdc34d27ff1f519d573830d", "score": "0.8528124", "text": "def id\n (a = attribute('id')).nil? ? a : a.value\n end", "title": "" }, { "docid": "fe58cf24252be77de724e98700a5aef0", "score": "0.82572293", "text": "def id # :nodoc:\n @attributes[ 'id' ]\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "2e63d7e81b3ed510ac8aeffaecedc6b1", "score": "0.0", "text": "def movie_params\n params.require(:movie).permit(:id, :titulo, :imdb, :poster, :ano, :nota, :genero)\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...
51c439d1a849c326e2c5f78338126ec3
Add a white list of extensions which are allowed to be uploaded. For images you might use something like this:
[ { "docid": "e6627fe07158e2dd6f283ec7b53954e7", "score": "0.7892588", "text": "def extension_white_list\n [\"jpg\", \"jpeg\", \"gif\", \"png\", \"ico\"]\n end", "title": "" } ]
[ { "docid": "40a7399e920801aa4963aabc5543d316", "score": "0.83563995", "text": "def extension_white_list\n %w(jpg jpeg gif png) # Gives error message on webpage if upload a different filetype.\n end", "title": "" }, { "docid": "dedd34d73a25e418139b8cd2116fb452", "score": "0.8356185", ...
26bddb846e4971e5a8e1b876ce18915a
Records that processing have ended
[ { "docid": "a927a54cb834c9489ab95625d62ab8cd", "score": "0.0", "text": "def stop_processing\n @end_time = Time.now\n @run_time = @end_time - @start_time\n end", "title": "" } ]
[ { "docid": "08bb0bb5b22ea7a701bf59425bcf1090", "score": "0.74921495", "text": "def batch_finished\n end", "title": "" }, { "docid": "a0b9c10876d21742effc63b405804e0e", "score": "0.7240584", "text": "def on_end_process()\n # subclasses may override this method\n end", ...
f2eee9c346e1c7b9c167776e5089e1cb
lexer rule t__33! (T__33) (in C.g)
[ { "docid": "f8323742d79095cd333cf5fba802d644", "score": "0.64526355", "text": "def t__33!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 11)\n\n type = T__33\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - ...
[ { "docid": "a31665535ad69b4a4f95ffcc62dba933", "score": "0.80889827", "text": "def t__65!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 43)\n\n type = T__65\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - ...
7cc8628309f4bd2f85de84967508c044
Configuration status ROM for the device, list of 32bit hostendian integers.
[ { "docid": "f903685ee44017c4b333c53d27ac1ed2", "score": "0.0", "text": "def csr\n return @csr\n end", "title": "" } ]
[ { "docid": "a5d998368643d36b85ba6928e3fc14f8", "score": "0.53015316", "text": "def device_numbers\n @data.unpack('VV')\n end", "title": "" }, { "docid": "f50ed3b34ca207ff1cdf7009f5a3d475", "score": "0.5231148", "text": "def device_statuses=(value)\n @device_sta...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "72cbe25fdfa7797829a2ef0aab26adc0", "score": "0.0", "text": "def get_interested_categories_form_params\n params.require(:account).permit(category_ids: [])\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...
b70eeb0fa911c0d2df4ff93958c62bc5
returns a list of css file paths for a sass directory
[ { "docid": "1cfeb6f83589ea86faee1b1baf35bee7", "score": "0.0", "text": "def include_javascripts(path)\n if AppConfig.minimize\n \"min/#{path}.js\"\n else\n javascript_list = Dir[\"#{RAILS_ROOT}/public/javascripts/#{path}/*.js\"]\n\n result = []\n javascript_list.each do |javasc...
[ { "docid": "26afed3877d6384bf01cee70ac92a75f", "score": "0.75351274", "text": "def sass_load_paths\n @sass_load_paths ||= [project_src_directory] + Compass::Frameworks::ALL.map{|f| f.stylesheets_directory}\n end", "title": "" }, { "docid": "63929703ede22e001c047033f420db18", ...
c5cd75789e85ae220c51821c39ae18e8
Returns the "EX" field from an SDI error message.
[ { "docid": "4808b9b0ca631568b840ab6ffd7ab492", "score": "0.0", "text": "def ex\n @base_obj.ex\n end", "title": "" } ]
[ { "docid": "eada8f2b80a14dc80a7f7300a5b3822e", "score": "0.65988636", "text": "def error_message\n @fetch_sdi.error_message\n end", "title": "" }, { "docid": "cfdeac4e1c405fe374f5730179f322b7", "score": "0.6533043", "text": "def error_message\n get_parsed_singular('error...
dcda5a1ea0db2d93c692a08cb29faa2e
requests entity count from ReCharge API
[ { "docid": "3af5c1fde73340d3b29aef46a1db77f3", "score": "0.7974094", "text": "def api_count(args)\n query_str = args[:query]\n object_name = args[:entity].pluralize\n my_response = HTTParty.get(\"https://api.rechargeapps.com/#{object_name}/count?#{query_str}\",\n ...
[ { "docid": "a47a5f7cc1530b8afdb0d7e069ccf2f4", "score": "0.71332294", "text": "def count\n call_client(:count)\n end", "title": "" }, { "docid": "8e466a54d53b15778d0691dc4865ffb8", "score": "0.6968997", "text": "def count()\n if @count == -1\n params = @...
085ea32c11de0440b32c84834fed4165
GET /plants GET /plants.xml
[ { "docid": "f5c7b8374896f423bd048e7926166b43", "score": "0.653253", "text": "def index\n #@plant is set by cancan before filter load_and_authorize_resource using Plant.accessible_by(current_ability).\n # see: http://rdoc.info/github/ryanb/cancan/master/CanCan/ModelAdditions/ClassMethods:accessible...
[ { "docid": "e987ce9ee8f9f91abfd7ee93d86836fb", "score": "0.6582643", "text": "def index\n @plants = @garden.plants\n end", "title": "" }, { "docid": "bf78d87c08c3d315b1eaa2c259892736", "score": "0.65341777", "text": "def index\n @user = current_user\n @plants = @user.plants...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "8565ac4267b769993aea63a044a97ad7", "score": "0.0", "text": "def time_management_params\n params.require(:time_management).permit(:chart_year)\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"...
5d680acc00113b9042732de0a54fdc4d
keep audio buffer during this number of frames
[ { "docid": "c63a7668e0a155e8635c0b3dc93221ae", "score": "0.0", "text": "def initialize(conf)\n @conf = conf\n @rate = conf.audio_sample_rate\n @bits = conf.audio_bit_depth\n raise \"sample bits must be 8 or 16\" unless @bits == 8 || @bits == 16\n @pack_format = PACK_FORMAT[@bits...
[ { "docid": "977a519c226ae5b9503eb75721ba7aa1", "score": "0.6420569", "text": "def killBuffer buffer\n @frames.delete buffer\n end", "title": "" }, { "docid": "18e4e64c8a0b5ae9ab0fc99165a3e155", "score": "0.636102", "text": "def flush_buffer\r\n data = @buffer.clone\r\n ...
341f5c850ceda8de52476938997b8b7d
GET /emails/new GET /emails/new.xml
[ { "docid": "9ed02c7324c38b3cf1bec750b486f0f3", "score": "0.68100095", "text": "def new\n return error_status(true, :cannot_create_email) unless (Email.can_be_created_by(@logged_user, @page))\n \n @email = @page.emails.build\n\n respond_to do |format|\n format.html # new.html.erb\n ...
[ { "docid": "c0b04c2caa079aca6a688862e248e7b2", "score": "0.76108825", "text": "def new\n @emails_person = EmailsPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @emails_person }\n end\n end", "title": "" }, { "docid": "01fc...
a5201f9c3a2dd323283fdc52fc851889
Make the robot moves on the table
[ { "docid": "f8220fde0f112fcb616ad9b3370aa64d", "score": "0.73887944", "text": "def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end", "title": "" } ]
[ { "docid": "b1ccb503a9103e0cbb2108b5abbb5409", "score": "0.764751", "text": "def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_...
406b58fb60015106e5517acf88c0f491
GET /confessions/new GET /confessions/new.json
[ { "docid": "42abc8ec10a6431420bce1e3f61a542a", "score": "0.8469158", "text": "def new \n @confession = Confession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @confession }\n end\n end", "title": "" } ]
[ { "docid": "1b3dd6cc9de147cfe5db9a543ee753ef", "score": "0.72809243", "text": "def new\n @competence = Competence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competence }\n end\n end", "title": "" }, { "docid": "13648eda77b920...
8be4a557498b0f77c9dd892dceb955ca
takes a block, pass the value of the key to the block if its present and passes validation
[ { "docid": "f755d867bd31414e81484fea0ac96bdb", "score": "0.0", "text": "def get_request(key, validation)\n if request.include?(key)\n if validation == :boolean\n unless [TrueClass, FalseClass].include?(request[key].class)\n raise \"#{key} should be boolean\"\n ...
[ { "docid": "46b4b0896c45f9cd9ac5ea06669fc8eb", "score": "0.6974784", "text": "def validate_block\n end", "title": "" }, { "docid": "05a368ef1db0ffa0f30b4525fa866471", "score": "0.684928", "text": "def validator(key, &block)\n return if !block\n vals = (@validators[key....
07cc51545186264c51c7770685d5a7ca
space: O(n), n = length of the longer string, via creating the string1 hash
[ { "docid": "1cceb03ec54d9901158ccaa23eb9cefa", "score": "0.0", "text": "def permutations?(string1, string2)\n # return false for different size strings\n return false if string1.length != string2.length\n # true for empty strings\n return true if string1.empty? && string2.empty?\n\n # hash first st...
[ { "docid": "391eca83e5f59cabcb99e6e296568b5d", "score": "0.72140473", "text": "def short_hash\n first_part = to_s.split(' ').first\n Digest::SHA1.hexdigest(first_part)[0..4]\n end", "title": "" }, { "docid": "a245b4485b6d53c4ab3113b4ae2688d7", "score": "0.71011704", "tex...
afbd7ee4855a0613046319372a60acb4
check for duplicates in a given column
[ { "docid": "b0f7b66d18973a29509021131f5e5c68", "score": "0.0", "text": "def check_is_numeric(csv_data, column_name)\n data = csv_data.select{|item| !item[column_name].nil? }\n non_numeric_values = data.filter{|i| !CSV::Converters[:integer].call(i[column_name]).is_a?(Numeric) }\n naughty_values ...
[ { "docid": "aad37860bc6c7389367896eff5e5be1c", "score": "0.75601745", "text": "def check_for_duplicates(csv_data, column_name)\n data = csv_data.select{|item| !item[column_name].nil? }\n value = data.map{|i| i[column_name]}\n duplicates = value.filter{ |e| value.count(e) > 1 }.sort.uniq\n na...
439f04bfa0740d0bc5d12b4d83a5cd9c
POST /merchants POST /merchants.json
[ { "docid": "30e7871358c3cfd2d8d643672c7a9b9e", "score": "0.57516956", "text": "def create\n @merchant = Merchant.new(params[:merchant])\n\n respond_to do |format|\n if @merchant.save\n format.html { redirect_to @merchant, notice: 'Merchant was successfully created.' }\n format.j...
[ { "docid": "7fb729f840344a701e9695ccb4a560ef", "score": "0.7375247", "text": "def get_merchants(request)\n dashboard_request('POST', '/api/get-merchants', request)\n end", "title": "" }, { "docid": "c20122c2ec774f56ee2d2b464974241d", "score": "0.71960133", "text": "def mercha...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "85688fc7793bf93981d9de9bd45b07f7", "score": "0.0", "text": "def set_table_video\n @table_video = TableVideo.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163754", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045816", "text": "def action_hook;...
f260b0743e3635ff851ba1fb8f391b00
GET /users/1 GET /users/1.json
[ { "docid": "995f053e1f31b04037e2ee075f4153d6", "score": "0.0", "text": "def show\n if current_user.role!='admin' && @user.email!=current_user.email\n redirect_to home_index_path\n end\n overdue_calculator\n end", "title": "" } ]
[ { "docid": "9f7c735ace683c5c2b12c914cc9ad8a8", "score": "0.771752", "text": "def get\n users = User.all.as_json\n render(json: users.as_json, status: :ok)\n end", "title": "" }, { "docid": "a95dfe28d6b386aafc5fb53749e84258", "score": "0.75107867", "text": "def user\n...
19e3793921ada8d15fbf2c8d773fd6c2
Automatically respond with 404 for ActiveRecord::RecordNotFound
[ { "docid": "dcc2c0577121fa47f7d0508f6b58db4e", "score": "0.7610271", "text": "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "title": "" } ]
[ { "docid": "938c1cec3bd3ee178551b355f4179f45", "score": "0.7977074", "text": "def not_found\n respond_with 404\n end", "title": "" }, { "docid": "5795cb887e61c8e8a0d1aa688beb9044", "score": "0.7908341", "text": "def record_not_found\n render json: \"Record not found\", s...
f968d5180a8e787da277a3f160414200
Add return_to to session if it's been requested
[ { "docid": "244533198fc8c3576fde1190ce873be0", "score": "0.70018023", "text": "def save_return_to\n session[:return_to] = params[:return_to] unless params[:return_to].blank?\n session[:return_to_after_profile] = params[:return_to_after_profile] unless params[:return_to_after_profile].blank?\n end...
[ { "docid": "53501fe9141b6f3e8da35e62f93a4b4a", "score": "0.75118977", "text": "def store_return_to()\n session[:return_to] = request.env[\"PATH_INFO\"]\n end", "title": "" }, { "docid": "f7c85ac38f85544cd2407f01c8704b79", "score": "0.7435391", "text": "def store_location_to_r...
0560c9c506a6f06156e6aa282c46461f
Returns a nice filename generated from the title.
[ { "docid": "a2d5d5b24932ce5d763cc872940862d9", "score": "0.75800484", "text": "def public_filename\n File.basename(title, ext).parameterize + ext\n end", "title": "" } ]
[ { "docid": "084e0e589cc5d075591b86589a44185d", "score": "0.834869", "text": "def title_as_filename(ext = '', use_uuid: false)\n file_title = title ? title.tr('/:', '_') : \"Untitled\"\n \"#{unique_id(use_uuid)} - #{file_title}#{ext}\"\n end", "title": "" }, { "docid": "e2357ca1a64dacd...
7099f37d8efd533f0bc57565e1c33da2
initialise what's always happening in this class initially.
[ { "docid": "fc83778cbde8f5682bdb4273317e8307", "score": "0.0", "text": "def initialize(options)\n\t\t@name = options[:name] || \"Unnamed Bot\"\n\t\tbegin\n\t\t# Load data files\n\t\t\t@data = YAML.load(File.read(options[:data_file]))\n\t\t# In case data cannot be loaded\n\t\trescue\n\t\t\traise \"Can't ...
[ { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.8159732", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.8159732", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "sc...
26e75325b6b83427c2e76f1aaefc882e
Public: Begin Files migration on the command line opts Hash containing options mappings.
[ { "docid": "841772748045c7eb9734af8aa89b7e9b", "score": "0.5217164", "text": "def initialize(opts)\n @options = opts\n @download_finished = false\n @download_mutex = Mutex.new\n @upload_mutex = Mutex.new\n @download_list = []\n @upload_list = []\n\n source_store = define_store(\"sou...
[ { "docid": "52efc35ab9042509deba024f93f13098", "score": "0.5497546", "text": "def migrate(key, options); end", "title": "" }, { "docid": "44f8feea50eda394d579451edae6fa92", "score": "0.54788935", "text": "def execute!\n load_defaults unless @opts\n\n opts.s_files.each do |sname...
95ada9914209b5429c93d1d5701bac5b
Returns the number of created faces.
[ { "docid": "c10822f8e0890b81ffebf41844edbda1", "score": "0.0", "text": "def create_edge\n model = Sketchup.active_model\n model.start_operation('Edge', true)\n edge = model.active_entities.add_line(picked_points)\n num_faces = edge.find_faces || 0 # API returns nil instead of...
[ { "docid": "3745e9cbd0539c18617ceb89b73067e7", "score": "0.72150755", "text": "def get_faces_count\n @cards_faces.each_with_object(Hash.new(0)) { |key, hash| \n hash[key] += 1 \n }\n end", "title": "" }, { "docid": "054ca90d9cf8c394abc4979c4ea856c6", "score": "0.6570557", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "abd27d5eac94bb2a7b46030ca58b5886", "score": "0.0", "text": "def set_ticket_event\n @ticket_event = TicketEvent.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163754", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045816", "text": "def action_hook;...
e4fcac9c6ac5139cc4413a9b9a3b2dfa
GET /pulses GET /pulses.json
[ { "docid": "ff6c053c581d649464438f3478297516", "score": "0.7001243", "text": "def index\n @pulses = Pulse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pulses }\n end\n end", "title": "" } ]
[ { "docid": "bea9cc7e57de4f15828bd68244ee54a7", "score": "0.64412826", "text": "def get_user_pulses(username, limit = 10, page = 1)\n uri = \"/api/v1/pulses/user/#{username}\"\n params = { limit: limit, page: page }\n results = []\n\n json_data = get(uri, params)\n\n json_data['r...
df38af8be96deb89111e832a58d3fc85
cfg should have [:jump_groups]
[ { "docid": "f91fd2712932fe62ced8cfaef1addae4", "score": "0.0", "text": "def ext_local_shell\n super\n verbose { 'Initiate Mcr Shell' }\n ___init_stat\n ___init_procs\n ___init_conv\n ___init_recview_cmd\n ___init_rank_cmd(@cobj.loc.add_view)...
[ { "docid": "00309183f6e7a39326a9337be8c00e92", "score": "0.565858", "text": "def test_correct_jump_offsets\n assert_instructions \"(true or true or true) or true\", [\n [\"lit\", true], [\"jtrue\", 4], [\"lit\", true], [\"jtrue\", 2], [\"lit\", true],\n [\"jtrue\", 2], [\"lit\",...
e060736b9896fa108a3e5285600bd8a4
DELETE /azufangs/1 DELETE /azufangs/1.json
[ { "docid": "b8f028469768011a65ab65a7efe22650", "score": "0.7058724", "text": "def destroy\n @azufang.destroy\n respond_to do |format|\n format.html { redirect_to azufangs_url, notice: 'Azufang was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title"...
[ { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.75245535", "text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end", "title": "" }, { "docid": ...
1af5a013d7804130e4b83dc33a402b63
GET /engineers/1 GET /engineers/1.xml
[ { "docid": "32000cda8a196ca3fed34c8ab8068ec7", "score": "0.0", "text": "def show\n update_similar\n@engineer = Engineer.find(params[:id])\n @resume = Resource.find_last_by_engineer_id(@engineer)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @enginee...
[ { "docid": "852a763f2128dd295484eb2815369746", "score": "0.71436405", "text": "def show \n @engineer = Engineer.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @engineer }\n end \n end", "title": "" }...
7d727e06a5c639e0e2e264e8eb917398
Checks that file generation was in the format client_name/file_name
[ { "docid": "fcb27013b4ef1cc26f9ead2b845c234a", "score": "0.0", "text": "def has_path_and_filename?\n !(File.dirname(args[0]) == '.')\n end", "title": "" } ]
[ { "docid": "9b0331c2f0857c840794ebbcae86e15d", "score": "0.61567825", "text": "def validate_on_create \n regex = %r{\\.(srm|csv|tcx)$}i\n errors.add(\"filename\", \"is an unsupported format\") unless self.filename.match(regex)\n end", "title": "" }, { "docid": "689e3bfb84aceb273...
e144e94ec43519279222bca8113b8b94
Add any correct colors to the temp_guess
[ { "docid": "448e829ef1ed017355aaec208f89c1e8", "score": "0.80039775", "text": "def add_correct_colors(temp_guess, temp_code, last_guess)\n must_place = {}\n last_guess.each_with_index do |color, slot|\n if color != nil && temp_code.include?(color)\n must_place[color] = slot\n ...
[ { "docid": "0beeb5c4a90f90374369e0f980dfca0b", "score": "0.7449621", "text": "def give_hint(guess)\n\n @correct_color = 0\n\n @correct_color_and_position = 0\n\n @colors = {}\n\n puts @colors.inspect\n\n for i in 0..3\n\n if guess[i] == @code[i]\n\n ...
3ff28896a69061a8b965f6009be899ef
Put the same content in all locale translations
[ { "docid": "40722318ca5552ddb87c487ac690bc69", "score": "0.5702881", "text": "def create_translations\n I18n.available_locales.each do |locale|\n next if locale == I18n.locale\n @micropost.translations.create(locale: locale,\n content: micropost_p...
[ { "docid": "edaf4dc3689d2d0e441d1a4961de1c2b", "score": "0.7089852", "text": "def seed_page_content_translations!\n I18n.available_locales.each do |locale|\n seed_content_for_locale locale.to_s\n end\n end", "title": "" }, { "docid": "335961c358398912a0fb0cb91e9b3...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "080fb67b0f79ed2325e2879f277f10ba", "score": "0.0", "text": "def zip_code_params\n params.require(:zip_code).permit(:code, :city_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
537a11b1224c70d9ac17ff4b5bd1e73f
Permite apenas admin logados
[ { "docid": "ffc79efd16a5fdc30c8172e1f552adda", "score": "0.0", "text": "def check_admin\n redirect_to root_path unless current_user.has_role? :admin\n end", "title": "" } ]
[ { "docid": "ed1281540aa69aaede95b2fc9b0496d0", "score": "0.76467407", "text": "def logged_in_admin\n unless admin?\n # show a flash message on the page\n flash[:danger] = \"Non sei autorizzato a visitare questa pagina\"\n # redirect user to home page\n redirect_to root_p...
385b2895ecf695af224dedf8889c3458
GET /categories/category_id/tags GET /categories/category_id/tags.xml
[ { "docid": "2072b982936b82e41160197c4c62409e", "score": "0.75449246", "text": "def index\n @tags = @category.tags.all\n\n respond_to do |format|\n format.html { redirect_to @category }\n format.xml { render :xml => @tags }\n end\n end", "title": "" } ]
[ { "docid": "9d177f96bf2a2dd934c13b30278ded70", "score": "0.70218337", "text": "def tags\n get('tags')\n end", "title": "" }, { "docid": "8fb11c432a8bb2c5fc11d5fb6181b5b5", "score": "0.6783129", "text": "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\...
87f025aab5c36a34351e511c5b74a3f2
value= stores the value in the Event_recordevent_status. this minor hack lets us share methods with the event class.
[ { "docid": "70bfff85e1a013db592b71dc2d73295e", "score": "0.8096094", "text": "def value=(value)\n @event_status = value \n end", "title": "" } ]
[ { "docid": "11726b5762fdd1cbab043a3081ddb393", "score": "0.7537416", "text": "def event_status=(value)\n @event_status = value\n end", "title": "" }, { "docid": "37565992337d642a26dcb9889017822e", "score": "0.7512181", "text": "def value\n @event_status\n...
d84d3f1d543fe309b3286529670c59f0
POST /text_blocks POST /text_blocks.json
[ { "docid": "bcf977b7f3619f8cee2f90fb7174ab78", "score": "0.66427904", "text": "def create\n @text_block = TextBlock.new(text_block_params)\n\n if @text_block.save\n\t\t\tredirect_to find_redirect(post_params), notice: 'text_block was successfully created.'\n else\n render :new\n end\n ...
[ { "docid": "0909d5d4c8b2360f794befeaa1a747dc", "score": "0.7058462", "text": "def create\n @text_block = TextBlock.new(text_block_params)\n\n respond_to do |format|\n if @text_block.save\n format.html { redirect_to @text_block, notice: 'Text block was successfully created.' }\n...
50f9f185a7e0a4b735aeced6110bd841
Calculates hash code according to all attributes.
[ { "docid": "7c482711eb5ffad1bf9dc8070e148ab2", "score": "0.0", "text": "def hash\n [entity_type, id, title, details, tag_category_id, attachment_type_id, auto_link_to_parent_payload_entity, create_lookup_entity].hash\n end", "title": "" } ]
[ { "docid": "08105588814074a5aed46dbb236c8d02", "score": "0.791457", "text": "def hash_code; Digest::SHA256.hexdigest(@attributes.values.join); end", "title": "" }, { "docid": "706cbdb4c78e6b67e29589df0a4b1b5c", "score": "0.73099273", "text": "def attr_hash\n md5 = Digest::MD5.ne...
554882478d934b2a91cf78d2f54fb025
PUT /quizzs/questions/1 PUT /quizzs/questions/1.xml
[ { "docid": "2744e649e9152a59e4da5e2b525e9359", "score": "0.0", "text": "def check\n @quizz = Quizz.find(params[:id])\n @user = User.find(session[:user_id])\n $i = Result.where(\" userid= ? AND questionid = ?\", @user.username, @quizz.id).count\n if $i == 0\n @result = Result.create(userid: @us...
[ { "docid": "6e2612e562749d74a9ae623e96014d97", "score": "0.7152569", "text": "def save_question(uin, xml)\n uri = File.join(@base_url, \"api/qais/questions\", uin)\n issue_request(:put, uri, xml)\n end", "title": "" }, { "docid": "a91213a81bb9835043d9ecf8ed7cc4f6", "score": ...
08684a97bb5d046ff712a08a3bf61b4d
Resque Status expects a Hash
[ { "docid": "83b8f2950f6cfb4f6e5877be2d7756cb", "score": "0.0", "text": "def to_hash\n Hash[(instance_variables - [:@validation_context, :@errors]).map {|v| [v.to_s[1..-1],instance_variable_get(v)]}]\n end", "title": "" } ]
[ { "docid": "25f6e4575d637f5561886f5ae522a775", "score": "0.7864258", "text": "def status\n Resque::Plugins::Status::Hash.get(resque_key)\n end", "title": "" }, { "docid": "2d8d472772be08522c89811d8bf9d4ab", "score": "0.75340986", "text": "def status_hash\n if self.resque_job\n...
cf3d9061af50332798b92a0518cd26cb
Create a new Game and a new Log
[ { "docid": "08ed4cd4c6c87f8853e38b4eed49cb3a", "score": "0.7236687", "text": "def create\n # Get date (for table game)\n date = params[:start_date]['year']+'-'+params[:start_date]['month']+'-'+params[:start_date]['day'] if params[:start_date]\n # Get Opponent id (for the table log)\n opponen...
[ { "docid": "bc38e8603bdd9afcf8cb93b3942760c1", "score": "0.68688875", "text": "def create_new_pg_game\n @log.debug \"bot create_new_pg_game on state #{@state_pg_create}, supported games num: #{@supported_games.size}\"\n if @state_pg_create != :submitted\n #p @supported_games\n @supported...
d43fafa3d24d46e1d72e1e3d5aa2df42
Function Name: setProgressValue Activity: Function for witing progress ratio Param: objects
[ { "docid": "dd88e935e8ff5f4e3ea4def755a33528", "score": "0.585184", "text": "def setProgressValue(key, value)\n\n\t\tif key == @key_progress\n\t\t\t@progress = value\n\t\tend\n\n\t\tif @progress == nil\n\t\t\t@progress = \"\"\n\t\tend\n\t\t\n\t\tbegin\n\t\t\tcontents = @key_progress + \":\" + @progress\...
[ { "docid": "13869c9403d421fc95f32c1685e6a4e9", "score": "0.7547446", "text": "def progress(value)\n\t\t\tend", "title": "" }, { "docid": "1d9e4bc5c23e4ed78a802c2a2657a674", "score": "0.74744827", "text": "def setProgress(*val)\n $exec.setProgress(*val)\n end", "title": "" }...
ad9e92965d88c9b024029f84bcc8134d
PATCH/PUT /scat2s/1 PATCH/PUT /scat2s/1.json
[ { "docid": "c8d1d7014d9b82b26fa2d762ec5aed90", "score": "0.6426731", "text": "def update\n @scat2 = Scat2.find(params[:id])\n\n @scat2.incident_datetime = @scat2.s_to_date(params[:incident_datetime])\n @scat2.evaluation_datetime = @scat2.s_to_date(params[:evaluation_datetime])\n\n process_...
[ { "docid": "20645b5c3bf9d5916aab0a757b3297ea", "score": "0.6409007", "text": "def update\n respond_to do |format|\n if @sp2.update(sp2_params)\n format.html { redirect_to @sp2, notice: 'Sp2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @sp2 }\n ...
dc8394da6a3b50d8efe9067eee8b3d14
=== Descripcion Constructor de la clase, en caso de no existir denomidador se pone la unidad ==== Atributos +n+ filas +d+ columnas ==== Examples Fraccion.new(2, 2) Fraccion.new(4, 5)
[ { "docid": "3187890ee3dc218ed4eccd4358e5a6d4", "score": "0.5671107", "text": "def initialize(a,b)\n\t\tif b==0\n\t\t\traise \"Error de ejecucion. Division entre 0\"\n\t\telse\n\t\t\t@n,@d = a,b\n\t\tend\n\t\t#Se simplifica al crear la fraccion\t\t\n\t\t@n, @d = @n/mcd(@n, @d), @d/mcd(@n, @d)\t\n\tend", ...
[ { "docid": "286af6ffbd21bca276e7d74ce5c03956", "score": "0.6877969", "text": "def initialize(filas, columnas)\n #Variable que guarda el numero de filas de la matriz.\n @filas=filas\n #Variable que guarda el numero de columnas de la matriz. \n @columnas=columnas \n end", ...
e1b37cafa49c4c6c72967a72e0d2e413
PUT /expense_options/1 PUT /expense_options/1.json
[ { "docid": "6cce63763581c18d84e2457fb4c85e15", "score": "0.7598447", "text": "def update\n @expense_option = ExpenseOption.find(params[:id])\n\n respond_to do |format|\n if @expense_option.update_attributes(params[:expense_option])\n format.html { redirect_to @expense_option, notice: '...
[ { "docid": "00e78f549976a03f8bbefb0a802ff425", "score": "0.67968106", "text": "def update\n respond_to do |format|\n if @api_v1_initiative_expense.update(api_v1_initiative_expense_params)\n format.html { redirect_to @api_v1_initiative_expense, notice: 'Initiative expense was successfully ...
3f1d533abc7e113d2a17fe38c1746cf1
GET /top GET /top.json
[ { "docid": "37ee6b86c5467e74d2e50a0cffe92ac4", "score": "0.0", "text": "def index\n redirect_to top_show_path if user_signed_in?\n end", "title": "" } ]
[ { "docid": "b7973ac9f436029831b9b6d81f4f239f", "score": "0.83180326", "text": "def top\n\n url = Url.new\n @top = url.top\n\n respond_to do |format|\n format.html { }\n format.json { render json: {status: 'SUCCESS', data:@top}, status: :ok }\n end\n\n end", "title": "" }, ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "51e242f3700576a6d21ff49024afcd23", "score": "0.0", "text": "def user_params\n params.require(:user).permit(\n :name,\n :email,\n :password,\n :password_confirmation\n )\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496716", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6956598", "text": "def strong_params\n params.require(:request).permit(param_white...
1b7a376dfdd2139ad0b16b891a31c79e
Devuelve la hora de hoy en formato HH:MM
[ { "docid": "ce2c7a25b6fdfe1aad84cd271bcae91d", "score": "0.7519537", "text": "def ahora\n Time.now.strftime('%H:%M')\nend", "title": "" } ]
[ { "docid": "2ec4784acebd4f0c03e2ec7334dc8df8", "score": "0.75621605", "text": "def hora_geracao\n Time.current.strftime('%H%M%S')\n end", "title": "" }, { "docid": "2ec4784acebd4f0c03e2ec7334dc8df8", "score": "0.75621605", "text": "def hora_geracao\n Time.cur...
3f8857ce06130ea56769ba0596af40b0
full? method determines if there are any open positions left on the board
[ { "docid": "6a97fedb34f4a01f5a386ce5c348fcef", "score": "0.6996003", "text": "def full?(board)\n board.none? do |position|\n position == \" \" || position == \"\" || position.nil?\n end\nend", "title": "" } ]
[ { "docid": "36fd10704dfa96b9adb40eb6d862c84f", "score": "0.81009", "text": "def board_full\n\n # Assume the board is full\n result = true\n\n # Outer loop through each row\n for row in 0..BOARD_MAXIMUM_INDEX\n\n # Inner loop through each column\n for column in 0..BOARD_MAXIMUM_INDE...
b25dd7334227b2c6f114f36507632b04
POST /tours POST /tours.json
[ { "docid": "102b113c0fa4641792e9c0667df13ff1", "score": "0.0", "text": "def create\n @tour = Tour.new()\n\n @tour.name = params[:tour][:name]\n @tour.place = params[:tour][:place] \n @tour.date = params[:tour][:date] \n @tour.time = params[:tour][:time]\n # @tour.description = params[:...
[ { "docid": "56fcbd51a611d146adff3da8df92c15f", "score": "0.69214255", "text": "def create\n @tour = current_user.hosted_tours.new(tour_params)\n\n respond_to do |format|\n if @tour.save\n format.html { redirect_to @tour, notice: 'Tour was successfully created.' }\n format.json {...
bf3eb7abc11d8bf6b396e579af44b47f
This allows you to manually specify the graph aliases to use when using graph. You can use it to only select certain columns, and have those columns mapped to specific aliases in the result set. This is the equivalent of +select+ for a graphed dataset, and must be used instead of +select+ whenever graphing is used. gra...
[ { "docid": "c80d25bbdcc89e8401abcf57ad82ecf5", "score": "0.8549909", "text": "def set_graph_aliases(graph_aliases)\n columns, graph_aliases = graph_alias_columns(graph_aliases)\n if graph = opts[:graph]\n select(*columns).clone(:graph => Hash[graph].merge!(:column_aliases=>graph_aliases...
[ { "docid": "80b8ee86bb7e57056b18f8e17c6e711d", "score": "0.77693874", "text": "def graph_alias_columns(graph_aliases)\n gas = {}\n identifiers = graph_aliases.map do |col_alias, tc| \n table, column, value = Array(tc)\n column ||= col_alias\n gas[col_alias] = [table, colum...
b9ed265efb7981832dc2982d1f5e93c5
Single task with successor of smaller priority
[ { "docid": "02a1e83b72dce1f119f7a271df11025b", "score": "0.71631813", "text": "def testSingleSuccessorSmallerPriority\n # Create 2 tasks of different priorities to 2 resources, 1 successor of the other\n executeSimpleTest(\n [ [ 'T1', 'R1', 100, 2, [], ' =='],\n [ 'T2', 'R...
[ { "docid": "f47a60b82e16a6e5489ed5e60c817a0a", "score": "0.70686615", "text": "def testSingleSuccessorGreaterPriority\n # Create 2 tasks of different priorities to 2 resources, 1 successor of the other\n executeSimpleTest(\n [ [ 'T1', 'R1', 200, 2, [], ' =='],\n [ 'T2', 'R...
761d2a7402cd6a0c14c64bc8b0e7a673
Call this in the class of a controller to skip the check_authorization behavior on the actions. class HomeController :index end Any arguments are passed to the +before_filter+ it triggers.
[ { "docid": "bbf10addf74997baf94118c877e6685f", "score": "0.75262547", "text": "def skip_authorization_check(*args)\n self.before_filter(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end", "title": "" } ]
[ { "docid": "defb5f2df80d2d9ee9b3196ab243bc97", "score": "0.74842954", "text": "def skip_authorization_check(*args)\n self.before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end", "title": "" }, { "docid": "76963bf1...
ff3d946a51e4b6ab25a492f94eb44df9
DELETE /avis/1 DELETE /avis/1.json
[ { "docid": "a9b56c5c196d605b908e97af213e18ca", "score": "0.0", "text": "def destroy\n @avi.destroy\n respond_to do |format|\n format.html { redirect_to avis_url, notice: 'Avi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "179ff0053e8f4f967cb3d92206094cf0", "score": "0.72689486", "text": "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "title": "" }, { "docid": "689d5a07a403c4b765ba178e4aff08a3", "score": "0.71751493", "text": "def dele...
7cfa2ee75b84ffbdcaafe54bffb034a8
Allow override via ENV.
[ { "docid": "0950cddbfd9daaeb506f78bb8ddadca4", "score": "0.0", "text": "def memory_per_jruby(memory)\n if ENV['TEST_MEM_JR']\n Puppet.debug(\"Using TEST_MEM_JR=#{ENV['TEST_MEM_JR']} for memory_per_jruby\")\n return ENV['TEST_MEM_JR'].to_i\n end\n fit_to_memory(memo...
[ { "docid": "5e82d12fae13588b48a88ea59947debf", "score": "0.71627676", "text": "def environment_override(env, create_key=false)\n env.each do |key, value|\n flexvar = normalize_envvar(key) # Get an array of symbols representing the path\n if data_path = get_path(@data, flexvar, create_key)\...
04bbb1056c42ae591248d56ec61ecef7
Extract the variables out of a gettext variable part We cannot simply split the variable part on a comma, because it can contain gettext calls itself. Example: :a => 'a', :b => 'b' => [":a => 'a'", ":b => 'b'"] TODO clean up if it's possible
[ { "docid": "d667ad266ebe0b7b993a5773bb118f3d", "score": "0.56493485", "text": "def get_variables_splitted\n return if variable_part.nil? \n in_double_quote = in_single_quote = false\n method_indent = 0 \n s = 0\n vars = []\n variable_part.length.times do |i|\n token...
[ { "docid": "d9d8d8dfbc48be8dbab10cde25ee4d13", "score": "0.6923807", "text": "def translate_with_args text, locale \n parts = text.split /(%\\{\\w+\\})/\n parts.inject(\"\") do |res, part|\n res << var_translate(part, locale)\n end\n end", "title": "" }, { "doci...
b5e052a09d1f4ea76987fe4e45ab4fe4
defines a method on the model instance named after the identifier and then creates a CLI command matching that, so for example: given a model called 'Post' and an action named 'publish' the brief CLI executable will respond to: brief publish posts PATH_GLOB this will find all of the Post models from the documents match...
[ { "docid": "c798758cf440ce3ddb9d7c5b13b48862", "score": "0.70368415", "text": "def action(identifier, _options = {}, &block)\n Object.class.class_eval do\n command \"#{identifier}\" do |c|\n c.syntax = \"brief #{identifier}\"\n c.description = \"run the #{identifier} comman...
[ { "docid": "5438c99799a4aa12eae101a4b67ed34c", "score": "0.6221186", "text": "def create_command(meth)\n if meth == \"perform\"\n alias_method command_name, meth\n else\n # Prevent exception about command without usage.\n # Some commands defin...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "5acbd2145d7e9a3a39e8ba3c92e6f237", "score": "0.0", "text": "def set_hostel\n @hostel = Hostel.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...
6b1c02dae084b67811c4bcb0e3d24ab7
Send an HTTP PUT request to the path
[ { "docid": "07125f16aad3873222e039b85b0f4e84", "score": "0.0", "text": "def put_rest(path, json, headers={})\n run_request(:PUT, create_url(path), headers, json)\n end", "title": "" } ]
[ { "docid": "c7d3cd0f218c42e01dbd0246ab7b00c9", "score": "0.8464229", "text": "def put(path, params={}); make_request(:put, host, port, path, params); end", "title": "" }, { "docid": "07918d5a67562e424f50e841ebcd6a84", "score": "0.83296806", "text": "def put(path , params = {})\n ...
8829da356585d451697e52bf15eb0116
PUT /ped_goals/1 PUT /ped_goals/1.json
[ { "docid": "70e7b5b412ee0f25b45f87f7f1179ec9", "score": "0.7133899", "text": "def update\n @ped_goal = PedGoal.find(params[:id])\n\n respond_to do |format|\n if @ped_goal.update_attributes(params[:ped_goal])\n format.html { redirect_to @ped_goal, notice: 'Ped goal was successfully upda...
[ { "docid": "1cae1d99d3f3470d22671f6eecee5895", "score": "0.7218137", "text": "def update!(**args)\n @goals = args[:goals] if args.key?(:goals)\n end", "title": "" }, { "docid": "1cae1d99d3f3470d22671f6eecee5895", "score": "0.7218137", "text": "def update!(**args)\n ...
2936e4e85fc1f1018b8dbffe29a50325
Returns the immediate parent
[ { "docid": "028f4d4a2ef1af42654f578dab360665", "score": "0.0", "text": "def parent\n super\n end", "title": "" } ]
[ { "docid": "ea94e139c23b4eb555afc4363ce942b8", "score": "0.8436946", "text": "def parent\n nil\n end", "title": "" }, { "docid": "b29e7ab8336f902458f3bb4f5e20a9ea", "score": "0.84113014", "text": "def _parent\n @__parent || nil\n end", "title": "" }, { "do...
6590d799b51a0a9dcf027941abb6c64c
array The array input2 The number Examples append([1, 123, 10], 4) => [1, 123, 10, 4] Returns the complete array
[ { "docid": "2ee06704876307071e6d1b4e1dd1678c", "score": "0.79071426", "text": "def append(array, input2)\n output = array\n output << input2\n return output\nend", "title": "" } ]
[ { "docid": "bc995cc6bffe11a0898e3d11bc2cce05", "score": "0.71283776", "text": "def append(arr, num1)\n return arr << num1 \nend", "title": "" }, { "docid": "65a9a9dbfab1dd4cc14e27f4bcfdcd39", "score": "0.71247023", "text": "def custom_concat(array1, array2)\n array2.each do |nu...
32ff474da6079064f27c230204c25405
Add persistent volume that will be deleted only if transaction failed. this volume is important for result of transaction and it is needed after it ends.
[ { "docid": "d3e6b0a12f606d8d8ed9cc9ec8b91ae3", "score": "0.6055124", "text": "def add_persistent_volume(volume, host_spec = {:host_name => 'localhost'})\n @per_volumes_by_hosts[host_spec[:host_name]] << volume\n @hosts_specs[host_spec[:host_name]] ||= host_spec.to_h\n end", "title...
[ { "docid": "1e12407e045c49971dc372af3efbb25a", "score": "0.62166", "text": "def addVolume(dev, size, type: \"gp2\", delete_on_termination: false)\n\n if setDeleteOntermination(dev, delete_on_termination)\n MU.log \"A volume #{dev} already attached to #{self}, skipping\", MU::NOTICE\n...
416c3cccddcfd3660c80213b7f4ddab2
def ip ips.first end schedule a creation of virtual machine by creating an action with command 'create_vm' (action object autmatically schedules background job).
[ { "docid": "bbaae44dfc893641f7907157fd90b23e", "score": "0.7814056", "text": "def schedule_create_vm!\n with_lock do\n actions.build(command: :create_vm, payload: create_vm_options || {})\n enqueue\n save!\n end\n rescue => err\n LabManager.logger.error(\"Cannot create action `c...
[ { "docid": "8360c699d6e0c3036028a92829ab40c3", "score": "0.6929527", "text": "def schedule_vm_instance(record)\n cloud_client = cloud_client_instance(record.user_id)\n vm_id = cloud_client.instantiate_vms('scalarm', record.image_secrets.image_identifier, 1,\n ...
42848f93ed908e067853030a9015220c
deactivate all active smtpservers called whan a new server is activated Smtpserver class method is scoped, so only account.smtpservers are fetched.
[ { "docid": "7d022e0424f96e5c3ecb2ec4b64985f4", "score": "0.7601505", "text": "def deactivate_all\n Smtpserver.activated.update_all active:false\n end", "title": "" } ]
[ { "docid": "072029799d9fdf917e46c104ca92aa7c", "score": "0.57756615", "text": "def stop_all\n @servers.each do |s|\n terminate_server(s) if s.state == 'operational' || s.state == 'stranded'\n end\n @servers.each { |s| s.wait_for_state(\"stopped\") }\n # unset dns in our local ...
86eb1bf25be01f2c49f60d623d37d6fc
Converts a Time object to a Fixnum (integer) representing milliseconds.
[ { "docid": "3fe8bccb3614ac9ebe1d76ec664661c2", "score": "0.63100314", "text": "def format_time(time)\n time = time.to_f * 1_000\n [0, time.to_i].max\n end", "title": "" } ]
[ { "docid": "8be01919ecfcb34178ac49ffff2d9347", "score": "0.8245527", "text": "def toMillis(time); (time.to_f * 1000).to_i end", "title": "" }, { "docid": "da1e807adb74b490c5cc6cab73293cbc", "score": "0.8087816", "text": "def toMillis(time)\n (time.to_f * 1000).to_i\n end", "t...
c98031fe76f1998bb679e44b04d4c2f3
DELETE /people/1/skills/1 DELETE /people/1/skills/1.xml
[ { "docid": "ba451bc94e6870670e3f2e2d0ad76650", "score": "0.0", "text": "def destroy\n redirect_to @person and return if params[:cancel]\n\n flash[:notice] = \"#{@skill.name} was successfully deleted.\" if @skill.destroy\n\n respond_to do |format|\n format.html { redirect_to @person }\n ...
[ { "docid": "db49b3acab8dafc694d9ad4cf271d872", "score": "0.66659915", "text": "def destroy\n @user_skill = UserSkill.find(params[:id])\n @user_skill.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_skills_url) }\n format.xml { head :ok }\n end\n end", "titl...
a67f38aaae6ed8460af5d58b17cd4e6c
Return status as text
[ { "docid": "44b3aab884325bef1026d5ebed48dac8", "score": "0.0", "text": "def status\n serf_statuses[self['Status']] || \"unknownStatus:#{self['Status']}\"\n end", "title": "" } ]
[ { "docid": "d1ecc7e01ec027cfa3f2917d79579728", "score": "0.87693954", "text": "def get_status_text\n return @status_text\n end", "title": "" }, { "docid": "f75a9322dfe0d5f7e0c13cd52e9348b1", "score": "0.85536724", "text": "def status_text\n return @@status_values[self.st...
afe5ce891121b41eedaa5457810ea0e9
def onboarding_completed!(onboarding_type) self.onboarded false) end
[ { "docid": "0e982b0b5bf8c566ae597f31a238c220", "score": "0.0", "text": "def invited_startups!\n self.setup << :invite_startups\n save\n end", "title": "" } ]
[ { "docid": "2f49765a52e01adaa1aa816913d7c1be", "score": "0.6599083", "text": "def show_onboarding?\n AppSettings['onboarding.complete'] == '0'\n end", "title": "" }, { "docid": "dbc1bf624ec2ea7d942eb1813d7809e9", "score": "0.63736033", "text": "def toggle_status # Toggle status m...
cf6707ffbb3c0838b0c1f1c396271717
Randomly generate filename for uploaded photos. This prevents someone from guessing the URL of another event's photos.
[ { "docid": "eceb39a43fd9725ed52a61b29d34d1b7", "score": "0.0", "text": "def filename\n return unless file\n if model.send(\"#{mounted_as}_changed?\")\n # Generate a secure name for the new file\n extension = file.extension == 'jpeg' ? 'jpg' : file.extension\n \"#{secure_token}.#{ext...
[ { "docid": "33a2f3ac6e150935941797e0b7c7a1ef", "score": "0.79307383", "text": "def filename\n \"#{SecureRandom.hex(10)}.jpeg\"\nend", "title": "" }, { "docid": "20fd8d7e362101ae90b4215a8909f004", "score": "0.79038954", "text": "def generate_unique_file_name\r\n return unless file...
faaef5f201eafc3a5d79d5afa05e944d
POST /live_reviews POST /live_reviews.json
[ { "docid": "1448a26837c691eb7f10f8a927fafcbc", "score": "0.73936427", "text": "def create\n @live_review = LiveReview.new(live_review_params)\n\n respond_to do |format|\n if @live_review.save\n format.html { redirect_to @live_review, notice: 'Live review was successfully created.' }\n ...
[ { "docid": "b9b6c4a115c7988fe1574861dafe21e1", "score": "0.70291716", "text": "def create\n @review = Review.create!(review_params)\n\n render json: @review\n end", "title": "" }, { "docid": "c787beba1147c19c1c8dad0480e2df61", "score": "0.6975898", "text": "def create\n ren...
ca91c94748253679c3bdd11529a7bdff
Removes an existing network ACL network_acl.destroy ==== Returns True or false depending on the result
[ { "docid": "fc7cc819a64d8de2c3c9095eb404c109", "score": "0.8497649", "text": "def destroy\n requires :network_acl_id\n\n service.delete_network_acl(network_acl_id)\n true\n end", "title": "" } ]
[ { "docid": "e640df378cc7935807a42cb3024952dd", "score": "0.71785516", "text": "def destroy\n @aws_network_acl.destroy\n respond_to do |format|\n format.html { redirect_to aws_network_acls_url, notice: 'Aws network acl was successfully destroyed.' }\n format.json { head :no_content }\n ...
b96a40374dfe1eae844f5eb55178de8b
Process files as they are uploaded: process :scale => [200, 300] def scale(width, height) do something end Create different versions of your uploaded files: version :thumb do process :resize_to_fit => [50, 50] end Add a white list of extensions which are allowed to be uploaded. For images you might use something like t...
[ { "docid": "c03f32931be11f5f128d26ce7e70d34c", "score": "0.0", "text": "def extension_white_list\n %w(jpg jpeg gif png bmp)\n end", "title": "" } ]
[ { "docid": "27191c1daa163a4e77ce50ee7c04c86b", "score": "0.6353897", "text": "def process_img\n path = self.local_path_with_file\n process_options = attachment_options[:thumbnails][:options]\n process_options.each do |p|\n ImageScience.with_image(path) do |img|\n ...
85924cb1d60431fa94f673013daed02f
Generate summary table of what was parsed
[ { "docid": "6498b3ebbe443d63a3d7abc810358f1f", "score": "0.0", "text": "def generate_overview html = false\n templates = Set.new(@tracker.templates.map {|k,v| v[:name].to_s[/[^.]+/]}).length\n warnings = checks.warnings.length +\n checks.controller_warnings.length +\n ...
[ { "docid": "8cdd0454aeff5bba21ab4f1d7b30cb1a", "score": "0.72830194", "text": "def summary; end", "title": "" }, { "docid": "8cdd0454aeff5bba21ab4f1d7b30cb1a", "score": "0.72830194", "text": "def summary; end", "title": "" }, { "docid": "8cdd0454aeff5bba21ab4f1d7b30cb1a",...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "beb31a24d35ad6d95c2dfc288988e15b", "score": "0.0", "text": "def update!(**args)\n @alias = args[:alias] if args.key?(:alias)\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...
fe1313d3ad41ab31df691a61c152bb0b
Replace this with your real tests.
[ { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.0", "text": "def test_truth\n assert true\n end", "title": "" } ]
[ { "docid": "16a6d5e8eabd975007f205c109c50890", "score": "0.7378937", "text": "def testing; end", "title": "" }, { "docid": "1068832c8229c37488788b46a0871f26", "score": "0.6994956", "text": "def testing\n end", "title": "" }, { "docid": "8fbc98d9068bd9c82033a031286f0a1e",...
4b6ba954be474701b8573deeace82ac3
PATCH/PUT /timetable_us/1 PATCH/PUT /timetable_us/1.json
[ { "docid": "17a5344591a55c8d2730441d5b89e047", "score": "0.7566812", "text": "def update\n\n respond_to do |format|\n if @timetable_u.update(timetable_u_params)\n format.json { render :show, status: :ok, location: @timetable_u }\n else\n format.json { render json: @timetable_u...
[ { "docid": "4315e2e807528ec598597c2ad4a3898f", "score": "0.7535556", "text": "def update\n @timetable = Timetable.find(params[:id])\n\n respond_to do |format|\n if @timetable.update_attributes(params[:timetable])\n format.html { redirect_to @timetable, notice: 'Timetable was successful...
b89fcff803cbc66e80cb5e55f08ba7e4
The full path for the instance resource. Values are of the form `projects//instances/`.
[ { "docid": "4ba197f01abeeb047ce5d08c57d53a25", "score": "0.0", "text": "def path\n @grpc.name\n end", "title": "" } ]
[ { "docid": "a0ddef50f036d3bbe94fbb5d63ec46c4", "score": "0.7512389", "text": "def instance_path instance_id\n Admin::V2::BigtableInstanceAdmin::Paths.instance_path project: project_id, instance: instance_id\n end", "title": "" }, { "docid": "085deebf7527f669cda803bb2209a605",...
a68c06e5eba21f285e5e34d593669bc4
Publishes the queued_task to the receivers
[ { "docid": "0f16a2413707990af01476be2eac9afb", "score": "0.66550195", "text": "def publish_queued_task(name, cur_publish_on, options={})\n cur_publish_on = Time.now + cur_publish_on if cur_publish_on.kind_of?(Fixnum)\n raise \"Expected Time type. Got:\" + cur_publish_on.class.name unless cur_...
[ { "docid": "bc271a89aacca09d24e8a655e97765cc", "score": "0.6815543", "text": "def _publish\n puts(\"pushing message: #{self.to_json} to queue #{@queue}\")\n AMQPCli.instance.push(self.to_json, @queue)\n end", "title": "" }, { "docid": "8a20b5b208909154429a1ce13c10ed41", "score": "...
154e54f71c2f422ca1f9416f0bb67b73
Non generic methods (will work on only 'file' table)
[ { "docid": "bf910f14f0534b9dd6625d6e6b47015e", "score": "0.0", "text": "def clear_test_database\n log_info(\"Delete contents of #{DB_NAME_TEST} (hard coded name)\")\n end", "title": "" } ]
[ { "docid": "763f6b48ab33ff31486f5bf0f8bc4470", "score": "0.670413", "text": "def files; end", "title": "" }, { "docid": "763f6b48ab33ff31486f5bf0f8bc4470", "score": "0.670413", "text": "def files; end", "title": "" }, { "docid": "763f6b48ab33ff31486f5bf0f8bc4470", "sc...
6f41442e55111ff00864d4464120a9be
Using JRuby to build the WAR file is necessary, as MRI Ruby can build broken files, even with the same set of rubygems. Especially gettext seems to be a problem.
[ { "docid": "bec3e4d343eaae7107ced319a7e95895", "score": "0.5423505", "text": "def define_warble_task\n desc 'Create a WAR package with Warbler'\n task :warble do\n jruby_home = (ENV['JRUBY_HOME'] || @config.class::JRUBY_HOME)\n unless jruby_home\n info 'JRUBY_HOME is not...
[ { "docid": "2d5a4f2fd9ea5dc2b04729d00c7473a0", "score": "0.7029974", "text": "def create_war(args)\n #Run warbler\n system(\"jruby -S warble\")\n web_inf = File.join(\".\", \"tmp\", \"war\", \"WEB-INF\")\n rave_jars = File.join(File.dirname(__FILE__), \"..\", \"jars\")\n #Delete the complete JRuby ...
84e734302eb702f7a6332835c70d6cec
endpoint read GET /searches
[ { "docid": "eac7070202c3d82541198e5a747e7db5", "score": "0.0", "text": "def index\n @search_conditions = SearchConditionService.list(current_user.id)\n end", "title": "" } ]
[ { "docid": "72c47bd35d3820128debc21eda36b9d0", "score": "0.79486996", "text": "def Search query\n \n APICall(path: \"search.json?query=#{query}\",method: 'GET')\n \n end", "title": "" }, { "docid": "df9e529167b779b7cfec5e76294c2a9b", "score": "0.7541854", "t...
c42d3795ce41f9fc4db9cd7806770f89
Create a new stack and update the response values
[ { "docid": "4ce93347098d1e835cd5bfe4590d5764", "score": "0.73246396", "text": "def create_stack(response, resource, properties, parameters, message)\n stack = remote_api(properties[:location]).stacks.build(\n :name => generate_stack_name(resource),\n :template => properties.fetc...
[ { "docid": "dda6714a192e97ac4130217b2277bab5", "score": "0.695994", "text": "def create\n @stack = Stack.new(stack_params)\n\n if @stack.save\n render json: @stack, status: :created, location: @stack\n else\n render json: @stack.errors, status: :unprocessable_entity\n end\n end", ...
8ef6014181df2cd090cca4ff6d3121c0
Returns the html/js to make any tables matching selector sortable
[ { "docid": "4c526bde2ce8f9f250a3e85a6fb82bbd", "score": "0.8003266", "text": "def sortable_table(selector, default_sort)\n column, direction = (default_sort || \"\").split(\"_\")\n\n res = javascript_include_tag \"jquery.tablesorter.min.js\"\n js = <<-EOS\n makeSortable(jQuery(\"#{ se...
[ { "docid": "3b5117c65116e0ecd2fc39beb7f72800", "score": "0.71216196", "text": "def sortable_table(options={}, &block)\n raise \"Must specify block\" unless block_given?\n options[:id] ||= 'sortable'\n id = \"id='#{options[:id]}'\"\n #\n result = \"<table #{id} cellpadding=\\\"0\\\" cellsp...
d4a1edaae4d92d004632cf64501ce2e7
DELETE /users/1 DELETE /users/1.json
[ { "docid": "15bbd6148634eeae1703a9d0983f5a27", "score": "0.0", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "be9d8ff5c0124f1d5efc98ec2baa3fc1", "score": "0.7590564", "text": "def test_delete_user\n delete '/users/2'\n data = JSON.parse last_response.body\n\n assert_equal 'Daniel', data['name'], 'Propiedad name incorrecta'\n assert_equal 'Arbelaez', data['last_name'], 'Propiedad last_nam...
1f9815ea8f730d6e8fde5beb97a1b3fc
Finishes building the macro and returns it as a drawable object. The width and height affect nothing about the recording process, the resulting macro will simply return these values when you ask it. Most usually, the return value is passed to Image::Image().
[ { "docid": "ad1ba4b68c50e34ec9719741cb91990a", "score": "0.53260684", "text": "def end_recording(width, height); end", "title": "" } ]
[ { "docid": "23ebb0f213fc126b4c11badde856cd54", "score": "0.5609783", "text": "def create_contents\n self.contents.dispose\n self.contents = Bitmap.new(width - 32, [height - 32, row_max * @line_h].max)\n end", "title": "" }, { "docid": "23ebb0f213fc126b4c11badde856cd54", "score": "...
ade48ac14071cb3a8a61c014db427465
loads a player hash given an api_player_id
[ { "docid": "491bec3ab8d6422117953477dae618a8", "score": "0.6577874", "text": "def load_player_by_id(player_id)\n connect(\"players/#{player_id}\")\nend", "title": "" } ]
[ { "docid": "12f5b8518061aeabb3c1c774412228e6", "score": "0.6580069", "text": "def find_PlayerID(playerId)\n request_api(\"https://api-nba-v1.p.rapidapi.com/players/playerId/#{playerId}\") \n end", "title": "" }, { "docid": "ea09e800ccdae226c8b207ff9bbb4d0b", "score": "0.65673405", ...
0040c904b35405d0d94701c2e8d6dae9
Finish auth process and get access token Arguments: authz_code: (String)
[ { "docid": "5e7856639388e59b8a8ee9428add9dda", "score": "0.685581", "text": "def get_access_token(authz_code = nil)\n if @config.grant_type == 'client_credentials'\n $LOG.i \"getting access token\"\n\t @access_token = @oauth2_client.client_credentials.get_token\n $LOG.i \"got a...
[ { "docid": "b3e33c85328b4d74779fbd2464bbecd5", "score": "0.74531996", "text": "def oauth_complete(code)\n # Let's compile the API URL we're calling.\n url = PUTIO_BASE_URL + \"/oauth2/access_token?client_id=%i&client_secret=%s&grant_type=authorization_code&redirect_uri=%s&code=%s\" % [@client_...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "958fe4d85cfc4d14cba066ea7ca5d7d7", "score": "0.0", "text": "def delivery_params\n params.require(:delivery).permit(:start_date, :delivery_date, :quantity, :cncjob_id, :deliverytype_id)\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"...
a39ba30747b6ae4b6217dd32032521d4
Create a new ClickHouse database.
[ { "docid": "391d50294fed9f695d1bc1e95da987d3", "score": "0.7360857", "text": "def create_database(name)\n sql = \"CREATE DATABASE #{quote_table_name(name)}\"\n log_with_debug(sql, adapter_name) do\n res = @cluster.post(\"/?#{@config.except(:database).to_param}\", \"CREATE DATABASE...
[ { "docid": "710bb35fa44e5b95bd1b333b04324097", "score": "0.77707094", "text": "def create_db\n conn = PG.connect(dbname: 'postgres')\n conn.exec(\"CREATE DATABASE #{@db_name}\")\n end", "title": "" }, { "docid": "abacf7928b0b47b67b79a5a77f921606", "score": "0.76897144", "text"...
bd004121454581c4d063cc186a195627
Read evpn tunnel endpoint configuration Read evpn tunnel endpoint configuration.
[ { "docid": "8113d80e9f0054ecac87bbe5373abfc1", "score": "0.5808924", "text": "def read_evpn_tunnel_endpoint_config_with_http_info(tier_0_id, locale_services_id, tunnel_endpoint_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingCo...
[ { "docid": "20099b3263d82aaad0c7953a8fed67de", "score": "0.6971458", "text": "def read_evpn_tunnel_endpoint_config(tier_0_id, locale_services_id, tunnel_endpoint_id, opts = {})\n data, _status_code, _headers = read_evpn_tunnel_endpoint_config_with_http_info(tier_0_id, locale_services_id, tunnel_end...
b53cead4383f1a910f2b42a60d99027f
Given a new Valkyrie Resource, generate a random UUID and assign it to the Resource
[ { "docid": "c501ac0dbd91dd23258e98f506de2553", "score": "0.70906395", "text": "def generate_id(resource)\n Valkyrie.logger.warn \"The Solr adapter is not meant to persist new resources, but is now generating an ID.\"\n resource.id = SecureRandom.uuid\n end", "title": "" } ]
[ { "docid": "dd75146b32b04adb9d11be08aafbfba5", "score": "0.78877884", "text": "def create\n super\n resource.uuid = SecureRandom.uuid\n resource.save\n end", "title": "" }, { "docid": "6350ba796dd2bd547399908acd351d70", "score": "0.7540216", "text": "def create_uuid\n se...
ea0d37956b233fdf744621d6e5d6ca3d
tag management ajaxly rename the tag
[ { "docid": "655147b3386a9dc26a190b2a17259964", "score": "0.7862847", "text": "def rename_tag\n if request.post?\n tag = Tag.find(params[:tag_id])\n tag.name = params[:tag_name]\n tag.save\n render :text => tag.name\n end\n end", "title": "" } ]
[ { "docid": "a52aeb060ada1ad6eaf9676069bbced6", "score": "0.6944099", "text": "def rename_tag(old_name, new_name)\n options = { :old => old_name, :new => new_name }\n doc = process_request(API_URL_RENAME_TAG + options.to_query)\n doc.at('result')['code'] == 'done' \n end", "tit...
0c34560b7cdd531821353a8549856ccd
GET /posts/1 GET /posts/1.json edit here
[ { "docid": "6f08fb3e91c8c92ee48725be5be308e4", "score": "0.0", "text": "def show\n @post = Post.find(params[:id])\n if @post.us_id != current_user.id \n redirect_to denial_index_path\n end \nend", "title": "" } ]
[ { "docid": "c884d3048f42b4b1b768c271940bbed7", "score": "0.69828844", "text": "def show\n post_id = params[:id]\n render json: V1::Post.get_a_post(post_id)\n end", "title": "" }, { "docid": "bcbeb2abcf5878da3e007d92fc48139a", "score": "0.69724923", "text": "def show\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "0a210e2cfae1b84e909e62169ec09671", "score": "0.0", "text": "def section_container_params\n params[:section_container].nil? ? {} : params[:section_container].\n # Change from Demid:\n # permit(:position, :after, :document_id, :section_text)\n permit(:position, :after, :docum...
[ { "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...
8ac987c1405e55a52dbb9ab1c5e37776
log a warning message to the LogServer or cout
[ { "docid": "4817433907038bc2471551544e1324c8", "score": "0.8379522", "text": "def logWarning(message)\n found = false\n if ($logMessages)\n\tlogServer = get($serverPath+'log')\n\tif (logServer != nil)\n\t\tlogServer.warning(message)\n\t\tfound = true\n\tend\n end\n if (!found or !$logMessages or $pr...
[ { "docid": "5255ccdbf9b865e598d5eaaebc0220d2", "score": "0.8527695", "text": "def warning(msg) log(4, msg); end", "title": "" }, { "docid": "298d5640a30adad00a40746a987744bc", "score": "0.79191846", "text": "def warn(msg); @logger.warn(msg); end", "title": "" }, { "docid"...