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
Use callbacks to share common setup or constraints between actions.
def set_trouble @variable_trouble = Trouble.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
Never trust parameters from the scary internet, only allow the white list through.
def trouble_params params.require(:trouble).permit(:name, :url, :solution, :status_id, :category_id, :user_id) 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
vi: set ft=ruby :
def configure_node(node) node.vm.box = "debian/jessie64" node.vm.box_check_update = true node.vm.synced_folder "./data", "/data" node.vm.provider "virtualbox" do |v| v.gui = false v.memory = "2048" v.cpus = 2 v.customize ["modifyvm", :id, "--cpuexecutioncap", "100"] v.customize ["modifyvm", :id, "--hpet", "on"] v.default_nic_type = "82545EM" end node.vm.provision "shell", inline: <<-SHELL apt-get -y update apt-get -y install build-essential apt-get -y install cmake apt-get -y install emacs apt-get -y install ninja-build apt-get -y install git apt-get -y install htop apt-get -y install zsh apt-get -y upgrade SHELL end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_of_executing_the_commands\n @commands = \":set ft=ruby\r\" + @commands\n RobotVim::Runner.new.run(:input_file => @input, :commands => @commands)\nend", "def ruby\n unless @ruby\n @ruby = \"\"\n @body.each_line do |l|\n @commands << {:ruby => l}\n @ruby << l\n ...
[ "0.5803009", "0.5457295", "0.544725", "0.5440447", "0.540047", "0.5387971", "0.53144646", "0.520739", "0.5160547", "0.5159978", "0.5159782", "0.5146485", "0.5083554", "0.50814515", "0.5080929", "0.5077087", "0.50639117", "0.50580174", "0.50580174", "0.50380445", "0.50380445",...
0.0
-1
Creates an instance of a Neuron
def initialize @id = self.class.uid @connections = Connections.new({}, {}, {}) @error = Error.new(0.0, 0.0, 0.0) @trace = Trace.new({}, {}, {}) @state = @old = @activation = 0.0 @selfconnection = Synaptical::Connection.new(self, self, 0.0) @squash = Synaptical::Squash::Logistic @neighbors = {} @bias = rand * 0.2 - 0.1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_network\n @neural_net = RubyFann::Standard.new(num_inputs: @nuerons_number,\n hidden_neurons: [(2 * @nuerons_number) / 3],\n num_outputs: @nuerons_number)\n end", "def initialize(neural_inputs: nil,\n ...
[ "0.6922735", "0.6798534", "0.6624502", "0.6372999", "0.63082767", "0.58965474", "0.58900154", "0.57446855", "0.5735965", "0.5689767", "0.5684622", "0.5626519", "0.5623773", "0.5618617", "0.56077605", "0.56077605", "0.5571133", "0.5557739", "0.54934824", "0.5460241", "0.544940...
0.50827587
54
Back propagate the error
def propagate(rate = 0.1, target = nil) error = 0.0 # Is neuron in output layer if !target.nil? # Eq. 10. @error.responsibility = @error.projected = target - @activation else # The rest of the neuron compute their error responsibilities by back- # propagation connections.projected.each_value do |connection| neuron = connection.to # Eq. 21. error += neuron.error.responsibility * connection.gain * connection.weight end # Projected error responsibility @error.projected = @derivative * error error = 0.0 # Error responsibilities from all the connections gated by this neuron trace.extended.each do |id, _| neuron = @neighbors[id] # gated neuron # If gated neuron's selfconnection is gated by this neuron influence = neuron.selfconnection.gater == self ? neuron.old : 0.0 # Index runs over all th econnections to the gated neuron that are # gated by this neuron trace.influences[id].each do |input, infl| # Captures the effect that the input connection of this neuron have, # on a neuron which its input/s is/are gated by this neuron influence += infl.weight * trace.influences[neuron.id][input].from.activation end # Eq. 22. error += neuron.error.responsibility * influence end # Gated error responsibility @error.gated = @derivative * error # Error responsibility - Eq. 23. @error.responsibility = @error.projected + @error.gated end connections.inputs.each_value do |input_neuron| # Eq. 24 gradient = @error.projected * trace.elegibility[input_neuron.id] trace.extended.each do |id, _| neuron = neighbors[id] gradient += neuron.error.responsibility * trace.extended[neuron.id][input_neuron.id] end # Adjust weights - aka. learn input_neuron.weight += rate * gradient end # Adjust bias @bias += rate * @error.responsibility end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recover_from(_error); end", "def recover_from(_error)\n end", "def propagate\n @propagate_exceptions = true\n end", "def errback &block\n super\n end", "def errback &block\n super\n end", "def original_exception; end", "def original_error; end", "def original_error;...
[ "0.78358305", "0.7769815", "0.73721474", "0.7307578", "0.7307578", "0.7294966", "0.71287996", "0.71287996", "0.70360065", "0.693632", "0.6852727", "0.68255615", "0.68120587", "0.6798293", "0.6780801", "0.67698485", "0.67666113", "0.67588055", "0.67269343", "0.67269343", "0.67...
0.0
-1
Add connection to gated list
def gate(connection) connections.gated[connection.id] = connection neuron = connection.to unless trace.extended.key?(neuron.id) # Extended trace neighbors[neuron.id] = neuron xtrace = trace.extended[neuron.id] = {} connection.inputs.each_value do |input| xtrace[input.id] = 0 end end # Keep track if trace.influences.key?(neuron.id) trace.influences[neuron.id] << connection else trace.influences[neuron.id] = [connection] end # Set gater connection.gater = self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(name, connection)\n @connections.store(name, connection)\n end", "def join(c)\n connections << c\n end", "def add_connection(connection)\n self.connections[connection.id] = connection\n end", "def checkin_connection(conn)\n @available_connections << conn\n conn\n end", ...
[ "0.6710281", "0.6644192", "0.6618919", "0.63248587", "0.6299969", "0.6137364", "0.6130453", "0.61202246", "0.609378", "0.6069656", "0.60602605", "0.60501873", "0.5990621", "0.59905505", "0.5970015", "0.5866052", "0.58608943", "0.58341473", "0.578295", "0.57814914", "0.5767342...
0.0
-1
Returns wheter the neuron is self connected
def selfconnected? !selfconnection.weight.zero? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connected?\n @neighbors.count.nonzero?\n end", "def connected?\n !!@connected_to\n end", "def connected?\n\t\treturn self.connected ? true : false\n\tend", "def connected?\n return @connected\n end", "def connected?\n @connected\n end", "def connected?\n @connected\n end", "def ...
[ "0.78612447", "0.7776261", "0.7687298", "0.7642318", "0.7621607", "0.7621607", "0.7621607", "0.7621607", "0.7621607", "0.7621607", "0.76180816", "0.75662637", "0.75356555", "0.75356555", "0.75356555", "0.75356555", "0.75356555", "0.7524124", "0.75167465", "0.7482601", "0.7387...
0.81044173
0
Returns whether the neuron is connected to another neuron
def connected(neuron) result = Connection.new if self == neuron return unless selfconnected? result.type = :selfconnection result.connection = selfconnection return result end CONNECTION_TYPES .map { |ct| connections.send(ct).values } .flatten .each do |connection| next unless connection.to == neuron || connection.from == neuron result.type = type result.connection = type return result end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connected?\n @neighbors.count.nonzero?\n end", "def connected?\n !!@connected_to\n end", "def connected?(relation_name, other_object)\n return Relation.connected?(relation_name, self.node, other_object.node)\n end", "def connected?\n @connected\n end", "def connected?\n @connected\n ...
[ "0.7660644", "0.7226879", "0.7023916", "0.6970236", "0.6970236", "0.6970236", "0.6970236", "0.6970236", "0.6970236", "0.69097066", "0.6900309", "0.6900309", "0.6900309", "0.6900309", "0.6900309", "0.6851658", "0.6833169", "0.6833007", "0.6832464", "0.6817151", "0.67906076", ...
0.63998497
46
Clear the context of the neuron, but keeps connections
def clear trace.elegibility.transform_values { |_| 0 } trace.extended.each_value do |ext| ext.transform_values { |_| 0 } end error.responsibility = error.projected = error.gated = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n clear\n CONNECTION_TYPES.map { |ct| connections.send(ct) }.each do |conn_group|\n conn_group.each_value { |conn| conn.weight = rand * 0.2 - 0.1 }\n end\n\n @bias = rand * 0.2 - 0.1\n @old = @state = @activation = 0\n end", "def clear_all_connections!\n disconne...
[ "0.69750744", "0.68641007", "0.6859631", "0.68322355", "0.66762996", "0.6586585", "0.6547873", "0.6530158", "0.6530158", "0.65037745", "0.6487778", "0.6469523", "0.64575016", "0.64548844", "0.6441063", "0.6431822", "0.64028084", "0.63972294", "0.63754034", "0.6353571", "0.634...
0.0
-1
Clears traces and randomizes connections
def reset clear CONNECTION_TYPES.map { |ct| connections.send(ct) }.each do |conn_group| conn_group.each_value { |conn| conn.weight = rand * 0.2 - 0.1 } end @bias = rand * 0.2 - 0.1 @old = @state = @activation = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_oneconnect_statistics\n super\n end", "def clear\n patch.stop\n patch.connections = []\n patch.start\nend", "def reset_trace\n @trace = Relations::BidirectionalDirectedAdjacencyGraph.new\n @trace.add_vertex(@origin)\n end", "def reset\n @discov...
[ "0.6664129", "0.65102226", "0.63363385", "0.6218926", "0.6154794", "0.60806596", "0.60603154", "0.6031783", "0.6021906", "0.59948826", "0.59909064", "0.5952977", "0.59525317", "0.59307057", "0.59063745", "0.5905051", "0.5899698", "0.5886654", "0.58753353", "0.58753353", "0.58...
0.63049114
3
Hard codes the behavior of the neuron into an optimized function
def optimize(_optimized, _layer) raise 'TODO' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize\n operand\n end", "def optimize\n operand\n end", "def optimize\n operation.class.call(operand)\n end", "def evaluate\n @output_value = Math.tanh(@input_value - @bias)\n #p \"output value #{@output_value}\"\n @forward_nodes...
[ "0.6431355", "0.63889474", "0.63387406", "0.6284766", "0.61817074", "0.5959719", "0.58540237", "0.58300173", "0.5736978", "0.5664543", "0.5646727", "0.5642759", "0.56403196", "0.55940276", "0.5549522", "0.5549522", "0.55337155", "0.55337155", "0.54817295", "0.54817295", "0.54...
0.61065584
5
Returns the next id in the sequence
def uid @neurons += 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_sequence_id\n last_sequence_id + 1\n end", "def next_id\n @id ||= 0\n @id += 1\n end", "def next_id\n id = nil\n MinterState.transaction do\n state = read\n minter = ::Noid::Minter.new(state)\n id = minter.mint\n write!(min...
[ "0.8540969", "0.84595925", "0.82897836", "0.8184852", "0.81038445", "0.8096222", "0.8070239", "0.8039157", "0.8003045", "0.7994515", "0.7992852", "0.79890484", "0.79658055", "0.79425377", "0.78331304", "0.78319293", "0.7675046", "0.7554967", "0.74976826", "0.74309576", "0.734...
0.0
-1
Takes configuration and an arg that is expected to be key=value format. If c is empty, creates one and returns it
def add_to_configuration(c, arg) kv = arg.split('=') kv.length == 2 || (raise "Expected parameter #{kv} in key=value format") c = org.apache.hadoop.hbase.HBaseConfiguration.create if c.nil? c.set(kv[0], kv[1]) c end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def takes_hash(opts = {})\n c = opts[:c]\nend", "def create_key(arg = nil)\n set_or_return(\n :create_key,\n arg,\n kind_of: [ TrueClass, FalseClass ]\n )\n end", "def method_missing(name, *args, &block)\n if name.to_s[-1] == '='\n config[name[0..-2].to_s.upcase] ...
[ "0.58913434", "0.52278763", "0.51599497", "0.5076399", "0.5073432", "0.5073087", "0.5072594", "0.5065129", "0.5061468", "0.5061468", "0.5046907", "0.5040518", "0.50259733", "0.49905154", "0.49905154", "0.49905154", "0.49905154", "0.49905154", "0.4989487", "0.49871948", "0.498...
0.67047644
0
Print whether debug is on or off
def debug? puts "Debug mode is #{@shell_debug ? 'ON' : 'OFF'}\n\n" nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug?\n true\n end", "def debug?\n true\n end", "def debug_on(debug=true)\n ap \"Debugging is ON\"\n @debug = debug\n end", "def debug?\n false\n end", "def debugging?\n Options[:debug]\n end", "def debug?\n !!@debug\n end", "def debug?\n self[:d...
[ "0.82126373", "0.82126373", "0.812736", "0.8045684", "0.80291826", "0.79650563", "0.7947702", "0.7944235", "0.7939422", "0.792468", "0.7893369", "0.7868979", "0.7812287", "0.7804585", "0.7800024", "0.77902657", "0.771115", "0.7667466", "0.7664416", "0.76447296", "0.76447296",...
0.81820065
2
TODO it 'Employee need to login to visit supplier page' do
def supplier_attrs phone_type = FactoryGirl.create :phone_type { organization_id: @employee.organization_id, supplier: FactoryGirl.attributes_for(:supplier, name: 'Test Abc') .merge({'addresses_attributes' => {'0' => FactoryGirl.attributes_for(:address, is_primary: true), '1' => FactoryGirl.attributes_for(:address, is_primary: false)}}) .merge({'phones_attributes' => {'0' => FactoryGirl.attributes_for(:phone, is_primary: true, phone_type_id: phone_type.id), '1' => FactoryGirl.attributes_for(:phone, is_primary: false, phone_type_id: phone_type.id) }}) .merge({'contacts_attributes' => {'0' => FactoryGirl.attributes_for(:contact, is_primary: true), '1' => FactoryGirl.attributes_for(:contact, is_primary: false)}}) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n # supplier = Supplier.find_by :name =>\n # params[:name]\n @supplier = Supplier.find_by :email => params[:email]\n if @supplier.present? && @supplier.authenticate(params[:password])\n session[:supplier_id] = @supplier.id\n render :action => 'index.json'\n # redirect_to root_...
[ "0.6632423", "0.6550143", "0.6488614", "0.6418471", "0.639867", "0.6398366", "0.6381315", "0.6364478", "0.6362796", "0.6346718", "0.63345975", "0.63100624", "0.63077956", "0.6236504", "0.6210347", "0.6204072", "0.6204072", "0.6204072", "0.61961454", "0.61869633", "0.61864126"...
0.0
-1
Object :source_link Link link between source and target
def initialize(owner, name) @owner, @name, @source_link = owner, name.to_s, nil reset_value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _link # :nodoc:\n #that=self\n l=Mark.new().\n mark_extend(@node).\n data(lambda {|d| [d.source_node, d.target_node] }).\n fill_style(nil).\n line_width(lambda {|d,_p| _p.link_value * 1.5 }).\n stroke_style(\"rgba(0,0,0,.2)\")\n l\n end", "def link...
[ "0.7172718", "0.70488435", "0.7004372", "0.6687922", "0.6650446", "0.64533055", "0.64459884", "0.6442934", "0.6436069", "0.6425707", "0.63875926", "0.6365366", "0.6346967", "0.6344824", "0.63323754", "0.6253767", "0.6220664", "0.6207665", "0.6202209", "0.61936206", "0.6177848...
0.0
-1
After unbinding the source the value can be reset, or kept. The default is to reset the target's (self) value.
def remove_source(reset = true) return unless @source_link src, @source_link = @source_link, nil src.unbind reset_value if reset src.binding_source end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n @source.each_value(&:reset)\n nil\n end", "def reset\n @value = nil\n end", "def reset_change!\n @_changed = false\n self\n end", "def internal_reset(initial_value); end", "def m_clear\n a = source \"a\"\n a.clear\n sink a\nend", "def reset_obser...
[ "0.6716273", "0.6616443", "0.6249946", "0.62473464", "0.61636245", "0.6107335", "0.6066144", "0.6055263", "0.6054127", "0.6020813", "0.595989", "0.595989", "0.58536696", "0.5828215", "0.58160824", "0.5810968", "0.5810968", "0.5803173", "0.5803173", "0.5768993", "0.57497364", ...
0.6499401
2
number of appeals ClaimReviewAsyncStatsReporter established within 7 days (count + %), plus total,cancelled,processed
def run appeals_this_period = count_appeals_this_period async_stats = ClaimReviewAsyncStatsReporter.new(start_date: start_date, end_date: end_date) certification_metric = Metrics::CertificationUsage.new(Metrics::DateRange.new(start_date, end_date)) send_report(appeals: appeals_this_period, async_stats: async_stats, certification_metric: certification_metric) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summate_activity_counts\n activity_count = 0\n all_user_projects_subscriptions.find_each do |subscription|\n next if subscription.empty_summary?\n if count = subscription.summary.values.first[:count].to_i\n activity_count += count\n end\n end\n activity_count\n end", "def a...
[ "0.6553856", "0.6552795", "0.64260584", "0.6407644", "0.6370114", "0.6277535", "0.6213574", "0.61942023", "0.61942023", "0.6183292", "0.6158177", "0.6081236", "0.6081073", "0.60461265", "0.60155684", "0.60077083", "0.5994214", "0.59864664", "0.59864664", "0.59852785", "0.5964...
0.61094403
11
Override this in the subclasses that provide additional metrics.
def additional_metrics [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metrics\n @metrics ||= parent_klass.metrics.dup\n end", "def cpu_metrics\n super\n end", "def custom_metrics\n @custom_metrics ||= {}\n end", "def collect_metrics(*)\n raise NotImplementedError, 'Must implement collect_metrics'\n end", "def setup_metrics\n end...
[ "0.77207696", "0.7709614", "0.74785024", "0.7438503", "0.7288709", "0.7288709", "0.7288709", "0.7040408", "0.70399463", "0.70215666", "0.70215666", "0.70215666", "0.70215666", "0.70215666", "0.70215666", "0.70215666", "0.70215666", "0.70215666", "0.70215666", "0.70215666", "0...
0.7249552
7
Give protocol name for this class
def protocol_name 'SMB::Blocks' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def protocol_name\n self.class.protocol_name\n end", "def protocol_name\n self.class.to_s\n end", "def protocol_name\n PROTOCOLS[protocol.to_s]\n end", "def protocol; end", "def protocol; end", "def protocol; end", "def protocol; end", "def method_name\n return @method_...
[ "0.80247045", "0.79989266", "0.72159964", "0.7043649", "0.7043649", "0.7043649", "0.7043649", "0.6793753", "0.66835433", "0.6679379", "0.65549195", "0.63206524", "0.6294309", "0.6271764", "0.62333184", "0.6210549", "0.61958146", "0.61958146", "0.6156332", "0.6121943", "0.6121...
0.0
-1
Usage: git alias The second parameter is optional, if so, it will show the current value of the alias.
def git_alias(args) # check if the alias exists right now system("git config --global alias.#{args[0]} #{args[1]}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def git_alias(name,action)\n system 'git', 'config', '--global', '--replace-all', \"alias.#{name}\", action\n end", "def aliases\n\t\t\twith_dir do\n\t\t\t\t%x/git config --get-regexp 'alias.*'/.each_line.map do |l|\n\t\t\t\t\tputs l.sub(/^alias\\./,\"\").sub(/ /,\" = \")\n\t\t\t\tend\n\t\t\tend\n\t\tend...
[ "0.78487843", "0.66856784", "0.65222716", "0.6034868", "0.59449106", "0.5941758", "0.59098595", "0.5900271", "0.5846719", "0.57826656", "0.5763688", "0.57502395", "0.5745002", "0.571841", "0.56848145", "0.56157255", "0.5571074", "0.55693054", "0.5543564", "0.5538096", "0.5512...
0.8415596
0
before_action :authenticate_user! Rails image_url helper requires to setup host to generate the absolute url needed to load images from the external world (Facebook, Twitter, ...)
def default_url_options { host: ENV["HOST"] || "localhost:3000" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_url\n ActionController::Base.helpers.image_path('user.png')\n end", "def logo_url\n if user_signed_in?\n current_user\n elsif admin_signed_in?\n current_admin_user\n else\n root_url\n end\n end", "def user_img_URL\n self.user.image_url\n end", "def image_url\n ...
[ "0.6856503", "0.6596456", "0.65430766", "0.65305066", "0.64984775", "0.64625835", "0.6437273", "0.6402746", "0.6319955", "0.6289878", "0.6278521", "0.6190018", "0.61811256", "0.6170953", "0.61488456", "0.6125756", "0.61238515", "0.61193967", "0.61163116", "0.6116228", "0.6115...
0.0
-1
Check whether the request made to the API call is valid. Raises an error if the response code is 500
def valid_request? # 400 - Error with input # 403 - Key related error # 500 -Unknown error # Check http://www.mapquestapi.com/geocoding/status_codes.html for more details @valid = case status[:code] when 500 raise InvalidRequest when 400, 403 false else true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_request\n if @req.code.to_i.between?(400, 499)\n raise Exceptions::SlicingDiceHTTPError, \"Client Error \"\\\n \"#{@req.code} (#{@req.message}).\"\n elsif @req.code.to_i.between?(500, 600)\n raise Exceptions::SlicingDiceHTTPError, \"Server Error \"\\\n \"#{@req.c...
[ "0.74857956", "0.74276817", "0.74186575", "0.7180426", "0.714546", "0.70981413", "0.70233935", "0.70077634", "0.70068353", "0.6943511", "0.6911704", "0.6911704", "0.6911704", "0.6875084", "0.6865005", "0.6826477", "0.6757708", "0.67451006", "0.67451006", "0.67451006", "0.6721...
0.7272601
3
Returns information about the response. :code is an integer return value. See :messages subfield is an array of error messages which describe the status.
def status return :code => info[:statuscode].to_i, :messages => info[:messages] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_code\n response_value(:code)\n end", "def code\n @response.code\n end", "def response_code_message(response_code)\n case response_code\n when 1\n \"Success\"\n when 2\n \"Error\"\n when 3\n \"Server Too Busy\"\n when 4\n \"Protocol...
[ "0.7427587", "0.7386521", "0.7339554", "0.7272692", "0.7203265", "0.71380115", "0.71380115", "0.71380115", "0.71380115", "0.71356744", "0.71356744", "0.7121814", "0.71010655", "0.7060349", "0.70587444", "0.7052067", "0.7047583", "0.6975951", "0.69748366", "0.692607", "0.68583...
0.7208075
4
GET /animalcontrols GET /animalcontrols.json
def index @animalcontrols = Animalcontrol.all.paginate(:per_page =>15, :page => params[:page]).where("address ILIKE ?","%#{params[:address_search]}%").where("name ILIKE ?","%#{params[:name_search]}%").where("callback ILIKE ?","%#{params[:phone_search]}%").where("unitassigned ILIKE ?","%#{params[:unit_search]}%") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getControls\n controls = {}\n response = self.class.get(\"/rest/items\",:basic_auth => @auth)\n JSON.parse(response.body).each do |r|\n if r[\"category\"] == \"Controls\" || r[\"category\"] == \"Lamps\"\n controls[r[\"id\"]] = r[\"name\"]\n end\n end\n re...
[ "0.6556058", "0.636461", "0.61455053", "0.61082315", "0.5941021", "0.58936304", "0.5858589", "0.5834129", "0.58246624", "0.5819633", "0.5817017", "0.5741239", "0.573169", "0.56973547", "0.5689494", "0.5661258", "0.5653655", "0.56250393", "0.56229377", "0.56014323", "0.5591403...
0.0
-1
GET /animalcontrols/1 GET /animalcontrols/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_animalcontrol\n @animalcontrol = Animalcontrol.find(params[:id])\n end", "def show\n @cvi = Cvi.find(params[:id])\n @animals = @cvi.animals\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cvi }\n end\n end", "def getControls\n c...
[ "0.6581004", "0.62646437", "0.61185396", "0.60728", "0.60690963", "0.60163546", "0.59759474", "0.59373647", "0.5847238", "0.5826706", "0.5821832", "0.58089924", "0.57897115", "0.5785543", "0.5782728", "0.5759062", "0.5734136", "0.5723997", "0.56993574", "0.5692243", "0.568436...
0.0
-1
POST /animalcontrols POST /animalcontrols.json
def create @animalcontrol = Animalcontrol.new(animalcontrol_params) respond_to do |format| if @animalcontrol.save format.html { redirect_to @animalcontrol, notice: 'Animal Control Call-Out was successfully created.' } format.json { render :show, status: :created, location: @animalcontrol } else format.html { render :new } format.json { render json: @animalcontrol.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_animalcontrol\n @animalcontrol = Animalcontrol.find(params[:id])\n end", "def animalcontrol_params\n params.require(:animalcontrol).permit(:address, :name, :callback, :unitassigned, :problem, :comment)\n end", "def create\n @adotando_animal = AdotandoAnimal.new(params[:adotando_anima...
[ "0.63756686", "0.6221957", "0.57594293", "0.5747882", "0.5731585", "0.5700276", "0.5699038", "0.56507075", "0.56490535", "0.56368953", "0.5573037", "0.5549986", "0.55350286", "0.551721", "0.5497559", "0.5481593", "0.5481144", "0.54607636", "0.5445256", "0.5441208", "0.5437344...
0.69665813
0
PATCH/PUT /animalcontrols/1 PATCH/PUT /animalcontrols/1.json
def update respond_to do |format| if @animalcontrol.update(animalcontrol_params) format.html { redirect_to @animalcontrol, notice: 'Animal Control Call-Out was successfully updated.' } format.json { render :show, status: :ok, location: @animalcontrol } else format.html { render :edit } format.json { render json: @animalcontrol.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end", "def update\n animal = Ani...
[ "0.63176674", "0.6111031", "0.605045", "0.60483855", "0.6027697", "0.6010622", "0.5949315", "0.59429234", "0.59429234", "0.5921245", "0.5908152", "0.5879107", "0.58735347", "0.5870569", "0.5870569", "0.5829867", "0.5817469", "0.58036274", "0.5711903", "0.57088935", "0.5676198...
0.66352135
0
DELETE /animalcontrols/1 DELETE /animalcontrols/1.json
def destroy @animalcontrol.destroy respond_to do |format| format.html { redirect_to animalcontrols_url, notice: 'Animal Control Call-Out was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end", "def destroy\n @adocao_animal = AdocaoAnimal.find(params[:id])\n @adocao_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adocao_animals_url }\n format.json { head :no_content }\n...
[ "0.7078735", "0.70098305", "0.6943995", "0.6936795", "0.6925268", "0.68725455", "0.6822406", "0.6812868", "0.6735869", "0.67289764", "0.66958636", "0.66896856", "0.6671468", "0.6654652", "0.6633417", "0.6613773", "0.657441", "0.657441", "0.65690225", "0.65690225", "0.6568411"...
0.7201724
0
Use callbacks to share common setup or constraints between actions.
def set_animalcontrol @animalcontrol = Animalcontrol.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
Never trust parameters from the scary internet, only allow the white list through.
def animalcontrol_params params.require(:animalcontrol).permit(:address, :name, :callback, :unitassigned, :problem, :comment) 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.6980384", "0.6782743", "0.6746196", "0.6742575", "0.6736", "0.6594004", "0.65037984", "0.6496699", "0.64819324", "0.64791185", "0.6456292", "0.64403296", "0.63795286", "0.6375975", "0.6365291", "0.63210756", "0.6300542", "0.6299717", "0.62943304", "0.6292561", "0.6290683",...
0.0
-1
Reset the configuration settings
def reset @@config_instance = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_config\n config.reset_to_defaults\n end", "def reset_config\n\t\t\t@config = {}\n\t\tend", "def reset\n @config = empty_config\n end", "def reset\n @config = nil\n end", "def reset\n @config = Config.new\n end", "def reset_configuration\n @configuration = nil\n ...
[ "0.86073565", "0.84943277", "0.84462464", "0.8248292", "0.8238612", "0.82028466", "0.8197753", "0.8167996", "0.8163731", "0.8154217", "0.81309843", "0.81278926", "0.8086907", "0.79412115", "0.79251504", "0.7911866", "0.7911866", "0.7816713", "0.7629745", "0.7601162", "0.75837...
0.78899163
17
Create a new Config instance
def initialize @options = {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_config\n self.config = {} if !self.config\n end", "def create_config\n self.config = {} if !self.config\n end", "def new\n @config_value = ConfigValue.new\n end", "def config\n @config ||= Config.create ConfigLoader.new(root, CONFIG_FILE).to_hash, options.merge_config\n end...
[ "0.7425654", "0.7425654", "0.7048966", "0.70397705", "0.68793255", "0.6851928", "0.67711884", "0.6694753", "0.6663583", "0.6663583", "0.6648015", "0.66150254", "0.65808946", "0.6552033", "0.6499801", "0.6471179", "0.64452463", "0.64413464", "0.6425567", "0.64208513", "0.64157...
0.0
-1
Load a Config instance
def load(args = nil) @options[:config_file] = ENV['UBSAFE_CONFIG_FILE'] unless ENV['UBSAFE_CONFIG_FILE'].nil? #puts "UBConfig.load After env check @options #{@options.inspect}" @options.merge!(parse_args(args)) #puts "UBConfig.load After merge @options #{@options.inspect}" if @options[:config_file] @options.merge!(load_config_file(@options[:config_file])) end configure_logging end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_load(config); end", "def load_config\n @configuration = Configuration.find :first\n end", "def load_config\n if ::File.file?(CONFIG_PATH)\n config = ::OpenStruct.new\n config.reflected_validations = @@reflected_validations\n silence_warnings do\n eval(::IO.read...
[ "0.78320205", "0.75885504", "0.7508643", "0.7422764", "0.7359215", "0.73114765", "0.7278264", "0.727519", "0.7254802", "0.7232049", "0.72265995", "0.7216135", "0.72140723", "0.7211009", "0.719429", "0.7158115", "0.7134655", "0.71242386", "0.71021914", "0.7089531", "0.7085734"...
0.0
-1
Get the full set of configuration options for the specified backup
def full_options(backup_name) backup_options = {} # Get backup defaults backup_options.merge!(@options[:backup_defaults].dup_contents_1_level) # Get the specific backup definition unless @options[:backups].has_key?(backup_name.to_sym) @logger.fatal("The backup name specified '#{backup_name}' has no configuration defined in #{@options[:config_file]}") raise Exception.new("Non-existent backup specified '#{backup_name}'") end backup_options.merge!(@options[:backups][backup_name.to_sym].dup_contents_1_level) return nil unless backup_options[:enabled] backup_options[:backup_name] = backup_name.to_s unless backup_options[:backup_name] # Expand the backup host reference selected_host = backup_options[:backup_host] backup_options.merge!(@options[:backup_hosts][selected_host].dup_contents_1_level) # Expand the backup type reference selected_backup_type = backup_options[:backup_type] backup_options.merge!(@options[:backup_types][selected_backup_type].dup_contents_1_level) return backup_options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backup_configuration\n settings[\"backup_configuration\"]\n end", "def get_backup_config(opts = {})\n data, _status_code, _headers = get_backup_config_with_http_info(opts)\n return data\n end", "def all_options\n Config::Options.all\n end", "def get_backup_config_with_htt...
[ "0.6871624", "0.67159015", "0.6055941", "0.6008119", "0.59407794", "0.591406", "0.5899428", "0.58764654", "0.57891995", "0.57613283", "0.56316054", "0.55814433", "0.55628467", "0.55529535", "0.55327094", "0.55311596", "0.55297494", "0.55154544", "0.55077904", "0.55060583", "0...
0.75578475
0
def current_player_lives current_player.lives end
def success_message puts "Correct!".green end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_lives(player)\n player == 1 ? @player_1_lives : @player_2_lives\nend", "def show_lives\n puts \"Lives remaining: #{@players[0].name}: #{@players[0].life}/3 - #{@players[1].name}: #{@players[1].life}/3\"\n end", "def show_lives(lives)\n puts \"#{lives} Lives left\"\n end", "def player_live...
[ "0.7545884", "0.7437891", "0.72662926", "0.7192068", "0.69195426", "0.67830175", "0.6757567", "0.67477065", "0.67462265", "0.66757804", "0.66724586", "0.66680974", "0.6569438", "0.65597665", "0.6553944", "0.65300196", "0.65276724", "0.64887786", "0.6462895", "0.64182526", "0....
0.0
-1
Create a deep copy of a hash This is useful for copying a hash that will be mutated
def deep_copy_hash hash require_that(hash.is_a?(Hash), "deep_copy_hash requires a hash be specified, got #{hash.class}") Marshal.load Marshal.dump(hash) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deep_copy(hash)\n Marshal.load(Marshal.dump(hash))\n end", "def deep_copy\n copy = dup\n copy.values = {}\n @values.each { |k, v| copy.values[k] = v.clone }\n copy\n end", "def copy &alter\n Rumor.new(hash).tap &alter\n end", "def initialize_clon...
[ "0.8200839", "0.747171", "0.73471075", "0.73406154", "0.7339316", "0.7339316", "0.7270076", "0.7235719", "0.7235692", "0.72133195", "0.7176458", "0.716959", "0.70139116", "0.701154", "0.69308716", "0.6858759", "0.6856367", "0.68277925", "0.67780924", "0.6746879", "0.6659827",...
0.8403944
0
Require that a guard condition passes Simply checks that the guard is truthy, and throws an error otherwise
def require_that guard, message, return_guard = false if not guard then raise ExpectationFailedError.new(message) end if return_guard == true then guard elsif return_guard != false then return_guard end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert cond\n fail! unless cond\n end", "def guard; end", "def assert(cond)\n failure unless cond\n end", "def deny(condition, msg=\"\")\n assert !condition, msg\n end", "def deny(condition)\n # a simple transformation to increase readability IMO\n assert !condition\n end", "de...
[ "0.7233741", "0.6811358", "0.6462656", "0.63291764", "0.6272759", "0.6272759", "0.6272533", "0.6163501", "0.61149216", "0.6078253", "0.6055291", "0.6043552", "0.60076654", "0.60076654", "0.60076654", "0.5986781", "0.5926237", "0.59229416", "0.5859819", "0.58287674", "0.582183...
0.7565209
0
Given a hash, convert all keys to strings
def stringify_hash hash, options = {} (raise ExpectationFailedError.new("stringify_hash called without a hash")) unless hash.is_a?(Hash) hash.inject({}) do |result, (k,v)| key = options[:downcase] ? k.to_s.downcase : k.to_s if v.is_a?(Hash) then result[key] = stringify_hash(v) elsif v.is_a?(Regexp) && options[:rewrite_regex] then result[key] = v.inspect[1..-2] else result[key] = v end result end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringify_keys!(hash)\n transform_keys!(hash){ |key| key.to_s }\n end", "def stringify_hash_keys(hash); end", "def key2str(hash)\n return hash unless hash.is_a? Hash\n hash.each_value.select { |h| h.is_a? Hash }.each do |subh|\n sv = {}\n subh.each { |k, v| sv[k.to_s] = ...
[ "0.84265304", "0.8346799", "0.82667536", "0.8126027", "0.8119735", "0.80757165", "0.7916707", "0.7776567", "0.7755829", "0.7669759", "0.7669759", "0.7669759", "0.7669759", "0.76611507", "0.7580043", "0.75631803", "0.7562723", "0.7562723", "0.7562723", "0.75555116", "0.755153"...
0.6355506
82
Never trust parameters from the scary internet, only allow the following list through.
def rating_params params.require(:rating).permit(:rating, :task_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_allowlist=(_arg0); end", "def url_allowlist; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :...
[ "0.7361518", "0.7340487", "0.7001328", "0.68377465", "0.68079937", "0.677716", "0.6646763", "0.6632506", "0.65495855", "0.6519738", "0.6519738", "0.6519738", "0.6519738", "0.6519738", "0.6519738", "0.6519738", "0.6519738", "0.6519738", "0.6519738", "0.6519738", "0.64730406", ...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_event @event = Event.find(params[:event_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
Never trust parameters from the scary internet, only allow the white list through.
def agenda_item_params params.require(:agenda_item).permit(:name, :event_id) 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
q = "The exception object passed to raise" a = "$!"
def continue? print "Enter any key to continue or 'x' to exit: " response = gets.chomp().downcase if response == 'x' return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raise(exception); end", "def throw _args\n \"throw _args;\" \n end", "def raise(exception_klass = T.unsafe(nil)); end", "def raise(*rest) end", "def raise(*rest) end", "def foo\n return raise\n#> xxxxxx\n end", "def exception\n raise \"It's a bad one!\"\n end", "def raise_e...
[ "0.7040508", "0.69944483", "0.67944354", "0.67427915", "0.67427915", "0.67416877", "0.66127324", "0.6548758", "0.653782", "0.65268755", "0.64640105", "0.64640105", "0.64640105", "0.64640105", "0.64640105", "0.6454771", "0.6414772", "0.6413546", "0.6379602", "0.63581204", "0.6...
0.0
-1
GET /clients/1 GET /clients/1.json
def show @pessoa = Pessoa.find(params[:id]) respond_to do |format| # format.html # show.html.erb format.json { render json: @pessoa } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @clients = current_user.clients\n render json: @clients\n end", "def show\n client = Client.retrieve_by_id(params[:id])\n\n render json: client, serializer: SingleClientSerializer\n end", "def index\n @clients = Client.all\n render json: @clients\n end", "def inde...
[ "0.7714569", "0.7692897", "0.7610902", "0.7599894", "0.7557071", "0.7554301", "0.75299674", "0.75299674", "0.75299674", "0.75299674", "0.75299674", "0.75299674", "0.75299674", "0.75143087", "0.747129", "0.73328424", "0.7307047", "0.7303964", "0.73004144", "0.72511", "0.720374...
0.0
-1
GET /pessoas/new GET /pessoas/new.json
def new puts 'NEW METHOD' @pessoa = Pessoa.new @pessoa.enderecos.build 2.times { @pessoa.telefones.build } respond_to do |format| format.html # new.html.erb format.json { render json: @pessoa } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @peso = Peso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @peso }\n end\n end", "def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end", "def ...
[ "0.7907233", "0.7842003", "0.7615102", "0.7615102", "0.7613786", "0.759081", "0.7580052", "0.75653297", "0.7562309", "0.75578606", "0.7555149", "0.7544436", "0.7539151", "0.7507897", "0.7504545", "0.7490896", "0.747814", "0.7456194", "0.7453076", "0.74522394", "0.744491", "...
0.76610804
2
POST /clients POST /clients.json
def create puts 'AQQQQQUUUUUUUIIIIII' json = ActiveSupport::JSON.decode(params[:pessoa]) puts json @pessoa = Pessoa.new(json) # @address = Address.new(params[:address]) # @client.addresses = @address respond_to do |format| if @pessoa.save format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' } format.json { render json: @pessoa, status: :created, location: @pessoa } else format.html { render action: "new" } format.json { render json: @pessoa.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to clients_url, notice: 'El cliente se creó correctamente' }\n format.json { render :index, status: :created, location: @client }\n else\n format.html { render...
[ "0.72085994", "0.71753484", "0.7120956", "0.7116921", "0.710099", "0.6981326", "0.6981326", "0.6981326", "0.6979284", "0.6971666", "0.6971666", "0.6971666", "0.6970004", "0.69603", "0.6956069", "0.69386387", "0.69206727", "0.691133", "0.689539", "0.6878896", "0.6864519", "0...
0.0
-1
PUT /clients/1 PUT /clients/1.json
def update @client = Client.find(params[:id]) respond_to do |format| if @client.update_attributes(params[:client]) format.html { redirect_to @client, notice: 'Client was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @client.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @client.update(client_params)\n render json: @client\n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to clients_path, notice: 'Client was successfully updated.' }\n ...
[ "0.74382377", "0.6906038", "0.6906038", "0.688342", "0.6853038", "0.6845028", "0.6813453", "0.67778057", "0.6769948", "0.6766596", "0.676636", "0.67412317", "0.6728952", "0.6726424", "0.67103064", "0.6692573", "0.6692084", "0.66644424", "0.6654053", "0.66500646", "0.66369826"...
0.68509334
6
DELETE /clients/1 DELETE /clients/1.json
def destroy @client = Client.find(params[:id]) @client.destroy respond_to do |format| format.html { redirect_to clients_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n fo...
[ "0.7798913", "0.7798913", "0.7783736", "0.77692276", "0.7714563", "0.76365036", "0.7623739", "0.75873184", "0.7583132", "0.7539502", "0.7536981", "0.7536981", "0.7536981", "0.7536981", "0.7536981", "0.7536981", "0.7536981", "0.7533958", "0.7527346", "0.75249654", "0.7523737",...
0.77730614
10
`t` is relative to the beginning of the production
def alive_at?(t) t.between?(t1, t2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tpr(i)\n [ @tp[i].quo(@tp[i] + @n[i] - @tn[i]), 1 ].min\n end", "def t\n end", "def tdist(n, t); p_t(n, t); end", "def t\n return @L if a < 0\n round ((t1 / @P) +@L)\n end", "def tt; end", "def tld; end", "def tld; end", "def q(t)\n \n end", "def evaluate(...
[ "0.60234684", "0.59898734", "0.59122366", "0.5752115", "0.5722987", "0.571017", "0.571017", "0.56276375", "0.56019264", "0.5555247", "0.5474507", "0.538331", "0.5365684", "0.53624415", "0.53434587", "0.53382766", "0.5323178", "0.5314425", "0.5291562", "0.5264904", "0.52391285...
0.0
-1
Return start time for this element, relative to the beginning of the production.
def t1 _absolute(enter) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_time\n return @start_time\n end", "def start_time\n @start_time\n end", "def get_start_time()\n return process_stamp(@start_time)\n end", "def start_time\n @internal_data.start_time\n end", "def start_time\n @parts.first...
[ "0.82547283", "0.8158939", "0.81584513", "0.80315775", "0.80276", "0.7977008", "0.78999317", "0.78999317", "0.78714585", "0.7850189", "0.7850189", "0.7690866", "0.764593", "0.764593", "0.764593", "0.764593", "0.764593", "0.764593", "0.764593", "0.764593", "0.764593", "0.764...
0.0
-1
Return exit time for this element, relative to the beginning of the production.
def t2 _absolute(exit) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duration\n TingYun::Helper.time_to_millis(@exit_timestamp - @entry_timestamp)\n end", "def end_time\n if ev = stop_event.last\n ev.time\n end\n end", "def end_time\n if ev = stop_event.last\n ev.time\n end\n ...
[ "0.69723284", "0.6793387", "0.6793387", "0.6746913", "0.6685164", "0.65341544", "0.6291045", "0.6286001", "0.6230943", "0.6192343", "0.6181741", "0.6153685", "0.611721", "0.60857975", "0.6075967", "0.60359967", "0.6027863", "0.60192806", "0.59939355", "0.5980202", "0.59691286...
0.0
-1
Specify or return the start time for this element, relative to the beginning of the scene.
def enter(t = nil) if t @enter = _convert(t) self else @enter end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_time\n @start_time\n end", "def set_start_time\n @start_time = Time.now.to_f\n end", "def set_start_time\n @start_time = Time.now.to_f\n end", "def start_time\n start\n end", "def start_time\n return @start_time\n end", "def start_...
[ "0.7678431", "0.7618756", "0.7618756", "0.7617907", "0.7583595", "0.7571923", "0.7247722", "0.7247722", "0.7228195", "0.7221751", "0.721993", "0.71760607", "0.71760607", "0.7136239", "0.7062417", "0.7035593", "0.7033041", "0.7028682", "0.70214206", "0.698388", "0.69774", "0...
0.0
-1
Specify or return the exit time for this element, relative to the beginning of the scene.
def exit(t = nil) if t @exit = _convert(t) self else @exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duration\n TingYun::Helper.time_to_millis(@exit_timestamp - @entry_timestamp)\n end", "def end_time\n if ev = stop_event.last\n ev.time\n end\n end", "def end_time\n if ev = stop_event.last\n ev.time\n end\n ...
[ "0.6462086", "0.6356982", "0.6356982", "0.6264477", "0.5941877", "0.59163207", "0.5897695", "0.589158", "0.5877107", "0.5817365", "0.5790553", "0.57628226", "0.56954104", "0.56803817", "0.56780267", "0.5667649", "0.5636055", "0.5610557", "0.55989003", "0.5591684", "0.5586325"...
0.0
-1
`t` is the global time value, relative to the beginning of the production.
def render_at(t, canvas) _evaluate_attributes!(t) alpha = attributes[:alpha] || 1.0 size = attributes[:size] || production.resolution position = attributes[:position] || Castaway::Point.new(0, 0) return if alpha <= 0.0 || size.empty? canvas.stack do |stack| _prepare_canvas(t, stack) stack.geometry size.to_geometry _transform(stack) stack.geometry position.to_geometry unless position.zero? end _composite(canvas, alpha) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cold_start_time\n Time.now\nend", "def evaluate(t, vars)\n t # Right now, time vars must simply return t.\n end", "def start_time=(_arg0); end", "def timestamp t\n\n\t\t::Pantheios::Core.timestamp t, nil\n\tend", "def fmt_time(t)\n if t.present?\n ApplicationHelper.localtime(t).strftime(A...
[ "0.6217947", "0.60945517", "0.60709155", "0.6068327", "0.59893614", "0.59629416", "0.5868513", "0.5866598", "0.5837131", "0.5837131", "0.5837131", "0.5837131", "0.5837131", "0.5837131", "0.5837131", "0.5837131", "0.5837131", "0.5825585", "0.5779032", "0.57724434", "0.57608175...
0.0
-1
Problems in exercism evolve over time, as we find better ways to ask questions. The version number refers to the version of the problem you solved, not your solution. Define a constant named VERSION inside of the top level BookKeeping module, which may be placed near the end of your file. In your file, it will look like this: module BookKeeping VERSION = 1 Where the version number matches the one in the test. end If you are curious, read more about constants on RubyDoc:
def test_bookkeeping skip assert_equal 2, BookKeeping::VERSION end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bookkeeping\n assert_equal 3, BookKeeping::VERSION\n end", "def test_bookkeeping\n assert_equal 1, BookKeeping::VERSION\n end", "def test_bookkeeping\n assert_equal 1, BookKeeping::VERSION\n end", "def test_version\n skip\n assert_equal 2, BookKeeping::VERSION\n end", "def test_...
[ "0.79813254", "0.79248947", "0.79248947", "0.7861686", "0.7822919", "0.7822919", "0.77796483", "0.7732682", "0.7732682", "0.7732682", "0.7732682", "0.7732682", "0.7732682", "0.7732682", "0.7611245", "0.65245193", "0.63514304", "0.6241997", "0.6071279", "0.6035757", "0.5898936...
0.775525
12
Now I Know my ABCs
def block_word?(string) hash = { 'B' => 'O', 'G' => 'T', 'V' => 'I', 'X' => 'K', 'R' => 'E', 'L' => 'Y', 'D' => 'Q', 'F' => 'S', 'Z' => 'M', 'C' => 'P', 'J' => 'W', 'N' => 'A', 'H' => 'U'} banned_letters = [] bool = true letters = string.upcase.chars letters.each do |letter| if hash.has_key?(letter) banned_letters << hash[letter] elsif hash.has_value?(letter) banned_letters << hash.key(letter) end end banned_letters.each do |letter| if letters.include?(letter) bool = false break else next end end bool end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def who_we_are\r\n end", "def anatomy; end", "def lookups; end", "def getKnowledge\n\t\t\n\tend", "def info; end", "def info; end", "def known_identities; end", "def getAdvocacy\n\t\t\n\tend", "def scientist; end", "def info()\n #This is a stub, used for indexing\n end", "def...
[ "0.60811454", "0.59465194", "0.59139854", "0.58393383", "0.58142215", "0.58142215", "0.5680013", "0.5658929", "0.56078935", "0.5603612", "0.55929106", "0.55883366", "0.55831116", "0.55687404", "0.5559011", "0.5552435", "0.55514306", "0.5546846", "0.5546846", "0.5546846", "0.5...
0.0
-1
Next Featured Number Higher than a Given Value
def featured(number) featured = 0 loop do number += 1 if number % 7 == 0 && number.odd? && number.to_s.length == number.to_s.chars.uniq.length featured = number break end if number.to_s.length > 10 puts "Invalid" featured = 0 break end end featured end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def higher(n)\n self > n ? self : n\n end", "def pick_value(random_number, prev_value)\n\tnext_value = @frequencies[prev_value]\n\tif next_value.nil? then\n\t\tnext_value = @frequencies[nil]\n\tend\n\n succ_list = next_value.sort_by{|key, value| value}\n freq_counter = 0.0\n \n succ_list...
[ "0.6525721", "0.6194821", "0.6079245", "0.6041829", "0.60179055", "0.5999514", "0.5983866", "0.5968499", "0.59534675", "0.5947692", "0.5895796", "0.5893031", "0.5873366", "0.5857065", "0.58431315", "0.580838", "0.5807935", "0.5806526", "0.5779731", "0.5768964", "0.5734192", ...
0.0
-1
Sum Square Square Sum
def sum_square_difference(number) squared_sum = 1.upto(number).inject(:+)**2 sum_squares = 0 1.upto(number).each {|num| sum_squares += num**2} squared_sum - sum_squares end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_squares\n\t\t\tinject(0) do |sum, elem|\n\t\t\t\tsum + (elem ** 2)\n\t\t\tend\n\t\tend", "def square_sum\n self.inject(0.0){|accum, i| accum +i**2 }\n end", "def sum_of_squares\n self.inject(0) { |sos, n| sos + n**2 }\n end", "def square_of_sum\n\t\t@n**2*(@n+1)**2/4\n\tend", "def square...
[ "0.8410559", "0.8214191", "0.8073652", "0.8046577", "0.79860216", "0.7918175", "0.7889149", "0.7844171", "0.78209805", "0.7707787", "0.77009046", "0.76886505", "0.7669717", "0.7668815", "0.76598954", "0.75784105", "0.7574576", "0.7514405", "0.74935305", "0.74680746", "0.74210...
0.6714385
85
if no PayPal button was hit, send mail with all details to Amavat contact person
def no_paypal_account_email(order) @order = order mail(to: ENV['NO_PAYPAL_EMAIL_ADDRESS'], subject: 'Kein PayPal Konto für Amavat Bestellung') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment_upcoming\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def setup_email(user, payment)\n mail = Mail.deliver do\n to user.email\n from 'FoodCircles <hey@joinfoodcircles.org>'\n subject \"Got your Voucher for #{payment.offer.venue.name}\"\n reply_to 'used@i...
[ "0.7228104", "0.69622606", "0.6925633", "0.691114", "0.68244267", "0.6745754", "0.67181855", "0.66886914", "0.6684846", "0.6678822", "0.66547906", "0.6645421", "0.6624651", "0.6618962", "0.66142327", "0.6586017", "0.65782166", "0.65730214", "0.65532655", "0.65532655", "0.6553...
0.6705325
7
GET /user_work_skills GET /user_work_skills.json
def index @user_work_experience_role = UserWorkExperienceRole.find_by(id: params[:user_work_experience_role_id]) @user_work_experience = UserWorkExperience.find_by(id: @user_work_experience_role.user_work_experience_id) @skill_inventories = SkillInventory.includes(:user_work_skills,:skill_category).where(:"user_work_skills.user_work_experience_role_id" => @user_work_experience_role.id) render layout: 'home' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_skills\n @user = User.find(params[:id])\n @user_skill = UserSkill.where(\"user_id = @user.id\")\n end", "def index\n if params[:id]\n @skills = Skill.where(id:params[:id])\n elsif params[:user_id]\n @skills = Skill.where(user_id:params[:user_id])\n elsif params[:name]\n ...
[ "0.7509374", "0.71328115", "0.70986575", "0.69688535", "0.6967232", "0.69478595", "0.6845694", "0.68431205", "0.68178016", "0.6808735", "0.6794626", "0.67935795", "0.6763454", "0.673417", "0.66102004", "0.66086113", "0.66054326", "0.6598565", "0.65531975", "0.65531975", "0.65...
0.57295173
91
GET /user_work_skills/1 GET /user_work_skills/1.json
def show render layout: 'home' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_skills\n @user = User.find(params[:id])\n @user_skill = UserSkill.where(\"user_id = @user.id\")\n end", "def index\n if params[:id]\n @skills = Skill.where(id:params[:id])\n elsif params[:user_id]\n @skills = Skill.where(user_id:params[:user_id])\n elsif params[:name]\n ...
[ "0.7304121", "0.714873", "0.6937032", "0.68924606", "0.6878287", "0.6857654", "0.6837119", "0.6822634", "0.68094826", "0.6794314", "0.6773726", "0.66820616", "0.66520387", "0.664569", "0.664569", "0.66118103", "0.660106", "0.659733", "0.6573303", "0.6570311", "0.6542668", "...
0.0
-1
POST /user_work_skills POST /user_work_skills.json
def create user_work_experience_role_id = params[:user_work_skill][:user_work_experience_role_id] @user_work_experience_role = UserWorkExperienceRole.find_by_id(user_work_experience_role_id) @user_work_skill = @user_work_experience_role.user_work_skills.new(user_work_skill_params) respond_to do |format| puts "ACTION: ATTEMPTING TO SAVE" if @user_work_skill.save puts "SAVED: SAVED SUCCESS" format.html { redirect_to action: "index", :user_work_experience_role_id => user_work_experience_role_id} format.json { render :show, status: :created, location: @user_work_skill } else @user_work_skill.errors.full_messages.each do |message| puts "ERROR : #{message}" end format.html { render :new } format.json { render json: @user_work_skill.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n respond_to do |format|\n begin\n if params[\"skills_user\"][\"user_id\"]\n skill_id = params[\"skills_user\"][\"skill_id\"]\n user_ids = params[\"skills_user\"][\"user_id\"].reject{ |c| c.empty? }\n user_ids.each do |user_id|\n SkillsUser.create(ski...
[ "0.731443", "0.73023045", "0.7213907", "0.7183761", "0.71397376", "0.7125107", "0.6841065", "0.68301046", "0.68299854", "0.6799575", "0.67919403", "0.67768073", "0.67762285", "0.67728066", "0.67399436", "0.67308784", "0.66867733", "0.66721106", "0.6668681", "0.66686535", "0.6...
0.69891775
6
PATCH/PUT /user_work_skills/1 PATCH/PUT /user_work_skills/1.json
def update respond_to do |format| if @user_work_skill.update(user_work_skill_params) format.html { redirect_to action:"index",:user_work_experience_role_id=>@user_work_skill.user_work_experience_role_id } format.json { render :show, status: :ok, location: @user_work_skill } else format.html { render :edit } format.json { render json: @user_work_skill.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @user_skill = UserSkill.find(params[:id])\n\n respond_to do |format|\n if @user_skill.update_attributes(params[:user_skill])\n format.html { redirect_to @user_skill, notice: 'User skill was successfully updated.' }\n format.json { head :no_content }\n else\n format...
[ "0.73432004", "0.7312003", "0.7224675", "0.721832", "0.7188362", "0.71461034", "0.70388323", "0.6989368", "0.69759834", "0.69737285", "0.6963536", "0.6942745", "0.6942745", "0.6894826", "0.6891755", "0.6876254", "0.6868217", "0.6856555", "0.6851883", "0.68247133", "0.67911756...
0.73636067
0
DELETE /user_work_skills/1 DELETE /user_work_skills/1.json
def destroy @user_work_skill.destroy respond_to do |format| format.html { redirect_to action:"index", :user_work_experience_role_id=> @user_work_skill.user_work_experience_role_id } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @user_skill = UserSkill.find(params[:id])\n @user_skill.destroy\n\n respond_to do |format|\n format.html { redirect_to user_skills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.skills.delete_all\n \n @person.destroy\n respond_to do |...
[ "0.7760334", "0.76458406", "0.7583783", "0.74354345", "0.73909444", "0.7380749", "0.73618454", "0.7353754", "0.7329657", "0.72775155", "0.7243548", "0.72377294", "0.719272", "0.71708316", "0.7169053", "0.7113529", "0.7100926", "0.7079245", "0.7077078", "0.7071041", "0.7047798...
0.7621494
2
Use callbacks to share common setup or constraints between actions.
def set_user_work_skill @user_work_skill = UserWorkSkill.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
Never trust parameters from the scary internet, only allow the white list through.
def user_work_skill_params params.require(:user_work_skill).permit(:total_experience, :last_time_used, :last_time_used_duration_years, :refresher, :notes,:user_work_experience_role_id,:skill_inventory_id,:id) 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
if user is logged in, return current_user, else return guest_user
def current_or_guest_user if current_user if session[:guest_user_id] && session[:guest_user_id] != current_user.id logging_in(guest_user_id) guest_user(with_retry = false).try(:destroy) session[:guest_user_id] = nil end current_user else guest_user end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_or_guest_user\n if current_user\n transfer_session_to_logged_in_user if session[:guest_user_id].present?\n current_user\n else\n guest_user\n end\n end", "def current_or_guest_user\n if user_signed_in? then current_user else guest_user end\n end", "def current_or_gu...
[ "0.8973923", "0.8931811", "0.8853329", "0.8695554", "0.865321", "0.85355735", "0.85355735", "0.85148513", "0.8458254", "0.84193385", "0.8403974", "0.8403553", "0.8400531", "0.8400531", "0.839848", "0.837988", "0.83771473", "0.83707076", "0.83662665", "0.8357405", "0.8357405",...
0.84001786
14
find guest_user object associated with the current session, creating one as needed
def guest_user(with_retry = true) # Cache the value the first time it's gotten. @cached_guest_user ||= User.find(session[:guest_user_id] ||= create_guest_user.id) rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid session[:guest_user_id] = nil guest_user if with_retry end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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", "def guest_user\n User.find(session[:guest_user_id].nil? ? session[:guest_user_id] = creat...
[ "0.8472314", "0.845497", "0.8437258", "0.83520234", "0.82588893", "0.8223962", "0.8223962", "0.82176185", "0.8186563", "0.816379", "0.8079325", "0.8057306", "0.80276537", "0.80152476", "0.79473615", "0.79373574", "0.78641075", "0.7785678", "0.7782463", "0.7755364", "0.7704745...
0.76364464
26
creates guest user by adding a record to the DB with a guest name and email
def create_guest_user email = "guest_#{Time.now.to_i}#{rand(99)}@example.com" u = User.create(:email => email) u.save!(:validate => false) session[:guest_user_id] = u.id u end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_guest_user\n user = User.new { |user| user.role = 'guest' }\n user.email = \"guest_#{Time.now.to_i}#{rand(99)}@example.com\"\n user.save(validate: false)\n user\n end", "def create_guest_user\n u = User.new(:name => \"guest\", :email => \"guest_#{Time.now.to_i}#{rand(100)}@ex...
[ "0.830063", "0.82268023", "0.8224379", "0.8064195", "0.80425715", "0.7921024", "0.77377284", "0.76262295", "0.7621246", "0.754229", "0.75343883", "0.7490319", "0.7354039", "0.73403853", "0.72703385", "0.72430253", "0.71995056", "0.7190832", "0.7177955", "0.7111888", "0.708427...
0.8220254
3
GET /products/1 GET /products/1.json
def show @categories = Category.parent_categories @images = @product.product_images end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product(name)\n get(\"/apiproducts/#{name}\")\n end", "def show\n product = Product.find_by_id(params[:id])\n\n render json: product\n end", "def show\n @product = Product.find(params[:id])\n\n render json: @product\n end", "def index\n @api_v1_products = Product.all\n jso...
[ "0.77224106", "0.76329553", "0.76313764", "0.7607208", "0.75760156", "0.7552171", "0.7506385", "0.7484625", "0.745622", "0.74501616", "0.74376804", "0.7421124", "0.7362056", "0.7318765", "0.73185545", "0.73185545", "0.73185545", "0.7316062", "0.7311976", "0.73088664", "0.7294...
0.0
-1
GET /categories/1 GET /categories/1.json
def show_cat @categories = Category.parent_categories if params[:sort] @products = Product.where(category_id: @category.id).order(params[:sort]).page(params[:page]).per(9) else @products = Product.where(category_id: @category.id).order(:title).page(params[:page]).per(9) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def GetCategory id\n\n ...
[ "0.7877691", "0.7865133", "0.78486437", "0.78422695", "0.7414923", "0.74083245", "0.73075056", "0.7306919", "0.7306919", "0.7282217", "0.7235693", "0.7186931", "0.7158298", "0.7133119", "0.7122198", "0.70659566", "0.70442134", "0.7036961", "0.70349413", "0.70324004", "0.70126...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_prod @product = Product.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
Action for only changing user's password
def password end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_password\r\n \r\n end", "def edit_password; end", "def set_change_password(user)\n user.update_column(:must_change_passwd, true)\n session[:pwd] = 1\n end", "def change_password\n return if generate_filled_in\n if do_change_password_for(@user)\n # since some...
[ "0.84440583", "0.8195093", "0.800686", "0.7944755", "0.7904684", "0.7873718", "0.7840397", "0.7805231", "0.7786356", "0.7766612", "0.77570957", "0.77211535", "0.77211535", "0.77173865", "0.7709839", "0.77001524", "0.76962465", "0.7695477", "0.76768774", "0.7671499", "0.765646...
0.0
-1
"A".to_binary() > "010000001" "AA".to_binary() > "010000001010000001"
def to_binary() return self.unpack('B*').join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_binary(input)\n binary = []\n input.each_char do |char|\n result = char.hex.to_s(2).rjust(char.size*4, '0')\n binary << result\n end\n binary.join()\nend", "def fake_bin(s)\n s.tr('1-9', '00001')\nend", "def bin(x)\n x.to_s(16).chars.to_a.map{|d| d.to_i(16).to_s(2).rjust(4, '0')}.join(' ')...
[ "0.7192082", "0.7156558", "0.7130314", "0.7125877", "0.7091967", "0.70899665", "0.70899665", "0.708422", "0.7028592", "0.6983277", "0.6929828", "0.69008875", "0.68876886", "0.6862115", "0.68590826", "0.68250453", "0.67699736", "0.67368907", "0.6736262", "0.6699089", "0.668693...
0.66680175
22
GET /categories GET /categories.json
def index @tasks = Task.all render json: @tasks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter:...
[ "0.83888507", "0.8327856", "0.83211476", "0.78072983", "0.7742051", "0.75669324", "0.75111455", "0.74151826", "0.7386452", "0.7369945", "0.7369187", "0.73691803", "0.73691803", "0.73457074", "0.73304063", "0.7316772", "0.72851175", "0.72663945", "0.72275496", "0.7220998", "0....
0.0
-1
GET /categories/1 GET /categories/1.json
def show render json: @task end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def GetCategory id\n\n ...
[ "0.7877691", "0.7865133", "0.78486437", "0.78422695", "0.7414923", "0.74083245", "0.73075056", "0.7306919", "0.7306919", "0.7282217", "0.7235693", "0.7186931", "0.7158298", "0.7133119", "0.7122198", "0.70659566", "0.70442134", "0.7036961", "0.70349413", "0.70324004", "0.70126...
0.0
-1
POST /categories POST /categories.json
def create @task = Task.new(task_params) if @task.save render json: @task, status: :created else render json: @task.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n json_create(category_params, Category)\n end", "def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATE...
[ "0.7738549", "0.74339235", "0.72349083", "0.71634054", "0.7124031", "0.70645165", "0.705568", "0.695861", "0.6956783", "0.6903891", "0.6838659", "0.6821712", "0.68190134", "0.6807838", "0.678525", "0.66138625", "0.6566919", "0.65661913", "0.65567696", "0.6523676", "0.65186286...
0.0
-1
PATCH/PUT /categories/1 PATCH/PUT /categories/1.json
def update if @task.update(category_params) head :no_content else render json: @task.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n json_update(category,category_params, Category)\n end", "def update_categories(categories, options = {} )\n options.merge!(:docid => self.doci...
[ "0.76931995", "0.7600433", "0.721346", "0.6943123", "0.6914936", "0.6817601", "0.67816055", "0.6713112", "0.66984165", "0.6693479", "0.66566056", "0.66523254", "0.6651486", "0.6645902", "0.66068524", "0.65989816", "0.6571709", "0.6571709", "0.65543723", "0.65349466", "0.65002...
0.0
-1
DELETE /categories/1 DELETE /categories/1.json
def destroy @task.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @category.destroy\n render json: @category, status: :ok\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |f...
[ "0.78272814", "0.77353686", "0.76392984", "0.7488916", "0.74731207", "0.74233276", "0.7399541", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7378597", "0.7378597"...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_task @task = Task.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
Never trust parameters from the scary internet, only allow the white list through.
def task_params params.require(:task).permit(:title, :description, :duration, :priority, :category_id) 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
GET /controlpltkts GET /controlpltkts.json
def index @controlpltkts = Controlpltkt.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_controlpltkt\n @controlpltkt = Controlpltkt.find(params[:id])\n end", "def index\n @controltltkts = Controltltkt.all\n end", "def index\n @controltnytts = Controltnytt.all\n end", "def create\n @controlpltkt = Controlpltkt.new(controlpltkt_params)\n\n respond_to do |format|\n ...
[ "0.67161757", "0.65112853", "0.62452555", "0.61688733", "0.61178905", "0.603198", "0.6029375", "0.5960648", "0.58432084", "0.58032733", "0.58014846", "0.56973445", "0.5612154", "0.55961776", "0.5566658", "0.5547444", "0.5513052", "0.5481493", "0.5434418", "0.53877026", "0.534...
0.7468065
0
GET /controlpltkts/1 GET /controlpltkts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @controlpltkts = Controlpltkt.all\n end", "def set_controlpltkt\n @controlpltkt = Controlpltkt.find(params[:id])\n end", "def index\n @controltltkts = Controltltkt.all\n end", "def index\n @tps = Tps.all\n end", "def index\n @tp_parameters = TpParameter.all\n\n respond...
[ "0.723292", "0.65737957", "0.62344295", "0.6181718", "0.61692655", "0.61501455", "0.6101707", "0.60642964", "0.59439987", "0.58539784", "0.58221895", "0.580051", "0.57625717", "0.5710458", "0.57098657", "0.56659013", "0.5644223", "0.560472", "0.55934644", "0.5578684", "0.5565...
0.0
-1
POST /controlpltkts POST /controlpltkts.json
def create @controlpltkt = Controlpltkt.new(controlpltkt_params) respond_to do |format| if @controlpltkt.save format.html { redirect_to @controlpltkt, notice: 'Controlpltkt was successfully created.' } format.json { render :show, status: :created, location: @controlpltkt } else format.html { render :new } format.json { render json: @controlpltkt.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def controlpltkt_params\n params.require(:controlpltkt).permit(:n1, :n2, :siglas, :limite, :vendida)\n end", "def set_controlpltkt\n @controlpltkt = Controlpltkt.find(params[:id])\n end", "def create\n @tnpsc = Tnpsc.new(tnpsc_params)\n\n respond_to do |format|\n if @tnpsc.save\n ...
[ "0.6564666", "0.64664435", "0.62317586", "0.6172066", "0.6170496", "0.6067384", "0.605376", "0.59029263", "0.5852787", "0.5839412", "0.5767802", "0.5723936", "0.5675327", "0.55736446", "0.54343426", "0.5364062", "0.5357854", "0.53383005", "0.53369534", "0.52882266", "0.528447...
0.72422993
0
PATCH/PUT /controlpltkts/1 PATCH/PUT /controlpltkts/1.json
def update respond_to do |format| if @controlpltkt.update(controlpltkt_params) format.html { redirect_to @controlpltkt, notice: 'Controlpltkt was successfully updated.' } format.json { render :show, status: :ok, location: @controlpltkt } else format.html { render :edit } format.json { render json: @controlpltkt.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @controltltkt.update(controltltkt_params)\n format.html { redirect_to @controltltkt, notice: 'Controltltkt was successfully updated.' }\n format.json { render :show, status: :ok, location: @controltltkt }\n else\n format.html { render :edit...
[ "0.6532852", "0.6509571", "0.6395982", "0.6198386", "0.61478835", "0.613765", "0.6071614", "0.60679764", "0.6034653", "0.59630775", "0.59617704", "0.5924026", "0.58550006", "0.58530194", "0.5848847", "0.5816572", "0.58021027", "0.579757", "0.57883656", "0.5745402", "0.5745032...
0.7192734
0
DELETE /controlpltkts/1 DELETE /controlpltkts/1.json
def destroy @controlpltkt.destroy respond_to do |format| format.html { redirect_to controlpltkts_url, notice: 'Controlpltkt was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @controltltkt.destroy\n respond_to do |format|\n format.html { redirect_to controltltkts_url, notice: 'Controltltkt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circle...
[ "0.6941498", "0.68738836", "0.6850847", "0.672702", "0.6712603", "0.67033225", "0.6682263", "0.667959", "0.666711", "0.6617167", "0.6615948", "0.6608726", "0.6579389", "0.6556748", "0.65337735", "0.6502583", "0.64983404", "0.64923036", "0.64913964", "0.64684", "0.6462727", ...
0.72975755
0
Use callbacks to share common setup or constraints between actions.
def set_controlpltkt @controlpltkt = Controlpltkt.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
Never trust parameters from the scary internet, only allow the white list through.
def controlpltkt_params params.require(:controlpltkt).permit(:n1, :n2, :siglas, :limite, :vendida) 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
Create 'n' number of new Harness (class) with parameters
def new_harnesses puts "++ NEW HARNESSES++ ++++++++++++++++++" number = "" until number.class == Fixnum puts "How many Harnesses would you like to create?" number = gets.chomp.to_i end counter = 1 while number > 0 puts "-------- Harness #{counter} input --------" puts "Input a harness NUMBER: (standard format of one letter and 2 number eg. A99)" harness_number = gets.chomp if $all_harnesses[0..$all_harnesses.length].include?(harness_number.upcase) puts "Sorry, that Harness already exists. Please input a unique ID" else puts "Input a harness TYPE: (single, 2-point, 3-point, jerk, ballet, garden...etc.)" harness_type = gets.chomp puts "Input YEAR #{harness_number} was built:(yyyy)" harness_year = gets.chomp.to_i harness = Harness.new(harness_number, harness_type, harness_year) $all_harnesses << harness harness.print number = number - 1 counter += 1 end end return $all_harnesses end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate klass, n = klass::COUNT\n n.times.map {\n o = klass.new self\n yield o if block_given?\n o }\n end", "def initialize(n)\n @n = n\n end", "def initialize(n, h, w, a)\n # defines instance variables upon creation of new object\n # ties specific and individual data to crea...
[ "0.6583012", "0.6545054", "0.644339", "0.6393393", "0.63457257", "0.62996715", "0.62719965", "0.6266888", "0.62598974", "0.62580454", "0.62580454", "0.6203432", "0.6166434", "0.6128871", "0.6119985", "0.60836107", "0.6072784", "0.6022334", "0.6011186", "0.6005819", "0.6005789...
0.0
-1
saves selected harness in 'current_harness'
def select_harness all_harness_str = "" $all_harnesses.each_with_index do |harness, index| new_harness = " " + index.to_s + "- " + harness.serial_number all_harness_str += new_harness end puts all_harness_str harness_input = -1 until harness_input >= 0 && harness_input < $all_harnesses.length puts "Which HARNESS to edit?(select number)" harness_input = gets.chomp.to_i current_harness = $all_harnesses[harness_input] end return current_harness end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_test_suite(test_suite)\n @test_suites << test_suite\nend", "def capture_current_tune_settings\n puts \"Checking current tune settings...\"\n settings_json = run_script_on(master, \"./util/tune/current_settings.rb\").output\n output_path = \"#{@archive_root}/#{CURRENT_TUNE_SETTINGS}\"\n\n pu...
[ "0.56488454", "0.5514428", "0.53165376", "0.52906543", "0.5230893", "0.52292037", "0.5226883", "0.51932436", "0.5168493", "0.5162603", "0.5051158", "0.50435627", "0.50306785", "0.50306785", "0.4960219", "0.4954789", "0.4954789", "0.49421448", "0.49306655", "0.49264398", "0.49...
0.5011029
14
These methods change a harnesses attributes
def add_location(current_harness) current_harness.print puts "Location of #{current_harness.serial_number}? (City, State)" location = gets.chomp puts "Date sent?(mm/dd/yyyy)" date = gets.chomp current_harness.new_location(location, date) current_harness.print end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(hsh = {})\n hsh.each { |name, val| self.set_attr(name,val) }\n self\n end", "def attributes= hsh\n conv_hsh = {}\n hsh.each do |k,v|\n k = k.to_s.gsub(/:/,'_') if k =~ /:/\n conv_hsh[k] = v\n end\n super hsh\n end", "def change_info(n, h, w)\n #using...
[ "0.648372", "0.6469076", "0.6367974", "0.6240641", "0.62323076", "0.61405843", "0.61291534", "0.61275584", "0.61275584", "0.603827", "0.603827", "0.6023425", "0.5988246", "0.5988246", "0.5988246", "0.5988246", "0.594472", "0.59079933", "0.59029317", "0.58717495", "0.58717495"...
0.0
-1
Init with exception message and response object if one is available
def initialize(httpMsg, responseObj = nil) @response = responseObj super("An error occurred executing the HTTP request: #{httpMsg}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(*args, **opt)\n @http_response = @http_status = @cause = nil\n args.map! do |arg|\n case arg\n when Integer then (@http_status = arg) and next\n when Exception then @cause = arg\n when Faraday::Response then faraday_response(arg)\n else ...
[ "0.7069889", "0.6628665", "0.65540856", "0.65407354", "0.6517642", "0.6460289", "0.64318734", "0.6425355", "0.6399185", "0.6388257", "0.6331553", "0.628075", "0.6268058", "0.6266657", "0.6239877", "0.6239677", "0.6235888", "0.6196421", "0.61874914", "0.61860734", "0.6182955",...
0.71237963
0
want it to eexcute every time called
def exists? false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bye; end", "def once\n end", "def recall; end", "def faint; end", "def faint; end", "def pass; end", "def pass; end", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def reap; end", "def pausable; end", "def guard; end", "def celebration; end", "def suivre; end", "def previousl...
[ "0.7053825", "0.6686775", "0.66590184", "0.6605249", "0.6605249", "0.64587957", "0.64587957", "0.6423222", "0.63762295", "0.6366376", "0.62914056", "0.62506443", "0.62167203", "0.6207459", "0.6207459", "0.6201841", "0.6196357", "0.61727077", "0.6152838", "0.6144347", "0.61443...
0.0
-1
convert to Ruby's false
def plain_old_ruby_object return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_bool() false end", "def to_bool() true end", "def to_bool\n return false if self.downcase == \"false\"\n return true\n end", "def literal_false\n 'false'\n end", "def parse_bool() false end", "def parse_bool() false end", "def to_b\n self != \"false\"\n end", "def litera...
[ "0.8618231", "0.8069835", "0.7842985", "0.77524644", "0.7743881", "0.7743881", "0.7739689", "0.7731916", "0.7684636", "0.7671056", "0.7614487", "0.7614487", "0.760904", "0.758418", "0.75761753", "0.75724113", "0.7500706", "0.74900174", "0.7412951", "0.7342175", "0.73240656", ...
0.0
-1
Equality. All false instances are equal each other, plus a FalseClass instance is also equal to this.
def == other case other when FalseClass, self.class true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other); [TrueClass,FalseClass]; end", "def not_equal (other)\n (self == other).to_bool ? False : True\n end", "def ===(other); end", "def ==(other); false; end", "def ===(other)\n return false unless (self == other)\n end", "def eql?(other)\n other.is_a?(self.class) && !self.cla...
[ "0.72368556", "0.6925946", "0.6732788", "0.6704121", "0.66679466", "0.66410625", "0.6603368", "0.65989083", "0.6587162", "0.65594", "0.65432835", "0.6522678", "0.65223044", "0.6517165", "0.6517165", "0.6517165", "0.6517165", "0.6517165", "0.6517165", "0.6517165", "0.6517165",...
0.7469688
0
the number showing is set as number if number was valid otherwise it is randomly chosen
def initialize number roll unless cheat(number) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_random_number\n @lower = Number.find(params[:id]).lower_bound\n @upper = Number.find(params[:id]).upper_bound\n @random_number = rand(@lower..@upper)\n end", "def show\n @random_number = 1 + rand(10)\n @result = Number.compare_numbers(@number.input, @random_number)\n end", "def result\...
[ "0.71744174", "0.70904475", "0.68139404", "0.6757829", "0.6669887", "0.65517724", "0.6537248", "0.65205514", "0.65195686", "0.6513361", "0.64588976", "0.645765", "0.64264876", "0.6405328", "0.63936865", "0.63841087", "0.63654894", "0.6353816", "0.6349735", "0.6344556", "0.632...
0.0
-1
roll the die so the number showing is randomly chosen
def roll @numberShowing = 1 + rand(6) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roll_die\n die_roll = rand(1..6)\n #\nend", "def roll_die\n Random.new.rand(1..6)\nend", "def dice_roll\n rand(1..6)\n end", "def dice_roll\n return (rand(6) + 1)\n end", "def roll_die(sides)\n\tresult = 1 + rand(sides)\nend", "def roll\n @number = rand(1..6)\n end", "def roll\n ...
[ "0.8527218", "0.83658195", "0.8145509", "0.81010586", "0.80351335", "0.80314523", "0.801649", "0.80140185", "0.797654", "0.7976043", "0.7957698", "0.7890214", "0.7850539", "0.78412217", "0.7789856", "0.77882195", "0.77838427", "0.77485967", "0.77404815", "0.7727842", "0.76987...
0.8049349
4
attempts to set the number showing to number and returns if cheat was successful
def cheat number if number > 0 && number < 7 @numberShowing = number return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cheat\n puts 'What number do you want to roll?'\n\tnumber = gets.chomp.to_i\n\tif number >= 1 && number <= 6\n\t @number_showing = number\n\telse\n\t puts 'Cheater!!!'\n end\n @number_showing\t\n end", "def exercise_119 (number)\n end", "def tricky_number\n if true\n number = 17\n els...
[ "0.7084534", "0.6498242", "0.63801116", "0.63492996", "0.63155574", "0.6196656", "0.61731446", "0.6157264", "0.614858", "0.614858", "0.614858", "0.614858", "0.614858", "0.614858", "0.614858", "0.614858", "0.614858", "0.61007816", "0.60525936", "0.60385585", "0.6005804", "0....
0.7521906
0
returns the number showing
def showing return @numberShowing end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showing \n @numberShowing\n end", "def display_number\n self['display_number'] ||= self.class.mask(number)\n self['display_number']\n end", "def display_number\n self.class.mask(number)\n end", "def display_number\n self.class.mask(number)\n end", "def display...
[ "0.76895446", "0.75263774", "0.73904663", "0.73502016", "0.7256698", "0.69704247", "0.6843486", "0.68390197", "0.6705172", "0.6705172", "0.66914254", "0.66914254", "0.66657346", "0.6662729", "0.6578317", "0.6570832", "0.65338814", "0.6527316", "0.64803106", "0.64112204", "0.6...
0.79139525
0
I worked on this challenge with James Boyd I spent [1.5] hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. 0. Pseudocode What is the input? An array, an integer (minimum size for output array), filler object What is the output? (i.e. What should the code return?) A new array What are the steps needed to solve the problem? 1. Compare size of array to minimum size a. If it is bigger or equal to min_size, return original array 2. When array is smaller than minimum size, pad array with the default value until it is minimum size b. 3. Return new array 1. Initial Solution
def pad!(array, min_size, value = nil) #destructive if array.length >= min_size return array end # refactor for a cooler method than while loop # use an index for looping i = array.length while i < min_size array.push value i += 1 end array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(array, min_size, value = nil) #non - destructive\n array_modified = []\n if min_size <= array_modified.length\n array_modified = array.map { |x| x }\n elsif min_size == 0\n array_modified = array.map { |x| x }\n else\n array_modified = array.map { |x| x }\n (min_size...
[ "0.79110974", "0.79039675", "0.7896784", "0.7896694", "0.7891354", "0.7873531", "0.78532475", "0.78498214", "0.7846627", "0.78444684", "0.7837927", "0.7828748", "0.7827339", "0.7825683", "0.78104824", "0.7806454", "0.78062946", "0.7802543", "0.7798264", "0.7795762", "0.778933...
0.76326996
58