query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
8844d670fab2b6c76acdb5eb5cb1634e
TODO Remove this maybe?
[ { "docid": "bda30fd2ee9345788220da059a453fe1", "score": "0.0", "text": "def respond_with(*args)\n @resource = [:admin] + args\n super(*(@resource))\n end", "title": "" } ]
[ { "docid": "b6b2bcc0062aeb115edab7b10cbe6930", "score": "0.659932", "text": "def desired; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.64747685", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", ...
aaadfe3abcf7485e21672fa05b7636c4
Use callbacks to share common setup or constraints between actions
[ { "docid": "c809b1b59d8edb67d4d8e78c5d148242", "score": "0.0", "text": "def set_library\n @library = Library.find_by(id: params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.62848085", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.61890435", "text": "def run_action...
3fea7e747249acdf91c09adaa5550629
PUT /civils/1 PUT /civils/1.json
[ { "docid": "b2c8e9b679d18c00e821a34f9d72adb1", "score": "0.6808958", "text": "def update\n @civil = Civil.find(params[:id])\n \n respond_to do |format|\n if @civil.update_attributes(params[:civil])\n format.html { redirect_to @civil, notice: 'Civil was successfully updated.' }...
[ { "docid": "bfb4017453bf6240114d9a3cfcd5dc51", "score": "0.6727699", "text": "def update\n @civilite = Civilite.find(params[:id])\n\n respond_to do |format|\n if @civilite.update_attributes(params[:civilite])\n format.html { redirect_to(@civilite, :notice => 'Civilite was successfully ...
38c5f392935c8489972dc4571579d0ae
Sum quantities from all magazines
[ { "docid": "986bc3643f157b1046fa682e3aa3b9f8", "score": "0.0", "text": "def sell_quantity\n StoredItem\n .select('SUM(quantity) as sum_quantity')\n .where(item: item).first.sum_quantity\n end", "title": "" } ]
[ { "docid": "17e6b5ed8edd6c65d295fc775a9a6841", "score": "0.65038896", "text": "def total_magnesium\n\t\tmy_meals.to_a.sum { |item| item.total_magnesium }\n\tend", "title": "" }, { "docid": "8d0a3f1a0e8ae2506ff7b21b62bcd11b", "score": "0.648357", "text": "def total\n self.line_item...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "63062c3e81ee7e2168dcca1768b54293", "score": "0.0", "text": "def property_params\n params.require(:property).permit(:name, :area, :price, :description, :property_type_id, :interest, :status, :user_id, :bed_rooms, :bath_rooms, :address, :county_id, :state_id, :city_id, :latitude, :longitu...
[ { "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...
668562aebad16d1dd3bf1f15abf5e850
Performs search using rsolr
[ { "docid": "be39fb4d26957d65e341f326a3304fe4", "score": "0.73434454", "text": "def search(params=nil)\n rsolr.get select, :params => solr_params\n end", "title": "" } ]
[ { "docid": "f694d26c5b8a992e76c06db5fe78231b", "score": "0.78351754", "text": "def run_solr\n @solr = Sunspot.new_search(Document)\n generate_search\n build_pagination\n @solr.execute\n @total = @solr.total\n @results = @solr.results\n end", "title": ...
ad7b594af73af7711158adbadc49a088
PATCH/PUT /past_histories/1 PATCH/PUT /past_histories/1.json
[ { "docid": "5b28fc219daa5074cc32cf60d91c6e6d", "score": "0.7141876", "text": "def update\n respond_to do |format|\n if @past_history.update(past_history_params)\n format.html { redirect_to @past_history, notice: 'Past history was successfully updated.' }\n format.json { render :sho...
[ { "docid": "5adc071ac70442e8ab9181648c94eed9", "score": "0.68334514", "text": "def update\n @historical = Historical.find(params[:id])\n\n respond_to do |format|\n if @historical.update_attributes(params[:historical])\n format.html { redirect_to @historical, notice: 'Historical was suc...
be223fe804cf5ad2056dc600ee27ae0f
PATCH/PUT /favorite_spots/1 PATCH/PUT /favorite_spots/1.json
[ { "docid": "c29f533ba111a5d7035816edc96bacb1", "score": "0.7529315", "text": "def update\n respond_to do |format|\n if @favorite_spot.update(favorite_spot_params)\n format.html { redirect_to @favorite_spot, notice: 'Favorite spot was successfully updated.' }\n format.json { render ...
[ { "docid": "2baeb506e0b60fd313af538571bcbe23", "score": "0.7177691", "text": "def update\n if @favorite.update(favorite_params)\n render json: @favorite, status: :ok\n else\n render json: @favorite.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "doci...
7af56d5952a2aa320fb51d8381161082
POST /documents POST /documents.json
[ { "docid": "e95e11d1f396cad2d3fed9b595b6f176", "score": "0.0", "text": "def create\r\n @appoint_responsible = AppointResponsible.new\r\n @document = Document.new(document_params)\r\n @document.user_id = current_user.id\r\n @document.email = current_user.email\r\n\r\n\r\n respond_to do |fo...
[ { "docid": "706f5c0f4f01c5b58d1a75fe4ca43b41", "score": "0.7266928", "text": "def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, :notice => 'Document was successfully created.' }\n format...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "1a276939c1a6ccd3374ae1824316b138", "score": "0.0", "text": "def set_houseinfo\n @houseinfo = Houseinfo.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;...
4f21aae2bb1730fc7e48e15883d7d6a9
Overwriting the sign_out redirect path method
[ { "docid": "343b93ab7c03f69f362ba8418f98b098", "score": "0.0", "text": "def after_sign_out_path_for(resource_or_scope)\n \"http://www.delab.cl\"\n end", "title": "" } ]
[ { "docid": "9f04e62b663f6477f6c1d68d1b288eeb", "score": "0.82528174", "text": "def after_sign_out_path_for(resource)\n super\n end", "title": "" }, { "docid": "82427fe165aea1e420f5e1332636a243", "score": "0.81517977", "text": "def sign_out\n redirect_to root_path\n end", ...
246f26ecab30748551d7532f1753f81e
GET /fertilizations GET /fertilizations.json
[ { "docid": "4996dc16d4e92d27952d3cd9941c22be", "score": "0.0", "text": "def index\n @fertilizations = Fertilization.where(user: current_user).page(params[:page]).per(12)\n\n if (params[:from] != '' && params[:to] != '') && (params[:from] != nil && params[:to] != nil)\n @fertilizations = @fert...
[ { "docid": "0068be8d679d781740a9165129698f38", "score": "0.63789964", "text": "def get_formation_users\n @rest['users/users_formation'].get\n end", "title": "" }, { "docid": "fe565e4f7f0d90d296fad6ea32e1ddf1", "score": "0.6219415", "text": "def show\n @fetznedition = Fet...
5f854ccb24ea0002f6c275ad78f3c406
Method to print a list and make it look pretty input: output: Print shopping list formatted as "Quantity Item" steps: 1. Print Title 2. ITERATE through each item in list_items and print as formatted
[ { "docid": "3dc3bdcc7678d85bfd00169b4c085dfe", "score": "0.7806578", "text": "def display_list(list_items)\n title = \"Shopping List:\"\n puts title\n puts \"-\" * title.length\n list_items.each do |item_name, item_qty|\n puts \"#{item_qty}x - #{item_name}\"\n end\n\nend", "title": "" } ]
[ { "docid": "e90cdd9d656b886626232a244ca59a0c", "score": "0.8488027", "text": "def pretty_list(list)\n\tlist.each { |item_name, item_quantity|\n\t\tputs \"You will need to purchase #{item_quantity} of #{item_name}.\"\n\t}\nend", "title": "" }, { "docid": "1e076958452a777064fc640e9cfee496", ...
d027468a031e04012709668cce2e45b4
POST /vouchers POST /vouchers.json
[ { "docid": "b1f6538a6c6691aaa933986dd32770a8", "score": "0.53603965", "text": "def create\n @voucher = current_user.vouchers.build(voucher_params)\n @voucher.comments.each do |comment| \n comment.user_id = current_user.id\n end\n respond_to do |format|\n if @voucher.save\n fl...
[ { "docid": "0a464be010a76cafcc3c4f79848cc89e", "score": "0.6584073", "text": "def build_vouchers(options)\n return unless options \n\n self.vouchers.build(options)\n end", "title": "" }, { "docid": "ca0619b526e427648447252f81eb1282", "score": "0.58828604", "text": "def v...
a7566bb9b93b7daa046a2d7fe0c4a38c
convert a plist to string
[ { "docid": "12bcbf0dd71e76cf86d8980530b496ff", "score": "0.0", "text": "def to_str(opts={})\n return true\n end", "title": "" } ]
[ { "docid": "7b1577b5aa7fb65b8f056ecad571deaf", "score": "0.6703861", "text": "def to_plist_node\n content = []\n content << \"<dict>\\n\"\n content << @plist.collect {|k,v| [\"<key>#{k}</key>\\n\", Plist::Emit::plist_node(v)] }\n content << \"</dict>\\n\"\n content.flatten.join\n end", ...
c0ac95fa657af18328719816422a4d37
GET /stocks/1 GET /stocks/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "101460710b669b67f96b513d093ffd0c", "score": "0.813285", "text": "def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end", "title": "" }, { "docid": "0c3b49e80a15388e4b39723baa4e0c32", "score": "0.7827617", "text": "def show\n @stock = Stock.fi...
e87eee7bf80e0d5da427cf045da950c3
Get JSON data output
[ { "docid": "02e1481ce875df2e25b7ec1ec2475c7b", "score": "0.0", "text": "def to_json\n {\n 'id' => @id, 'name' => @name, 'type' => @type,\n 'statuses' => [tr(:active), tr(:done)],\n 'active_count' => @active_count,\n 'done_count' => @...
[ { "docid": "8c9bc0e2d2f89d457e47d8bba0a603a1", "score": "0.7972685", "text": "def json\n data\n end", "title": "" }, { "docid": "ad091c545100352a2804599bf4a90fad", "score": "0.78901035", "text": "def json()\n process if @data.nil?\n @data.to_json\n end", ...
a0a9e009f0070f444290289e696c9c4e
Retrieves data for items with the highest watch count
[ { "docid": "02f8d0bd3a44ca3df6d9955b98c2bbc2", "score": "0.7208373", "text": "def get_most_watched_items(payload = {})\n request('getMostWatchedItems', payload)\n end", "title": "" } ]
[ { "docid": "80bf10aa2141745741328a2590ae7e27", "score": "0.6198224", "text": "def watch_count\n item_hash.deep_find(:watch_count, 0)\n end", "title": "" }, { "docid": "a9f595c2df325d1e3605a974d9fbca84", "score": "0.6054121", "text": "def recent\n @limit = 10\n @webhooks...
4433aaed5f278928b7a624bc2107fca0
Adds a path to be recognized. To assign a part of the path to a specific variable, use :variable_name within the route. For example, add('/path/:id') would match /path/test, with the variable :id having the value "test". You can receive mulitple parts into a single variable by using the glob syntax. For example, add('/...
[ { "docid": "55f086b1f515c2bd49d34e14af35803c", "score": "0.8125948", "text": "def add(path, options = nil)\n add_route route(path.dup).with_options(options)\n end", "title": "" } ]
[ { "docid": "fa5c737adcf7a5dbd7bcef566a91c262", "score": "0.7013771", "text": "def add(verb, path, options = {}, &block)\n routes << (route = Route.new(path, verb, options, &block))\n route.router = self\n route\n end", "title": "" }, { "docid": "e973093c9e10ec9f278634374fca...
594b5a3d8e46c408026a05afe3c32505
POST /people POST /people.xml
[ { "docid": "3fe700612bc4d1ed644ef684aec830ac", "score": "0.0", "text": "def create\n @person = Person.new(params[:person])\n @current_style = :details\n \n if !params[:person][:uploaded_data].nil?\n @person.image = Image.new({ :uploaded_data => params[:person][:uploaded_data] })\n ...
[ { "docid": "5752b1fac9a71a418a2c4f4a2317862b", "score": "0.6141427", "text": "def create\n #rg = RestGraph.new( :app_id => APP_ID, :secret => APP_SECRET)\n #parsed_request = rg.parse_signed_request!(params[\"signed_request\"])\n @person = Person.new(params[:person])\n\n respond_to do |format...
08cef44ab705b67418e26f03ac28ddd2
Transform the provided kitchen config into the hash we'll use to create the aws instance can be passed in null, others need to be ommitted if they are null Some fields can be passed in null, others need to be ommitted if they are null
[ { "docid": "f0ec085a5c9dca5dc41722173776f8f9", "score": "0.0", "text": "def ec2_instance_data\n # Support for looking up security group id and subnet id using tags.\n vpc_id = nil\n client = ::Aws::EC2::Client.new(region: config[:region])\n if config[:subnet_id].nil? ...
[ { "docid": "e0bb1f5ff9ffe22eed4b895761b8dbe5", "score": "0.6224806", "text": "def generate_aws_config(vmname, config)\n {\n :ssh_username => option_handler(config, :ssh_username),\n :use_private_ip_for_ssh => option_handler(config, :use_private_ip_for_ssh),\n :bootstrap_options => {\n ...
34e50f629d6689a72cbcda90ac9528fe
Tries to expand a generic URI value that is either given as a full URL or a namespace:name value. This will assume a full URL if it finds a ":/" string inside the URI. Otherwise it will construct a namespace name URI
[ { "docid": "beb659114798ee7dccb95cf9b523849c", "score": "0.72756404", "text": "def expand_uri(uri) # TODO: Merge with uri_for ?\n assit_block do |errors| \n unless(uri.respond_to?(:uri) || uri.kind_of?(String)) || uri.kind_of?(Symbol)\n errors << \"Found strange object of type...
[ { "docid": "f7409922e3cff09a6c46aa84eccc1fd5", "score": "0.6151195", "text": "def url_formater\r\n if $uri.instance_of?(URI::Generic)\r\n $uri = URI::HTTP.build({:host => $uri.to_s}) \r\n end\r\nend", "title": "" }, { "docid": "fb8dde58126c3a8e0962c44aae2a6e98", "score": "0....
a2463f9e6ba68784c156876bdbb0a5a4
Force the encoding of all returned strings to the model's forced_encoding.
[ { "docid": "bfae4e917d5ce917b1c603458821f839", "score": "0.6093015", "text": "def typecast_value(column, value)\n s = super\n if s.is_a?(String) && !s.is_a?(Sequel::SQL::Blob) && (fe = model.forced_encoding)\n s = s.dup if s.frozen?\n s.force_encoding(fe)\n ...
[ { "docid": "82ff1fff8ba69e26165c7de5c254168d", "score": "0.7343299", "text": "def force_encoding(*); self; end", "title": "" }, { "docid": "e1f6a014090403fae321ea8ca5bbef58", "score": "0.7194289", "text": "def force_encoding(str)\n encoding = ::Rails.application.config.encodin...
481bdd34a1f31f47553a6598c3433bfb
Write a method that counts the number of elements of the array that is being passed in, only if the index of the number 42 in the onedimensional representation of the array is 5.
[ { "docid": "85d3f43b7bde7c0f49484f63a9626268", "score": "0.7277849", "text": "def zen(array)\n converted = array.compact.flatten\n converted.index(42) == 5 ? converted.count : nil\nend", "title": "" } ]
[ { "docid": "5a6599e6e0cb7d294e81d385fae5c104", "score": "0.74553514", "text": "def length_of_array(array)\n array.count\nend", "title": "" }, { "docid": "b4f372e1878d61924688fd6ac4f048ea", "score": "0.74418604", "text": "def q5\n array = [1, 5, 8, 10, 2, 3, 2, 3, 3, 1, 4, 5, 9]\n\n...
d6f190b6a38cc7fcd91ad75199aee313
If this is actually a module (as opposed to a class or whatever) then we can have a module in the implementation language containing primitives for this specific module in the source language. For instance, if we create a +ModuleInstance+ with name "Kernel", then the module named "KernelModule", defined primitives for ...
[ { "docid": "7b2edabf36d809fb51305b78e2ca28ee", "score": "0.7513504", "text": "def primitives_module\n if name && Carat::Data.const_defined?(\"#{name}Module\")\n Carat::Data.const_get(\"#{name}Module\")\n end\n end", "title": "" } ]
[ { "docid": "9de4306501711176ab8084b28395030d", "score": "0.6181525", "text": "def module; end", "title": "" }, { "docid": "5b35bc360c6f229d5f5fb89b98e54b5c", "score": "0.60803956", "text": "def visit_module(node)\n s(\n :module,\n [visit(node.constant),...
a7ff1ef8c760ee35986c978524d0bebf
The Amazon Route 53 hosted zone ID associated with the load balancer
[ { "docid": "40114c860135c611285b4028b2392ea7", "score": "0.71045613", "text": "def canonical_hosted_zone_id\n @alb.canonical_hosted_zone_id\n end", "title": "" } ]
[ { "docid": "3325b0cbf40e524551973f23f67d8619", "score": "0.80487156", "text": "def zone_id\n route_53_client.\n list_hosted_zones[:hosted_zones].\n each.\n select { |z| z[:name] == zone }.\n map {|z| z[:id] }.\n first\n end", "title": "" }, { "docid": "...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "56ce152272ea755a197a2e319984ccea", "score": "0.0", "text": "def set_lesson_planner\n @lesson_planner = LessonPlanner.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...
3fe5bda23e9a17670f720f82de3ae98c
Work out the duration based on the start end time
[ { "docid": "a118c225bff97898ad3ae2152af75465", "score": "0.80000645", "text": "def calc_duration\n self.duration_minutes = ((self.ended_at - self.started_at) / 60) + 1\n end", "title": "" } ]
[ { "docid": "ebad0d511e71bfb7e9cf59814cc18f86", "score": "0.8661253", "text": "def duration\n end_time - start_time\n end", "title": "" }, { "docid": "778abc215cf33a3a9cca15130b5f9f3a", "score": "0.8577027", "text": "def duration\n ((end_time - start_time) * 24 * 60).to_f\n en...
696387e1ad5b91992113a9b89605b3a8
GET /bill_summaries GET /bill_summaries.json
[ { "docid": "82d61ee3f8ac150db261c26453d628c6", "score": "0.79001945", "text": "def index\n @bill_summaries = BillSummary.all\n end", "title": "" } ]
[ { "docid": "40052b38990ff3d260f34b902daa587b", "score": "0.6743894", "text": "def index\n @bill_detail_infos = BillDetailInfo.all\n end", "title": "" }, { "docid": "f86cab27572c50f31d7f3878d36e10e5", "score": "0.6628985", "text": "def index\n render json: Bill.all\n e...
96da5cbad68127aaef307c74781a1469
your only friends are make believe
[ { "docid": "19d00a49ddc12d984a4a4665b024e9a0", "score": "0.0", "text": "def friender_not_friendee\n if self.friendee_id == self.friender_id\n errors.add(:base, \"Can't be friends with self.\")\n return false\n end\n end", "title": "" } ]
[ { "docid": "353078801991a4edab87c57a22ba97a8", "score": "0.76922727", "text": "def excluded_friends\n pending_friends + blocked_friends + friends\n end", "title": "" }, { "docid": "46820d4c9319acb3349e416e9f77cc21", "score": "0.7517373", "text": "def friends\n self.invit...
d3c58c93ca21cb3c6d97582f0a79dec8
Travar mais de X horas de apontamento no mesmo dia Retorna a quantidade de horas apontadas por um usuario num determinado dia Alterado metodo para receber tambem o id do time_entry e excluilo na soma porque quando e editado um valor ele conta novamente para o calculo de restricao
[ { "docid": "9c0b1c91326417e26bfb8e8e1942c265", "score": "0.49049416", "text": "def get_hours_spent_on_day_by_user(user, date, exclude_time_entry_id=nil)\n if user and date\n conditions = \"#{TimeEntry.table_name}.user_id = #{user.id} and #{TimeEntry.table_name}.spent_on = '#{date}'\"\n cond...
[ { "docid": "7d3b0a6f28f2e364acf44ba39c25993d", "score": "0.6080708", "text": "def validar_hora\n if(self.status == \"Deferido\")\n x = User.find(self.user_id)\n x.cargahoraria_total[self.grupo] += self.hora_computada\n x.cargahoraria[self.grupo] += self.hora_computada\n ...
d7f583a266434e5d5772c4707af0c2a5
Returns the Sender value of the mail object, as a single string of an address spec. A sender per RFC 2822 must be a single address. Example:
[ { "docid": "da4bcc2c10c4e615a0b05b78f43a8fa4", "score": "0.0", "text": "def sender( val = nil )\n default :sender, val\n end", "title": "" } ]
[ { "docid": "d22c6e4ad0f219233d881676964807ff", "score": "0.7476716", "text": "def from\n address = @mail[:from].formatted\n Mail::Address.new(address.first)\n end", "title": "" }, { "docid": "76f30d2a181d4dc51061a686ff623149", "score": "0.7033126", "text": "def mail_from...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "535d086a36e32c0643260200214761d3", "score": "0.0", "text": "def resolucao_params\n params.require(:resolucao).permit(:resposta, :exercicio_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...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "9a889b3afa911c4d5e35076e97590e68", "score": "0.0", "text": "def contractorpo_params\n params.require(:contractorpo).permit(:number, :date, :amount, :description, :contractorquote_id, :user_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
a27c544807c1ac63ed6d25e2ddc75c5a
use the existing sufia role mapper to determine who is an admin
[ { "docid": "cc6b94965d749d41cbe60e6b5c79ef3b", "score": "0.0", "text": "def admin?\n groups.include?( 'admin' )\n end", "title": "" } ]
[ { "docid": "c39168d4177d6333fd92b3aa3a1e2020", "score": "0.7632531", "text": "def admin\n role.eql?(\"admin\")\n end", "title": "" }, { "docid": "039bfe7458a5ed06ba683b262626bc49", "score": "0.75456905", "text": "def admin?\n role == 'admin' ? true : false\n end", "title"...
fe9f51cbfad194c5bc54337980a66256
Display a form to edit an existing location GET /locations/1/edit
[ { "docid": "13d9d82b05c59c1d7d22387e67a6f80a", "score": "0.0", "text": "def edit\n end", "title": "" } ]
[ { "docid": "ccf6a0011f33a168897d9b2ed595d959", "score": "0.8566833", "text": "def edit\n\t\t@location = Location.find(params[:id])\n\tend", "title": "" }, { "docid": "b66ba6fdbd4397155b512a4b4ce3a902", "score": "0.8536288", "text": "def edit\n @location = Location.find(par...
51b74074b8b22f71dbf5e1fd27661ffd
DELETE /ps_perimeters/1 DELETE /ps_perimeters/1.json
[ { "docid": "f0120e1bd7f5f271c5d430478608f3e4", "score": "0.7059739", "text": "def destroy\n @ps_perimeter.destroy\n respond_to do |format|\n format.html { redirect_to ps_perimeters_url, notice: 'Physical Security Perimeter was successfully deleted!' }\n format.json { head :no_content }\n...
[ { "docid": "b5be55ee5b9710a0ba803063cd6f2ac6", "score": "0.69608736", "text": "def destroy\n @es_perimeter.destroy\n respond_to do |format|\n format.html { redirect_to es_perimeters_url, notice: 'Electronic Security Point was successfully deleted!' }\n format.json { head :no_content }\n ...
d2fc2921d937f31c62ee44016660d386
Cult.find_by_location takes a String argument that is a location and returns an Array of cults that are in that location
[ { "docid": "518185891235ebca9041fb023765b8d1", "score": "0.81372046", "text": "def find_by_location(location)\n Cult.all.select {|cult_name| cult_name.location == location}\nend", "title": "" } ]
[ { "docid": "21774d2a660a8b0e943ce530fd0b00b8", "score": "0.6717959", "text": "def find_by_location(location)\n filtered_set(\n all.select { |elm| elm.respond_to?(:location) },\n key: 'location', value: location\n )\n end", "title": "" }, { "docid": "928b9...
4801010736f1d5f775e107f979a8ea44
Obtains the root of Jenkins server. This function is used to see if Jenkins is running
[ { "docid": "84f8cf28e7fb9665b9783f7387ad278e", "score": "0.66827816", "text": "def get_root\n @logger.debug \"GET #{@jenkins_path}/\"\n request = Net::HTTP::Get.new(\"#{@jenkins_path}/\")\n make_http_request(request)\n end", "title": "" } ]
[ { "docid": "2082b17e071482edd9a258b4f74dced6", "score": "0.6851965", "text": "def jenkins?\n @logger.info \"Jenkins Detected: #{not (ENV['WORKSPACE'].nil?)}\"\n return !ENV['WORKSPACE'].nil?\nend", "title": "" }, { "docid": "edaa9713e0bd332464f9e1e857b86de1", "score": "0.66264784", ...
a7a817661c0faa5c863dfc7d8fa829b2
Returns the string representation of the object
[ { "docid": "a408df9f3be79d7c20500741a990725c", "score": "0.0", "text": "def to_s\n to_hash.to_s\n end", "title": "" } ]
[ { "docid": "fbdd4f858146598aaabf84003282a8d1", "score": "0.901777", "text": "def to_s\n @object.to_s\n end", "title": "" }, { "docid": "d69be2e09bbb16dc0e9df0ec2905d3f4", "score": "0.88380826", "text": "def to_s\n\t\treturn self.obj.to_s\n\tend", "title": "" }, ...
d639f2e1295088a43b35f8966d08ea9b
GET get a friend of the user /friends/json/show_is_my_friend_by_user_id_and_friend_id/:user_id/friend_id' /friends/json/show_is_my_friend_by_user_id_and_friend_id/206/13.json' // success > head 200 OK
[ { "docid": "6451c32abc0c5677b3c6d9d061d9af64", "score": "0.70572764", "text": "def json_show_is_my_friend_by_user_id_and_friend_id\n respond_to do |format|\n if User.exists?(id:params[:user_id])\n @friends = Friend.where('user_id = ? and user_id_friend = ?',params[:user_id],params[:friend...
[ { "docid": "dc3053d4b0bd36277860b119d83e0cf9", "score": "0.791449", "text": "def show\n if params[:user_id] then\n @friends = Friendship.find_all_by_user_id(params[:user_id])\n else\n @friends = Friendship.find_all_by_user_id(params[:id])\n end\n\n respond_to do |format|\n for...
8a0ceea5982f3022be00dacd742cfb14
Check for JAAS configuration
[ { "docid": "de3fc825e944d9bc2fc66db6a1ecae1f", "score": "0.6743634", "text": "def check_jaas_config(service)\n %w(client master).each do |type|\n next unless node[service].key?(\"#{type}_jaas\")\n %w(client server).each do |key| # These are JAAS keys, not files\n next unless ...
[ { "docid": "e1fa3e33e70ad44120d7a13ef55c94d7", "score": "0.69183725", "text": "def has_configuration?\n @config[:username] and @config[:password]\n end", "title": "" }, { "docid": "9b03352c85fa34c7fa6b324a034c4cb6", "score": "0.67062145", "text": "def check_auth(configuration...
f21916a03c489a99571dab06f7f9985c
Show a single celebrity
[ { "docid": "b7fedfe61f6bc8798933f6a8f3d9f860", "score": "0.65124387", "text": "def show\n # @celebrity_to_show = {}\n for celebrity in session[:celebrities]\n if params[:name] == celebrity['name']\n @celebrity = celebrity\n end\n end\n end", ...
[ { "docid": "dd578edb55d8f70fdf345e0240e4bd79", "score": "0.6719986", "text": "def show\n @celebrity = Celebrity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @celebrity }\n end\n end", "title": "" }, { "docid": "...
ecb96c0d8a3115da20c9f2024c4804aa
called (once) when the user logs in, insert any code your application needs to hand off from guest_user to current_user.
[ { "docid": "c1b8109a7bddbb1801f1d79cbcab493c", "score": "0.67875904", "text": "def logging_in\n guest_reviews = guest_user.reviews.all\n guest_reviews.each do |review|\n review.user_id = current_user.id\n review.save\n end\n # For example:\n # guest_comments = guest_user.comment...
[ { "docid": "85f9b8ef7b00b362315a712a80c23bc9", "score": "0.76545906", "text": "def logging_in\n logger.debug \"ApplicationController:logging_in >>> \"\n current_user.transfer_data(guest_user)\n end", "title": "" }, { "docid": "aaf7d1bd504ecebaca7a91ddcc18dcc1", "score": "0.7561395...
809265b27b6cd55bba61f15e52df4aa9
to get recently added expenses
[ { "docid": "6123897eee988def16574f354d1909b4", "score": "0.70127827", "text": "def recent_expenses\n expenses.where('expended_at BETWEEN ? AND ?', Date.current.beginning_of_month, Date.current.end_of_month).order(expended_at: :desc).limit(5) \n end", "title": "" } ]
[ { "docid": "0832a9814b53f9cf7a2f8002029f0ff6", "score": "0.71511954", "text": "def expenses_this_month \n self.get_specific_expenses(30)\n end", "title": "" }, { "docid": "3c30f400c8978e42dabbccdb0151e839", "score": "0.712136", "text": "def expenses_this_week \n self...
a02964aba4d7bc36b33eca623b0c9949
1 / \ nil nil
[ { "docid": "7d29c774e201c27c770db9afdf685738", "score": "0.6023632", "text": "def test_tree_with_nil_branches\n tree = Tree.new(1, nil, nil)\n assert_equal 1, solution(tree)\n end", "title": "" } ]
[ { "docid": "8bdbc91e5d5efc0d596b93fc28ee9251", "score": "0.7089876", "text": "def nil!; end", "title": "" }, { "docid": "b17a5e73b18d3162a6a8b98a898d7e72", "score": "0.68403345", "text": "def null!; end", "title": "" }, { "docid": "8d558a11eadd9b270e542d8c9688eac0", "...
19d16da6ad07f861ec6072bd37bb0ca5
Delete VM Groups if they are empty
[ { "docid": "df5b888b45ac8a3347ef77ad5d4577d6", "score": "0.792759", "text": "def delete_vm_groups(vm_group_names)\n return if vm_group_names.empty?\n DrsLock.new(DRS_LOCK_VMGROUP ).with_drs_lock do\n empty_vm_groups = @cluster.configuration_ex.group.select do |group|\n group.is...
[ { "docid": "31660405f858f823278c9fb20cda7c87", "score": "0.74920756", "text": "def remove_empty_group\n group = self.group\n if group.users.size == 1\n # group.destroy\n end\n end", "title": "" }, { "docid": "3a95fc56121fa07ffc734b44c39b00d1", "score": "0.69504595", "t...
04e884ed022dca1fc661ec5bc81f292f
Send user ID, params, and request URL to Sentry onerror.
[ { "docid": "4b8cc92b0442291e9af1fff6053e8b98", "score": "0.0", "text": "def set_raven_context\n Raven.user_context(id: current_user&.username)\n Raven.extra_context(params: params.to_unsafe_h, url: request.url)\n end", "title": "" } ]
[ { "docid": "39ff81fa1f0b9e2a712f5230b8ec1c20", "score": "0.60574794", "text": "def log_to_sentry(method, uri, params)\n Sentry.error('Api Failed', method: method, uri: uri, params: params)\n end", "title": "" }, { "docid": "f4e7afc9333f18624aa24dc093a3a669", "score": "0.5967679",...
11293fd83bb5ed11d4f61b4fc8665cb0
Request a remote server's `exec.php` script version.
[ { "docid": "51aa7c29cd517bb5927f413e799f44f0", "score": "0.0", "text": "def version\n script = ScriptBatch.new { |s| s << 'echo EXECPHP_VERSION;' }\n version = exec(script).body\n version if version =~ /^\\d\\.\\d\\.\\d(?:\\.\\w+)?$/\n end", "title": "" } ]
[ { "docid": "ef9616a5c8c72b3f2b1cbed806e46f9c", "score": "0.624517", "text": "def exec\n path = File.join(options[:bin_path], 'request')\n `#{path} #{parse_params}` || ''\n end", "title": "" }, { "docid": "710058159ff8d82fdf2567f9818b7968", "score": "0.59050...
c1c8f786e3d1e79d7e6d780628f0b7cb
PATCH/PUT /clothing_types/1 PATCH/PUT /clothing_types/1.json
[ { "docid": "69c658e07d5fe156c0cf50e5c55fd5e6", "score": "0.7212358", "text": "def update\n respond_to do |format|\n if @clothing_type.update(clothing_type_params)\n format.html { redirect_to @clothing_type, notice: 'Clothing type was successfully updated.' }\n format.json { render ...
[ { "docid": "a1aa2dfe3e0c161f7a4964616dfb4071", "score": "0.68707484", "text": "def update\n respond_to do |format|\n if @thing_type.update(thing_type_params)\n format.html { redirect_to @thing_type, notice: 'Thing type was successfully updated.' }\n format.json { render :show, stat...
1aa08cd4ae327c58da17de3dc602665f
initialize all rows of the listings table with eager load for s3 images, ransack for search and search and paginate for limiting listings per page
[ { "docid": "4856901a405c31628d725520ef05020b", "score": "0.7055027", "text": "def index\n @q = Listing.ransack(params[:q])\n @listings = @q.result.with_attached_picture.paginate(:page => params[:page], :per_page=>8)\n end", "title": "" } ]
[ { "docid": "64f4108b7d566a29077b99a88e53e686", "score": "0.67563665", "text": "def index\n @listings = Listing.order(created_at: :desc).includes(:commoner, :tags, :comments, :images)\n end", "title": "" }, { "docid": "aaf9417d1155d3fb37d8878cc745718c", "score": "0.65990776", "tex...
df5cff09ff9603704f22b24bbc32368e
user_id, subject, content, msg_to, delivery_date, delivery_time, msg_public
[ { "docid": "a0e913f23b9244b028607ccf17f66f6c", "score": "0.0", "text": "def create\n @message = Message.new(message_params)\n @message.msg_public = params[:msg_public]\n @message.user_id = params[:user_id]\n\n if @message.save\n redirect_to message_path(@message)\n else\n render...
[ { "docid": "10e4b248a5078346a8ab3cf35b74c367", "score": "0.6627512", "text": "def pub(user, mailing_id, subject, body, mailing)\n @trackerModel = mailing.secubat_model_id\n @trackerMailing = mailing.id\n if (user.first_name.length > 2)\n @username = \"#{user.gender.capitalize} #{user.first...
95cb6e6c8c9c5275a22482588d551e22
DELETE /bilges/1 DELETE /bilges/1.json
[ { "docid": "001ab417586c829a73b4ceb7d3331623", "score": "0.7051547", "text": "def destroy\n @bilge.destroy\n respond_to do |format|\n format.html { redirect_to bilges_url, notice: 'Bilge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" ...
[ { "docid": "91cbb9fba8ae599d34e55d5a573a7815", "score": "0.6775657", "text": "def destroy\n @bili = Bili.find(params[:id])\n @bili.destroy\n\n respond_to do |format|\n format.html { redirect_to bilis_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { ...
56fc87a73d8736faeee03a0059715b48
restore original state revert the changes made by all ticks of apply (some actions need to store state to make this work, other actions can fire an inverse fx)
[ { "docid": "4040bffc6315b9021b1fb3750f11ce3c", "score": "0.5733524", "text": "def undo\n\t\t\t\t\n\t\t\tend", "title": "" } ]
[ { "docid": "89fca189114b09925cc522460681c6e2", "score": "0.68939805", "text": "def reset\n unapply\n apply\n end", "title": "" }, { "docid": "16cb291d5b853c8645d2eeb1b65d0b1d", "score": "0.6869091", "text": "def revert\n end", "title": "" }, { "docid": "ddbdac...
0f9663e1cf36bfe2a31a00588e25334a
GET /covenants/1 GET /covenants/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "931da6e0c9eabf5aef8996c86e3a32aa", "score": "0.7770812", "text": "def index\n @covenants = Covenant.page(params[:page])\n .per(params[:page_limit])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @covenants }\n end\n end", "...
591f3231bfa5bccb7da3c279ffffba4e
Time Complexity: O(n) Space Complexity: O(n)
[ { "docid": "aaa74513a3d28bbede78778b8124da7b", "score": "0.0", "text": "def postorder_helper(current_node, list)\n return list if current_node.nil?\n \n postorder_helper(current_node.left, list)\n postorder_helper(current_node.right, list)\n list << {key: current_node.key, value: current_...
[ { "docid": "9bfaea331eedce3072d8464bb5cccee1", "score": "0.650033", "text": "def fast_two_sum?(arr)\n # O(n) in time and space\n result = []\n complements = {}\n\n arr.each_with_index do |el, i|\n if complements[el]\n result.push([complements[el], i])\n else\n complements[-el] = i\n ...
3504435134165d204b9b6a86f36d19dd
This method is used to capture the main content for a page and wrap it in a containing element. The content wrapper will be suppressed for AJAX requests.
[ { "docid": "415ff2633df2adf658bd7fa568f4f60c", "score": "0.6232464", "text": "def content(opts = {}, &blk)\n output = capture(&blk)\n if request.xhr?\n output\n else\n content_tag(:div, opts.merge(:id => 'content')) do\n content_tag(:div, output, class: ...
[ { "docid": "0b3eb3d4083b0041c139fc669d4774ec", "score": "0.6720516", "text": "def within_page_content(&_block)\n within(:css, 'div#content-wrap') { yield }\nend", "title": "" }, { "docid": "e0460e2ac56add6132216e4f8aa07d3a", "score": "0.67011404", "text": "def body_content\n div ...
1ef28ac01ab82679ea3d58549cbe5af6
GET /ebay/shipping_service_options/1 GET /ebay/shipping_service_options/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "f1035dc2dbc00df6ad60acc95661d4fb", "score": "0.7679175", "text": "def index\n @ebay_shipping_service_options = Ebay::ShippingServiceOption.all\n end", "title": "" }, { "docid": "78c211340f893fa04c2b387dddfc0bb9", "score": "0.74736345", "text": "def set_ebay_shipping_s...
1eadf00dab4dd32ce0f52b9a7fe5c458
If you have extra params to permit, append them to the sanitizer.
[ { "docid": "a26d01f349d7517425688abe1b6980d4", "score": "0.0", "text": "def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up).push(:username, :x, :y)\n end", "title": "" } ]
[ { "docid": "9f3b62fe05ad1542504f6ef13056ac4e", "score": "0.6905034", "text": "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = p...
6280330bd4df66882234c5b433fc7898
If the directory is not valid or file is not 404. If you turn on the direct address directory index 403 If the directory is correct, then return its index 200 If the file is, then bring it back 200
[ { "docid": "6d23df20d1df4c3017e3e162916ea94e", "score": "0.0", "text": "def get_handler(client, path, body=true)\n\tpath = URI.unescape(File.join(DOCUMENT_ROOT, path))\n\n\tif File.file?(path) and path.end_with?(INDEX_PATH)\n\t\tclient.puts get_headers(STATUS_FORBIDDEN)\n\t\tclient.close\t\t\n\tend\n\n\...
[ { "docid": "7b36b49b04e47de93d6801080243dd1b", "score": "0.7075258", "text": "def check_404\n end", "title": "" }, { "docid": "d565f4438d384b39edc50448cd7d7823", "score": "0.69738996", "text": "def directory_index_response(req)\n response = ::Rack::Response.new\n dir_index...
e051be4b1caf8f2cac1bd763fcf26609
Returns a relation for all roles on a given object.
[ { "docid": "ad3b2daea77843f25cbb5de68ee7c9bf", "score": "0.0", "text": "def on(owner = nil)\n if owner.present?\n where :owner_id => owner.id, :owner_type => owner.class.name\n else\n where :owner_id => nil, :owner_type => nil\n end\n end", "title": "" } ]
[ { "docid": "6253d46d52fd443d6210f3aec9807846", "score": "0.6388311", "text": "def all_roles\n _role_ids_ = (account_groups.map(&:role_ids) + role_ids).flatten.uniq\n Role.where(id: _role_ids_)\n end", "title": "" }, { "docid": "cab8d1f063f65ccb32ef55362b86509c", "score":...
96c3fd9f93b8c12d9cc0b369eb85529f
Writes an html file for a camera make with the first 10 works of that make and navigation to allow the user to browse to the index page and to each make
[ { "docid": "03d9c2e29b2696ba28da70f04c0e89c6", "score": "0.76550895", "text": "def write_make(make, cameras)\n @title = make\n\n @thumbnail_urls = cameras.slice(0, 10).map do |camera|\n camera[:image_url]\n end\n\n @models = extract_models(cameras)\n\n # Create the make subdirectory ...
[ { "docid": "5a02c7c89538797fc04bf8d49f52c32a", "score": "0.7375761", "text": "def write_index(cameras)\n @title = \"Camera Index\"\n # order wasn't specified so just use the order they came in\n @thumbnail_urls = cameras.slice(0, 10).map do |camera|\n camera[:image_url]\n end\n\n @ma...
ba69cf487d11585bb25a1837be93ae91
Add new measurement / unit
[ { "docid": "fb544e4446f900d950d83ce12da69b40", "score": "0.7773767", "text": "def add_measurement name, unit\n unless @measurements.include? name\n @measurements << name\n @units[name] = unit\n @ranges[name] = Ranges.new\n else\n raise \"Unit '#{unit}' different from previously...
[ { "docid": "77bb9db3cd99d36cb78552ccb79d8794", "score": "0.77918696", "text": "def add_unit (unit)\n @units << unit\n\n end", "title": "" }, { "docid": "cb9d37cd63b24b850460fb78ea0b9a71", "score": "0.7652688", "text": "def add( measurementName, feet, inches )\n\n\tend", "titl...
2bff18d8c993d5372030f4a6be595eeb
Removes the asset from the specified group
[ { "docid": "7e2566dd21f23e6fd0baa0fcc366f2f2", "score": "0.8341705", "text": "def remove_from_group\n asset_group = AssetGroup.find_by_object_key(params[:asset_group])\n if asset_group.nil?\n notify_user(:alert, \"Can't find the asset group selected.\")\n else\n if @asset.asset_groups...
[ { "docid": "9bb6bb7418cfddae376fcb2bb8e6225d", "score": "0.75559074", "text": "def remove_group!( group )\n save if remove_group( group )\n end", "title": "" }, { "docid": "f5a96c3e7a91e51bed38008cabc10da8", "score": "0.7511211", "text": "def object_group_remove(group)\n @...
2afd3360998ab2c98e3ef98b2c4c9640
Close Incident Closes incident with given identifier
[ { "docid": "ed047061bf55a888d4a9adf0b20b74d0", "score": "0.8143233", "text": "def close_incident(identifier, opts = {})\n data, _status_code, _headers = close_incident_with_http_info(identifier, opts)\n data\n end", "title": "" } ]
[ { "docid": "1b202c61257ba5a239dd72812e68d53c", "score": "0.7353245", "text": "def close_incident_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IncidentApi.close_incident ...'\n end\n # verify the required par...
af0f749e169c0844d77e7a36babedd10
Method definitions Method to find sum
[ { "docid": "4d33436e9bbf43ce9ad6952f0d857c52", "score": "0.6797285", "text": "def getSum ( x , y )\n\tsum = x + y\n\treturn sum\nend", "title": "" } ]
[ { "docid": "410444f0c4963588f832ead99f8a48db", "score": "0.83689773", "text": "def sum; end", "title": "" }, { "docid": "fb38ff9e78b9a76bce3d9962d51df19c", "score": "0.7448097", "text": "def amount_sum_for(meth)\n entries.select(&meth).map{ |entry| entry.amount.to_i }.compact.in...
281464204b9b851d7535582e7e03b389
`inputs` array must be sorted by length
[ { "docid": "abbfd227747805acc3fc4ab55851b1ab", "score": "0.0", "text": "def output_map(inputs)\n one = inputs[0]\n seven = inputs[1]\n four = inputs[2]\n eight = inputs[-1]\n\n zero_six_nine = inputs[6..8]\n six = zero_six_nine.find { !_1.superset?(one) }\n zero = zero_six_nine.diff...
[ { "docid": "c5cec0dd58ea9afb91c5482c4257e3de", "score": "0.62255424", "text": "def sort3(array, length)\n \nend", "title": "" }, { "docid": "d57a68193f0ac650d84886bf2afc3662", "score": "0.61711514", "text": "def sort3(array, length)\n\nend", "title": "" }, { "docid": "d5...
d91a48762c0bac43af16066ccd6df07b
Register an Actor locally as a named service
[ { "docid": "aa1629ee149332d64ae2eba26e5c5f48", "score": "0.6758107", "text": "def register(name, actor)\n unless actor.is_a?(Actor)\n raise ArgumentError, \"only actors may be registered\"\n end\n\n registered = @@registered.receive\n begin\n registered[name] = actor\n ...
[ { "docid": "4cbbd293ef8a81d89d0258c44ae5df0b", "score": "0.66221714", "text": "def register(actor, prefix = nil)\n @registry.register(actor, prefix)\n end", "title": "" }, { "docid": "0016076eb6f33685884da7d010cd5212", "score": "0.66043514", "text": "def register(name, actor)...
8bf43e9e63fd47990a9c5053f909c851
This takes a number of arrays as inputs, determines the length of the longest, and pads the rest with 0s until they're the sames length If we don't do this is becomes awkward to add numbers with different bit lengths
[ { "docid": "c14a594534ea7a0da05bc978ad996395", "score": "0.7139987", "text": "def even_the_bit_lengths(*numbers)\n longest_length = numbers.max {|a, b| a.length <=> b.length}.length\n numbers.map! do |number|\n while number.length != longest_length\n number.unshift(0)\n end\n number\n e...
[ { "docid": "85fd6d32f361f9579a752c9ae1001ae7", "score": "0.6425387", "text": "def longest_equal_subarray(array)\n return 0 if array == 0\n\n current_length, max_length, number = 0, 0, array.first\n\n array[1..-1].each do |x|\n if x == number\n current_length += 1\n else\n number = x\n...
8dc9b34268616b674d6b2c3d66076403
DELETE /estado_actividades/1 DELETE /estado_actividades/1.json
[ { "docid": "3c61c82a6b21122ff22977b15196fa97", "score": "0.0", "text": "def destroy\n\t\tauthorize! :destroy, EstadoActividad\n @estado_actividad.destroy\n respond_to do |format|\n format.html { redirect_to estado_actividades_url\nflash[:success] = 'Estado actividad fue borrado satisfactoriam...
[ { "docid": "05d038f52b418bf8f39fa0b764870ccf", "score": "0.7446455", "text": "def destroy\n @tipo_actividad = TipoActividad.find(params[:id])\n @tipo_actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_actividades_url }\n format.json { head :ok }\n end\n ...
bbbea12f6ddfb70e8395d735f5366086
Create an image that is at least DESIRED_WIDTHxDESIRED_WIDTH pixels, and then cache it.
[ { "docid": "2abc6e07e6ddf75ea343269697047df5", "score": "0.0", "text": "def get_random_spotlight_image(media_item, gravity = Magick::CenterGravity)\n result = \"error.jpg\"\n begin\n result = \"NOT DEFINED YET\"\n #no point creating the thumbnail from a possibly huge original image\n ...
[ { "docid": "d0b35ec32815a64224c7427551fa66e3", "score": "0.6304924", "text": "def genfullimage(width, height)\n cacheinfo = [fullname, width, height, File.mtime(fullname)]\n\n if (cacheinfo != @cacheinfo) then\n image = Magick::Image::read(fullname).first\n image.auto...
ab480a6dd009da910274ed5f4d033ff7
Stream data from the provided path
[ { "docid": "5ecdcb433aad2f8b55d0dc09c42630cd", "score": "0.6602348", "text": "def stream_from(path, opts = {}, &block)\n klass = opts.fetch(:klass)\n params = opts.fetch(:params, {})\n request = generate_request(path, {\n method: :get,\n content_type: :stream,\n ...
[ { "docid": "746834357732e84eff78093ae5628312", "score": "0.76146287", "text": "def stream_resource(path, options)\n connect.start do |http|\n http.get(\"/data#{path}\", header(options) || {}) do |chunk|\n yield chunk\n end\n end\n end", "title": "" }, { "d...
6f8c3250f6504b4aa5a3b35ba1d8027f
GET /eedesals/new GET /eedesals/new.xml
[ { "docid": "0b952e2c83807f662734fbdb21263a1b", "score": "0.77057385", "text": "def new\n @eedesal = Eedesal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @eedesal }\n end\n end", "title": "" } ]
[ { "docid": "baf6079ce8d80790117ed69dd2d6de88", "score": "0.7619701", "text": "def new\n @eep = Eep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @eep }\n end\n end", "title": "" }, { "docid": "329737ada5f32580f7415375d61043a8",...
1b580360e8c0da78e47255dae25b7e59
GET /savings/1 GET /savings/1.json
[ { "docid": "73f8b8b15f2501b3afa900e4096a8a41", "score": "0.0", "text": "def show\n @year= @saving.saving_date.year\n @month= @saving.saving_date.month\n @saving.year= @year\n @saving.month = @month\n\n @ref = @saving.id\n @totallodgement = Lodgement.where(saving_id: @ref).sum(:amount)\...
[ { "docid": "b0d447375e2519dcf9a973f546022c21", "score": "0.7051166", "text": "def index\n @savings = Saving.all\n end", "title": "" }, { "docid": "1a989c2e503483ac3fe3a9d88075a840", "score": "0.69771385", "text": "def show\n @saving = Saving.find(params[:id])\n\n respond_to...
fd7f8b72c0447184c8611576226dd1a1
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.order_mailer.shipped.subject
[ { "docid": "2d2959f69cc022a4f1c12e7c0d3d1d85", "score": "0.0", "text": "def shipped\n @greeting = \"test rails 1111111\"\n\n mail to: \"timanismayana@gmail.com\"\n end", "title": "" } ]
[ { "docid": "ea740e704e8f1173fb87b45dfcaaf989", "score": "0.71963865", "text": "def subject_for(key)\n I18n.t(:subject, scope: [:mailer, key])\n end", "title": "" }, { "docid": "8928fe4f050d7ebd3e9aa992b07e320a", "score": "0.7094809", "text": "def subject_for\n ActiveSuppor...
6d93c118313d5d4162e88b350882a7ef
Baseline implementation for the get_approval_request REST call
[ { "docid": "4b2eb61b79802f35ddb9c3890c1e0136", "score": "0.73619837", "text": "def get_approval_request request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_ap...
[ { "docid": "f97e0cbe81b48cd603d60f2978dec03f", "score": "0.6745242", "text": "def request_pre_approval(account = nil)\n params = Serializer.new(self).to_params\n response = post('/pre-approvals/request', API_V2 ,account, params).parsed_response\n code = response['preApprovalRequest']['cod...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "ae5f4bcde879cfd752d938a1cbf7f4f8", "score": "0.0", "text": "def manufacturer_params\n params.require(:manufacturer).permit(:name, :address1, :address2, :city, :state_id, :pin, :phone, :fax, :email, :website, :mobilephoe, :abbrev, :phone2, :release_status_id, :status_id)\n end", "...
[ { "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...
231b1bc302ea49de8a452a6e12ff0203
Raise a new alarm, or overwrite the existing alarm with the same id if one exists.
[ { "docid": "bdab9ebdc533b2464306b26d5124e898", "score": "0.72965956", "text": "def raise(alarm)\n @alarms[alarm.id] = alarm\n end", "title": "" } ]
[ { "docid": "35aabca532524e824f8fd8c75cea8f94", "score": "0.66856873", "text": "def set_alarm\n @alarm = Alarm.find(1)\n end", "title": "" }, { "docid": "a333f55f27872dd9e89847606f03e5bd", "score": "0.6227611", "text": "def set_alarm\n @alarm = Alarm.find(params[:id])\n ...
1781005aa7ebfae85ade596f40fea914
find guest_user object associated with the current session, creating one as needed
[ { "docid": "998acdba63fea8a565bc0894ec5530a5", "score": "0.76843524", "text": "def guest_user(with_retry = true)\n # Cache the value the first time it's gotten.\n @cached_guest_user ||= User.find(session[:guest_user_id] ||= create_guest_user.id)\n rescue ActiveRecord::RecordNotFound # if session[...
[ { "docid": "84d40efaa18043aaa92160f2ffe3d6c5", "score": "0.84715164", "text": "def guest_user\n User.find(session[:guest_user_id] ||= create_guest_user.id)\n\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user\n end", "ti...
00c44de0e3e0d7c5a03833d84aef1b14
_single_ local date object to a citeproc date
[ { "docid": "523832bb9b342d58e87e8deeefaeb2de", "score": "0.78926075", "text": "def local_date_to_citeproc_date(date)\n # we consider 'before' or 'after' not enough info for a date for citation at present,\n # haven't figured out how to interact with CSL to represent these, may be possible.\n ...
[ { "docid": "8559385ff138c4d155dfd3ae582b6cc6", "score": "0.79787713", "text": "def local_date_to_citeproc_date(date)\n # we consider 'before' or 'after' not enough info for a date for citation at present,\n # haven't figured out how to interact with CSL to represent these, may be possible....
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "e78be43784da093d4359264e8ddfad33", "score": "0.0", "text": "def news_feed_params\n params.fetch(:news_feed, {})\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.7121987", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.70541996", "text": "def expected_permitted_parameter_names; end", "title": "...
8dcb0c385c503cfcedc383fe215c846d
4/3pir^3 == 2r ^ 3
[ { "docid": "4e01d859af82235e2b4d393d4cf1721d", "score": "0.0", "text": "def length_hypotunuse(coord)\n hyp_sqrd = coord[0] ** 2 + coord[1] ** 2 + coord[2] ** 2\n hyp_length = hyp_sqrd ** 0.5\n end", "title": "" } ]
[ { "docid": "86935d0f98b4d5bb84f72bcf1f3f8af8", "score": "0.6755385", "text": "def f4( a, b, c )\n return truncate((a^b^c) + @constants[3])\n end", "title": "" }, { "docid": "32054024f99e8bd7686f3ccd42512746", "score": "0.6166749", "text": "def mod_sqr(p0) end", "title": "...
22e9d628edbea519223d1918a7df71de
Public: Change MozyPro plan
[ { "docid": "ab548b09e7e5c9801e64d3b502f910b2", "score": "0.6355564", "text": "def change_mozypro_plan(base_plan, server_plan, storage_add_on, coupon)\n # Find current server plan id e.g. 'products_addon_10353251, Server Plan, $12.99'\n server_plan_locator = '//label[starts-with(.,\"Server Plan...
[ { "docid": "08411d46eca359f1b9a88aca85aad41c", "score": "0.78183556", "text": "def set_plan\n \n end", "title": "" }, { "docid": "08b0636c6d445463464793b2ce0f9fc3", "score": "0.6954385", "text": "def change_billing_plan!(new_plan)\n # TODO!\n end", "title": "" ...
ea74155936c15cab0ba860ba70d6c5b2
Buildfile The current buildfile for the generator. The buildfile is calculated by merging the buildfile for the generator with the default generator buildfile. Buildfiles should be named "Buildfile" and should be placed in the generator root directory. === Returns Buildfile instance
[ { "docid": "d2502fbd6b0a70d1a191ad8bbcfdd388", "score": "0.823368", "text": "def buildfile\n return @buildfile unless @buildfile.nil?\n\n @buildfile = Buildfile.new\n\n # First try to load the shared buildfile\n path = File.join(SC.builtin_project.project_root, 'gen', 'Buildfile')\n ...
[ { "docid": "2c5729981e2dadbae78dde5774534239", "score": "0.7903612", "text": "def buildfile\n @buildfile ||= (parent_project.nil? ? Buildfile.new : parent_project.buildfile.dup).load!(project_root)\n end", "title": "" }, { "docid": "378e300d5c8fc9dc708903d246b68e49", "score": "0....
79cbb8a5ad138f90d13d28805998b580
stop rails CSRF protection for this action
[ { "docid": "f71accab9bc20c4fb6d36ea33c0b774f", "score": "0.0", "text": "def auth\n \n Pusher['presence-test-channel'].trigger('newPlayer', {:from => \"new name\", :subject => \"new subject\"})\n \n \n response = Pusher[params[:channel_name]].authenticate(params[:socket_id], {\n...
[ { "docid": "487129826d80e80d3e54f19210e585f8", "score": "0.77760774", "text": "def disable_request_forgery_protection; end", "title": "" }, { "docid": "26b410a9f0ecdf5041102a3671861b45", "score": "0.76563007", "text": "def disable_request_forgery_protection=(_arg0); end", "title"...
7ba468401fb5a3fb6fa9218f5cda3ba0
Public: Process a command however it needs to be handled. pipe_server The pipe server we're working with command The command we need to parse and handle
[ { "docid": "11067315392eec84fcea9c4b26e9b936", "score": "0.770832", "text": "def process_command(pipe_server, command)\n args = Shellwords.shellwords(command)\n\n # save the command unless we're exiting or repeating the last command\n unless args[0] == \"exit\" || (Readline::HISTORY.lengt...
[ { "docid": "f37ce99031970a2ccb9624067d18962b", "score": "0.63984734", "text": "def pipe_chunk chunk, command\n content = chunk.content\n output = @context.ui.pipe_to_process(command) do |stream|\n stream.write content\n end\n\n handle_pipe_output command, output\n end", "title": ""...
4586b9813af040c7a8698c7a94140372
In Rails 4.1 and below
[ { "docid": "cccb878ff807ddb5583ef5bc57ecf2c2", "score": "0.0", "text": "def verified_request?\r\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\r\n end", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.6455864", "text": "def private; end", "title": "" }, { "docid": "19d9764a2c7f930b2a464848744cafcd", "score": "0.56453305", "text": "def model_class; end", "title": "" }, { "docid": "ab0ec4288a3d3f5deef5148441b7aab...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "fb13c70ed76a32fa791d9112731ca152", "score": "0.0", "text": "def receiving_report_params\n params.require(:receiving_report).permit(:report_id_id, :user_id_id, :read)\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...
1e95f41d90ca615769b3a59371109955
options for the TTY command
[ { "docid": "de8f2611b25bb7205af0697d675c3801", "score": "0.6330619", "text": "def x_set_command_options(context)\n defaults = { uuid: false }\n defaults.merge!(dry_run: true) if context.options.key?(:dry_run)\n defaults\n end", "title": "" } ]
[ { "docid": "f834daa9a1e9119435da9a71023683ed", "score": "0.6998286", "text": "def command(**options)\n require 'tty-command'\n TTY::Command.new(options)\n end", "title": "" }, { "docid": "f834daa9a1e9119435da9a71023683ed", "score": "0.6998286", "text": "def command(**opt...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "96333ae3b8ce72fa6d23a2469715e4f0", "score": "0.0", "text": "def set_navbar\n @navbar = Navbar.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...
9873596b0c3fd6c8877d591b91bd6f89
Write a method triple_sequence that takes in two numbers, start and length. The method should return an array representing a sequence that begins with start and is length elements long. In the sequence, every element should be 3 times the previous element. Assume that the length is at least 1. input type : 2 numbers (s...
[ { "docid": "6f61faf106b67a6e9d6d77ccfa46c419", "score": "0.9193438", "text": "def triple_sequence(start, length)\n\n new_arr = []\n new_arr << start\n start = start * 3\n new_arr << start \n start = start * 3\n new_arr << start \n start = start * 3 \n new_arr << start \n\n ret...
[ { "docid": "30754426ba532114613ab09bd52ee01e", "score": "0.9210714", "text": "def triple_sequence(start, length)\n \tarry = []\n\t(1..length).each do | count|\n\n if count == 1\n arry << start\n else\n arry << arry[count-2] * 3\n end\n end\n return arry\nend", "...
05ab502d8de8367135836ced8df42aee
HeadlineWidget (not binary) headline :string
[ { "docid": "12dcda55493a0ee4b505f98396bfbca1", "score": "0.5808547", "text": "def summary\n self.headline + \" - \"\n end", "title": "" } ]
[ { "docid": "c615c9c44ec675af95a47917c42ffda2", "score": "0.7278461", "text": "def headline; end", "title": "" }, { "docid": "5c8051b8300526afbddbedd54a428dce", "score": "0.7107233", "text": "def headline(value=nil)\n @headline ||= value || self.presentation_name.pluralize\n ...
634d57e4fdcea2bbcb8db2e41780470e
validates find arguments accounting for 'ands'
[ { "docid": "bf4c4b3378aae7de9a39ba9b31013925", "score": "0.6148156", "text": "def valid_args_for_find?(args)\n args.each_with_index do |a, i|\n if i % 3 == 0\n return false unless Attendee.method_defined?(a) && !args[i + 1].nil?\n end\n end\n true\n end", "ti...
[ { "docid": "589b7487df7694e9229e120a268887c4", "score": "0.6663159", "text": "def parse_find_arguments(args)\n result_args = args[0..1]\n args.each_with_index do |f, i|\n if f == \"and\"\n result_args += args[i+1..i+2]\n end\n end\n result_args\n end", "...
386a9b8296607b6e8619f5c4c19eb7f1
Read IPSet Realized state Read an IPSet
[ { "docid": "a448fc2b63815d963aaf6b52e83e0e63", "score": "0.57326156", "text": "def read_ip_set_realized_state_with_http_info(enforcement_point_name, ip_set_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyInfraRealizedStateApi.read_ip_s...
[ { "docid": "88bef4096a46a7ff186d4db2fd91902b", "score": "0.65868706", "text": "def read_ip_set_realized_state(enforcement_point_name, ip_set_name, opts = {})\n data, _status_code, _headers = read_ip_set_realized_state_with_http_info(enforcement_point_name, ip_set_name, opts)\n data\n end", ...
c3ffdb050b4d3b23ddf40d036c877733
Applies current velocity to the position
[ { "docid": "991ef102e484ae08c7cad886ff01f65d", "score": "0.67101294", "text": "def update_position\n DIMS.values.each { |dim| @position[dim] += @velocity[dim] }\n end", "title": "" } ]
[ { "docid": "b385dfbee90ffd1166bdfc4aede17325", "score": "0.7286615", "text": "def update\n @position[0] += @velocity[0]*@dt\n @position[1] += @velocity[1]*@dt\n @center[0] = @position[0] + @size\n @center[1] = @position[1] + @size\n end", "title": "" }, { "docid": "c3538e2a47192...
3ceaad89d2617e1633ba6f63954a9fb3
= Workspaces List of available workspaces
[ { "docid": "35b8523f5b3feb3c43880125b097aa54", "score": "0.735516", "text": "def get_workspaces &block\n response = self.search :workspaces => nil\n doc = Nokogiri::XML(response)\n workspaces = doc.xpath(Workspace.root_xpath).collect{|w| w.text.to_s }\n list Workspace, workspaces, {}...
[ { "docid": "eea9920a3bbca777207ba6e47aed499e", "score": "0.7693752", "text": "def workspaces(workspace_namespace=PORTAL_NAMESPACE)\n path = self.api_root + '/api/workspaces'\n workspaces = process_firecloud_request(:get, path)\n workspaces.keep_if {|ws| ws['workspace']['namespace'] == workspace...
1119597463175b207cee12311a4d2750
PUT /enterprises/1 PUT /enterprises/1.xml
[ { "docid": "b44d277a217ec640c9ad924f23aa27ab", "score": "0.5739031", "text": "def update\n @enterprise = Enterprise.find(params[:id])\n\n respond_to do |format|\n if @enterprise.update_attributes(params[:enterprise])\n format.html { redirect_to(@enterprise, :notice => 'Enterprise was s...
[ { "docid": "353899a2c1a81988cc6ff4f929770e66", "score": "0.57697815", "text": "def update\n @prikey = Prikey.find(params[:id])\n\n respond_to do |format|\n if @prikey.update_attributes(params[:prikey])\n format.html { redirect_to(@prikey, :notice => 'Prikey was successfully updated.') ...
e6dedbd7ff55ce0d8a4dab071b2a2fdc
allow user to name hamster (method 1) string allow user to rename hamster (method 2) string record hamster noise level of squeaks ranked by number 110 integer record hamster fur color string record hamster age integer answer whether good candidate for adoption boolean?
[ { "docid": "abddc1a99ce065c4f257a3a2e73d8da1", "score": "0.6796178", "text": "def hamster_info\n puts \"what is the hamsters name?\"\n hamster_name = gets.chomp\n puts \"the hamsters name is #{hamster_name}\"\n\n puts \"rank the hamsters noise level from 1-10\"\n hamster_volume = gets.chomp.to_i\n ...
[ { "docid": "24da4a23bc7a92ddf9d5d301b51ac432", "score": "0.65535975", "text": "def hamster()\n\tputs \"What is your hamster's name?\"\n\thamster_name=gets.chomp\n\t\n\tputs \"How loud is your hamster?\"\n\tvolume_level=gets.chomp.to_i\n\t\n\tputs \"What is your hamster's fur color?\"\n\tfur_color=gets.c...
85be2de3f8dfc5b494af53b607947f95
List inbox forwarders List all forwarders attached to an inbox
[ { "docid": "e8d9ee3ea3cd334137fa67cdfb056fce", "score": "0.0", "text": "def get_inbox_forwarders_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxForwarderControllerApi.get_inbox_forwarders ...'\n end\n allowable_value...
[ { "docid": "dd7475496704d2166eda27a5b7560435", "score": "0.7078477", "text": "def index\n @forwarders = Forwarder.all\n end", "title": "" }, { "docid": "b00b3d201efbb4780c845fbd049c0297", "score": "0.6988489", "text": "def get_inbox_forwarders(opts = {})\n data, _status_code...
9f2ae10bacab1563f05bd075fd87f925
POST /venue_reviews POST /venue_reviews.xml
[ { "docid": "be80c5834d03ad907a43377237f120e7", "score": "0.71440285", "text": "def create\n @venue_review = @venue.venue_reviews.new(params[:venue_review])\n @venue_review.added_by = current_user.id\n respond_to do |format|\n if @venue.venue_reviews << @venue_review\n flash[:notice]...
[ { "docid": "8d3a846f10d8000e61235f9256c1e09c", "score": "0.7316928", "text": "def create\n \n @venue = Venue.find(params[:venue_id])\n #@venue = Venue.find_by_venue_id(params[:venue_id])\n @review = @venue.reviews.create(params[:review])\n #redirect_to venue_show_path(params[@venue.venue_id])\n @r...