query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "6ab6b035a1b682d1f0596317cdfc43d6", "score": "0.0", "text": "def geolocation_place_params\n params.require(:geolocation_place).permit(:id, :geo_location_place, :latitude, :longitude, :resource_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.79428834", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.6957111", "text": "def permitted_params\n params.permit!\n end", "title"...
fcbab3a2401abccff50465b98110de25
snippetend:[ruby.example_code.dynamodb.BatchWriteItem] snippetstart:[ruby.example_code.dynamodb.DeleteTable] Deletes the table.
[ { "docid": "ea58e482ec54407395dbca85c26b0777", "score": "0.755306", "text": "def delete_table\n @table.delete\n @table = nil\n rescue Aws::DynamoDB::Errors::ServiceError => e\n puts(\"Couldn't delete table. Here's why:\")\n puts(\"\\t#{e.code}: #{e.message}\")\n raise\n end", "title...
[ { "docid": "d0a1de847f6712fef81b99de8102c616", "score": "0.741634", "text": "def do_delete_table\n converge_by(\"delete DynamoDB table #{new_resource.table_name}\") do\n dynamodb.delete_table(table_name: new_resource.table_name)\n end\nend", "title": "" }, { "docid": "1038f79ec10402e66e...
c79c46c40b74707079f14f2e3a388080
define ratio ( 1 == network keeps 100% and Vydia keeps 0% )
[ { "docid": "f9d7991482a4a73468834c7cc8a6839b", "score": "0.0", "text": "def split_keep\n Network.default_split\n end", "title": "" } ]
[ { "docid": "1fe5bedb35a68e52cc324820f8d317b4", "score": "0.72284734", "text": "def ratio\n \n end", "title": "" }, { "docid": "466414a35fcd660553bf83cc0f285d7b", "score": "0.70238703", "text": "def vat_ratio\n 1 + vat_rate / 100\n end", "title": "" }, { "d...
5178d673cdea7f4f20ce30086c4e7261
When we're compiling the last statement of a set of statements within a scope, the instructions sometimes change from pops to leaves. These kinds of peephole optimizations can reduce the overall number of instructions. Therefore, we keep track of whether we're compiling the last statement of a scope and allow visit met...
[ { "docid": "cf325cae6141cc258f04bbc61db20a10", "score": "0.5644726", "text": "def with_last_statement; end", "title": "" } ]
[ { "docid": "11616547defb19cab75d19b2d7302dce", "score": "0.6326898", "text": "def end_of_statement?(last_token, last_kind); end", "title": "" }, { "docid": "11616547defb19cab75d19b2d7302dce", "score": "0.6326898", "text": "def end_of_statement?(last_token, last_kind); end", "titl...
a8bef1cf199580bf0251dc829a1a26b1
Add a flag for drugs with an age limit e.g. don't use in under 16
[ { "docid": "480af4ba20143bea94bcdca751a9983b", "score": "0.6132145", "text": "def age_limit\n str = /child under 16 years not recommended/\n if dose.match(str) || cautions.match(str)\n return 16\n else\n return nil\n end\n end", "title": "" } ]
[ { "docid": "022cb5760cb6c3b9c08bbfd209d4861e", "score": "0.7185453", "text": "def age_limit\n if age.present? && age.year > Time.now.year - 15\n errors.add(:age, \" must be at least 15 years old to get a suggestion\")\n end\n end", "title": "" }, { "docid": "e19fa4af64c5a6acbb818...
32d2388aa7de6651e43947580698c7d7
Get teleport type for scene
[ { "docid": "22dd337266c2ed4932c7870b9ddf551c", "score": "0.5496983", "text": "def csca_teleport_type\n @note =~ /<csca tele: (.*)>/i\n return $1.to_sym\n end", "title": "" } ]
[ { "docid": "6f65f73386a1720775dc432af148c7b8", "score": "0.61216867", "text": "def type\r\n @type ||= 'Scene'\r\n end", "title": "" }, { "docid": "cc70681c963726b9c11151bb4ae42337", "score": "0.5973777", "text": "def get_scene_type(scene_type_id)\n get \"commandcente...
0bc27d66b2adf82a10c5da363201183f
Schedules an action to be executed after dueTime
[ { "docid": "746ae829474fbb4d91ae69a8d849935c", "score": "0.62068206", "text": "def schedule_relative_with_state(state, due_time, action)\n raise 'action cannot be nil' unless action\n\n dt = Scheduler.normalize due_time\n return self.schedule_with_state state, action if dt == 0\n\n d...
[ { "docid": "e809cf0aa4764e6f98131c19a5aece5c", "score": "0.69376534", "text": "def schedule_relative(due_time, action)\n raise 'action cannot be nil' unless action\n schedule_relative_with_state(action, due_time, method(:invoke))\n end", "title": "" }, { "docid": "0ebc3400740cc8...
d55db9c359dc91673c53b07d889da179
Returns the XML for a SOAP request.
[ { "docid": "f7c7bf1fbd69710f6b969c1721036d95", "score": "0.61959785", "text": "def to_xml\n @xml ||= tag(builder, :Envelope, complete_namespaces) do |xml|\n tag(xml, :Header) { xml << header_for_xml } unless header_for_xml.empty?\n if input.nil?\n tag(xml, :Body)\n ...
[ { "docid": "adc5e39908ca1ff59910b737ad1fd0c1", "score": "0.78037524", "text": "def request_xml\n builder = Builder::XmlMarkup.new\n builder.instruct!(:xml, encoding: \"UTF-8\")\n\n builder.tag!(\"S:Envelope\",\n \"xmlns:S\" => \"http://schemas.xmlsoap.org/soap/envelope/\") do |e...
5d65f432a94598d525740791599b43ab
PUT /books/1 PUT /books/1.xml
[ { "docid": "abd86509e521af5f232c1f3d1e9d2a47", "score": "0.6370943", "text": "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book)...
[ { "docid": "e631b376ae2ccb776680432bf94b01cc", "score": "0.69026035", "text": "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "title": "" }, { "docid": "b73cd865e3b363ddc...
22d3f9fadd68440b18567ede48141918
DELETE /answers/1 DELETE /answers/1.json
[ { "docid": "1d59772ab69f020cb06c50475edbf33e", "score": "0.76281995", "text": "def destroy\n @@question.num_answers -= 1\n @@question.save\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.jso...
[ { "docid": "7e424e988ff941c50c2f6b1e3363193e", "score": "0.7804042", "text": "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7e424e988ff941c50c2f6...
ef853b01a15edd666b1e511c25de97e8
Come il rimanda, ma usando un percorso relativo.
[ { "docid": "4952848030a695305f0334f0cb7f4afc", "score": "0.64418054", "text": "def rimanda_relativo(costante, percorso_archivio)\n sorgente_chiamante, linea_chiamante = ottieni_sorgente_e_linea_chiamante caller_locations\n archivio_da_tradurre = archivio_relativo sorgente_chiamante, percorso_ar...
[ { "docid": "b4a20e8a6b2b466d569aad8c01641716", "score": "0.6567644", "text": "def rimanda_relativo(costante, percorso_archivio)\n sorgente_chiamante, linea_chiamante = ottieni_sorgente_e_linea_chiamante caller_locations\n archivio_da_tradurre = archivio_relativo sorgente_chiamante, percorso_arc...
036ff1133a34b7b1d3da55ac4a0d5961
Determines the index on the recommendation tables based on the dealer's count.
[ { "docid": "92ba536152f920ddf58a08408e163366", "score": "0.61641705", "text": "def dealer_index(dealer_count)\n if dealer_count == :A\n -1\n else\n dealer_count - 2\n end\n end", "title": "" } ]
[ { "docid": "9688a302a0c315c39ccd76d41ae2b6b8", "score": "0.6711111", "text": "def recommendation(dealer_count)\n if soft?\n if pair? #pair of aces\n @@pair_table[0][dealer_index(dealer_count)]\n else\n case non_ace_count\n when (8..10) then @@soft_table[0][dealer_inde...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "9632d8bd821d4c919b5e7341beea4bbe", "score": "0.0", "text": "def pokemon_params\n params.require(:pokemon).permit(:pokemon_specy_id, :level, :nickname, :hp, :attack, :defense, :sp_attack, :sp_defense, :speed, :iv_attack, :iv_defense, :iv_sp_attack, :iv_sp_defense, :iv_speed, :iv_hp, :ev_...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74968386", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958337", "text": "def strong_params\n params.require(:request).permit(param_whit...
9f1af16b21a9ff65027f0c30543c0ba2
POST /adventures POST /adventures.json
[ { "docid": "14624223769596cdc7193cbef87d5829", "score": "0.0", "text": "def create\n params[:adventure][:user_id] = current_user.id\n @adventure = Adventure.new(params[:adventure])\n\n respond_to do |format|\n if @adventure.save\n format.html { redirect_to @adventure, notice: 'Adven...
[ { "docid": "9b640b1cd7bc0f4a26f392c164294311", "score": "0.6256887", "text": "def create\n @adventue = Adventue.new(adventue_params)\n\n respond_to do |format|\n if @adventue.save\n format.html { redirect_to @adventue, notice: 'Adventue was successfully created.' }\n format.json...
1b728f7d1eb696dc03ecc071ad8ed968
TODO: Adjust the corresponding config values its quite hard to find the right balance of the numbers so that the game is neither too easy nor too hard. maybe I should build a function which tries out different combinations for me to choose from.
[ { "docid": "1f6aa73abfbcc5874441fa72dab346bd", "score": "0.0", "text": "def grow\n if [:sown, :growing].include?(state)\n @state += 1\n\n # Adjust the quality of the crop\n @quality += self.water ? cfg(:quality).can : -cfg(:quality).can\n @quality += self.soil ? cfg(:qua...
[ { "docid": "61629c3dce5d008863a3d5fa29f12757", "score": "0.6560361", "text": "def affordable_combos\n self.option_prices\n combinations = @option_prices.select{|k,v| v <= to_cents(@budget)}.keys\n unless combinations.empty? then combinations else \"You can't afford anything...\" end\n end", ...
f64043fd6b8ba50f40afe093ff065883
skip_before_filter :require_no_authentication before_action :authenticate_root!
[ { "docid": "85b8a71a1ba942df5c2c4da532116cad", "score": "0.0", "text": "def require_no_authentication\n if professor_signed_in? && current_professor.email.to_s == \"root@hanyang.ac.kr\"\n render \"professors/registrations/new\", resource: current_professor\n #redirect_to new_professor_sessi...
[ { "docid": "9114a8540702e0962944c7889c55b013", "score": "0.77547085", "text": "def not_authenticated\n redirect_to root_path\n end", "title": "" }, { "docid": "32881cb5e389a9fb251bfd04fd302303", "score": "0.7420343", "text": "def authenticate\n redirect_to(root_path) u...
8bfceb34c8469b7f69ba0a25704cb7f4
This did not work: has_many :used_by_zunits, :through => :used_by_zmethods, :source => 'zreturn' Therefore we have the following method.
[ { "docid": "6a8015ef01746c570f38547620f962e4", "score": "0.5770177", "text": "def used_by_zunits\n\t\tmethods = used_by_zmethods\n\t\tres = []\n\t\tmethods.each { |method|\n\t\t\tres << method.owner\n\t\t}\n\t\tres.uniq\n\tend", "title": "" } ]
[ { "docid": "e71e8bb3ce401356220a5601875f21cc", "score": "0.5606203", "text": "def get_rented_units\n #implement\n end", "title": "" }, { "docid": "0f6dde93f389deccf90fae8ff55b8df4", "score": "0.52926975", "text": "def find_mates\r\n self.order_part.order_items\r\n end", "...
e464acae6efa9f001b1a27ee72f49df9
Task 2: Create a String to Sign for Signature Version 4
[ { "docid": "3c4012ff4eae808fa8b4441101937ba6", "score": "0.73419166", "text": "def string_to_sign\n [\n 'AWS4-HMAC-SHA256',\n @timestamp.strftime('%Y%m%dT%H%M%SZ'),\n credential_scope,\n Digest::SHA256.hexdigest(canonical_request)\n ].join(\"\\n\")\n end", "t...
[ { "docid": "08079a7b5f340233ba74e35407faa24a", "score": "0.7625269", "text": "def string_to_sign\n parts = []\n parts << 'AWS4-HMAC-SHA256'\n parts << @date\n parts << credential_string\n parts << hexdigest(canonical_request)\n parts.join(LF)\n end", "t...
f7b2bf0e5e1f900658ed178f10f9ffc6
Instantiating new instance of class Artist
[ { "docid": "0b5d885ac85f539345334c2b4d633bac", "score": "0.0", "text": "def initialize(name)\n @name = name\n @@all << self\n end", "title": "" } ]
[ { "docid": "de2fe54ff6a499831bc10442755fe486", "score": "0.7952567", "text": "def initialize(name) # First, we initialize our Artist class with the name attribute.\n @name = name\n @@all << self # We take our class instance and push it into our class variable.\n end", "title": "" }, { ...
71035cf4548274ffff670ed03fe06206
Called after the relevant point test has been inserted into the flow Takes the options used to build the previous point test as well as insert_charz_test specific options to then drill down to the point of the flow where the charz test would go, at which point control is handed back to the user's interface to handle cr...
[ { "docid": "5b580ecffe4e5e878d4fe6a6f86dcb4f", "score": "0.76119244", "text": "def insert_charz_tests(options, &block)\n if charz_active?\n if options[:id]\n # two purposes:\n # 1) prevent all charz tests inadverntently using the same ID as their parent\n # 2) used...
[ { "docid": "862531bdacc0b9a8da1e97d823624b37", "score": "0.5736226", "text": "def run(model, runner, user_arguments)\n make_zones = true\n\tsurface_matching = true\n\t\n ft_to_m = 0.3048\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUser...
1afb76105f64340f40559a33b01102ce
PUT /zombies/1 PUT /zombies/1.json
[ { "docid": "339844c0592e2a406926ef63cd3b206e", "score": "0.6500357", "text": "def update\n @zombie = Zombie.find(params[:id])\n\n respond_to do |format|\n if @zombie.update_attributes(params[:zombie])\n format.html { redirect_to @zombie, notice: 'Zombie was successfully updated.' }\n ...
[ { "docid": "d1e318880d44506023b71b45c83abbd4", "score": "0.62959343", "text": "def update\n respond_to do |format|\n if @zombie.update(zombie_params)\n format.html { redirect_to @zombie, notice: \"Zombie was successfully updated.\" }\n format.json { render :show, status: :ok, locat...
f8132d20f2211f05ab57a2bcc60ba1ab
GET /curlies/new GET /curlies/new.json
[ { "docid": "199ed3435f8817bf019f9cbfbb32f27f", "score": "0.7372179", "text": "def new\n @curly = Curly.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @curly }\n end\n end", "title": "" } ]
[ { "docid": "5da16b2c91298b65822f602999d1754d", "score": "0.66799116", "text": "def new_stories\n get('/newstories.json')\n end", "title": "" }, { "docid": "152e7856798c19c0be9d4d83c31cd1b7", "score": "0.6656426", "text": "def new\n @curso = Curso.new\n\n respond_to do |form...
1da927ed2ffa174edce680dda9ecb62a
Create Nutrition base on `access_token` and `authentication_token`
[ { "docid": "25087ad7357eca89fa036ca42fa523f0", "score": "0.7067648", "text": "def create_nutrition(options={})\n options = {\n access_token: options[:access_token],\n nutrition: {\n calories: options[:calories],\n carbohydrates: options[:carbohydrates],\n fa...
[ { "docid": "583ac863714569723d4cf3dfa457866d", "score": "0.6794073", "text": "def create\n respond_with current_user.access_tokens.create(access_token_params)\n end", "title": "" }, { "docid": "583ac863714569723d4cf3dfa457866d", "score": "0.6794073", "text": "def create\n resp...
0c9afb9efccb38a050c8bc44b7f6635c
PUT /movies/1 PUT /movies/1.xml
[ { "docid": "3c6cc474aefdcee5213ebf928313f452", "score": "0.0", "text": "def update\n @purchase = Purchase.find(params[:id])\n\n respond_to do |format|\n if @purchase.update_attributes(params[:purchase])\n flash[:notice] = 'Purchase was successfully updated.'\n format.html { redi...
[ { "docid": "a02e8f60e17ed74e735fdfba4e66b179", "score": "0.64294046", "text": "def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to(@movie, :notice => 'Movie was successfully updated.') }\n ...
47c85c1ab61f8374f3f27b58f3610d4e
DELETE /activities/1 DELETE /activities/1.json
[ { "docid": "76e4f28cd7177db01a9f0c899e0acf02", "score": "0.70853233", "text": "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_path(@activity_type.table_name), notice: \"#{@activity_type.name.humanize} was successfully deleted.\" }\n format...
[ { "docid": "b3d66c490303babb47c1bac08f884bd5", "score": "0.7712568", "text": "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b3d66c490303babb...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "4a4819e5c0b05448901c869307eae4c6", "score": "0.0", "text": "def set_event\n @event = Event.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...
2cbfb092e1920629505f8c0d316e63e0
give just one time a white for a symbol on a wrong position. even it is more then one time there
[ { "docid": "d936aef03aada76f76adcf16df5b07b9", "score": "0.0", "text": "def is_white?(codes, element, ignore_pos, symbols_to_ignore)\n raise(ArgumentError, 'codes is not an array') unless codes.is_a?(Array)\n raise(ArgumentError, 'element invalid') unless @match.class::SYMBOLS.include?(element)\n ...
[ { "docid": "3d0eca10020da36c2ce93b3a41704edf", "score": "0.70111066", "text": "def symbol \n return \"♞\" if @color == :black \n return \"♘\" if @color == :white\n end", "title": "" }, { "docid": "e00803f22e4f25e0b6a16938ef8d8c26", "score": "0.67742646", "text": "def white(pi...
e0addd3aa40fe783cac4cb83bd888b8a
Returns the options tags for a select based on the given option items
[ { "docid": "18f237e49d3cd3a222674f24abedf580", "score": "0.6849407", "text": "def grouped_options_for_select(grouped_option_items, selected_values = [])\n if grouped_option_items.blank?\n return ''\n end\n if !selected_values.is_a?(Array)\n selected_values = [selected_values...
[ { "docid": "f271fc8a98192d67bbcdd8b453195972", "score": "0.75282466", "text": "def options_for_select(option_items, selected_values = [])\n if option_items.blank?\n return ''\n end\n if !selected_values.is_a?(Array)\n selected_values = [selected_values].compact\n end\n ...
6ce4fff2bd2819e3e8abddde9060594f
GETAJAX Destroy project's photo
[ { "docid": "a5f9de7378fbf5de3b15d517e8ab129e", "score": "0.801472", "text": "def destroy_photo\n @project.remove_photo!\n @project.save\n respond_to do |format|\n format.html {redirect_to edit_project_path(@project)}\n end\n end", "title": "" } ]
[ { "docid": "bf67185a83bbfae1895ec8449c84a092", "score": "0.79731786", "text": "def destroy\n File.delete(@project.photo.url) if @project.photo_file_name\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: t(\"controllers.project.success_destroyed\"...
379be4544f8cb10d5f84fb6e7ec9776d
MS_PER_UPDATE = 1 / 6.0
[ { "docid": "885b75a649b1be9455de17db7041bc56", "score": "0.0", "text": "def main_loop(app)\n previous = Time.now\n lag = 0.0\n dirty = false\n\n loop do\n if Gtk.events_pending?\n Gtk.main_iteration\n end\n break if app.finished?\n\n current = Time.now\n lag += current - previous...
[ { "docid": "ea844e8ed1461221644ebc999f3ba9fb", "score": "0.71206224", "text": "def real_time_update_period\n if rate = real_time_update_rate\n 1.0 / rate\n end\n end", "title": "" }, { "docid": "d5abef1e960ca8b0db872cdf978ea127", "score": "0.67...
93ac14c9ad0a81d00fbd6bb2e96e433f
Message received when a given call, identified by its ID, has been processed on the remote peer. +result+ is the value returned by the method, +error+ an exception object (if an error occured).
[ { "docid": "7cf3a088eb3a0e8440dddcbb0d0f45ae", "score": "0.72239625", "text": "def completed(result, error, id)\n if peer.completion_queue.empty?\n result = Exception.exception(\"something fishy: got completion message for ID=#{id} but the completion queue is empty\")\n ...
[ { "docid": "4bd8b44145cfb0fe4a3a14e63c0132d6", "score": "0.7320667", "text": "def completed(result, error, id)\n\t\tcall_spec = peer.completion_queue.pop\n\t\tif call_spec.message_id != id\n\t\t result = Exception.exception(\"something fishy: ID mismatch in completion queue (#{call_spec.message_id} !...
61415d743058f50600da1d3928c5e37a
Call the event listener passing through the +sender+ and the additional args
[ { "docid": "b3f0e2a4c2d3ad27d06965481209cd09", "score": "0.58742523", "text": "def fire(sender=nil, *args)\n @callback.call(sender, *args)\n\n if @once\n Messenger::remove_listener(self)\n end\n end", "title": "" } ]
[ { "docid": "5ddc1dbb5f372f4d7ec5ea811dc57def", "score": "0.6613285", "text": "def call(event, *args)\n return unless @listeners[event]\n @listeners[event].each do |callback|\n callback.call(*args)\n end\n end", "title": "" }, { "docid": "6be871df2b5d3c6817e5a807c7f11...
23c522dc06947cf5586bf8283cc5cedc
Validates the composite object and throws errors on failure
[ { "docid": "08a06b393313d53ae9db906af60f50d9", "score": "0.7041153", "text": "def validate(composite_object)\n # Get the hash value from the composite object\n target_value = composite_object.hash[@key]\n\n return unless target_value\n\n target_values = target...
[ { "docid": "d5e3770b65f3ef7036bdc7254722ef6b", "score": "0.7320442", "text": "def validate\n assert !@object.valid?\n end", "title": "" }, { "docid": "aad11b92dc8637005b33ee1abdacd73e", "score": "0.70947796", "text": "def validate\n assert_valid @object\n ...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "eb94b599da67cddffa000f81fa5e483d", "score": "0.0", "text": "def update!(**args)\n @filters = args[:filters] if args.key?(:filters)\n @group_type = args[:group_type] if args.key?(:group_type)\n end", "title": "" } ]
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.701199", "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", "ti...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "da68a98d18457d54ebbbb0134eef5381", "score": "0.0", "text": "def user_params\n params.require(:user).permit(:email, :password, :password_confirmation,\n :name, :city, :profile, :about, :public)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74768823", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.71700543", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist...
d0b87dc20685692df2cadecab2e07090
Define a method to be used to present game instructions
[ { "docid": "a3d8ece54c8362212a44bede03bee8cc", "score": "0.65077955", "text": "def display_instructions\n \n Console_Screen.cls #Clear the display area\n puts \"INSTRUCTIONS:\\n\\n\" #Display a heading\n \n #Display the game's instructions\n puts \"Th...
[ { "docid": "f0551e59a77ca388ad445c7ac2b0fbf8", "score": "0.6663377", "text": "def instruction(name, instruction)\r\n end", "title": "" }, { "docid": "5bbe62ee32f08d9fb0f1a4cc6d844ec7", "score": "0.6546618", "text": "def display_instruction\r\n puts \"Start by choosing if you wa...
04e704b634283bc55b1a8e72eed6a370
Return the status of this Wireless Device. At the moment we are only concerned about the CELL ID state of this device. [Return] the Cell ID of this Device
[ { "docid": "3b79a862eb802f7bcff5a86d32bea5f6", "score": "0.7226245", "text": "def checkStatus\n reply = `iwconfig #{deviceName}`\n if ! $?.success?\n warn \"Problems running iwconfig -- #{reply}\"\n return\n end\n if (m = reply.match(/(Access Point|Cell): ([^ ]+)/))\n id = m[2...
[ { "docid": "0ab55507281a0c664a90bbfc24117bf1", "score": "0.5893311", "text": "def status\n return @interface.GetStatus.first[0]\n end", "title": "" }, { "docid": "c97f08de0d29deab3279a252b57c3ac8", "score": "0.5817746", "text": "def active_cell_id; end", "title": "" }, ...
e043a2e4fa9a53356510917bf1a86a88
Initialize the configuration object Loads the configuration from RAILS_ROOT/config/uv_storage.yml if +config_path+ is omitted. == Examples:
[ { "docid": "21aa628d5cd775f0057745b38a8e8bc9", "score": "0.8361444", "text": "def initialize(config_path = nil)\n self.config_path = config_path.nil? ? \"#{RAILS_ROOT}/config/uv_storage.yml\" : config_path\n self.config = YAML.load_file(self.config_path)\n self.config.stringify_keys...
[ { "docid": "50c120a03b7548d4d0cc51d2814d4af4", "score": "0.69481224", "text": "def init_config\n#--{{{\n @config =\n if @options['config']\n ConfigFile::new(@options['config'])\n else\n ConfigFile::any CONFIG_DEFAULT_PATH, CONFIG_SEARCH_PATH\n end\...
b08b9ef3ba91cf389a6143642fcc624d
=begin def find_element_index(array, value_to_find) index = 0 while index < array.length do if array[index]==value_to_find return index end index +=1 end end =end
[ { "docid": "3b7c32e32a48524f57425bfd97cbc6ee", "score": "0.0", "text": "def find_max_value(array)\n max=0\n array.length.times do |index|\n if max < array[index]\n max = array[index]\n end\n end\n max\nend", "title": "" } ]
[ { "docid": "a96f2306c62436275793ddd9c2bf5ade", "score": "0.92493325", "text": "def find_element_index(array, value_to_find)\n # Add your solution here\t \n counter = 0\n while counter < array.length do \n if value_to_find == array[counter]\n return counter\n else counter += 1 \n end \n ...
257504ae886a6afaeb393ce7378b0c40
Create a new tree by using the provided Proc object to map the nodes of this tree to new nodes. This is always done in postorder, meaning that all children of a node are visited before the node itself.
[ { "docid": "0572d2a80fe5ec510c2f13bd8a8d0bac", "score": "0.572567", "text": "def map(&block)\n\t\t\tnew_values = self.values.map { |v| v.clone }\n\n\t\t\tnew_children =\n\t\t\tself.children.map do |c0|\n\t\t\t\tcase c0\n\t\t\t\twhen Array then c0.map { |c1| c1.map(&block) }\n\t\t\t\twhen ASTNode the...
[ { "docid": "69c7a022d6e028de2c1acbe1e527d1b4", "score": "0.58436006", "text": "def initialize(p, tree, is_leaf, parent = nil, prev_sibling = nil,\n next_sibling = nil)\n super(p)\n self.tree = tree\n self.parent = parent\n self.keys = @store.new(PEROBS::Array)\n\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "87fe27018fdf151d284ba19d8cb0df36", "score": "0.0", "text": "def set_blog_post\n @blog_post = BlogPost.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...
0df887eb3d848e4de5d90a9616113123
Supplier invoice internal no
[ { "docid": "5338f85e30ee0087210f1078fcf0c4cd", "score": "0.6382015", "text": "def si_next_no(company, posted_at)\n code = ''\n year = posted_at.year\n company = company.to_s if company.is_a? Fixnum\n company = company.rjust(3, '0')\n year = year.to_s if year.is_a? Fixnum\n year = year....
[ { "docid": "06c5872241ae9c786decb17b234ed850", "score": "0.7999048", "text": "def invoice_num\n item_id\n end", "title": "" }, { "docid": "18af55f770f4aca1f04e4a26462ce780", "score": "0.7979564", "text": "def invoice_num\n item_id\n end", "titl...
01ea382a0d79aecb345d2a573a6eacd2
method to write file to music directory
[ { "docid": "e2b1070317a75ca08506dbbd3f2f3bfa", "score": "0.7442342", "text": "def write_file(src, dest)\n file_path = \"#{@music_dir}/#{dest}\"\n dest = File.new(file_path, \"wb\")\n dest.write(src.read)\n dest.close\n end", "title": "" } ]
[ { "docid": "62ea2f38f21e9004451dd9cd5c0fb226", "score": "0.71539456", "text": "def savePlaylist musicArr, filename\n musicStr = ''\n musicArr.each do |musicFile|\n musicStr += musicFile + \"\\n\"\n end\n File.open filename + '.m3u', 'w' do |f|\n f.write(musicStr)\n end\nend", "title": "" ...
7bd39e3c4b1a17b561b75a91b7df7fd0
checks if we need to switch to filter mode to filter
[ { "docid": "7e073fa7c1590d2b07f2dbac5c80fb36", "score": "0.0", "text": "def state_filter_start?( line )\n line =~ /^(receiving|sending) incremental file list/i\n end", "title": "" } ]
[ { "docid": "8eab04af42182c90130837ab49187549", "score": "0.691749", "text": "def is_scan?\n @filters.nil? || @filters.empty?\n end", "title": "" }, { "docid": "0ed0594bee338472223bf5898eb6fff3", "score": "0.6897748", "text": "def filter?\n options[:filter].present?\n ...
5a1a1e99ddb0939961173ff7020f29cb
removes users from channels
[ { "docid": "30cfdc4364be95c74befff4342777497", "score": "0.58669055", "text": "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end", "title": "" } ]
[ { "docid": "c2d5eccc4847dccc12c4f3d5da799ebf", "score": "0.7352902", "text": "def remove_user(user)\n channels = Set.new\n\n @channels.each do |channel|\n if channel.remove_user(user)\n channels << channel\n end\n end\n\n channels\n end", "title": "" }...
e5a0a0f65a3478390aee593cf1691b7a
GET /profile_users/1 GET /profile_users/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "5eb1d55a836c2039fc718ef7a452c75c", "score": "0.7607319", "text": "def profile\n @oneuser = User.find_by(username: params[:username]) \n profile = user_profile(@oneuser.id, @oneuser.username, @oneuser.email, @oneuser.first_name, @oneuser.last_name, @oneuser.avatar_img, @oneuser.created_...
0f5e2b7e574e6b10953576007c713def
Only allows admin CRUD
[ { "docid": "a5038c48655fed7f671d7c7aacad5316", "score": "0.0", "text": "def logged_in_user\n if !logged_in?\n flash[:failure] = \"You must sign in first.\"\n redirect_to(login_url)\n end\n end", "title": "" } ]
[ { "docid": "887be23dfce00b86a9929dc3d4ffaa30", "score": "0.782955", "text": "def admin_only\n false\n end", "title": "" }, { "docid": "5072c1c8460b279c9de756e1148e063b", "score": "0.77325827", "text": "def admin_only\n deny_access(\"Necesitas tener privilegios de admi...
101c3f911c91a07cb58e67601121fe3d
shortcut method to retun center.y
[ { "docid": "e0af873853f0a91aee2bb74798edf8a4", "score": "0.79886556", "text": "def cy\n return self.center.y\n end", "title": "" } ]
[ { "docid": "f6f4039505cf13f25bd084b84ad0f8e2", "score": "0.8798255", "text": "def center_y\n @center[1]\n end", "title": "" }, { "docid": "fa63bb6a4fccb01d0d35db648bb3bcd3", "score": "0.8442809", "text": "def GetCenterY(y)\n centerY=(y+0)/2\nend", "title": "" }, { ...
10b305a40256fb5aa10df391fa3c89a5
Returns the id of the upserted User
[ { "docid": "88586014eec6a855b1f39a1630c86752", "score": "0.0", "text": "def handle(event_or_id)\n case event_or_id\n when Hash\n upsert_user(event_or_id)\n when String\n table.insert_ignore.insert(id: event_or_id)\n event_or_id\n end\n end", ...
[ { "docid": "a1a435d8b3e3e0389c080214b05bfe21", "score": "0.67136985", "text": "def user_id\n return nil unless success?\n\n @user_id\n end", "title": "" }, { "docid": "625fbea1cfe46f333fae7dcf7c551e0f", "score": "0.6449112", "text": "def generate_user_id\n # a...
7ae1ff94ab07b3ade83b475a2457d61a
Checks if the given_url has http or https
[ { "docid": "c8889c85fde0a6b86653354a7e12b5e0", "score": "0.0", "text": "def protocol_exists?\n uri = URI.parse(model.given_url)\n PROTOCOLS.include?(uri.scheme)\n end", "title": "" } ]
[ { "docid": "90a601717990e452557e36a488fad920", "score": "0.8290194", "text": "def https_url\n return false if (url.blank?)\n\n unless (url[0,8] == \"https://\")\n errors.add :url, \"Must be an HTPPS URL.\"\n return false\n end\n\n return true\n end", "title": "" ...
992853c5a24340685d9106a40bafec59
Delete Ticket Sync By Id
[ { "docid": "07775ee8f47b6f1b54631775e0e7f461", "score": "0.0", "text": "def system_ticket_syncs_id_delete(id, opts = {})\n system_ticket_syncs_id_delete_with_http_info(id, opts)\n return nil\n end", "title": "" } ]
[ { "docid": "5b3bcf851ccf000aaae59d36df4def60", "score": "0.7934521", "text": "def delete_ticket id\n\t\t\t\t\tFreshdesk::Api::Client.delete_status_wrapper do\n\t\t\t\t\t\t( @connection.delete TICKETS, id ).code\n\t\t\t\t\tend\n\t\t\t\tend", "title": "" }, { "docid": "bfdb73234a2944b4c4cfd247...
55f3c6e509cf4154177a1dcbd1716b6e
GET /tag_associations/1 GET /tag_associations/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "c3dc5eb6de058dd75f9ce6ef5532241b", "score": "0.7031987", "text": "def index\n @tag_associations = TagAssociation.all\n end", "title": "" }, { "docid": "c3dc5eb6de058dd75f9ce6ef5532241b", "score": "0.7031987", "text": "def index\n @tag_associations = TagAssociation....
c11335f2599cad9041cb7503869abd7f
POST /replies POST /replies.json
[ { "docid": "b9beb5d00c31cc8614ccf8047fcc609c", "score": "0.7232087", "text": "def create\n @reply = @comment.replies.new(reply_params)\n @reply.user_id = session[:user_id]\n respond_to do |format|\n if @reply.save\n format.html { redirect_to @post, notice: 'Reply was successfully cr...
[ { "docid": "39a382b02a8b3210f39c9a91870a0080", "score": "0.73018897", "text": "def create\n @reply = @place.replies.new(reply_params)\n @reply.user = current_user\n if @reply.save\n render :show, status: :created, location: @reply\n else\n render json: @reply.errors, st...
39b8243f58e070c98ba183cb3fd7cabb
Return the middle character of a string. Return the middle two characters if the word is of even length, e.g. middle_substring("middle") => "dd", middle_substring("mid") => "i"
[ { "docid": "64d17156cc26b50e344fd98ffe12f1fe", "score": "0.85973006", "text": "def middle_substring(str)\n lgth = str.length\n return str[(lgth/2).floor] if lgth % 2 == 1\n mdl = lgth / 2\n str[mdl - 1] + str[mdl]\nend", "title": "" } ]
[ { "docid": "44898cef7ddf5d53242297e27f9dcd7f", "score": "0.88728637", "text": "def middle_substring(str)\n length = str.length\n middle = str.length / 2\n length.odd? ? str[middle] : str[middle - 1, 2]\nend", "title": "" }, { "docid": "18b00b4f0b3f37f2e7ce60d49d860bde", "score": "0.87...
6b441e6086497ffa106f17a5e1ba3e98
Returns true if the relation is ordered by the attribute_name, and false otherwise.
[ { "docid": "8ddc3d0828ba86024ad4aba1ae9d3fac", "score": "0.7475996", "text": "def ordered_by?(attribute_name)\n ordered_by(attribute_name).to_b\n end", "title": "" } ]
[ { "docid": "b23c994b00b97e0eea29092437cb27ec", "score": "0.6811492", "text": "def sortable?(attr)\n model_class.column_names.include?(attr.to_s) || \n sort_mappings.include?(attr.to_sym)\n end", "title": "" }, { "docid": "757af598ab6eabfabd0413a30b25de05", "score": "0.666169...
64be360dceff25fa7ec70d63a63e9de4
Destroy the entry. If it is a dir, everything inside it will also be destroyed.
[ { "docid": "6bf25bcb0a5032a469a836e5bbe037ce", "score": "0.0", "text": "def destroy(*options)\n\t\tconnection.destroy(full_path)\n\tend", "title": "" } ]
[ { "docid": "92001221a463f591a9efd88d3270f050", "score": "0.7248488", "text": "def destroy\n class_name = @entry.class.name\n @entry.destroy\n destroy_helper(entries_url, class_name)\n end", "title": "" }, { "docid": "6849e11b47f42009d87fc81ca522614e", "score": "0.68115544", ...
a1bae34e80460d532813c9b39769cea6
Wraps the recipient into an output P2SH script (OP_HASH160 OP_EQUAL).
[ { "docid": "b10413637cf2aa3abb42d54959525351", "score": "0.7522583", "text": "def p2sh_script\n Script.new << OP_HASH160 << BTC.hash160(self.data) << OP_EQUAL\n end", "title": "" } ]
[ { "docid": "2a53e68d9c5ccc6cfbf1301125956bd5", "score": "0.657532", "text": "def to_p2sh\n Script.to_p2sh(to_hash160)\n end", "title": "" }, { "docid": "efabdc3e8fface765cb0e4a2eb6d88fa", "score": "0.6352729", "text": "def p2sh_script\n h160 = CoinOp.syncbit(@network[:na...
5ef9686bdaadd221434e84068b9276d6
Remove pin object Remove a pin object
[ { "docid": "f4b0db0c93792e3d2b9e606fd35cf3de", "score": "0.0", "text": "def pins_requestid_delete_with_http_info(requestid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PinsApi.pins_requestid_delete ...'\n end\n # verify the required ...
[ { "docid": "d1fd31679ae4c530051521998f67b660", "score": "0.7306021", "text": "def destroy\n @pin.destroy\n end", "title": "" }, { "docid": "147f5a41504da6db0e73a3b326a84276", "score": "0.7067091", "text": "def delete_pin(pin)\n if pin.is_a?(PowerPin)\n bank = all_...
6d83c496ec1b09c2d3203be9bf17be58
Add aliases so that RSS feed elements can be accessed using the names of their Atom counterparts.
[ { "docid": "440b5f8b29f9de83814b47ef44a0dd09", "score": "0.6771256", "text": "def emulate_atom!\n aliases.merge!({\n :rights => :copyright,\n :content => :description,\n :contributor => :author,\n :id => [ :guid_value, :link ],\n :author ...
[ { "docid": "4cf436eb32ed19f15533adbe270e5905", "score": "0.79954296", "text": "def emulate_rss!\n aliases.merge!({\n :guid => :id, # this alias never actually gets used; see FeedData#id\n :copyright => :rights,\n :pubdate => [ :published, :updated ],...
07e800679aba51248d7b0212cd6e3b96
logs a command options[:command] override command line to be logged. useful for masking passwords.
[ { "docid": "247bc38a6cd8b8ae5e9f6f4ae4807d2a", "score": "0.67049354", "text": "def log_command(status, options = {})\n command = options[:command] || status.command\n \n log_command_line(command, status.success?)\n log_command_status(status)\n \n overall_error! if current_h...
[ { "docid": "556f48957304a8c32c0a5c819c2e6232", "score": "0.7425694", "text": "def log_command command\n return unless @telnet_options[:command_log]\n @command_logger.info command\n end", "title": "" }, { "docid": "774fea1da796873dba935200b11606aa", "score": "0.71493524", "text...
a646a17e89d4ba76245b56f353fd7789
simple function to read in the passed in file name and attempt to convert the contects from JSON to a Ruby hash
[ { "docid": "d402033cc0ad9263edb9baed78b15d92", "score": "0.65990955", "text": "def parse_json(filename)\n p 'parse_json ' + filename if $debug >98\n begin\n json = JSON.parse!(File.open(filename).read)\n rescue JSON::ParserError => ex\n puts \"Error: Cannot parse \" + filename\n puts \"#{ex....
[ { "docid": "20e2867a4fd5ad08fa246c49e2f40a68", "score": "0.80190945", "text": "def read_json(file_name)\n file = File.read(file_name)\n data_hash = JSON.parse(file)\nend", "title": "" }, { "docid": "5a92ee1d5b21f3ec07c9f5964ae3528e", "score": "0.7690803", "text": "def read_file(fil...
d6d8827c14a0416c0b9bfcf6ba3b9b5e
return a value based on a mast The character will be replaced with a number The A character will be replaced with an upper case letter The a character will be replaced with a lower case letter
[ { "docid": "afe03f41bb90431d60b2d097a5ece08a", "score": "0.0", "text": "def mask(value)\n result = ''\n value.each_char do |ch|\n case ch\n when '#' then result += randomize(0..9).to_s\n when 'A' then result += ('A'..'Z').to_a[rand(26)]\n when 'a' then result += ('a...
[ { "docid": "5cdbdec072a7c9021a86706da59bc9ae", "score": "0.7342802", "text": "def replaceCharToNumber(char)\n case char\n when 'T'\n then\n char = 10\n when 'J'\n then\n char = 11\n when 'Q'\n then\n char = 12\n when 'K'\n then\n char = 13\n when 'A'\n ...
6373504a17be4186c8d3255ba899b524
GET /learning_days/new GET /learning_days/new.xml
[ { "docid": "2de8f8c24fc39ca562dac94f46b67934", "score": "0.68679446", "text": "def new\n @school_class= SchoolClass.find(params[:school_class_id])\n @learning_day = @school_class.learning_days.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml =>...
[ { "docid": "267110a22d02096d8ff3003378c189f4", "score": "0.71707344", "text": "def new\n @day = current_account.days.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @day }\n end\n end", "title": "" }, { "docid": "bc3968147541...
940e53518b7e857ff974c00d0190cab6
adding a query to the queue of things to be queried, but only if the query isn't already queued or answered
[ { "docid": "7ae4c9289dec30703ad39588e5602c3f", "score": "0.6754015", "text": "def add_query(query,state,level=@level+1)\n if query =~ /^\\d+ \\w+\\./\n query = query.split(/ /,2)[1]\n end\n return if get_state(query)\n puts \"Adding query: #{query}, #{state}, #{level}\" if @de...
[ { "docid": "5ae26dd3ade047c28dd56350527a927c", "score": "0.6766607", "text": "def enqueue_queries\n Query.find_each(&:enqueue!)\n end", "title": "" }, { "docid": "5a5eebc7d34fdf06a5bc23fd617a865c", "score": "0.6706795", "text": "def make_query(query, &handler)\n if @last_que...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "78c0c849966b314be8fefca33508366f", "score": "0.0", "text": "def set_usern\n @usern = Usern.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
a950eefaea521bf55a1f0725e68b69b2
DELETE /push_offers/1 DELETE /push_offers/1.json
[ { "docid": "c28141fc66424b1393a876edf4eebd01", "score": "0.7751578", "text": "def destroy\n @push_offer = PushOffer.find(params[:id])\n @push_offer.destroy\n\n head :no_content\n end", "title": "" } ]
[ { "docid": "6eed9be996f761358a04ed780ffb23ce", "score": "0.6941959", "text": "def delete_endpoint\n end", "title": "" }, { "docid": "3cdd3ad90c3f9ca197763024e36f351a", "score": "0.6876763", "text": "def delete\n self.class.delete(\"#{PUSH_URL}/#{id}\", :basic_auth => auth)\n ...
2dedb14524d60d63455b072e5f8166ac
GET /ips/daily/2009/1 GET /ips/daily/2009/1.xml GET /ips/daily/2009/1.xls GET /ips/daily/2009/1.csv GET /ips/monthly/2009/1 GET /ips/monthly/2009/1.xml GET /ips/monthly/2009/1.xls GET /ips/monthly/2009/1.csv
[ { "docid": "dd6669eb4bab31db27c92b74fd9d5793", "score": "0.61038256", "text": "def find_by_month\r\n #date = params[:year] + \"-\" + params[:month] + \"-\" + params[:day]\r\n if params[:period] == \"monthly\"\r\n Ip.switch_table(\"monthly\")\r\n @ips = Ip.find(:all, :conditions => [\"ser...
[ { "docid": "5994a875cdf408cd873d0931fc4e18b4", "score": "0.62987113", "text": "def find_by_date\r\n Ip.switch_table(\"daily\")\r\n #date = params[:year] + \"-\" + params[:month] + \"-\" + params[:day]\r\n @ips = Ip.find(:all, :limit => 50, :conditions => [\"day(server_date) =? and month(server_...
582f45b893c812f8bc489abd8af79b2f
DELETE session => '/logout' Quit the Session of a User who has logged out
[ { "docid": "de4186e962bfb6ad899714718cb093cc", "score": "0.0", "text": "def destroy\n log_out\n redirect_to root_path\n end", "title": "" } ]
[ { "docid": "3bb7aa029ff19540c0867deac58f84ba", "score": "0.8560591", "text": "def logout\n session.delete(:user_id)\n end", "title": "" }, { "docid": "a26de6c3e3a3d4b4556969a19edcf7ed", "score": "0.85555875", "text": "def logout\n session.delete :user_id\n end", "ti...
4088f223805c0229387f203543aeee98
for building diagram activity metrics per time
[ { "docid": "394b11bf9f57fe2b1a0b4a35cfed6729", "score": "0.0", "text": "def getAllActivityMetrics(dataHash, activity_name)\n $data[activity_name] = dataHash.select do |row|\n row[\"activity\"].eql? activity_name \n end\nend", "title": "" } ]
[ { "docid": "268211f2e151a7dc8f6829c0b0aa2af5", "score": "0.6638813", "text": "def create_metrics; end", "title": "" }, { "docid": "c9ec9b4099a8cdad383df5513f979291", "score": "0.6249891", "text": "def activity\n# logger.debug( \"* Activity graph for Project ID: #{params[:id]}\" )\...
170397ce14c3228b293c4ae5b229bc13
each move costs 1
[ { "docid": "53a137f6eae717cd20d2e1a698276c1a", "score": "0.0", "text": "def search( grid, init , deltas, cost, goal , delta_names)\n # ----------------------------------------\n # insert code here and make sure it returns the appropriate result\n # ----------------------------------------\n ...
[ { "docid": "e2d4c805e6776f68be985ececa4f6776", "score": "0.65008795", "text": "def moves\n\n end", "title": "" }, { "docid": "31cdae7f2dee71af86e044ae23e1e471", "score": "0.64942807", "text": "def moves\n end", "title": "" }, { "docid": "436ee372c6cb2ff9251cd1a2c14972d2...
8b2306a7f3894058e5db20fca8af21a4
callback.rb Provides a ruby script to invoke a callback from the FreePBX callback plugin using call files and enabling more options Copyright (c) 2008, Jason Goecke All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published...
[ { "docid": "77f5a7fe42f5d6fb83940eacfd4383ba", "score": "0.0", "text": "def parse_config_file\n fh = File.open(\"#{@amp_configuration}\").each do | line |\n param_str = line.split('=')\n case param_str[0]\n when \"AMPMGRUSER\"\n @astman_user = param_str[1].rstrip\n when \"AMPMGRPASS\"\...
[ { "docid": "ba8337b444ee989993825eba6c53efc6", "score": "0.5912287", "text": "def callback_method\n run(\"on\", \"string\", \"callback\")\n end", "title": "" }, { "docid": "48ac9b7bf121648023a63b25e17724c9", "score": "0.5848294", "text": "def set_Callback(value)\n ...
a376e6fa73ea0a89f2b0af76185f0ce2
Converts email to all lower case.
[ { "docid": "c0b35ed7658270421c632de486a9a72e", "score": "0.0", "text": "def downcase_email\n\t\t\tself.member_email = member_email.downcase\n\t\tend", "title": "" } ]
[ { "docid": "434a53dadeb1628ebc04d7cf7c8251af", "score": "0.81705624", "text": "def downcase_email\n\t email.downcase!\n\t end", "title": "" }, { "docid": "61c6f9455ec34c2acd15663a017f23dc", "score": "0.8109149", "text": "def downcase_email\n email.downcase!\n ...
77f9fd72590820a83d373b27687d20a1
GET /destinations/1 GET /destinations/1.xml
[ { "docid": "e0961e159a5dc14f8bccffc3c59a9975", "score": "0.6791085", "text": "def show\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @destination }\n end\n end", "title": "" } ]
[ { "docid": "34de7cce9ccf8b9d6981d6e463f00ce6", "score": "0.6702296", "text": "def index\n @destinations = Destination.order(\"ancestry ASC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @destinations }\n end\n end", ...
47f0b4c204e9f0bdee119e9cbd566f32
Register a new event
[ { "docid": "b4f04e1ff255e57d757e02df77084c7c", "score": "0.0", "text": "def update_event(body, opts = {})\n data, _status_code, _headers = update_event_with_http_info(body, opts)\n data\n end", "title": "" } ]
[ { "docid": "b9445c9b68daf0f69b7f273b9f6b32ec", "score": "0.8155859", "text": "def register(event)\n attended_events << event\n end", "title": "" }, { "docid": "06c9010c836a1b96e4b0812aa2d78360", "score": "0.81413203", "text": "def register_event(event)\n @event_handler.registe...
2aa80d514ca1bbe4ae9f7bc74243a287
A useful method to rotate the files nb_to_keep is the number of backups to keep betwwen the two down_date and up_date (number above number_to_keep will be deleted)
[ { "docid": "90861dde1ed6f7fa7b85d7e50c346322", "score": "0.77792746", "text": "def rotate(nb_to_keep, down_date, up_date)\n nb_kept = keep_backup(nb_to_keep,down_date, up_date)\n\n if nb_kept == nb_to_keep\n puts \"There is enough backups for this time period.\"\n else\n puts \"Not en...
[ { "docid": "6de369c888a1dcbb73c59db383d5a95a", "score": "0.74247885", "text": "def keep_backup(nb_to_keep,down_date, up_date)\n range = down_date..up_date\n nb_kept = 0\n self.reverse_each do |bck|\n if range === bck.date\n if nb_kept < nb_to_keep\n if bck.to_keep != true\n...
af741f85990ae432d8631740de19626b
Delegate to target_hosts and clusters
[ { "docid": "85cded22bbf6a8fafa2464dbe923218e", "score": "0.0", "text": "def stop(wait = false, options = nil, aborted = false)\n logger.debug { \"#{self.class}##{__method__}\" }\n if current_execution_cycle.nil?\n raise(Hailstorm::Exception, 'Nothing to stop... no tests running')\n else\n ...
[ { "docid": "215d1140fde062f08bbafe88184c5285", "score": "0.70161825", "text": "def determine_hosts; end", "title": "" }, { "docid": "7c852fb21b4992487c641a41d2b1db13", "score": "0.6836778", "text": "def set_hosts\n if node.run_state['cluster_def'].nil? then\n node.run_state['clus...
a3d91572c42f0465651ce02f3c8daaba
TODO: reader for this
[ { "docid": "437e4865426718d4e2ed8e71a6a89cd1", "score": "0.0", "text": "def value_labels=(values)\n return if values == :no_labels\n\n # TODO: figure out how to handle c_value_labels, if they turn up\n API.set_var_n_value_labels(handle, [name], values)\n end", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.73464406", "text": "def private; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.62883407", "text": "def probers; end", "title": "" }, { "docid": "d8ae3e2b236950074c4632d180274b8a",...
99d6addc891220db9349f6bc7b42b54c
Gets the isUsableForSignIn property value. Determines if users can use this authentication method to sign in to Azure AD. true if users can use this method for primary authentication, otherwise false.
[ { "docid": "fd7dbb7bf2c007cd59a28876e25e1041", "score": "0.6907855", "text": "def is_usable_for_sign_in\n return @is_usable_for_sign_in\n end", "title": "" } ]
[ { "docid": "3ea8fd4125ff36c7d8288844ee79ac52", "score": "0.67479914", "text": "def active_for_authentication?\n super && self.enabled? && self.is_allowed_in?\n end", "title": "" }, { "docid": "59e4d3438cc861780b1af9c1d70dc5d7", "score": "0.6433895", "text": "def active_for_authen...
8a16e9f0fd8dc8c979291ab0cbd8758c
Whether this query is using the global scope
[ { "docid": "34302d44ad28a20dd98be5ba3c8e64d9", "score": "0.85162187", "text": "def global_scope?\n @scope == :global\n end", "title": "" } ]
[ { "docid": "c47481f83984d7722a3b3107f09844ff", "score": "0.77317864", "text": "def local_scope?\n @scope == :local\n end", "title": "" }, { "docid": "4831149abe39126bed6abdd52c906bd1", "score": "0.77064973", "text": "def global?() false end", "title": ""...
ec7240b79e2b05351f6727582afc9e98
access to the image's dimensions
[ { "docid": "9359cc363e95f7e88be9e8149a546d3e", "score": "0.0", "text": "def dimensions( type = :original )\n command = <<-end_command\n #{ Paperclip.path_for_command('identify') }\n -format \"{:width => %[fx:w], :height => %[fx:h]}\"\n \"#{ attachment.path type }\"\n end_command\n ...
[ { "docid": "5a07a1b820924f9abf54aef2c84b21fc", "score": "0.8884448", "text": "def dimensions\n @context.image_size(@image)\n end", "title": "" }, { "docid": "5e65bd020d395cb5617e77a195a3a28d", "score": "0.82493937", "text": "def width\n @image[\"width\"]\n end", ...
a39ce96fa99c119f7ce688b00f0df504
Write a method that takes in two strings and prints a concatenation of those two strings, for example the arguments could be (man, woman) and the end result might be "When Harry Met Sally". Then, call that method.
[ { "docid": "b014c41d26d42c4ea0ec9a91b470d5a1", "score": "0.0", "text": "def submission_confirmation(nominee_conf, client_conf, award_level_conf)\n puts \"You have successfully nominated: #{nominee_conf}\"\n puts \"Client: #{client_conf} and Level of Influence: #{award_level_conf}\"\n puts \"If this i...
[ { "docid": "01fb5896948876bd64fc4461248acb52", "score": "0.8003094", "text": "def string_concat(name_1, name_2)\n puts \"I went to the concert with \" +name_1 + \" and \" + name_2 + \".\"\nend", "title": "" }, { "docid": "30f37772464e53959239c101ecfd76fe", "score": "0.7918114", "tex...
e760ce12595c0391e4c091ba39de809d
def ssl_required? return false if ['development'].include?(Rails.env) (ENV['Rails.env'] == "production" || !local_request?) && (self.class.read_inheritable_attribute(:ssl_required_actions) || []).include?(action_name.to_sym) end
[ { "docid": "2df8817f37e789c664bc5bc29e491ee5", "score": "0.0", "text": "def send_email(commented_on_user_model, commenting_user_id, email_subject, email_text)\n commenting_user = User.find(commenting_user_id)\n # create email and send it to right recipients depending on their roles\n if is_inte...
[ { "docid": "c179a0f55ca95d2972b37c4cd8afce8b", "score": "0.94412726", "text": "def ssl_required?\n return ENV['SSL'] == 'on' ? true : false if defined? ENV['SSL']\n return false if local_request?\n return false if RAILS_ENV == 'test'\n ((self.class.read_inheritable_attribute(...
edd216a463b7e82876a555362c8a349b
GET /shops/1 GET /shops/1.json
[ { "docid": "f52778782d86d4e874ac9540109aac8d", "score": "0.58744603", "text": "def show\n @shop = Shop.find(params[:id])\n @candies = @shop.candies\n @shelves = @shop.shelves\n end", "title": "" } ]
[ { "docid": "2d4dc1c76cb1689bfdd1076ddbfc025c", "score": "0.7023943", "text": "def index\n @shop = Shop.find(1)\n render :json => @shop\n return\n end", "title": "" }, { "docid": "b743ab232382c0a1ebd288c8b980a002", "score": "0.6906654", "text": "def index\n @workshops = W...
65032828d0083db24b4c3732aa14f5ca
function with time parameters and singlesource and mulitple attribute list
[ { "docid": "e5a2f0b8bf5a92f3be08626a661fb56d", "score": "0.7192199", "text": "def timeSeriesSingleSourceMultipleAttributes(time1,time2,dataSources,attributes)\n @result = nil\n if attributes != nil\n attrList = \"MultipleColumnPrefixFilter(\"\n attributes.each do |x|\n if attrList...
[ { "docid": "2aa2770101475432de5667772ee99ded", "score": "0.60506254", "text": "def timeSeriesMultipleSourceMultipleAttributes(time1,time2,dataSources,inverters)\n @result = nil\n if inverters != nil\n invList = \"MultipleColumnPrefixFilter(\"\n inverters.each do |x|\n if invList !...
5f012ba5e6b0fdac549a09920e251e7f
Assigns a card to each player i turn. The pack is dealt in order. ==== Attributes +pack+ The pack object, containing all the cards. +players+ An array of players.
[ { "docid": "0b647f5397f7935500a0b6e3e16b65d7", "score": "0.70876104", "text": "def deal(pack, players)\n cards = pack.cards\n\n player_counter = 0\n\n (0..cards.length - 1).each { |i|\n players[player_counter].hand.push(cards[i])\n player_counter = (player_coun...
[ { "docid": "1362208e66ba609e92ded724c064a751", "score": "0.7063812", "text": "def assign_cards_to_players\n\t\t5.times do \n\t\t\t@players.each do |player|\n\t\t\t\tplayer.add_card(random_card)\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "5db8c3072c720cbe88b2a167941fc5a1", "sc...
b337103f791cb547ac55745c0704e490
Cart manipulation, anonymous user Make sure adding a product to the cart works
[ { "docid": "32003217b61852e0b2ba335bb2df7fa7", "score": "0.6750988", "text": "def test_add_product \n post :add, :id => 1\n assert_redirected_to :controller => :cart, :action => ''\n cart = get_anonymous_cart\n assert_equal(1, cart.cart_items.size)\n assert_equal(1, ...
[ { "docid": "f7b1d458ebed8851ddd0f9f342022467", "score": "0.79377174", "text": "def add_to_cart\n if current_user.cart\n update\n else\n create\n end\n end", "title": "" }, { "docid": "2a4370ddbb588b4f86bd01849af34fd9", "score": "0.7446047", "text": "def create\n ...
d5b6f1aeb5214f1176a1f7351c4b46f1
Puppet apply Fundamental step
[ { "docid": "b3a2cb0c1ca07f638f3098100aa4860c", "score": "0.6615726", "text": "def apply\n started_at = DateTime.now.to_s\n # Check if a Puppetfile is neccesary for use/not use librarian-puppet\n check_puppetfile_content\n # Copy static modules that are not downloaded by librarian-pup...
[ { "docid": "98ea14de71fffa39f9cf1fe5288bd406", "score": "0.7298931", "text": "def apply_step\n # Create deploy directories\n cap 'deploy:setup'\n # Deploy the configured step\n $?.success? ? (cap 'deploy') : (return $?)\n # Download dynamic step modules through librarian-puppet\...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "d3e265fd2042437a6bdc36851935fd74", "score": "0.0", "text": "def constraint_params\n params.require(:constraint).permit(:title, :description, :task_id)\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...
9617459a0ee347089903fecfb19c26ff
first and last name are not case sensitive
[ { "docid": "39dc490c973ac9e9e725bc745515217a", "score": "0.0", "text": "def search_by_agent_full_name(first_name, last_name)\n response = @conn.get do |req|\n req.url \"/resource/colorado-business-entities.json?agentfirstname=#{first_name}&agentlastname=#{last_name}\"\n end\n parsed = JSON...
[ { "docid": "a75c6f277dc42a626c6c72306b20f46b", "score": "0.796825", "text": "def lower_text_fields\n self.email.downcase!\n self.first_name.downcase!\n self.last_name.downcase!\n end", "title": "" }, { "docid": "30c947d0242defbb352e572c033fcfcc", "score": "0.7846704", "text...
ab0e6abdf8df62a00e3b6fb5b8eb05c5
Marks the request between self and from_user as accepted Puts self and from_user in locked state Sends notification to sender of request
[ { "docid": "920a6aa00d0277b113cbd50d958bdbd6", "score": "0.8211129", "text": "def accept_request_from(from_user)\n begin\n Request.set_as_accepted(self.id, from_user.id)\n lock = Lock.new\n lock.one_id = self.id\n lock.another_id = from_user.id\n lock.creation_date = Time.now...
[ { "docid": "1a05af31ec8d1cd11d42ff349b8eb871", "score": "0.8356029", "text": "def accept_request_from(from_user)\n begin\n Request.set_as_accepted(self.id, from_user.id)\n\n a = self\n b = from_user\n # Making both users aware that they are locked.\n a.status = LOCKED\n ...
3ba7cbcb91e2999e3e26a7babf0e76b6
DELETE /departments/1 DELETE /departments/1.json
[ { "docid": "dff964c59137d9211031c9c9ace8715a", "score": "0.0", "text": "def destroy\n \n users = UsersDepartment.where(department_id: @department.id)\n user_departments = UsersDepartment.where.not(department_id: @department.id)\n \n if user_departments.count < 1 then\n users.each ...
[ { "docid": "c19e9529c1eebad07eaa7484b353f517", "score": "0.75529605", "text": "def destroy\n @departure = Departure.find(params[:id])\n @departure.destroy\n\n respond_to do |format|\n format.html { redirect_to departures_url }\n format.json { head :no_content }\n end\n end", "...
8cc36cdecb641f57a4b241c6f2799718
GET /home/events/new GET /home/events/new.json
[ { "docid": "92843bc24731fe1e37f0192ffd93b99a", "score": "0.7685391", "text": "def new\n @home_event = Home::Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @home_event }\n end\n end", "title": "" } ]
[ { "docid": "964f26f6a11e612de5548d2f9cd1854d", "score": "0.8088763", "text": "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end", "title": "" }, { "docid": "0ce9522763b40d72c5aa9f0ed9e53bb7", "score": "0.796...
fb4fd348ea85b45a34dbe34ce2d23be7
Creates a PostgreSQL view.
[ { "docid": "393411bea4686768d044a701cc61c3e2", "score": "0.8349348", "text": "def create_view(view)\n repository.adapter.execute <<-SQL.compress_lines\n create or replace view #{quote_name(view.name)} as\n #{view.to_sql}\n SQL\n end", "title": "" } ]
[ { "docid": "df844722dd913df4909c288bbae6da2d", "score": "0.79198414", "text": "def create_view(name, sql_definition)\n execute \"CREATE VIEW #{name} AS #{sql_definition};\"\n end", "title": "" }, { "docid": "4723fb543d0557b41e48d90ce06fb06d", "score": "0.7889519", "text":...
da50cc54091f5244c9f124e8aefa9703
update cached feed entries from remote feed
[ { "docid": "30a39851bd3c82c9e5b58dcaa89727c8", "score": "0.71979225", "text": "def update_with_remote_entries\n count = 0\n if remote_feed\n remote_feed.entries.each do |entry|\n if Entry.first(:url => entry.url)\n break # should be ordered most to least recent, so safe to dis...
[ { "docid": "dd38d8ec8f84702c506bbec1f62c413e", "score": "0.7827767", "text": "def fetch\n feed_objects = [self.blog_parser,self.source_code_parser].compact\n feed_cache = Feedzirra::Feed.update(feed_objects, {:timeout => 45})\n feed_cache = [feed_cache] unless feed_cache.is_a? Array\n self.u...
0d404f3b121bab34f1c79641d1a6a148
Add tracers for the given list of methods. methods The String or Array of method selectors to trace. Returns nothing.
[ { "docid": "c41eae4141794d9d2127ef6ab65605e7", "score": "0.59984684", "text": "def add(methods, slow=false)\n Array(methods).each do |func|\n func = func.strip\n next if func.empty?\n\n if func =~ /^(.+?)\\((.+)\\)$/\n name, args = $1, $2\n args = args.split(',').map{ |a|...
[ { "docid": "05ec533a54fb08f44eceb04d692ba3bf", "score": "0.6134246", "text": "def add_slow(methods)\n add(methods, true)\n end", "title": "" }, { "docid": "05ec533a54fb08f44eceb04d692ba3bf", "score": "0.6134246", "text": "def add_slow(methods)\n add(methods, true)\n end", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "a06e295b0e78b5e0cf04b4215aceb025", "score": "0.0", "text": "def set_entry\n @entry = Entry.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...
dcbc06b1f38c34971862d9e4f78cb04e
Copy attachments between a page and version (when creating new version), from a version to another version (when creating a new version and attachments are unchanged) or from a version to a page (when publishing a version)
[ { "docid": "502882254cf60e9b4e20a3d3f310f197", "score": "0.7202739", "text": "def copy_attachments(from_object, to_object)\n # clear existing attachments \n to_object.attachments.each {|a| a.destroy(true)}\n # and reload the association\n to_object.attachments(true)\n # copy the attachmen...
[ { "docid": "0ea2bf708988dc797e3c1f7c8d226a62", "score": "0.7554097", "text": "def copy_attributes(from_object, to_object)\n unless new_record?\n # If copying to a new version, check if attachments have been modified in this page\n # if so, copy to the new version, otherwise give new version...
19e280c7cafa3ff26898bfdb4351f60c
You can add fixtures and/or initialization code here to make experimenting with your gem easier. You can also use a different console, if you like. (If you use this, don't forget to add pry to your Gemfile!) require "pry" Pry.start
[ { "docid": "c4fa716d3cdd81f6194595770d7f3e43", "score": "0.0", "text": "def reload!\n $LOADED_FEATURES.each { |file| load file if file.include?('spellchecker') }\n\n 'ok'\nend", "title": "" } ]
[ { "docid": "dbc40b7dbbc3d275c9dffc53c62ad971", "score": "0.66811705", "text": "def test\n # require \"pry\"; binding.pry\n end", "title": "" }, { "docid": "0e88625757db4ec72d353bc86812a228", "score": "0.65036756", "text": "def setup\n \n end", "title": "" }, { "do...
af6caca9582dfe403a08de284e379e53
Create the timer. Set to_log to true to log out solved duration. Set verbose to true to log out start and end times.
[ { "docid": "8e0e84345706ac0da138c86b99a52a48", "score": "0.0", "text": "def initialize(to_log = false, verbose = false)\n @to_log = to_log\n @verbose = verbose\n end", "title": "" } ]
[ { "docid": "7fd22083e4072374b0ef973b267868c0", "score": "0.597206", "text": "def start\n @start_time = Time.now\n # Only log starting puzzle time if user wants verbose logging.\n puts \"Solving puzzle at #{@start_time.strftime(TIME_FORMAT)}.\\n\\n\" if @to_log and @verbose\n end", "title":...
16b6b972766d836d08927a7aff6d612d
GVV login input assertion: not logged in yet
[ { "docid": "f9973e2635a0a0a77ee266ba213a9151", "score": "0.0", "text": "def login (user, password, expected_success=true)\n @b.goto @base_url\n screenshot('scr_before_login.png')\n @b.text_field(:id => 'identity').set user\n @b.text_field(:id => 'password').set password\n @b.button(:type ...
[ { "docid": "4e07e01183dddf753a3748cefadd83ad", "score": "0.7654556", "text": "def incorrent_login_test\n # password_nil\n # email_nil\n if (signin_password_idx_tmp == 0) and (signin_email_idx_tmp == 0) then\n p 'Im loged in ||| Email and password is correct'\n signin_login_button\n ...