query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
POST /critical_success_factors POST /critical_success_factors.json
def create @critical_success_factor = CriticalSuccessFactor.new(params[:critical_success_factor]) @critical_success_factor.user = current_user @critical_success_factor.confidential = false respond_to do |format| if @critical_success_factor.save format.html { redirect_to @critical_success_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @critical_factor = CriticalFactor.new(params[:critical_factor])\n @critical_factor.user = current_user\n @critical_factor.confidential = false\n\n\n respond_to do |format|\n if @critical_factor.save\n format.html { redirect_to @critical_factor, notice: 'Critical factor was succ...
[ "0.70815897", "0.67568547", "0.6602582", "0.6287686", "0.6212863", "0.6200802", "0.6193872", "0.6188759", "0.60412735", "0.6025456", "0.5848939", "0.5836134", "0.575085", "0.5743646", "0.56773", "0.5666445", "0.56566066", "0.56250733", "0.5579509", "0.55563235", "0.5551971", ...
0.745101
0
PUT /critical_success_factors/1 PUT /critical_success_factors/1.json
def update @critical_success_factor = CriticalSuccessFactor.find(params[:id]) respond_to do |format| if @critical_success_factor.update_attributes(params[:critical_success_factor]) format.html { redirect_to @critical_success_factor, notice: 'Critical success factor was successfully updated.' } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @critical_factor = CriticalFactor.find(params[:id])\n\n respond_to do |format|\n if @critical_factor.update_attributes(params[:critical_factor])\n format.html { redirect_to @critical_factor, notice: 'Critical factor was successfully updated.' }\n format.json { head :no_content...
[ "0.702316", "0.68707484", "0.6584947", "0.6509946", "0.631188", "0.61794734", "0.6138569", "0.61032444", "0.59480697", "0.5888146", "0.585326", "0.5845258", "0.58416766", "0.58416766", "0.58416766", "0.57815325", "0.57792103", "0.5764768", "0.5760554", "0.571699", "0.57088935...
0.7374729
0
DELETE /critical_success_factors/1 DELETE /critical_success_factors/1.json
def destroy @critical_success_factor = CriticalSuccessFactor.find(params[:id]) @critical_success_factor.destroy respond_to do |format| format.html { redirect_to critical_success_factors_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @critical_factor = CriticalFactor.find(params[:id])\n @critical_factor.destroy\n\n respond_to do |format|\n format.html { redirect_to critical_factors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @critical_success_factor_type = CriticalSuccessFacto...
[ "0.7422815", "0.71957785", "0.6728011", "0.671912", "0.66975945", "0.6678189", "0.66501415", "0.65498006", "0.6528397", "0.6507262", "0.64848846", "0.6455677", "0.6441735", "0.64309156", "0.64199823", "0.6415962", "0.64059234", "0.64035225", "0.6396183", "0.63764226", "0.6375...
0.7606194
0
Space Complexity: o(1) creates 2 variables only, no matter value of nums
def max_sub_array(nums) return 0 if nums.nil? return nil if nums.empty? max_so_far = nums[0] max_for_sub_array = 0 nums.each do |num| max_for_sub_array = max_for_sub_array + num if num > max_for_sub_array max_for_sub_array = num end if max_for_sub_array > max_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def single_number(nums)\n 2 * nums.uniq.reduce(:+) - nums.reduce(:+)\nend", "def two_sum(nums)\n special = []\n count = 0\n x = nums.length\n i = 0\n j = 1\n while (i < x) && (i + j) < x\n \n if nums[i] + nums[i + j] == 0\n special[count] = i\n count += 1\n special[count] = i + j\n ...
[ "0.63705766", "0.6257732", "0.6253977", "0.61784875", "0.61408997", "0.61095667", "0.6108676", "0.608929", "0.6072515", "0.60372686", "0.6022191", "0.60155416", "0.5977896", "0.596774", "0.5953833", "0.5945491", "0.5923407", "0.5902848", "0.59023833", "0.5864047", "0.58572924...
0.0
-1
Tries to find a person record with an email address matching the one returned from the omniauth provider. If none was found, a new person is initialised with the basic information from the provider
def person @person ||= Person.find_or_initialize_by email: @auth[:info][:email] do |p| if %i(first_name last_name).all? { |f| @auth[:info].key? f } # If the oauth provider gave us first and last name, use them p.first_name = @auth[:info][:first_name] p.last_name = @auth[:info][:last_na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_or_create_for_omniauth auth, &block\n email = auth.info.email\n # This is just a placeholder for indexes and validations etc.\n # (twitter doesn't give us an email)\n email ||= \"#{auth.info.nickname || auth.uid}@#{auth.provider}.auth\"\n\n user = find_for_omniauth auth\n use...
[ "0.7421134", "0.65816665", "0.6554829", "0.65196466", "0.64751333", "0.6468865", "0.6433882", "0.64330184", "0.6425275", "0.6366515", "0.6353439", "0.63365877", "0.63228524", "0.62915677", "0.6273348", "0.62678343", "0.6250944", "0.6227089", "0.6224936", "0.6198357", "0.61974...
0.7642451
0
first parameter string table column name optional second symbol parameter
def annotate(str) return "#{str}'#{parstr(str)}" if @ordering[0].isMatchingKey?(str) return "#{str}\"#{parstr(str)}" if @ordering[1].isMatchingKey?(str) return str + parstr(str) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_name\n name.to_sym\n end", "def column_name; end", "def columns(table_name, name = nil) end", "def table_symbol_from x\n x.to_s.tableize.to_sym\n end", "def quote_column_if_needed(column); end", "def i(s)\n connection.quote_column_name(s)\n end", "def [](name)\n @table...
[ "0.6656023", "0.6523673", "0.6505875", "0.64937526", "0.63589096", "0.633834", "0.6333878", "0.63311887", "0.6287636", "0.6196503", "0.61703753", "0.6167192", "0.6167192", "0.61563283", "0.61321676", "0.61321676", "0.6098053", "0.606657", "0.60652953", "0.603084", "0.602077",...
0.0
-1
Takes a Time object or nil, and returns a String in yyyymmdd format or "unspecified" for nil.
def printHTMLDateShort(tobj) return alStrftime(tobj,'%y-%m-%d') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_to_str(dt)\r\n ret = nil\r\n if dt.nil?\r\n ret = \"\"\r\n else\r\n ret = dt.iso8601\r\n ret[10..-1] = \"Z\" if self.allday # yyyy-mm-ddZ\r\n end\r\n ret\r\n end", "def fmt_time(t)\n if t.present?\n ApplicationHelper.localtime(t).strftime(Applicat...
[ "0.7030388", "0.6770661", "0.66752595", "0.6617918", "0.64254403", "0.64056027", "0.6382072", "0.63234895", "0.6312686", "0.6301572", "0.6275509", "0.6275509", "0.62578034", "0.6238357", "0.6238357", "0.6238357", "0.6215649", "0.6201892", "0.6201892", "0.6187873", "0.61768377...
0.0
-1
Takes a Time object or nil, and returns a Strong in "monthname day, year" format or "unspecified" for nil.
def printHTMLDateLong(tobj) return alStrftime(tobj,'%B %d, %Y') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dateshort( time )\n time.strftime('%Y-%m-%d') if time\n end", "def short_time\n \ttime.strftime \"%b %-d\"\n end", "def pretty_date(time)\n time.strftime(\"%B %d, %Y\")\n end", "def pretty_date(time)\n time.strftime(\"%B %d, %Y\")\n end", "def pretty_date(time)\n time.strftime(\"%d %b %Y\...
[ "0.6062872", "0.59992146", "0.599244", "0.599244", "0.59637845", "0.59637845", "0.58694", "0.58259994", "0.57849205", "0.57384616", "0.56223816", "0.5594916", "0.5577839", "0.55600923", "0.5559729", "0.5559497", "0.5494544", "0.54836494", "0.5475932", "0.5434538", "0.54333174...
0.0
-1
Seems there's a but in Ruby strftime
def alStrftime(tobj, str) return "unspecified" unless tobj return tobj.strftime(str) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strftime(p0) end", "def strftime(*args)\n #This is a stub, used for indexing\n end", "def strftime(arg0, arg1, *rest)\n end", "def strftime(format, time = T.unsafe(nil)); end", "def strftime(format)\n return LIBC.new.c_strftime(format, @vals)\n end", "def lsish\n strftime \"%e. %b \...
[ "0.867353", "0.83066976", "0.8066974", "0.79515195", "0.7152179", "0.6884948", "0.6838843", "0.6750337", "0.6683784", "0.6597377", "0.651525", "0.65092206", "0.64757514", "0.64757514", "0.6471596", "0.641031", "0.63935286", "0.63405555", "0.63396007", "0.63278127", "0.6272796...
0.65882015
10
Use callbacks to share common setup or constraints between actions.
def set_credit_card @credit_card = CreditCard.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def credit_card_params params.require(:credit_card).permit(:customer_profile_id, :customer_payment_profile_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7120904", "0.70538116", "0.69469863", "0.6901261", "0.67348766", "0.6717708", "0.66874576", "0.6676195", "0.66601187", "0.65563625", "0.6525127", "0.64565873", "0.64494514", "0.644928", "0.64452374", "0.6433947", "0.6412815", "0.6412815", "0.6391939", "0.63792473", "0.6379...
0.0
-1
get visualization from url
def can_org_user_fork_resource(url, current_user) referer_match = /tables\/([^\/]+)\/public/.match(url) res = nil if referer_match.nil? referer_match = /viz\/([^\/]+)/.match(url) unless referer_match.nil? res = referer_match[1] # If has schema, remove it if res =~ /\./ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n url = params[:url]\n width = params[:maxwidth] || '100%'\n height = params[:maxheight] || '100%'\n format = request.query_parameters[:format]\n\n if (width =~ /^[0-9]+(%|px)?$/) == nil\n raise ActionController::RoutingError.new('Incorrect width')\n end\n if (height =~ /^[0-9]+(...
[ "0.6083963", "0.6016673", "0.59852743", "0.5969215", "0.59300774", "0.58464736", "0.58337486", "0.58178335", "0.5786241", "0.5749554", "0.5729008", "0.5713627", "0.5687092", "0.5687092", "0.56591237", "0.56472355", "0.5647052", "0.5638793", "0.5581574", "0.55800974", "0.55800...
0.0
-1
Supported options: :forced => true synchronization has been triggered manually :only_entities => [person, tasks_list] :full_sync => true synchronization is performed without date filtering :connec_preemption => true|false : preemption is always|never given to connec in case of conflict (if not set, the most recently up...
def perform(organization_id, opts = {}) organization = Maestrano::Connector::Rails::Organization.find(organization_id) return unless organization&.sync_enabled # Check if previous synchronization is still running if Maestrano::Connector::Rails::Synchronization.where(organization_id: organization.id, st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform(organization, opts)\n return unless organization.sync_enabled\n\n # Check if previous synchronization is still running\n if Synchronization.where(organization_id: organization.id, status: 'RUNNING').where(created_at: (30.minutes.ago..Time.now)).exists?\n ConnectorLogger.log('info'...
[ "0.66411525", "0.59989583", "0.59356856", "0.59096086", "0.58785987", "0.58742815", "0.5601097", "0.55811906", "0.555252", "0.5534722", "0.55219615", "0.55144244", "0.5513175", "0.5478699", "0.54473746", "0.5437034", "0.5417752", "0.5414169", "0.540412", "0.530393", "0.530393...
0.66044074
1
Does a batched sync on either external or connec!
def first_sync_entity(entity_name, organization, connec_client, external_client, last_synchronization_date, opts, external = true) limit = Settings.first_sync_batch_size || 50 skip = 0 entities_count = limit last_first_record = nil h = {__limit: limit} external ? h[:__skip_connec] = true : h[:_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync() end", "def sync() end", "def sync() end", "def sync; end", "def fsync() end", "def fsync() end", "def fsync() end", "def sync\n end", "def sync\n end", "def fsync\n end", "def fsync\n end", "def sync(&block)\n queue SyncCommand, [], {}, &block\n end", "def sync_io!\n ...
[ "0.7342659", "0.7342659", "0.7342659", "0.7038433", "0.70182884", "0.7018116", "0.7018116", "0.67531145", "0.67531145", "0.6627787", "0.6627787", "0.66060287", "0.65389866", "0.65180844", "0.650483", "0.6429728", "0.6342846", "0.6329813", "0.6324012", "0.63091266", "0.6280378...
0.0
-1
Perform the sync and return the entities_count for either external or connec
def perform_sync(entity_instance, last_synchronization_date, external = true) entity_instance.before_sync(last_synchronization_date) external_entities = entity_instance.get_external_entities_wrapper(last_synchronization_date) connec_entities = entity_instance.get_connec_entities(last_synchronization_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def co_managed_device_count\n return @co_managed_device_count\n end", "def count_observers\n sync_peers { |peers| peers.size }\n end", "def first_sync_entity(entity_name, organization, connec_client, external_client, last_synchronization_date, opts, external = true)\n limit...
[ "0.59548205", "0.58991575", "0.5769256", "0.56921476", "0.564046", "0.5584988", "0.55841094", "0.5570818", "0.55129135", "0.5512827", "0.5502534", "0.54871714", "0.54769075", "0.54173416", "0.54062015", "0.5395632", "0.538975", "0.53745514", "0.5358591", "0.5358414", "0.53052...
0.7148752
0
pessoa_fisica = PessoaFisica.new('Diego') calcular_imc calcular_altura(5), 50
def voce_eh_legal?(linguagem) if linguagem == 'ruby' return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcula_imc(peso, altura)\n return peso / altura ** 2\nend", "def calcular_imc\n (@peso)/(@altura*@altura)\n end", "def calcula_imc\n \n if @peso/@altura*@altura < 18\n puts \"vc esta magro\"\n elsif @peso/@altura*@altura <= 25\n puts \"vc esta no pes...
[ "0.74686474", "0.7428915", "0.7425615", "0.6791244", "0.6728294", "0.6392658", "0.638362", "0.63169855", "0.6202294", "0.6167578", "0.6165069", "0.6140818", "0.6138148", "0.6096314", "0.6083791", "0.6076216", "0.6073842", "0.6051941", "0.604908", "0.6042112", "0.6040557", "...
0.0
-1
Returns a whitespace free slug for markup or SEO purposes.
def slug name.split(' ').join('-') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slug\n self.title.downcase.gsub(/\\s+/, '-').gsub(/[^a-z0-9_-]/, '').squeeze('-')\n end", "def slug\n self.title.downcase.gsub(/\\s+/, '-').gsub(/[^a-z0-9_-]/, '').squeeze('-')\n end", "def slugged_name\n name.gsub(' ', '-').delete(\"?/#\")\n end", "def slug\n self.title.downcase.gsub(\" \...
[ "0.8069976", "0.8069976", "0.8010032", "0.7938606", "0.7931759", "0.791703", "0.7889389", "0.78807265", "0.7848801", "0.7834407", "0.7831333", "0.7831333", "0.7812329", "0.7758183", "0.7753267", "0.7747148", "0.77194434", "0.771537", "0.771537", "0.76850384", "0.76850384", ...
0.7758961
13
Unpack message and create payload
def unpack(message) payload = super if(self.class == Jackal::Cfn::Event) begin unless(payload.get(:data, :cfn_event)) payload = format_event(payload.fetch('Body', 'Message', payload)) payload[:origin_type] = message[:message].get('Body', 'Type') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpack(message)\n payload = super\n if(self.is_a?(Jackal::Cfn::Resource))\n begin\n if(payload['Message'])\n payload = MultiJson.load(payload['Message']).to_smash\n payload = transform_parameters(payload)\n payload[:origin_type] = message...
[ "0.70783406", "0.6986811", "0.6706475", "0.6528558", "0.64641255", "0.64204985", "0.63859016", "0.6255469", "0.6159768", "0.61405224", "0.6133293", "0.61029845", "0.6081042", "0.6077328", "0.6057204", "0.6052907", "0.60302293", "0.6026357", "0.60199404", "0.60062534", "0.5955...
0.710813
0
Format payload into proper event structure
def format_event(evt) parts = evt.split("\n").map do |entry| chunks = entry.split('=') key = chunks.shift.strip value = chunks.join.strip.sub(/^'/, '').sub(/'$/, '').strip [key, value] end event = Smash[parts] unless(event['ResourceProperties'].to_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_body(event)\n # TODO: Create an HTTP post data codec, use that here\n if @format == \"json\"\n LogStash::Json.dump(map_event(event))\n elsif @format == \"message\"\n event.sprintf(@message)\n elsif @format == \"json_batch\"\n LogStash::Json.dump(event.map {|e| map_event(e) })\n...
[ "0.7117667", "0.69573206", "0.6857746", "0.67655516", "0.6565603", "0.64938295", "0.64134157", "0.63436836", "0.6323799", "0.6239035", "0.615861", "0.6117513", "0.60747945", "0.6069579", "0.60632056", "0.60632056", "0.5963819", "0.59476453", "0.59276974", "0.59185463", "0.588...
0.64124656
7
Generate payload and drop
def execute(message) data_payload = unpack(message) payload = new_payload( config[:name], :cfn_event => data_payload ) if(config[:reprocess]) debug "Reprocessing payload through current source (#{destination(:input, payload)})" Carnivore::Superviso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_payload(attributes, _record)\n fields = self.encoder.schema_fields\n payload = attributes.stringify_keys\n payload.delete_if do |k, _|\n k.to_sym != :payload_key && !fields.map(&:name).include?(k)\n end\n end", "def generate_rop_payload(rop, payload, opts={}...
[ "0.6454642", "0.6059785", "0.6011976", "0.5849499", "0.578041", "0.56837124", "0.5612073", "0.5608123", "0.5608123", "0.55572385", "0.5554902", "0.5530629", "0.550776", "0.5485087", "0.5442348", "0.5392634", "0.5349398", "0.53311956", "0.5321127", "0.5293448", "0.52853125", ...
0.0
-1
GET /sensors GET /sensors.json
def index @mysensors = current_user.sensors @othersensors=Array.new current_user.misuration_subscriptions.each do |ss| @othersensors.push(ss.sensor) end def aggiorna_firmware @sensors = Sensor.find(params[:id]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n owner.json_api_command('sensor', nil, '-l')&.fetch(:sensors)\n end", "def show\n sensorType = params[:sensor_type]\n id = params[:id]\n since = params[:since]\n\n table = getSensorTable(sensorType)\n if table == nil\n # raise ActionController::RoutingError.new('Unrecogn...
[ "0.78302395", "0.72864616", "0.72790223", "0.71815115", "0.69082516", "0.6863284", "0.685946", "0.67612666", "0.6641948", "0.6557257", "0.64905214", "0.64006484", "0.6374732", "0.6336776", "0.6251645", "0.6243259", "0.6158273", "0.614347", "0.6099776", "0.6089257", "0.6037153...
0.6017658
22
GET /sensors/1 GET /sensors/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n sensorType = params[:sensor_type]\n id = params[:id]\n since = params[:since]\n\n table = getSensorTable(sensorType)\n if table == nil\n # raise ActionController::RoutingError.new('Unrecognized Sensor')\n # TODO remove this once testing is done\n r = Random.new\n data ...
[ "0.75594866", "0.73599404", "0.70769614", "0.69845426", "0.69219834", "0.6740585", "0.67015606", "0.66519785", "0.6593406", "0.6536577", "0.65242946", "0.6498031", "0.6487837", "0.63183373", "0.6308647", "0.6243648", "0.62109596", "0.6196243", "0.61792016", "0.6174209", "0.61...
0.0
-1
POST /sensors POST /sensors.json
def create @sensor = Sensor.new(sensor_params) @sensor.user_id=current_user.id respond_to do |format| if @sensor.save format.html { redirect_to @sensor, notice: 'Sensore creato correttamente' } format.json { render :show, status: :created, location: @sensor } else format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @sensor = Sensor.new(sensor_params)\n\n respond_to do |format|\n if @sensor.save\n format.html { redirect_to @sensor, notice: 'Sensor was successfully created.' }\n format.json { render json: @sensor, status: :created }\n else\n format.html { render action: 'new' }...
[ "0.7137672", "0.69938827", "0.69076943", "0.6834126", "0.6659618", "0.6618718", "0.65169317", "0.63745844", "0.63265955", "0.6229061", "0.61728895", "0.6155715", "0.611579", "0.6109327", "0.6090812", "0.6075705", "0.603692", "0.59785604", "0.58897495", "0.5854673", "0.5819852...
0.6537768
6
PATCH/PUT /sensors/1 PATCH/PUT /sensors/1.json
def update respond_to do |format| if @sensor.update(sensor_params) && @sensor.user_id==current_user.id format.html { redirect_to @sensor, notice: 'Sensore aggiornato correttamente' } format.json { render :show, status: :ok, location: @sensor } else format.html { flash[:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @sensor.update(sensor_params)\n render json: { status: :ok }\n else\n render json: { status: :unprocessable_entity }\n end\n end", "def update\n @sensor = Sensor.find(params[:id])\n\n if @sensor.update(params[:sensor])\n head :no_content\n $redis.publish('senso...
[ "0.67329824", "0.66567314", "0.6640555", "0.6640555", "0.6473937", "0.6281619", "0.6217782", "0.62018484", "0.61912465", "0.6167798", "0.60664326", "0.60059553", "0.59864724", "0.59725225", "0.59129864", "0.5882799", "0.5859326", "0.5824215", "0.5821438", "0.5820142", "0.5800...
0.5684759
29
DELETE /sensors/1 DELETE /sensors/1.json
def destroy respond_to do |format| if @sensor.user_id==current_user.id && @sensor.destroy format.html { redirect_to sensors_url, notice: 'Sensore eliminato correttamente' } format.json { head :no_content } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @sensor.destroy\n respond_to do |format|\n format.html { redirect_to sensors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sensor.destroy\n respond_to do |format|\n format.html { redirect_to sensors_url }\n format.json { head :no_content ...
[ "0.7253959", "0.7253959", "0.71814615", "0.7080591", "0.69224805", "0.6913819", "0.6844931", "0.67355186", "0.66197515", "0.6551329", "0.6526063", "0.6498166", "0.64602757", "0.6410781", "0.6408433", "0.6394271", "0.63749903", "0.6360223", "0.63569367", "0.63564956", "0.63443...
0.62617207
30
Use callbacks to share common setup or constraints between actions.
def set_sensor @sensor = Sensor.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def sensor_params params.require(:sensor).permit(:mac, :url, :tipo, :latitudine, :longitudine, :unit_misura, :public, :downtime_to_alarm, :last_firmware_update, :image) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
Check if the job should still execute, or if changes since being scheduled have invalidated it. The user hasn't changed the time they want to get emails. The user still wants email notifications. The user still wants batched emails.
def job_invalid?(user, user_now) user.preference_notify_me_by_email != user_now.preference_notify_me_by_email || user.preference_individual_email_notifications != user_now.preference_individual_email_notifications || user.preference_email_time != user_now.pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_qualified?\r\n job_status != JobStatus::COMPLETED and job_status != JobStatus::INCOMPLETED and job_status != JobStatus::EXCLUDED\r\n end", "def reminders_need_to_be_sent?(event, local_time_job_started, job_interval)\n # Could put other logic here...\n return self.time_to_remind?(event, loca...
[ "0.6469474", "0.6458905", "0.6404905", "0.63537586", "0.6268199", "0.6258666", "0.6184996", "0.6158081", "0.61517024", "0.60779554", "0.60510105", "0.6047423", "0.6014912", "0.5995066", "0.59754014", "0.5971593", "0.5957179", "0.59554905", "0.59515315", "0.5946495", "0.594448...
0.73576903
0
returns a new string that contains the original value of the argument with first char of every word capt and all other letters lowercase
def cap(str) arr = str.split(//) arr[0].upcase! arr[1..-1].each { |el| el.downcase! } arr.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_cap2(str)\n str.split(' ').map { |wrd| wrd[0].upcase + wrd[1..-1].downcase }.join(' ')\nend", "def word_cap3(str)\n str.split.map { |word| word.sub(word[0], word[0].upcase) }.join(\" \")\nend", "def word_cap2(str) # Without Using .capitalize method\n str.split.each { |word| word[0] = word[0].upcas...
[ "0.73642445", "0.7354402", "0.7214044", "0.7181456", "0.7161918", "0.71618265", "0.7148106", "0.7146229", "0.7123766", "0.71100444", "0.70944685", "0.70855993", "0.70854205", "0.7073121", "0.7061191", "0.7060982", "0.70231783", "0.7005794", "0.7001035", "0.7001035", "0.697059...
0.0
-1
each Auto complete hook that gets called from application_controller.rb.
def auto_complete(controller, context = {}) query, tags = parse_query_and_tags(context[:query]) klass = controller.controller_name.classify.constantize if tags.empty? klass.my(:user => context[:user], :limit => 10).search(query) else klass.my(:user => context[:user], :limit => 10).search(que...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autocomplete; end", "def auto_complete\n @query = params[:term] || ''\n @auto_complete = hook(:auto_complete, self, query: @query, user: current_user)\n if @auto_complete.empty?\n exclude_ids = auto_complete_ids_to_exclude(params[:related])\n @auto_complete = klass.my(current_user).text_se...
[ "0.77667874", "0.7307132", "0.716601", "0.6972508", "0.68930584", "0.6579809", "0.6545349", "0.65353984", "0.65034467", "0.64849186", "0.64737", "0.6438269", "0.6423622", "0.6362081", "0.63257426", "0.63088506", "0.62807626", "0.6272243", "0.62631685", "0.62363505", "0.623461...
0.6414792
13
Somewhat simplistic parser that extracts query and hashprefixed tags from the search string and returns them as two element array, for example: "real Billy Bones pirate" => [ "Billy Bones", "real, pirate" ]
def parse_query_and_tags(search_string) query, tags = [], [] search_string.scan(/[\w#]+/).each do |token| if token.starts_with?("#") tags << token[1 .. -1] else query << token end end [ query.join(" "), tags.join(", ") ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_tags!\n @parsed_query.gsub!(/(\\b)*tags\\:(\\S*)(\\b)*/i, \"\")\n @tags = $2.split(',') unless $2.blank?\n end", "def parse(tags); end", "def parse_tags(string_tags)\n s_tags = string_tags || \"\"\n s_tags = \"untagged\" if s_tags.empty?\n return s_tags.split(/[\\s,]+/)\n ...
[ "0.6870629", "0.62808573", "0.61984223", "0.61482644", "0.61242163", "0.6085514", "0.6002061", "0.59882283", "0.5943162", "0.58887887", "0.5875179", "0.5875179", "0.5838191", "0.5831543", "0.5831543", "0.58224005", "0.57892233", "0.5780819", "0.57700866", "0.57327324", "0.572...
0.79012907
0
I N S T A N C E M E T H O D S Set up an Arrow::Dispatcher object based on the specified +config+ (an Arrow::Config object).
def initialize( name, config ) @name = name @config = config @broker = Arrow::Broker.new( config ) self.configure( config ) rescue ::Exception => err msg = "%s while creating dispatcher: %s\n%s" % [ err.class.name, err.message, err.backtrace.join("\n\t") ] self.log.error( msg ) msg.gsub!( /%/, '%%' )...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure( config )\n\t\tself.log.notice \"Configuring a dispatcher for '%s' from '%s': child server %d\" %\n\t\t\t[ Apache.request.server.hostname, config.name, Process.pid ]\n\n # Configure any modules that have mixed in Configurability\n\t\tif defined?( Apache )\n\t\t\trequire 'apache/logger'\n\t\t\t...
[ "0.64778095", "0.6233456", "0.6176466", "0.5847911", "0.5816586", "0.5766625", "0.5562188", "0.5535949", "0.5512622", "0.55065244", "0.54957205", "0.5495665", "0.5370169", "0.53425545", "0.53371906", "0.5304126", "0.52975297", "0.52975297", "0.5279543", "0.5247904", "0.521429...
0.7028642
0
(Re)configure the dispatcher based on the values in the given +config+ (an Arrow::Config object).
def configure( config ) self.log.notice "Configuring a dispatcher for '%s' from '%s': child server %d" % [ Apache.request.server.hostname, config.name, Process.pid ] # Configure any modules that have mixed in Configurability if defined?( Apache ) require 'apache/logger' Configurability.logger = Lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconfig(config)\n self.config = config\n end", "def reconfigure(config)\n icfg = config.internal\n\n icfg.processing.coordinator_class = Processing::Coordinator\n icfg.processing.partitioner_class = Processing::Partitioner\n icfg.processing.scheduler = Processing:...
[ "0.68900675", "0.688025", "0.5913441", "0.5563094", "0.55505264", "0.55088794", "0.5504369", "0.5492594", "0.5492443", "0.548743", "0.54773015", "0.5467637", "0.53247565", "0.53247565", "0.53195256", "0.5310756", "0.52964765", "0.52872", "0.525052", "0.51804143", "0.5176927",...
0.6961419
0
mod_ruby Handlers Child init mod_ruby handler
def child_init( req ) # :nodoc self.log.notice "Dispatcher configured for %s" % [ req.server.hostname ] return Apache::OK end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_handler\n\tend", "def start_handler\n end", "def setup_handler\n end", "def initialize(handlers)\n # the servlet base class does not consume any arguments\n # and its BasicServer base class only accepts a 'class_delim'\n # option which won't change in Puppet at all\n # thus, w...
[ "0.6527672", "0.6343741", "0.60680014", "0.6045966", "0.60007477", "0.5947786", "0.5908477", "0.58676946", "0.58233744", "0.57887036", "0.576995", "0.57551587", "0.5745718", "0.57081825", "0.57081825", "0.57081825", "0.56404185", "0.56272376", "0.5536905", "0.553318", "0.5523...
0.5524966
20
The content handler method. Dispatches requests to registered applets based on the requests PATH_INFO.
def handler( req ) self.log.info "--- Dispatching request %p ---------------" % [req] self.log.debug "Request headers are: %s" % [untable(req.headers_in)] if (( reason = @config.changed_reason )) self.log.notice "** Reloading configuration: #{reason} ***" @config.reload @broker = Arrow::Broker.new( @con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handler( req )\n\t\treq.content_type = \"text/plain\"\n\t\treq.puts \"In content handler.\"\n\t\treq.server.log_error \"StageLogger {%d}>> RubyHandler: handler(%p)\" % [\n\t\t\tProcess.pid,\n\t\t\treq\n\t\t ]\n\n\t\treturn Apache::OK\n\tend", "def handle\n @response.layout = contained_view(\"info/lay...
[ "0.5614783", "0.56004274", "0.5478348", "0.5181845", "0.5175803", "0.51520324", "0.5136218", "0.5108478", "0.5082092", "0.5082092", "0.5082092", "0.50743157", "0.50728375", "0.5038304", "0.5035027", "0.5032285", "0.5025611", "0.50228494", "0.5017056", "0.5011123", "0.49661914...
0.0
-1
Return a humanreadable representation of the receiver as a String.
def inspect return "#<%s:0x%x config: %s>" % [ self.class.name, self.object_id, @config.name, ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n toString()\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n e...
[ "0.76251346", "0.76251346", "0.76251346", "0.76251346", "0.7618669", "0.75820905", "0.75820905", "0.75820905", "0.75820905", "0.75615007", "0.75188076", "0.7509071", "0.7470543", "0.74367434", "0.74367434", "0.74367434", "0.74303305", "0.74298364", "0.74298364", "0.74298364", ...
0.0
-1
By default, exceptions don't get forwarded to a fail queue (they get returned to the caller)
def default_fail_queue_target false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_to_queue(queue, item)\n queue.push(item)\nrescue Exception => e\n puts \"Rescued #{e}\"\nend", "def fail\n # no-op\n end", "def failure\n @back.pop.call\n end", "def event_processing_failed(exception, payload, raw_payload, dead_letter_queue_name)\n # do nothing\n end", "def c...
[ "0.7095811", "0.6775115", "0.6749722", "0.6628479", "0.6571805", "0.6558655", "0.6524011", "0.65215987", "0.6507731", "0.645286", "0.6437736", "0.64216727", "0.639104", "0.6375339", "0.6373629", "0.63359565", "0.6332952", "0.6310929", "0.6310027", "0.6276768", "0.6267952", ...
0.59266037
64
Handle any processing that you want to perform after the reply
def post_request(object) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_response!(response)\n\t\t\t\tfinish_request!\n\t\t\t\t\n\t\t\t\tif Exception === response\n\t\t\t\t\t@logger.warn \"[#{@message.id}] Failure while processing response #{response}!\" if @logger\n\t\t\t\t\tRubyDNS.log_exception(@logger, response) if @logger\n\t\t\t\t\t\n\t\t\t\t\ttry_next_server!\n\t\t\t...
[ "0.71880513", "0.7132034", "0.6936627", "0.6683231", "0.6683231", "0.66797817", "0.6678969", "0.65748465", "0.6563915", "0.6509288", "0.644981", "0.64349246", "0.6408383", "0.63923377", "0.6384942", "0.6376066", "0.63658786", "0.63352317", "0.63301474", "0.630082", "0.6293748...
0.0
-1
Sending marshaler is redundant but saves a lookup
def send_response(marshal_type, marshaler, object) return false unless message.reply_to begin session.producer(:destination => message.reply_to) do |producer| # For time_to_live and jms_deliver_mode, first use the local response_options if they're' set, otherwise # use ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def marshall_dump\n end", "def marshall_dump\n end", "def serializer; end", "def serialize!\n end", "def marshal_dump; end", "def marshal_load(serialised); end", "def serializer=(_arg0); end", "def __send__(*rest) end", "def process\n demarshal\n end", "def marshal(_obj...
[ "0.66133547", "0.6568048", "0.6232844", "0.621995", "0.61825466", "0.6169411", "0.6134908", "0.6039825", "0.6035135", "0.5995298", "0.5969132", "0.5935219", "0.5908148", "0.5876064", "0.58131754", "0.58131754", "0.58002955", "0.57563365", "0.57563365", "0.57317793", "0.572009...
0.0
-1
GET /orders GET /orders.json
def index @orders = Order.all.paginate(page: params[:page], per_page: 5) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n ...
[ "0.83266383", "0.81536555", "0.8002928", "0.7946372", "0.7845412", "0.78225523", "0.78017557", "0.7697768", "0.7696449", "0.7681226", "0.7681226", "0.7681226", "0.7681226", "0.76811934", "0.75869167", "0.7572688", "0.7561361", "0.7531057", "0.74846864", "0.7430992", "0.736885...
0.0
-1
GET /orders/1 GET /orders/1.json
def show @order_line = OrderLine.new @article_list = Article.all @article_list.each do |option| @article_id = option.id @article_description = option.description end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n render json: @orders, status: 200\n end", "def index\n @orders = Order.order(\"id\").all\n\n resp...
[ "0.7551269", "0.748772", "0.7474795", "0.73770833", "0.73708034", "0.7341552", "0.73383164", "0.7316408", "0.7301667", "0.7291072", "0.7291072", "0.7291072", "0.7291072", "0.72909385", "0.72781694", "0.726596", "0.7249828", "0.7229755", "0.7213231", "0.71826744", "0.71255547"...
0.0
-1
POST /orders POST /orders.json
def create @order = Order.new(order_params) @order.user_id = current_user.id @order.uuid = SecureRandom.hex(8) respond_to do |format| if @order.save format.html { redirect_to @order, notice: 'Order was successfully created.' } format.json { render 'show', status: :created, locatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders\n authenticated_post(\"orders\").body\n end", "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def create\n order = Order.create(order_params)\n render json: order\nend", "def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = ...
[ "0.75886714", "0.7490972", "0.7488501", "0.74664384", "0.72739846", "0.7195349", "0.7063682", "0.69745994", "0.6910657", "0.68880194", "0.68747663", "0.685004", "0.6840204", "0.6838178", "0.6838178", "0.6838178", "0.6838178", "0.682244", "0.6790037", "0.67793274", "0.6779247"...
0.65232676
62
PATCH/PUT /orders/1 PATCH/PUT /orders/1.json
def update respond_to do |format| if @order.update(order_params) format.html { redirect_to @order, notice: 'Order was successfully updated.' } format.json { head :no_content } else format.html { render 'edit' } format.json { render json: @order.errors, status: :unprocessa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_conte...
[ "0.6802742", "0.6802742", "0.6774753", "0.67434865", "0.6735464", "0.67268074", "0.6723089", "0.6719465", "0.6704642", "0.6704579", "0.6704579", "0.6704579", "0.6704579", "0.6704579", "0.6704579", "0.6704579", "0.6704579", "0.6704579", "0.6704579", "0.6704579", "0.6704579", ...
0.66486466
39
DELETE /orders/1 DELETE /orders/1.json
def destroy @order.destroy respond_to do |format| format.html { redirect_to orders_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end", "def destroy\n @order1 = Order1.find(params[:id])\n @order1.destroy\n\n respond_to do |format|\n format.html { redirect_to order1s_url }\n format.json { head :no_content }\n end\...
[ "0.75915873", "0.7474085", "0.7430466", "0.73727256", "0.73726606", "0.73718613", "0.73583674", "0.73583674", "0.73583674", "0.73583674", "0.73583674", "0.734848", "0.734848", "0.734848", "0.734848", "0.734848", "0.734848", "0.734848", "0.734848", "0.734848", "0.734848", "0...
0.731227
54
Use callbacks to share common setup or constraints between actions.
def set_order @order = Order.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6165422", "0.60457647", "0.5946384", "0.5916027", "0.58905005", "0.583495", "0.5777223", "0.56995213", "0.56995213", "0.56532377", "0.5621348", "0.5422839", "0.54118705", "0.54118705", "0.54118705", "0.53935355", "0.5379617", "0.53577393", "0.53407264", "0.53398263", "0.53...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def order_params params.require(:order).permit(:uuid, :order_date, :user_id, :delivery_date) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Returns the object in string form.
def to_s self.to_a.map {|x| x.to_s}.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @object.to_s\n end", "def to_s\n object.to_s\n end", "def serialize(object)\n object.to_s\n end", "def to_s\n @string || @object.to_s('F')\n end", "def to_s\n @string || @object.to_s('F')\n end", "def to_s\n \"#<#{self.class.name}:#{object_i...
[ "0.8522118", "0.8512306", "0.8133207", "0.8091163", "0.8091163", "0.7761123", "0.7749178", "0.76491255", "0.76491255", "0.76491255", "0.76491255", "0.7639897", "0.76087546", "0.76087546", "0.76087546", "0.76087546", "0.7575533", "0.75612605", "0.75111973", "0.750027", "0.7489...
0.0
-1
Reads a string to populate the object.
def read(str) force_binary(str) return self if str.nil? self[:icmp_type].read(str[0,1]) self[:icmp_code].read(str[1,1]) self[:icmp_sum].read(str[2,2]) self[:body].read(str[4,str.size]) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(str)\n parse(str, ber: true)\n self\n end", "def read(str)\n PacketGen.force_binary(str)\n io = StringIO.new(str)\n parse_section(io)\n self\n end", "def read_string; end", "def read(str)\n return unless str\n force_binary(str)\n sel...
[ "0.733062", "0.7276423", "0.6999158", "0.6998165", "0.6862692", "0.6833966", "0.67425317", "0.6715686", "0.66853476", "0.6669805", "0.6655863", "0.6635725", "0.66091716", "0.6595902", "0.6558109", "0.6525967", "0.6465454", "0.64432836", "0.6416698", "0.6410884", "0.64056945",...
0.6543808
15
Setter for the type.
def icmp_type=(i); typecast i; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_type(val)\n self.type = val\n self\n end", "def type=(value)\n @type = value\n end", "def type=(value)\n @type = value\n end", "def type=(value)\n @type = value\n end", "def type=(value)\n @typ...
[ "0.8813267", "0.87673706", "0.87673706", "0.87673706", "0.87673706", "0.87673706", "0.87673706", "0.87673706", "0.87163293", "0.8581177", "0.854442", "0.84909844", "0.84852207", "0.8454122", "0.840839", "0.8374968", "0.8364594", "0.8307618", "0.8281238", "0.8259468", "0.82279...
0.0
-1
Getter for the type.
def icmp_type; self[:icmp_type].to_i; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type\n @type.name\n end", "def type\n return @type\n end", "def type\n return @type\n end", "def type\n return @type\n end", "def type\n return @type\n end", "def type\n return @type\n ...
[ "0.8506456", "0.8453542", "0.84147185", "0.84147185", "0.84147185", "0.84147185", "0.84147185", "0.84147185", "0.84147185", "0.8369178", "0.83482087", "0.83477694", "0.83477694", "0.83477694", "0.8332029", "0.82924724", "0.8245675", "0.8245675", "0.8245675", "0.8229712", "0.8...
0.0
-1
Setter for the code.
def icmp_code=(i); typecast i; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setCode(code)\n @code = code\n end", "def code=(v)\n @code = v\n end", "def code= new_code\n @code = new_code\n end", "def set_Code(value)\n set_input(\"Code\", value)\n end", "def code=(code)\n generate(code)\n end", "def set_code(code)\n input_co...
[ "0.84881794", "0.8434415", "0.81894636", "0.8054438", "0.79977804", "0.7796409", "0.7385123", "0.7343123", "0.7272592", "0.7245777", "0.7245777", "0.7220691", "0.71597", "0.71597", "0.71597", "0.71597", "0.71597", "0.71597", "0.71597", "0.7090023", "0.7090023", "0.7082328",...
0.0
-1
Getter for the code.
def icmp_code; self[:icmp_code].to_i; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code\n @code\n end", "def code\n @code\n end", "def code\n @code\n end", "def code\n @code\n end", "def code\n @code\n end", "def getCode()\n return @code\n end", "def code\n self.class.code\n end", "def code\n @info.code\n end", "de...
[ "0.88232267", "0.88232267", "0.8817283", "0.8807403", "0.8807403", "0.87090474", "0.8423073", "0.8343125", "0.8270456", "0.8270456", "0.82564116", "0.8232786", "0.8110974", "0.80720246", "0.8017178", "0.7775155", "0.7684521", "0.7684521", "0.7684521", "0.7684521", "0.7566253"...
0.0
-1
Setter for the checksum. Note, this is calculated automatically with icmp_calc_sum.
def icmp_sum=(i); typecast i; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checksum!# {{{\n self.csum = compute_checksum\n end", "def calc_checksum\n # Checksum is only on header, so cannot use IP.sum16,\n # which also calculates checksum on #body.\n nb_words = ihl * 2\n self.checksum = 0\n checksum = to_s.unpack(\"n#{nb_words}\").sum\n ...
[ "0.78006846", "0.7630904", "0.75601715", "0.75601715", "0.7535507", "0.7255537", "0.72143877", "0.71747106", "0.71638554", "0.7152814", "0.7152814", "0.69322777", "0.68993336", "0.68759924", "0.6854359", "0.676435", "0.6656922", "0.6639629", "0.6599365", "0.6554887", "0.65344...
0.0
-1
Getter for the checksum.
def icmp_sum; self[:icmp_sum].to_i; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checksum\n end", "def checksum\n Nanoc::Checksummer.calc(self)\n end", "def checksum\n source[digest_type]\n end", "def checksum!# {{{\n self.csum = compute_checksum\n end", "def checksum\n\t\t@checksum ||= FileManager.checksum(@path)\n #\t\tif file?\n #\t\t\treturn FileManag...
[ "0.8215601", "0.8108554", "0.7862754", "0.7837578", "0.77673894", "0.77268004", "0.76303434", "0.75534683", "0.75116295", "0.749005", "0.74810606", "0.74794054", "0.7461084", "0.7461084", "0.74261373", "0.7403018", "0.73484415", "0.73267597", "0.7298995", "0.7298995", "0.7244...
0.0
-1
Calculates and sets the checksum for the object.
def icmp_calc_sum checksum = (icmp_type.to_i << 8) + icmp_code.to_i chk_body = (body.to_s.size % 2 == 0 ? body.to_s : body.to_s + "\x00") if 1.respond_to? :ord chk_body.split("").each_slice(2).map { |x| (x[0].ord << 8) + x[1].ord }.each { |y| checksum += y } else chk_body.split("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checksum!# {{{\n self.csum = compute_checksum\n end", "def checksum!\n self.checksum = compute_checksum\n end", "def checksum!\n self.checksum = compute_checksum\n end", "def checksum\n Nanoc::Checksummer.calc(self)\n end", "def checksum\n end", "def calc_checksum\n # Chec...
[ "0.80539864", "0.80013555", "0.80013555", "0.73268926", "0.727039", "0.70586544", "0.70096284", "0.6950192", "0.6943849", "0.6943849", "0.6929485", "0.67689216", "0.66897464", "0.6683487", "0.66554815", "0.6439313", "0.6420968", "0.63758403", "0.63669187", "0.63465244", "0.63...
0.0
-1
Recalculates the calculatable fields for ICMP.
def icmp_recalc(arg = :all) case arg.to_sym when :icmp_sum self.icmp_sum=icmp_calc_sum when :all self.icmp_sum=icmp_calc_sum else raise ArgumentError, "No such field `#{arg}'" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_icmp_statistics\n super\n end", "def icmp_recalc(arg=:all)\n\t\t\t# How silly is this, you can't intern a symbol in ruby 1.8.7pl72?\n\t\t\t# I'm this close to monkey patching Symbol so you can force it...\n\t\t\targ = arg.intern if arg.respond_to? :intern\n\t\t\tcase arg\n\t\t\twhen :icmp_sum\n...
[ "0.6783078", "0.63914204", "0.6342133", "0.6342133", "0.6191466", "0.6164175", "0.6094155", "0.56137776", "0.5549612", "0.5419154", "0.54019123", "0.54019123", "0.53256977", "0.53256977", "0.52058244", "0.52058244", "0.51873666", "0.5144381", "0.5143018", "0.514041", "0.51228...
0.6666251
1
Time Complexity: O(n) where n is the height of the tree or O(log n) if the tree is balanced Space Complexity: O(1)
def add(key, value) new_tree_node = TreeNode.new(key, value) if @root.nil? @root = new_tree_node else current = @root while current if new_tree_node.key <= current.key if !current.left current.left = new_tree_node return else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_height_nodes(root) # O(n)\n return 0 if root == nil\n left_height = 1 + find_height_nodes(root.left)\n right_height = 1 + find_height_nodes(root.right)\n\n return (left_height > right_height)? left_height : right_height\nend", "def height_balanced(root)\n return true if root.nil?\n\n left, right ...
[ "0.71738696", "0.6984392", "0.68886054", "0.6881646", "0.6790585", "0.6782054", "0.67194617", "0.6715604", "0.6690582", "0.6672468", "0.6662059", "0.6631104", "0.6598033", "0.6551444", "0.65333796", "0.65164113", "0.650183", "0.64850485", "0.6465149", "0.64647216", "0.6461742...
0.0
-1
Time Complexity: O(log n) if tree is balanced, n is size of tree O(n) in worst case where n is also size of tree Space Complexity: O(1)
def find(key) return nil if @root.nil? current = @root while current if key > current.key current = current.right elsif key < current.key current = current.left else return current.value end end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_balanced(root)\n # 1) empty trees are balanced.\n return true if root.nil?\n\n # 2) find left and right depth\n left_bal = depth(root.left)\n right_bal = depth(root.right)\n\n #\n (left_bal - right_bal).abs <= 1 &&\n is_balanced(root.left) &&\n is_balanced(root.right)\nend", "def balanced?(tr...
[ "0.69444054", "0.68250036", "0.68028283", "0.6781599", "0.67647463", "0.6760058", "0.6707102", "0.66959065", "0.6669732", "0.6644849", "0.65472996", "0.65416944", "0.65204555", "0.6499368", "0.6484751", "0.64004976", "0.6376438", "0.6369259", "0.6247324", "0.6223804", "0.6194...
0.0
-1
Time Complexity: O(n) where n is the height of the tree Space Complexity: O(n) where n is the height of the tree potentially O(n^2) with the arrays?
def inorder array = [] return [] if @root.nil? current = @root return inorder_recursive(current, array) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dp_possible_trees(n)\n array = Array.new(n+2) { Array.new(n+1) { 0 } }\n (0...n+2).to_a.each do |i|\n array[i][0] = 1\n end\n\n sum = 0\n (1...n+1).to_a.each do |i|\n sum = 0\n (1..i).to_a.each do |j|\n array[j][i] = array[n+1][i-j] * array[n+1][j-1]\n sum += array[j][i]\n end\n a...
[ "0.6643632", "0.63621527", "0.62926084", "0.6245075", "0.61923474", "0.6191766", "0.6151042", "0.60304797", "0.60066926", "0.5993424", "0.59577596", "0.59577507", "0.5933798", "0.5923278", "0.58638585", "0.5856788", "0.58558273", "0.5849361", "0.5845749", "0.579695", "0.57957...
0.0
-1
Time Complexity: O(n) where n is the height of the tree Space Complexity: O(n) where n is the height of the tree
def preorder array = [] return [] if @root.nil? current = @root return preorder_recursive(current, array) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_height_nodes(root) # O(n)\n return 0 if root == nil\n left_height = 1 + find_height_nodes(root.left)\n right_height = 1 + find_height_nodes(root.right)\n\n return (left_height > right_height)? left_height : right_height\nend", "def height\n return 0 if is_empty\n\n queue = [@root]\n height...
[ "0.72432035", "0.7150872", "0.68871224", "0.6873526", "0.6807246", "0.6799693", "0.677916", "0.6711782", "0.66456604", "0.6631044", "0.6561555", "0.6549498", "0.6546758", "0.64895624", "0.6475534", "0.6451536", "0.6436645", "0.64348894", "0.64317304", "0.643123", "0.6425746",...
0.0
-1
Time Complexity: O(n) where n is the height of the tree Space Complexity: O(n) where n is the height of the tree
def postorder array = [] return [] if @root.nil? current = @root return postorder_recursive(current, array) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_height_nodes(root) # O(n)\n return 0 if root == nil\n left_height = 1 + find_height_nodes(root.left)\n right_height = 1 + find_height_nodes(root.right)\n\n return (left_height > right_height)? left_height : right_height\nend", "def height\n return 0 if is_empty\n\n queue = [@root]\n height...
[ "0.72426903", "0.7149984", "0.68867284", "0.6872105", "0.6806394", "0.67989886", "0.67783237", "0.6710244", "0.6645586", "0.66305655", "0.65611213", "0.65494025", "0.65458304", "0.6487926", "0.6475519", "0.6450518", "0.64359444", "0.64323235", "0.6431476", "0.6429861", "0.642...
0.0
-1
Time Complexity: O(n) where n is the size of the tree Space Complexity: O(n)
def height return 0 if @root.nil? current = @root height_recursive(current) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(tree)\n if isEmpty?(tree)\n 0\n else\n 1 + size(tree.left) + size(tree.right)\n end\nend", "def build_tree( n , d )\n \n if d.key?('v')\n n < d['v'] ? build_tree(n , d['l']) : build_tree(n, d['r'])\n else\n d['l'] = {}\n d['v'] = n\n ...
[ "0.6786363", "0.66091007", "0.654648", "0.64906996", "0.63324195", "0.631474", "0.6311323", "0.62905467", "0.6260417", "0.62435657", "0.62393785", "0.6217167", "0.6211852", "0.62116235", "0.6201892", "0.6165161", "0.61636305", "0.6162185", "0.6157415", "0.6122844", "0.6114833...
0.0
-1
Optional Method Time Complexity: Space Complexity:
def bfs return [] if @root.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optional; end", "def maybe; end", "def optional?\n @optional\n end", "def optional?\n\t\t!required?\n\tend", "def option(criteria = T.unsafe(nil)); end", "def optimizable?\n super || !predicate.equal?(operation.predicate)\n end", "def none?\n !any?\n end", ...
[ "0.5707122", "0.5485201", "0.5262127", "0.51078975", "0.5073516", "0.50569075", "0.504007", "0.50215054", "0.50030905", "0.4978641", "0.49346524", "0.49229994", "0.48666954", "0.48421654", "0.48361006", "0.48277402", "0.48255092", "0.48205838", "0.4816803", "0.48151508", "0.4...
0.0
-1
Provide a default URL as a default if there hasn't been a file uploaded:
def default_url # # For Rails 3.1+ asset pipeline compatibility: ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) "/assets/fallback/" + [version_name, "default.png"].compact.join('_') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_with_default *args\n unless file_name.nil?\n url_without_default *args\n else\n nil\n end\n end", "def default_url\n nil\n end", "def default_url\n end", "def default_url\n url 'default'\n end", "def default_url\n file_path = [\n 'fallbacks',\n ...
[ "0.7883205", "0.77595973", "0.74651086", "0.71624243", "0.7141275", "0.708046", "0.69866884", "0.6946398", "0.6934942", "0.69288045", "0.69250774", "0.69250774", "0.69250774", "0.69208115", "0.6917895", "0.6908054", "0.6887987", "0.68706596", "0.68628246", "0.6834046", "0.677...
0.6120811
81
Resize and crop square from Center
def resize_and_crop(size) manipulate! do |image| if image[:width] < image[:height] remove = (image[:height] - 135).round image.shave("0x#{remove}") elsif image[:width] > image[:height] remove = ((image[:width] - image[:height])/2).round ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def square_image_crop\n if (self.crops)\n if !(self.crop_x.nil? || self.crop_y.nil? || self.crop_w.nil? || self.crop_h.nil?)\n @image = MiniMagick::Image.open(self.photo.url)\n # if image is larger than our max screen size, the cropped image will be incorrect (resizing)\n @image.sample...
[ "0.7075364", "0.6935234", "0.6606016", "0.65331835", "0.6484095", "0.6465967", "0.6382893", "0.637307", "0.6359863", "0.63013375", "0.62776214", "0.6276094", "0.6238306", "0.61736935", "0.61469185", "0.61461484", "0.611072", "0.61086005", "0.610806", "0.60886246", "0.60809094...
0.6777141
2
Sets the devise scope to be used in the controller. If you have custom routes, you are required to call this method (also aliased as :as) in order to specify to which controller it is targeted. as :user do get "sign_in", to: "devise/sessionsnew" end Notice you cannot have two scopes mapping to the same URL. And remembe...
def as(scope); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def devise_scope(scope)\n constraint = lambda do |request|\n request.env[\"devise.mapping\"] = Devise.mappings[scope]\n true\n end\n\n constraints(constraint) do\n yield\n end\n end", "def devise_scope(scope); end", "def scope_path\n opts = {}\n route = :\"new...
[ "0.6440811", "0.6260333", "0.60024804", "0.567202", "0.5520424", "0.5470942", "0.54442394", "0.5436649", "0.5228263", "0.5167874", "0.51521516", "0.51470935", "0.51470935", "0.5129631", "0.51057976", "0.51057976", "0.50937223", "0.50771517", "0.50634605", "0.50567603", "0.504...
0.0
-1
Sets the devise scope to be used in the controller. If you have custom routes, you are required to call this method (also aliased as :as) in order to specify to which controller it is targeted. as :user do get "sign_in", to: "devise/sessionsnew" end Notice you cannot have two scopes mapping to the same URL. And remembe...
def devise_scope(scope); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def devise_scope(scope)\n constraint = lambda do |request|\n request.env[\"devise.mapping\"] = Devise.mappings[scope]\n true\n end\n\n constraints(constraint) do\n yield\n end\n end", "def scope_path\n opts = {}\n route = :\"new_#{scope}_session_path\"\n alt_...
[ "0.64416087", "0.6001214", "0.56732464", "0.5520173", "0.5470844", "0.54457724", "0.54373413", "0.52277434", "0.5166573", "0.51522654", "0.5147866", "0.5147866", "0.5128817", "0.5105338", "0.5105338", "0.5093431", "0.50777364", "0.50625956", "0.5056366", "0.50460905", "0.5045...
0.62605816
1
Allow you to route based on whether a scope is not authenticated. You can optionally specify which scope. unauthenticated do as :user do root to: 'devise/registrationsnew' end end root to: 'dashboardshow' source://devise//lib/devise/rails/routes.rb331
def unauthenticated(scope = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def github_unauthenticated(scope=nil, options={}, &routes_block)\n github_constraint(scope, options, routes_block) do |warden, scope|\n not warden.authenticated?(scope: scope)\n end\n end", "def not_authenticated\n # Make sure that we reference the route from the main app.\...
[ "0.71268034", "0.6713842", "0.6662983", "0.6655149", "0.66442287", "0.65960336", "0.64886487", "0.62503827", "0.618027", "0.61723006", "0.61516523", "0.6122844", "0.61094546", "0.6083837", "0.60800225", "0.60374266", "0.5994432", "0.5964719", "0.5963091", "0.5927666", "0.5914...
0.61222196
12
Small method that adds a mapping to Devise. source://devise//lib/devise.rb360
def add_mapping(resource, options); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def devise_mappings; end", "def devise_mapping\n @devise_mapping ||= Devise.mappings[:user]\n end", "def devise_mapping\n @devise_mapping ||= Devise.mappings[:user]\n end", "def devise_mapping\n @devise_mapping ||= Devise.mappings[:user]\n end", "def devise_mapping\n @devise_mapping ||= requ...
[ "0.8111879", "0.78088266", "0.78088266", "0.78088266", "0.7464767", "0.6392888", "0.61393785", "0.6126036", "0.60958374", "0.6056741", "0.599452", "0.59280944", "0.5800597", "0.5745422", "0.5719109", "0.57128125", "0.5667718", "0.56620896", "0.5640379", "0.56369895", "0.56087...
0.52291787
61
Register available devise modules. For the standard modules that Devise provides, this method is called from lib/devise/modules.rb. Thirdparty modules need to be added explicitly using this method. Note that adding a module using this method does not cause it to be used in the authentication process. That requires that...
def add_module(module_name, options = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_module_by_normal_module(mod)\n add_class_or_module mod, @modules, @store.modules_hash\n end", "def register_module\n unless Object.const_defined? module_name\n Object.const_set module_name, Module.new\n end\n end", "def extend(mod)\n @modules << mod\n super(mod)\n ...
[ "0.5874596", "0.57253146", "0.56865597", "0.5641712", "0.5517758", "0.53963614", "0.53904074", "0.5383018", "0.53597116", "0.53132", "0.5231754", "0.5211694", "0.5181778", "0.51176196", "0.50330204", "0.50075495", "0.49249724", "0.48759675", "0.48558316", "0.48558316", "0.485...
0.5827348
1
A method used internally to complete the setup of warden manager after routes are loaded. See lib/devise/rails/routes.rb ActionDispatch::Routing::RouteSetfinalize_with_devise! source://devise//lib/devise.rb482
def configure_warden!; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finalize_artifacts\n \n return if skip_method(__method__)\n \n puts \"finalize Rails routes in config/routes.rb\"\n \n add_routes(@@rails_routes)\n \n # create the navigation menu\n finalize_menu\n \n end", "def setup_controller_for_warden; end", "def after_initialize\n ...
[ "0.57292837", "0.5662245", "0.5465966", "0.5375262", "0.5354061", "0.53004056", "0.52240586", "0.52220803", "0.5179177", "0.5097509", "0.50777185", "0.5066792", "0.50453264", "0.50387084", "0.5012676", "0.4940567", "0.4918251", "0.49097115", "0.48773956", "0.48754072", "0.487...
0.57931936
0
Generate a friendly string randomly to be used as token. By default, length is 20 characters. source://devise//lib/devise.rb507
def friendly_token(length = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_token\n 32.times.map{ rand(36).to_s(36) }.join # 32 alphanumeric characters\n end", "def friendly_token(length = 20)\n # To calculate real characters, we must perform this operation.\n # See SecureRandom.urlsafe_base64\n rlength = (length * 3) / 4\n SecureRa...
[ "0.8415376", "0.83537436", "0.82351744", "0.80652165", "0.80566436", "0.80488855", "0.80250734", "0.79541564", "0.7876227", "0.78434193", "0.78111786", "0.7808348", "0.7807786", "0.77982175", "0.7790881", "0.7783124", "0.7762144", "0.7751176", "0.77394456", "0.76737964", "0.7...
0.0
-1
Include helpers in the given scope to AC and AV. source://devise//lib/devise.rb463
def include_helpers(scope); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def devise_scope(scope); end", "def include_helpers(scope)\n ActiveSupport.on_load(:action_controller) do\n include scope::Helpers if defined?(scope::Helpers)\n #include scope::UrlHelpers\n end\n\n ActiveSupport.on_load(:action_view) do\n include scope::ViewHelpers\n end\n end", "de...
[ "0.67678535", "0.6391462", "0.5997977", "0.57599056", "0.56406826", "0.5548768", "0.5548768", "0.551162", "0.54747325", "0.54161847", "0.5395618", "0.5388058", "0.53593373", "0.53518903", "0.5329977", "0.53148067", "0.52538776", "0.5228034", "0.5228033", "0.5220419", "0.51732...
0.66385967
1
Get the mailer class from the mailer reference object. source://devise//lib/devise.rb349
def mailer; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mailer_class\n Object.const_get(self.class.to_s)\n end", "def mailer\n @mailer_ref.get\n end", "def mailer=(class_name)\n ActiveSupport::Dependencies.reference(class_name)\n @mailer_ref = Getter.new(class_name)\n end", "def class\n NameMailer.class\n end", "def mailer=(...
[ "0.83873934", "0.77915466", "0.7390879", "0.73567134", "0.7176125", "0.67854923", "0.66556853", "0.6575812", "0.65088624", "0.65088624", "0.6375758", "0.63133085", "0.62643677", "0.62500125", "0.60685647", "0.5981984", "0.5981984", "0.5957945", "0.58847076", "0.5737907", "0.5...
0.5582606
23
Set the mailer reference object to access the mailer. source://devise//lib/devise.rb354
def mailer=(class_name); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mailer\n @mailer_ref.get\n end", "def mailer=(class_name)\n ActiveSupport::Dependencies.reference(class_name)\n @mailer_ref = Getter.new(class_name)\n end", "def initialize mailer=\"mutt\"\n @mailer = mailer\n end", "def mailer\n ExamplerailsMailer.mailer\n end", "def...
[ "0.7682378", "0.75934964", "0.71761274", "0.6817066", "0.6779114", "0.67481995", "0.67481995", "0.67277086", "0.66867054", "0.6677117", "0.6601207", "0.6382463", "0.631185", "0.63107187", "0.6276338", "0.6274289", "0.6237451", "0.6227114", "0.61879236", "0.61879236", "0.61078...
0.69784576
3
Specify an OmniAuth provider. config.omniauth :github, APP_ID, APP_SECRET source://devise//lib/devise.rb457
def omniauth(provider, *args); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup\n OmniAuth.config.test_mode = true\n OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({:provider => 'github',:uid => '123545',:info => {:name => 'Satine', :email => 'satine@catworld.com'}})\n end", "def apply_omniauth(omniauth)\n authentications.build(provider: omniauth['provider'...
[ "0.6677584", "0.6627392", "0.6343202", "0.6343202", "0.6342501", "0.6285651", "0.6250629", "0.6242824", "0.6242824", "0.62416434", "0.6215671", "0.6207433", "0.62001616", "0.6190402", "0.6168289", "0.61561173", "0.61387134", "0.61215746", "0.6113521", "0.60856104", "0.6083039...
0.6994144
0
Regenerates url helpers considering Devise.mapping source://devise//lib/devise.rb475
def regenerate_helpers!; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def devise_mappings; end", "def url_helpers_module; end", "def define_path_helpers; end", "def add_devise_route # :nodoc:\n devise_route = <<-ROUTE\n\n devise_for :users,\n path: '',\n path_names: {\n :sign_in => 'login',\n :sign_out => 'logout',\n :sign_up => 'create',\n :p...
[ "0.7049527", "0.66652095", "0.6254909", "0.62348306", "0.6123032", "0.6090884", "0.6084645", "0.6054309", "0.6049145", "0.6049145", "0.6032312", "0.6026572", "0.60214484", "0.601394", "0.601394", "0.601394", "0.59097016", "0.5883669", "0.58504766", "0.58329934", "0.5830643", ...
0.5190152
58
constanttime comparison algorithm to prevent timing attacks source://devise//lib/devise.rb515
def secure_compare(a, b); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secure_compare(value)\n a = self.secret\n b = value\n\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n ...
[ "0.595053", "0.5904778", "0.5747252", "0.5661701", "0.56509936", "0.56411606", "0.56146735", "0.56043935", "0.56000566", "0.5570236", "0.5570236", "0.55407435", "0.55240667", "0.55119526", "0.549416", "0.54883504", "0.5486249", "0.54762703", "0.547471", "0.546547", "0.5460035...
0.69561625
2
Default way to set up Devise. Run rails generate devise_install to create a fresh initializer with all configuration values.
def setup; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def devise_install(&block)\n if block_given?\n Devise.setup do |config|\n block.call config\n end\n end\n end", "def install_devise\n require 'devise'\n if File.exists?(File.join(destination_root, \"config\", \"initializers\", \"devise.rb\"))\n puts \"\\n=========...
[ "0.7492007", "0.6516155", "0.63929355", "0.61673415", "0.5923616", "0.5700711", "0.563212", "0.5613101", "0.5571621", "0.5541415", "0.5429833", "0.5429833", "0.5429833", "0.5408335", "0.53179747", "0.52426136", "0.50626045", "0.50188977", "0.498464", "0.49749243", "0.49390104...
0.0
-1
Sets warden configuration using a block that will be invoked on warden initialization. Devise.setup do |config| config.allow_unconfirmed_access_for = 2.days config.warden do |manager| Configure warden to use other strategies, like oauth. manager.oauth(:twitter) end end source://devise//lib/devise.rb449
def warden(&block); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def devise_install(&block)\n if block_given?\n Devise.setup do |config|\n block.call config\n end\n end\n end", "def warden\n @warden ||= begin\n env['warden']\n end\n end", "def initialize(app, options={})\n default_strategies = options.dele...
[ "0.60763353", "0.59227175", "0.58624446", "0.5832411", "0.57695043", "0.5624022", "0.5624022", "0.54588443", "0.5454099", "0.54460955", "0.54460955", "0.54460955", "0.5434343", "0.54120314", "0.53698915", "0.5341713", "0.5277309", "0.52513546", "0.5204548", "0.51967084", "0.5...
0.51272607
27
The default url to be used after signing in. This is used by all Devise controllers and you can overwrite it in your ApplicationController to provide a custom hook for a custom resource. By default, it first tries to find a valid resource_return_to key in the session, then it fallbacks to resource_root_path, otherwise ...
def after_sign_in_path_for(resource_or_scope); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_sign_in_path_for(_resource)\n root_url\n end", "def after_sign_in_path_for(resource)\n sign_in_url = new_user_session_url\n if request.referer == sign_in_url\n super\n else\n stored_location_for(resource) || request.referrer || root_path\n end\n end", "def after_sign_in_pat...
[ "0.77106726", "0.76660436", "0.76341593", "0.7618879", "0.7580937", "0.7578742", "0.7565504", "0.7563469", "0.75564986", "0.75541747", "0.7548936", "0.7548936", "0.7548936", "0.7537568", "0.75077534", "0.7495068", "0.74298894", "0.7429423", "0.74189496", "0.739888", "0.737825...
0.704038
63
Method used by sessions controller to sign out a user. You can overwrite it in your ApplicationController to provide a custom hook for a custom scope. Notice that differently from +after_sign_in_path_for+ this method receives a symbol with the scope, and not the resource. By default it is the root_path. source://devise...
def after_sign_out_path_for(resource_or_scope); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_sign_out_path_for(resource_or_scope)\n '/users/sign_in'\n end", "def after_sign_out_path_for(resource_or_scope)\n \"/app/users/sign_in\"\n end", "def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end", "def after_sign_out_path_for(_resource_or_scope)\n user_se...
[ "0.8372493", "0.8366942", "0.8309909", "0.8309909", "0.8309909", "0.8309909", "0.8287882", "0.8240874", "0.82339793", "0.81840694", "0.8163991", "0.8163991", "0.81412935", "0.8104909", "0.81012356", "0.8092506", "0.80915797", "0.80915797", "0.80915797", "0.80915797", "0.80915...
0.8319657
2
Tell warden that params authentication is allowed for that specific page. source://devise//lib/devise/controllers/helpers.rb163
def allow_params_authentication!; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_options_authenticate?(params = {})\n params = params.symbolize_keys\n if params[:controller]\n # find the controller class\n klass = eval(\"#{params[:controller]}_controller\".classify)\n else\n klass = self.class\n end\n klass.user_authorized_for?(current_visi...
[ "0.67927015", "0.65254724", "0.64046264", "0.62075865", "0.6205795", "0.6192272", "0.61471504", "0.60884804", "0.6083158", "0.60477567", "0.6025135", "0.60043305", "0.5974223", "0.59658515", "0.59658515", "0.59658515", "0.5954233", "0.5923302", "0.59110546", "0.59047437", "0....
0.7107103
0
Return true if it's a devise_controller. false to all controllers unless the controllers defined inside devise. Useful if you want to apply a before filter to all controllers, except the ones in devise: before_action :my_filter, unless: :devise_controller?
def devise_controller?; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_authorized\n controller = params[:controller].classify\n exception = controller.split(':').first\n if exception.include? 'User'\n exception = controller.split(':').last\n devise_controller = controller.split(':').first\n end\n\n unless Rails.configuration.x.controller_exceptions.inc...
[ "0.7594558", "0.75755465", "0.7440443", "0.7112752", "0.6905673", "0.6874579", "0.6857997", "0.6641186", "0.66015667", "0.65371805", "0.647392", "0.6417568", "0.6197548", "0.6125058", "0.61115146", "0.6106995", "0.6102223", "0.61004406", "0.60591424", "0.60199547", "0.6017268...
0.64079183
12
Set up a param sanitizer to filter parameters using strong_parameters. See lib/devise/parameter_sanitizer.rb for more info. Override this method in your application controller to use your own parameter sanitizer. source://devise//lib/devise/controllers/helpers.rb158
def devise_parameter_sanitizer; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def devise_parameter_sanitizer\n if resource_class == User\n User::ParameterSanitizer.new(User, :user, params)\n else\n super\n end\n end", "def devise_parameter_sanitizer\n if resource_class == User\n User::ParameterSanitizer.new(User, :user, params)\n else\n super\n end\n...
[ "0.7436621", "0.7436621", "0.71319586", "0.710156", "0.6922984", "0.6808984", "0.6807405", "0.6703177", "0.65891755", "0.6564144", "0.65568626", "0.65568626", "0.65568626", "0.65496415", "0.6483804", "0.6459595", "0.64229757", "0.63791466", "0.63179356", "0.63119763", "0.6288...
0.8135269
0
Overwrite Rails' handle unverified request to sign out all scopes, clear run strategies and remove cached variables. source://devise//lib/devise/controllers/helpers.rb254
def handle_unverified_request; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_unverified_request\n employee_sign_out\n company_sign_out\n super\n end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def handle_unver...
[ "0.7779263", "0.7516193", "0.7516193", "0.7516193", "0.7516193", "0.7516193", "0.7516193", "0.7495953", "0.7495953", "0.7495953", "0.7495953", "0.7495953", "0.7495953", "0.7495953", "0.7495953", "0.7495953", "0.7495953", "0.7495953", "0.7495953", "0.7495953", "0.7495953", "...
0.0
-1
Check if flash messages should be emitted. Default is to do it on navigational formats
def is_flashing_format?; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flash_messages?; flash.any?; end", "def is_flashing_format?\n false\n end", "def flash_message?; flash.blank?; end", "def is_flashing_format?\n request.respond_to?(:flash) && is_navigational_format?\n end", "def set_flash\n flash[:messages]=@fired_events.find_all { |e| e.block_type.in? M...
[ "0.7396011", "0.7268108", "0.6926628", "0.6832367", "0.6642311", "0.655319", "0.6408385", "0.6397239", "0.6387804", "0.6311777", "0.621696", "0.6214255", "0.6170525", "0.6115967", "0.6065953", "0.606451", "0.60624224", "0.6055898", "0.60551506", "0.60381603", "0.60143393", ...
0.7159792
2
Sign in a user and tries to redirect first to the stored location and then to the url specified by after_sign_in_path_for. It accepts the same parameters as the sign_in method. source://devise//lib/devise/controllers/helpers.rb235
def sign_in_and_redirect(resource_or_scope, *args); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signed_in_user\n unless signed_in?\n # store friendly URL so we can redirect after signin (stored in session)\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def signed_in_user\n unless signed_in?\n store_location #record url of intended pag...
[ "0.786294", "0.78237176", "0.77839625", "0.77813095", "0.7764231", "0.7730236", "0.7689367", "0.7677377", "0.76565903", "0.76418495", "0.7626616", "0.76225525", "0.7600467", "0.7600467", "0.7600467", "0.75877005", "0.75579035", "0.75520736", "0.75520736", "0.75520736", "0.754...
0.7578729
16
Sign out a user and tries to redirect to the url specified by after_sign_out_path_for. source://devise//lib/devise/controllers/helpers.rb245
def sign_out_and_redirect(resource_or_scope); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_sign_out_path_for(_resource_or_scope)\n # require 'pry'\n # binding.pry\n # Note: at this time: flash[:notice] => \"Signed out successfully.\"\n # current_user is nil.\n new_user_session_path # signIn page\n end", "def after_sign_out_path_for(resource)\n #if curren...
[ "0.80424315", "0.79839855", "0.79773813", "0.79722524", "0.7916559", "0.7881666", "0.78052366", "0.78041863", "0.78029364", "0.7778255", "0.7749978", "0.77436846", "0.7742959", "0.77200735", "0.7692152", "0.76650035", "0.76650035", "0.76650035", "0.76650035", "0.76553583", "0...
0.7682516
15
The scope root url to be used when they're signed in. By default, it first tries to find a resource_root_path, otherwise it uses the root_path. source://devise//lib/devise/controllers/helpers.rb169
def signed_in_root_path(resource_or_scope); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signed_in_root_path(resource_or_scope)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n home_path = \"#{scope}_root_path\"\n if respond_to?(home_path, true)\n refinery.send(home_path)\n elsif respond_to?(:admin_root_path)\n refinery.admin_root_path\n else\n ...
[ "0.79330564", "0.78478867", "0.7836582", "0.78162897", "0.7684754", "0.76183945", "0.74245006", "0.74042886", "0.73664755", "0.7324574", "0.73240405", "0.73028785", "0.72878706", "0.72484624", "0.72393227", "0.7210555", "0.7210555", "0.7210555", "0.7210555", "0.7181752", "0.7...
0.8419402
0
The main accessor for the warden proxy instance source://devise//lib/devise/controllers/helpers.rb142
def warden; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warden\n env['warden']\n end", "def warden\n env['warden']\n end", "def warden\n request.env['warden']\n end", "def warden\n request.env['warden']\n end", "def warden\n request.env['warden']\n end", "def warden\n request.env['warden']\n end", "def current_user\n ...
[ "0.7226282", "0.7226282", "0.7168792", "0.7168792", "0.7168792", "0.6998974", "0.6889068", "0.68617916", "0.67265624", "0.6365627", "0.6335999", "0.6141931", "0.61035943", "0.5918005", "0.5912567", "0.5853453", "0.5841963", "0.58276165", "0.5783922", "0.5775854", "0.57686996"...
0.67073053
9
Remembers the given resource by setting up a cookie source://devise//lib/devise/controllers/rememberable.rb22
def remember_me(resource); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remember!(cookies)\n cookies[:remember_me] = {:value => \"1\",\n :expires => COOKIE_EXPIRATION }\n \n self.authorization_token = unique_identifier\n self.save!\n cookies[:authorization_token] = {:value => self.authorization_token,\n ...
[ "0.7479166", "0.74032325", "0.7398492", "0.7386852", "0.73616815", "0.7346154", "0.7326274", "0.7320403", "0.7293363", "0.7244919", "0.7242219", "0.7148867", "0.71374226", "0.71365684", "0.70657307", "0.7047959", "0.70178366", "0.6999937", "0.69996536", "0.6999407", "0.699443...
0.72710466
10
Sign in a user that already was authenticated. This helper is useful for logging users in after sign up. All options given to sign_in is passed forward to the set_user method in warden. If you are using a custom warden strategy and the timeoutable module, you have to set `env["devise.skip_timeout"] = true` in the reque...
def sign_in(resource_or_scope, *args); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_in(user)\n login_as user\n end", "def sign_in_as(user, options = {})\n password = options[:password] || 'password'\n remember_me = options[:remember_me] || '1'\n if integration_test?\n post_via_redirect user_session_path, 'user[email]' => user.email, 'user[password]' => passw...
[ "0.74970675", "0.7296163", "0.72668797", "0.70821077", "0.6933889", "0.69242007", "0.692091", "0.691604", "0.6896437", "0.6881414", "0.6860471", "0.68602103", "0.6858463", "0.6846369", "0.6824088", "0.6823251", "0.68110394", "0.67820823", "0.67603713", "0.67420447", "0.673547...
0.0
-1
Sign out a given user or scope. This helper is useful for signing out a user after deleting accounts. Returns true if there was a logout and false if there is no user logged in on the referred scope Examples: sign_out :user sign_out(scope)
def sign_out(resource_or_scope = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_out\n session.sign_out\n end", "def sign_out\n session.delete :user_id\n @current_user = nil\n end", "def sign_out(resource_or_scope); end", "def sign_out(resource_or_scope); end", "def sign_out\n session.delete(:user_id)\n @current_user = nil\n end", "def sign_out\n ...
[ "0.6739624", "0.6654081", "0.6633607", "0.6633607", "0.6621985", "0.64869946", "0.6467333", "0.64437497", "0.6433618", "0.64320564", "0.6425929", "0.6400286", "0.63965666", "0.6380197", "0.6360218", "0.6354883", "0.63337255", "0.63320184", "0.6327396", "0.6322863", "0.6315313...
0.0
-1
Sign out all active users or scopes. This helper is useful for signing out all roles in one click. This signs out ALL scopes in warden. Returns true if there was at least one logout and false if there was no user logged in on all scopes. source://devise//lib/devise/controllers/sign_in_out.rb95
def sign_out_all_scopes(lock = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logout_all\r\n\t\tif(!user_signed_in?)\r\n\t\t\tflash.notice = I18n.t('devise.sessions.already_signed_out')\r\n\t\t\tredirect_to root_path and return\r\n\t\tend\r\n\t\t\r\n\t\tsign_out current_user\r\n\t\tflash.notice = I18n.t('devise.sessions.signed_out')\r\n\t\tredirect_to root_path # also find sessions/toke...
[ "0.7194551", "0.67035425", "0.6154101", "0.6154101", "0.5812138", "0.5664051", "0.5632292", "0.557526", "0.55351365", "0.5525054", "0.5517817", "0.54938316", "0.5472924", "0.5429128", "0.5426166", "0.54034615", "0.5391479", "0.53559595", "0.53539765", "0.53437245", "0.5325030...
0.712225
1
Return true if the given scope is signed in session. If no scope given, return true if any scope is signed in. This will run authentication hooks, which may cause exceptions to be thrown from this method; if you simply want to check if a scope has already previously been authenticated without running authentication hoo...
def signed_in?(scope = T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signed_in?(scope)\n warden.authenticate?(:scope => scope)\n end", "def authenticated?(scope=nil)\n scope ? warden.authenticated?(:scope => scope) : warden.authenticated?\n end", "def authenticated?(scope=nil)\n scope ? warden.authenticated?(scope) : warden.authenticated?\n ...
[ "0.7900562", "0.76219875", "0.75977343", "0.64399636", "0.6398549", "0.6398549", "0.6361894", "0.63464546", "0.6342149", "0.6301117", "0.62513363", "0.62468064", "0.6226203", "0.6195811", "0.6171738", "0.61634266", "0.6163067", "0.6146949", "0.6142428", "0.613042", "0.6116488...
0.0
-1
Returns and delete (if it's navigational format) the url stored in the session for the given scope. Useful for giving redirect backs after sign up: Example: redirect_to stored_location_for(:user) || root_path source://devise//lib/devise/controllers/store_location.rb18
def stored_location_for(resource_or_scope); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_location!(scope)\n session[:\"#{scope}.return_to\"] = request.env['REQUEST_URI'] if request && request.get?\n end", "def store_location!\n session[:\"#{scope}_return_to\"] = attempted_path if request.get? && !http_auth?\n end", "def stored_location_for(resource_or_scope)\n session[...
[ "0.7218671", "0.6668747", "0.6617072", "0.6574878", "0.65582144", "0.6486702", "0.64611137", "0.6386886", "0.6368797", "0.6304412", "0.627545", "0.62740964", "0.62702525", "0.62541217", "0.62541217", "0.62541217", "0.62541217", "0.62541217", "0.62541217", "0.6238528", "0.6233...
0.0
-1
Choose whether we should respond in an HTTP authentication fashion, including 401 and optional headers. This method allows the user to explicitly disable HTTP authentication on AJAX requests in case they want to redirect on failures instead of handling the errors on their own. This is useful in case your AJAX API is th...
def http_auth?; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_client_to_handle_unauthorized_status\n headers.delete('WWW-Authenticate')\n end", "def require_authentication\n render_failed_auth_response unless authentication_successful? # render a 401 error\n end", "def require_authentication\n render_failed_auth_response unless authentication_s...
[ "0.68999493", "0.68994087", "0.68672377", "0.6758252", "0.6719097", "0.66592824", "0.65523046", "0.65301824", "0.650388", "0.6503533", "0.6485819", "0.6470028", "0.6465198", "0.6458805", "0.64326113", "0.64326113", "0.6430438", "0.6417581", "0.64020264", "0.6370617", "0.63487...
0.60816926
53
It doesn't make sense to send authenticate headers in AJAX requests or if the user disabled them.
def http_auth_header?; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_client_to_handle_unauthorized_status\n headers.delete('WWW-Authenticate')\n end", "def http_auth_header?\n Oath.config.http_authenticatable && !request.xhr?\n end", "def authenticate_request\n render :json => { :error => :unauthorized }, :status => :unauthorized unless current_...
[ "0.73233235", "0.72833264", "0.7272497", "0.7224589", "0.7162452", "0.6994631", "0.6991172", "0.6961415", "0.6902395", "0.6864929", "0.6855467", "0.68313974", "0.68074125", "0.67993075", "0.6794211", "0.6782117", "0.67774737", "0.6776349", "0.6762328", "0.67448205", "0.673941...
0.67113024
23
Check if flash messages should be emitted. Default is to do it on navigational formats
def is_flashing_format?; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flash_messages?; flash.any?; end", "def is_flashing_format?\n false\n end", "def flash_message?; flash.blank?; end", "def is_flashing_format?\n request.respond_to?(:flash) && is_navigational_format?\n end", "def set_flash\n flash[:messages]=@fired_events.find_all { |e| e.block_type.in? M...
[ "0.7393258", "0.7266733", "0.6923131", "0.6832732", "0.66389906", "0.6550679", "0.64050627", "0.6393993", "0.6384501", "0.6309731", "0.6213595", "0.6209325", "0.6166452", "0.6113381", "0.60633594", "0.60629666", "0.605936", "0.6054461", "0.6053563", "0.603398", "0.6011405", ...
0.71586376
3