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 |
|---|---|---|---|---|---|---|
Only allow a list of trusted parameters through. | def pasta_params
params.require(:pasta).permit(:name, :description, :active)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
this Walk function was found at and tweaked as needed to work for my purposes | def walk(start)
Dir.foreach(start) do |x|
path = File.join(start, x)
if x.match(/^(\..*)$/)
next
elsif File.directory?(path)
walk(path)
else
if m = x.match(/^([\sA-Za-z\-!',\(\)]*)\s(\d{2,3}).*\.([A-Za-z0-9]*)$/)
title = m[1]
issue = m[2]
ext = m[3]
elsi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def walk; end",
"def traverse; end",
"def walk(*args) walk_direction[*args] end",
"def walk\n \t\tputs \"Walking...\"\n \tend",
"def walk(path); end",
"def walk\n if @headed_left\n move_left\n else\n move_right\n end\n end",
"def walk\n\t\tputs \"walking around\"\t\n\ten... | [
"0.73307455",
"0.6468805",
"0.6096493",
"0.6010721",
"0.5781454",
"0.57638454",
"0.57454157",
"0.57321805",
"0.56756413",
"0.55908114",
"0.55386996",
"0.55243087",
"0.5520205",
"0.5485413",
"0.54273635",
"0.54201275",
"0.54201275",
"0.5396532",
"0.5389917",
"0.5386976",
"0.53... | 0.0 | -1 |
read in a list of publishers | def get_publishers
File.readlines('publishers.data').each do |line|
line = line.chomp
Publisher.create(name: line)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publishers\n get_publishers_from_url('/publishers')\n end",
"def publishers\n respond_to?(:publisher) ? topic : []\n end",
"def publishers_coll\n settings.db['publishers']\n end",
"def publishers(location = @location)\n raise ArgumentError, \"No location specifi... | [
"0.7371511",
"0.7330722",
"0.7247537",
"0.69874984",
"0.6896545",
"0.65670866",
"0.6470797",
"0.6291848",
"0.62315404",
"0.6109663",
"0.5955442",
"0.5948341",
"0.5924034",
"0.58930963",
"0.5865362",
"0.58466464",
"0.5790486",
"0.56596273",
"0.56498134",
"0.56396276",
"0.56396... | 0.66905576 | 5 |
read in a list of characters | def get_characters
File.readlines('characters.data').each do |line|
d = line.split(',').map(&:strip)
Character.create(name: d[0], publisher: d[1])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_character_data(list_of_characters)\n chars = list_of_characters.gsub(\" \", \"\").split(\",\")\n result = \"\"\n chars.each do |val|\n result << (\"%c\" % val.to_i)\n end\n result\n end",
"def read characters\n forward characters\n end",
"def read_i... | [
"0.75350493",
"0.6759784",
"0.61792964",
"0.6135192",
"0.60771596",
"0.6049432",
"0.59699357",
"0.5890778",
"0.586804",
"0.58103746",
"0.57732815",
"0.5751922",
"0.5741117",
"0.5741117",
"0.5741117",
"0.5688719",
"0.56498367",
"0.5627752",
"0.5575266",
"0.5572045",
"0.5526951... | 0.594454 | 7 |
Returns negative seconds for future dates | def age(from_dt)
to_dt = Time.current
total_seconds = (to_dt - from_dt).to_i
seconds = total_seconds
if total_seconds > SECONDS_IN_YEAR
years = seconds / SECONDS_IN_YEAR
seconds -= (years * SECONDS_IN_YEAR)
end
if total_seconds > SECONDS_IN_DAY
days = seconds / SECONDS_IN_DAY
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seconds_until_end_of_day\n end_of_day.to_f - to_f\n end",
"def seconds_until_end_of_day\n end_of_day.to_i - to_i\n end",
"def seconds_until_expiration(now=Time.now)\n ((@ends_at - now).abs).round\n end",
"def ago(seconds)\n to_time.since(-seconds)\n end",
"def ago(seconds)\n since(-s... | [
"0.70381856",
"0.6901007",
"0.6897678",
"0.68951565",
"0.6879637",
"0.6879637",
"0.6864444",
"0.6816741",
"0.67023486",
"0.66189754",
"0.66189754",
"0.6592566",
"0.65859544",
"0.64058435",
"0.63633525",
"0.6360139",
"0.6342838",
"0.6330787",
"0.6328031",
"0.6308561",
"0.63085... | 0.0 | -1 |
A basic response with 200 status code and a tiny body. | def respond_with(status=200, headers={}, body=['Hello World'], &bk)
@app = FakeApp.new(status, headers, body, bk)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_with(status_code)\n response.status = status_code\n response.write \"\"\n nil\n end",
"def ok(body = \"\")\n [200, {}, body]\n end",
"def render_200_response\n render :text => \"OK\", :status => 200\n end",
"def respond_with(status_code)\n response.status = status_c... | [
"0.73467284",
"0.7342938",
"0.72857857",
"0.7176647",
"0.7036734",
"0.7004166",
"0.6917049",
"0.6842154",
"0.6837827",
"0.6798636",
"0.67903227",
"0.67903227",
"0.6768131",
"0.6681621",
"0.66578823",
"0.6610206",
"0.6610206",
"0.65303636",
"0.6514526",
"0.6509483",
"0.6482126... | 0.63662785 | 27 |
we assume that the value coming in is an operator; also, if the function is | def value(ext_call = true)
@temp_stack = @stack.clone if ext_call
# puts "temp stack value from value: #{@temp_stack}"
call_op = @temp_stack.pop
if call_op == :+
value = calc_plus
elsif call_op == :-
value = calc_minus
elsif call_op == :*
value = calc_times
elsif call_op == :/
value = c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operator; end",
"def basic_op(operator, value1, value2)\n case operator\n when \"+\"\n value1 + value2\n when \"-\"\n value1 - value2\n when \"*\"\n value1 * value2\n when \"/\"\n value1 / value2\n end\nend",
"def basic_op(operator, value1, value2)\n case operator\n when '+'\n value1... | [
"0.7759577",
"0.701651",
"0.70035714",
"0.69598883",
"0.678714",
"0.67548305",
"0.67466086",
"0.67421055",
"0.6740003",
"0.666108",
"0.66385895",
"0.6616577",
"0.6550668",
"0.65419835",
"0.6533792",
"0.64998573",
"0.6499691",
"0.6428853",
"0.6377888",
"0.637532",
"0.63596946"... | 0.0 | -1 |
GET /cycles GET /cycles.json | def index
@cycles = Cycle.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cycles = Cycle.where(group_id: params[:group_id])\n\n render json: @cycles\n end",
"def show\n\n render json: @cycle\n end",
"def index\n @program_cycles = ProgramCycle.all\n end",
"def index\n @cycles = current_user.cycles\n end",
"def get_cycle(name)\n @_cycles = ... | [
"0.708707",
"0.6800078",
"0.6786475",
"0.6708614",
"0.62528396",
"0.62522423",
"0.6237355",
"0.61879665",
"0.60341984",
"0.60175425",
"0.59552664",
"0.5945532",
"0.5915027",
"0.5875378",
"0.5705871",
"0.5700656",
"0.5672322",
"0.5632059",
"0.55834484",
"0.54941833",
"0.547674... | 0.7171241 | 0 |
GET /cycles/1 GET /cycles/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cycles = Cycle.all\n end",
"def index\n @cycles = Cycle.where(group_id: params[:group_id])\n\n render json: @cycles\n end",
"def show\n\n render json: @cycle\n end",
"def index\n @program_cycles = ProgramCycle.all\n end",
"def get_cycle(name)\n @_cycles = Hash.new unles... | [
"0.69596",
"0.6859795",
"0.6804846",
"0.6614687",
"0.6540354",
"0.6529569",
"0.6462117",
"0.64397955",
"0.61911076",
"0.61378825",
"0.61004734",
"0.5966176",
"0.5934389",
"0.5934389",
"0.5871389",
"0.5752371",
"0.5674061",
"0.5619678",
"0.55884486",
"0.5584637",
"0.55520546",... | 0.0 | -1 |
POST /cycles POST /cycles.json | def create
@cycle = Cycle.new(cycle_params)
respond_to do |format|
if @cycle.save
format.html { redirect_to @cycle, notice: 'Ciclo creado exitosamente.' }
format.json { render :show, status: :created, location: @cycle }
else
format.html { render :new }
format.json { ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_next\n old_cycles = Maintenance::Cycle::CYCLE_TYPES.map { |type| Maintenance::Cycle.current(type) }.select{ |cycle| cycle && cycle.is_over? }\n cycles = []\n for old_cycle in old_cycles\n cycles << Maintenance::Cycle.generate_next_cycle( old_cycle.cycle_type )\n end\n flash[:sticky_m... | [
"0.67611086",
"0.6430943",
"0.6429438",
"0.6212236",
"0.6191468",
"0.60996926",
"0.5905922",
"0.586011",
"0.5840889",
"0.58364856",
"0.5818975",
"0.5787997",
"0.5499016",
"0.5454555",
"0.54378563",
"0.5423353",
"0.54097193",
"0.54",
"0.53752047",
"0.53752047",
"0.5374787",
... | 0.6557409 | 1 |
PATCH/PUT /cycles/1 PATCH/PUT /cycles/1.json | def update
respond_to do |format|
if @cycle.update(cycle_params)
format.html { redirect_to @cycle, notice: 'Ciclo actualizado exitosamente.' }
format.json { render :show, status: :ok, location: @cycle }
else
format.html { render :edit }
format.json { render json: @cycle.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @cycle = Cycle.find(params[:id])\n\n if @cycle.update(cycle_params)\n head :no_content\n else\n render json: @cycle.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @cycle.update(cycle_params)\n format.html { redirect... | [
"0.6747934",
"0.651102",
"0.628022",
"0.6271805",
"0.6126362",
"0.59283894",
"0.5894664",
"0.5871889",
"0.58668596",
"0.5816151",
"0.5805159",
"0.5766892",
"0.57534766",
"0.57299006",
"0.57299006",
"0.5702719",
"0.5689581",
"0.568217",
"0.56646687",
"0.566365",
"0.56442654",
... | 0.6247271 | 4 |
DELETE /cycles/1 DELETE /cycles/1.json | def destroy
@cycle.destroy
respond_to do |format|
format.html { redirect_to cycles_url, notice: 'Ciclo eliminado exitosamente.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cycle = Cycle.find(params[:id])\n @cycle.destroy\n\n respond_to do |format|\n format.html { redirect_to cycles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cycle.destroy\n respond_to do |format|\n format.html { redirect_to cycles_url, not... | [
"0.7483342",
"0.7200149",
"0.69120705",
"0.67050785",
"0.6690675",
"0.6663121",
"0.66304994",
"0.64957255",
"0.64874786",
"0.6436318",
"0.64187247",
"0.64167446",
"0.635822",
"0.63572705",
"0.6330216",
"0.632853",
"0.6321359",
"0.6306501",
"0.63038045",
"0.6296448",
"0.628570... | 0.7213115 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_cycle
@cycle = Cycle.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 cycle_params
params.require(:cycle).permit(:name, :semester, :year)
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 a new client that will connect to the given +host+ using the specified +playername+ and +password+. | def initialize( host, playername, password, vhost=DEFAULT_PLAYERS_VHOST )
@host = host
@playername = playername
@password = password
@vhost = vhost
@output = nil
@input = nil
@client = Bunny.new(
:host => host,
:vhost => vhost,
:user => playername,
:pass => passw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_client_connection(host, port, db)\n Connection.new(host, port, db, @handle)\n end",
"def connect(username, password, server)\n jid = \"#{username}@#{server}\"\n client.setup(jid, password)\n client.run\n end",
"def create\n conn = EM::Hiredis::Client.new(@hos... | [
"0.6445155",
"0.61642724",
"0.6119627",
"0.6024054",
"0.59170926",
"0.58645463",
"0.5825939",
"0.5804937",
"0.5802986",
"0.57895744",
"0.5788178",
"0.57827085",
"0.57665336",
"0.5752384",
"0.57511127",
"0.5726455",
"0.5718271",
"0.5713012",
"0.56860167",
"0.56430763",
"0.5634... | 0.6912155 | 0 |
Connect to the server's player event bus. | def connect
@client.start
# Set up our input and output exchange/queue
@output = @client.exchange( @playername, :passive => false )
@queue = @client.queue
@exchange = @client.exchange( @playername, :passive => false )
@queue = @client.queue( "#{@playername}_output", :exclusive => true )
login_exchange ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect(host=\"localhost\", port=2230)\n output_stream.puts \"sending request for a new game...\"\n EventMachine::run {\n EventMachine::connect host, port, GameBroker, &method(:setup_handler)\n }\n end",
"def start(host=\"localhost\", port=2230)\n output_stream.puts \"waiting ti... | [
"0.6836316",
"0.67808",
"0.6537835",
"0.65304977",
"0.6411546",
"0.62732184",
"0.6182691",
"0.61609846",
"0.6154123",
"0.6140854",
"0.6096301",
"0.60640603",
"0.6061905",
"0.6016416",
"0.6012971",
"0.5924622",
"0.5904126",
"0.58820826",
"0.58801615",
"0.58486277",
"0.5838735"... | 0.6987153 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_reply
@reply = Reply.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def reply_params
params.require(:reply).permit(:body)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Extracts information from the original broken format and maps it onto our table structure... ... or dies trying. | def fix_data(data)
methods = [:fix_login, :fix_address, :fix_streets, :fix_district]
error_state = false
methods.each do |method|
begin
data = self.send(method, data)
rescue ImportError
error_state = true
end
end
if(error_state)
ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_table; end",
"def parse\n input_data.each do |filename, data|\n rowdata_template = OpenStruct.new\n @preprocess_block.call(filename, rowdata_template) if @preprocess_block\n\n arrived_at_table_data = false\n\n data.split(\"\\r\\n\").each do |line|\n next if line.strip.empt... | [
"0.6328994",
"0.6054132",
"0.599253",
"0.5893134",
"0.5869693",
"0.5757646",
"0.5534169",
"0.548459",
"0.54843783",
"0.546706",
"0.54377365",
"0.5402489",
"0.53677887",
"0.5324417",
"0.5316378",
"0.5308036",
"0.52706504",
"0.52477306",
"0.5238582",
"0.5220622",
"0.5213329",
... | 0.0 | -1 |
nils along the path will return into nil | def force
forced = path.inject(parent) do |field, key|
return nil if field.nil?
unless field.respond_to?(:to_ary) || field.respond_to?(:to_hash)
raise TypeError
end
field[key]
end
forced = forced.force while forced.respond_to?(:force)
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n nil\n end",
"def strict_path val = nil\n begin\n strict_path! val\n rescue PathNotFound\n nil\n end\n end",
"def path=(_); end",
"def path=(_); end",
"def path=(_); end",
"def path=(_); end",
"def path=(_); end",
"def path=(_); end",
"def path_without_... | [
"0.69783896",
"0.66933846",
"0.66307396",
"0.66307396",
"0.66307396",
"0.66307396",
"0.66307396",
"0.66307396",
"0.6432402",
"0.64030033",
"0.64030033",
"0.64030033",
"0.64030033",
"0.64030033",
"0.6300911",
"0.60382175",
"0.6035666",
"0.6035666",
"0.6035666",
"0.6010365",
"0... | 0.0 | -1 |
overrides Indexable to stay rooted from parent resource | def dig(*deeper, type: Indexed)
type.new(parent, *path, *deeper)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(child); end",
"def index\n render_index @parent.with_user @user\n end",
"def default_index_subaction\n list_all\n end",
"def index\n super\n end",
"def index\n authorize! :index, nil\n @parents = Parent.by_name\n end",
"def indexable_by?(user, parent = nil)\n raise... | [
"0.7541881",
"0.7072306",
"0.6969318",
"0.69537807",
"0.68761665",
"0.67390114",
"0.65960133",
"0.6592926",
"0.6497116",
"0.63560367",
"0.63560367",
"0.6312482",
"0.62679905",
"0.6255349",
"0.62354535",
"0.6216054",
"0.62038684",
"0.6203012",
"0.6200946",
"0.6195384",
"0.6181... | 0.0 | -1 |
optimistically, always allow to_a | def to_a; Array(force) end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_a() end",
"def to_a() end",
"def to_a() end",
"def to_a() end",
"def to_a() end",
"def to_a() end",
"def test_0810_to_a\n @@log.debug \"test_0810_to_a starts\" if @@log.debug?\n assert_respond_to(@list, :to_a, \"test_0810_to_a_respond\")\n # Straight conversion\n result = @list.to_a\... | [
"0.62405616",
"0.62405616",
"0.62394667",
"0.62394667",
"0.62394667",
"0.62394667",
"0.6236809",
"0.6196581",
"0.5861951",
"0.5861951",
"0.5861951",
"0.5861951",
"0.5861951",
"0.5861951",
"0.5861951",
"0.5861951",
"0.58387977",
"0.5829621",
"0.579485",
"0.57740945",
"0.573249... | 0.48270625 | 93 |
Retrieve the album specified by tne ID | def album
@album ||= Album.includes(:images, :poster_image)
.where(id: params[:id], user_id: user_id)
.take || halt(404)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_album album_id\n get(\"/albums/#{album_id}\")\n end",
"def find_album_by_id(client, album_id)\n client.api(:album, :show, album_id)\nend",
"def album(album_id_or_url, options = {})\n options = make_options(:album_id, album_id_or_url, options)\n get(options)\n end",
"def fetch_albu... | [
"0.8010378",
"0.77816856",
"0.7161346",
"0.7132069",
"0.7047373",
"0.69990087",
"0.69178927",
"0.6826285",
"0.6800545",
"0.6760987",
"0.6750857",
"0.67139786",
"0.6642012",
"0.66255295",
"0.65998715",
"0.6595071",
"0.6555704",
"0.65529275",
"0.65084034",
"0.6483734",
"0.64780... | 0.6831091 | 7 |
Retrieve the image specified by the id parameter | def image
@image ||= Image.joins(:album)
.where(id: params[:id], :albums => {:user_id => user_id})
.take || halt(404)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image(image_id)\n return @rm.get(image_id)\n end",
"def get_raw_image_by_id(id)\n\n repo_images = self.get_raw_repository_images\n\n # select images from this repository with matching id\n image = repo_images.select { |image| image.id[0,id.length] == id }\n\n if image.length == 0\n ... | [
"0.82709265",
"0.8082861",
"0.80383474",
"0.8013702",
"0.7961944",
"0.7929668",
"0.7913042",
"0.7889093",
"0.7889093",
"0.7889093",
"0.77691233",
"0.7715314",
"0.7715113",
"0.7626646",
"0.7621824",
"0.7601607",
"0.7510343",
"0.7510343",
"0.75046146",
"0.7460996",
"0.7460996",... | 0.7334031 | 28 |
TODO: see parsing with errors and nonwhip files for greater indexer support | def index (path = ".")
files = Array.new
# search path and fill with files
Dir.foreach(path) do |entry|
if File.file?(path + "/" + entry)
if entry.length > 5 && entry[-5..-1] == ".whip"
files.push(Whip::File.new(path + "/" + entry, path + "/" + ent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_file(file, pages_dir, stopwords, file_data)\n # Removing the dir from the file name\n # begin\n actual_name = file.gsub(pages_dir, \"\")\n # rescue NoMethodError\n# actual_name = badpage.html\n \n\n # Resetting the file path\n file_path = \"\"\n file_path = File.e... | [
"0.6149506",
"0.6057887",
"0.60575813",
"0.5847879",
"0.5847879",
"0.5598973",
"0.5598973",
"0.5598973",
"0.5598973",
"0.55847794",
"0.55566394",
"0.5447334",
"0.54026747",
"0.539688",
"0.53896785",
"0.53896785",
"0.53896785",
"0.53896785",
"0.53521556",
"0.53391254",
"0.5319... | 0.51697487 | 35 |
before_enqueue do |job| puts(job.class) puts(job.inspect) return false end TODO: need add workday judge,if not workday don't send email need use before_action | def perform(*args)
#leader with employees in user_ids
#has attributes uid,user_ids,atten_rule
opts = args.extract_options!
yesterday = args[0] || Date.yesterday
leaders = User.leaders_by_date(yesterday)
#用于测试
if opts[:leader_user_id]
leaders = leaders.slice(opts[:leader_user_id]) #[l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_enqueue\n executor.before_enqueue(@messages, @coordinator)\n end",
"def queue_job; end",
"def before job=nil\n processing!\n end",
"def enqueue_job\n BgJob.enqueue(\n WebhookJob::RecordEvent,\n {\n client_id: @user_kyc_detail.client_i... | [
"0.69465005",
"0.67781705",
"0.6772475",
"0.6699654",
"0.6569768",
"0.6555264",
"0.6519671",
"0.65076345",
"0.6398932",
"0.6398701",
"0.63286227",
"0.63205826",
"0.62310404",
"0.6216094",
"0.6195856",
"0.6190585",
"0.61899745",
"0.61241966",
"0.61049086",
"0.6073873",
"0.6061... | 0.0 | -1 |
For fetching skill type data | def fetch_skill_data (skill_id,timediff)
@current_time = Time.now
#response = JSON.parse((InContactApi::Connection.base.get "/inContactAPI/services/v2.0/skills/"+skill_id.to_s+"/summary?startDate="+ (@current_time-timediff).utc.iso8601 + "&endDate=" + @current_time.utc.iso8601).body)['skillSummaries'].first... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type\n @data['type']\n end",
"def type\n\t\t\t@data[\"type\"]\n\t\tend",
"def type\n @data['type']\n end",
"def fetch_type name\n exercises = []\n data.exercises.each do |exe|\n if exe.target === name\n exercises.push(exe.name)\n end\n end\n ... | [
"0.6403184",
"0.6358555",
"0.63290876",
"0.6211419",
"0.6133469",
"0.60378104",
"0.6030702",
"0.6007002",
"0.5996764",
"0.5980627",
"0.5976824",
"0.59671146",
"0.59623027",
"0.59545135",
"0.5952907",
"0.5939788",
"0.5915111",
"0.5914434",
"0.5910562",
"0.5893245",
"0.5891329"... | 0.0 | -1 |
Sub function => to append values | def append_values(response,dept_response)
response['QueueCount']+=dept_response['QueueCount']
response['AbandonCount']+=dept_response['AbandonRate']
response['AgentsWorking']+=dept_response['AgentsWorking']
response['AgentsUnavailable']+=dept_response['AgentsUnavailable']
response['Longest... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(value)\n end",
"def append(target_array, value_to_append)\n target_array << value_to_append\nend",
"def add_values(existing_value, new_value)\n if existing_value && new_value\n existing_value += new_value\n elsif new_value\n existing_value = new_value\n ... | [
"0.7053231",
"0.6544624",
"0.6473534",
"0.6427085",
"0.636342",
"0.6273859",
"0.6253287",
"0.6253287",
"0.6246862",
"0.6203912",
"0.6181602",
"0.6159411",
"0.61290485",
"0.61156166",
"0.61125237",
"0.6097096",
"0.6038607",
"0.60289377",
"0.60238504",
"0.59641063",
"0.5958094"... | 0.5831981 | 40 |
Only allow a trusted parameter "white list" through. | def stage_params
params.require(:stage)
.permit(:name, :event_id, :strava_segment_id, :item_order, :distance)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Gets the friends of a given user [Input] user_id: integer the id of the current user [Output] friends: Array of User the friends of the user | def get
if request.post?
user = User.find_by_id(params[:user_id])
unless user
render json: {error: "user not fonud"} and return
end
render json: {friends: user.friends.each {|f| f.password = nil}}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends(user_id=self.username)\n connection.get(\"/users/#{user_id}/friends\").body.users\n end",
"def friends(id, options = {})\n get(\"users/#{id}/friends\").friends\n end",
"def get_friends(id)\n facebook_cookies = Koala::Facebook::OAuth.new(Facebooker2.app_id, Facebooker2.secret)... | [
"0.879044",
"0.78685296",
"0.7805573",
"0.76843894",
"0.7561067",
"0.75527763",
"0.7537882",
"0.7390034",
"0.7168912",
"0.7150991",
"0.7133224",
"0.7127329",
"0.7056541",
"0.7051656",
"0.70270103",
"0.69263655",
"0.6925526",
"0.6925172",
"0.68685746",
"0.6863041",
"0.68281776... | 0.6230802 | 56 |
Deletes a friend [Input] user_id: integer the id of the current user friend_id: integer the id of the friend the user wants to delete [Output] msg: string in case the friend was deleted error: string in case the friend can't be deleted | def remove
if request.post?
friendship = Friendship.where(user_id: params[:user_id], friend_id: params[:friend_id]).first
unless friendship
render json: {error: "You are not friends"} and return
end
friendship.destroy
render json: {msg: "Friend deleted"}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n user = begin User.find(params[:id]) rescue nil end\n @friend = FriendsUser.find(:first, :conditions => [\"user_id = ? AND friend_id = ?\", current_user.id, user.id])\n if @friend\n if @friend.destroy\n flash[:notice] = I18n.t('friend.destroy.notice')\n else\n flash[:e... | [
"0.8073093",
"0.7869427",
"0.76325524",
"0.75144774",
"0.7401875",
"0.7306251",
"0.7298602",
"0.72221917",
"0.71929795",
"0.7159843",
"0.7142337",
"0.70953035",
"0.7084428",
"0.70359343",
"0.702517",
"0.7009096",
"0.6996473",
"0.69813484",
"0.6963366",
"0.69408995",
"0.692740... | 0.7241691 | 7 |
Gets the latest actions of the user's friends [Input] user_id: integer the id of the current user [Output] feeds: Array the feeds Each feed contains the following information: quest: Quest the quest that was completed friend: User the friend that completed the quest time: timestamp the timestamp of when the friend comp... | def feeds
user = User.find_by_id(params[:user_id])
unless user
render json: {error: "user not fonud"} and return
end
cq = CompletedQuest.where(user_id: user.friends.ids).order(created_at: :desc).limit(10)
feeds = []
cq.each do |q|
hash = {}
hash[:quest] = q.quest
friend = q.user
friend.passwo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends(user=nil)\n\t\tself.twitagent.friends(user)\n\trescue => err\n\t\tRAILS_DEFAULT_LOGGER.error \"Failed to get friends via OAuth for #{current_user.inspect}\"\n\t\tflash[:error] = \"Twitter API failure (getting friends)\"\n\t\treturn\n\tend",
"def get_friends_activities(user_id, params = {})\n use... | [
"0.62776",
"0.616983",
"0.61544126",
"0.6151684",
"0.60758686",
"0.6059937",
"0.605606",
"0.60405034",
"0.6029896",
"0.5987669",
"0.59583455",
"0.5933729",
"0.5926683",
"0.59261334",
"0.5924559",
"0.5920349",
"0.5896081",
"0.58756226",
"0.582711",
"0.58267367",
"0.5811582",
... | 0.70070064 | 0 |
Searches for users given their facebookId [Input] user_id: integer the id of the current user facebook_ids: Array of string the facebook ids to search for [Output] friends: Array of User the users found | def search_facebook
if request.post?
user = User.find_by_id(params[:user_id])
unless user
render json: {error: "user not fonud"} and return
end
facebook_ids = JSON.parse(params[:facebook_ids])
friends = []
facebook_ids.each do |id|
friend = User.find_by_facebookId(id)
if friend
fr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends(user_id=self.username)\n connection.get(\"/users/#{user_id}/friends\").body.users\n end",
"def get_friends_list(user_id, *friend_ids)\r\n user_id = user_id.to_s\r\n @context.validate_identifier(:user_id, user_id)\r\n friend_ids.each do |friend_id|\r\n friend_id = friend_... | [
"0.75239897",
"0.7316799",
"0.730814",
"0.7256536",
"0.72116643",
"0.7114",
"0.7056444",
"0.7001471",
"0.6986888",
"0.6936247",
"0.6918402",
"0.6881386",
"0.67665666",
"0.67003536",
"0.66648906",
"0.65841633",
"0.6553104",
"0.65523607",
"0.64609",
"0.6458192",
"0.64569235",
... | 0.7249819 | 4 |
Write a method called max_by that behaves similarly for Arrays. It should take an Array and a block, and return the element that contains the largest value. If the Array is empty, max_by should return nil. Your method may use each, each_with_object, each_with_index, inject, loop, for, while, or until to iterate through... | def max_by(arr)
return nil if arr.empty?
highest = yield(arr[0])
highest_idx = nil
arr.each_with_index do |el, idx|
if yield(el) >= highest
highest = yield(el)
highest_idx = idx
end
end
arr[highest_idx]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_by(array)\n largest_item = nil\n array.each do |elem|\n largest_item ||= elem\n largest_item = elem if yield(elem) > yield(largest_item)\n end\n largest_item\nend",
"def max_by(array)\n return nil if array.empty?\n\n max_element = array.first\n max_return = yield(array.first)\n\n array[1..-... | [
"0.8660003",
"0.8499028",
"0.83953387",
"0.8387928",
"0.83474064",
"0.8274572",
"0.7979892",
"0.79672694",
"0.7956428",
"0.7845729",
"0.7809522",
"0.7713641",
"0.7668797",
"0.76050365",
"0.7570013",
"0.7548518",
"0.7547998",
"0.75418454",
"0.75365126",
"0.74987125",
"0.747010... | 0.82220316 | 6 |
X Y l w xs[0][1] | def neighbors1(x, y, b)
ns = []
if x-1 > -1
ns << [b[x-1][y], b[x-1][y+1]]
ns << b[x-1][y-1] if y-1 > -1
end
if y-1 > -1
ns << b[x][y-1]
ns << b[x+1][y-1] if b[x+1]
end
ns << b[x][y+1]
ns << [b[x+1][y+1], b[x+1][y]] if b[x+1]
ns.flatten.count('#')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_xy\n a = self\n a = [a[0].x, a[0].y] if length == 1\n return *a\n end",
"def node\n [@x, @y]\n end",
"def [](pos) #pos = [1,2]\n # x, y = pos\n x = pos[0]\n y = pos[1]\n @rows[x][y] \n end",
"def [] x, y\r\n @rows[y][x]\r\n end",
"def to_xy\n [... | [
"0.6507872",
"0.6339158",
"0.6048162",
"0.59968364",
"0.5912317",
"0.58363783",
"0.58155906",
"0.5753178",
"0.573398",
"0.57323897",
"0.5719587",
"0.5681158",
"0.56578666",
"0.56341577",
"0.5621213",
"0.5620855",
"0.5620038",
"0.56079745",
"0.5581945",
"0.5577287",
"0.5549506... | 0.0 | -1 |
GET /guide_posts GET /guide_posts.json | def index
if params == {"action"=>"index", "controller"=>"guide_posts"}
params.merge!({:price_min => 0, :price_max => 1000})
end
@guide_posts = GuidePost.fullSearch(params)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @guide_posts }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @guides = Guide.page(1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: {:guides => @guides.as_json} }\n end\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n\n @posts = Post.all\n\n render json:... | [
"0.65661657",
"0.6367996",
"0.63571507",
"0.6355822",
"0.6355822",
"0.63355887",
"0.63118577",
"0.63056415",
"0.6301101",
"0.6301101",
"0.6301101",
"0.6243155",
"0.62395346",
"0.62324625",
"0.6203858",
"0.6185819",
"0.6180161",
"0.6179112",
"0.6178142",
"0.61721987",
"0.61544... | 0.6032393 | 28 |
GET /guide_posts/1 GET /guide_posts/1.json | def show
@guide_post = GuidePost.find(params[:id])
@post_is_booked = true if @guide_post.booking_status == BookingStatus.find_by_status("Booked")
@post_is_pending = true if @guide_post.booking_status == BookingStatus.find_by_status("Pending")
if @post_is_pending
@pending_users = TripsToUser.find_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @guides = Guide.page(1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: {:guides => @guides.as_json} }\n end\n end",
"def show\n @guide = Guide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n forma... | [
"0.65747344",
"0.6449941",
"0.6371537",
"0.62169766",
"0.6176156",
"0.6158703",
"0.61265135",
"0.611089",
"0.60912603",
"0.60912603",
"0.60912603",
"0.6086504",
"0.60752046",
"0.60752046",
"0.6062679",
"0.6051798",
"0.6045131",
"0.6031854",
"0.60261744",
"0.60183686",
"0.6002... | 0.5939556 | 47 |
GET /guide_posts/new GET /guide_posts/new.json | def new
@guide_post = GuidePost.new
@rivers = River.all
respond_to do |format|
format.html # new.html.erb
format.json { render json: @guide_post }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\... | [
"0.76164794",
"0.75991756",
"0.7512329",
"0.74943334",
"0.74942076",
"0.74942076",
"0.74942076",
"0.74942076",
"0.74942076",
"0.74942076",
"0.74942076",
"0.74942076",
"0.74942076",
"0.74942076",
"0.74942076",
"0.74942076",
"0.74942076",
"0.74942076",
"0.74942076",
"0.74942076",... | 0.71209633 | 49 |
POST /guide_posts POST /guide_posts.json | def create
@guide_post = GuidePost.new(params[:guide_post])
respond_to do |format|
if @guide_post.save
format.html { redirect_to @guide_post, notice: 'Guide post was successfully created.' }
format.json { render json: @guide_post, status: :created, location: @guide_post }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n render json: Post.create(params[\"post\"])\n end",
"def create_posts\n end",
"def create_posts\n end",
"def create \n @guide = Guide.new(params[:guide])\n respond_to do |format|\n if @guide.save\n format.html { redirect_to guide_url(@guide), notice: 'Guide was successf... | [
"0.6364946",
"0.6320578",
"0.6320578",
"0.6259841",
"0.6194279",
"0.6187877",
"0.617753",
"0.61672175",
"0.61672175",
"0.6147188",
"0.60308415",
"0.602963",
"0.6027282",
"0.60225475",
"0.5992135",
"0.5981611",
"0.5960302",
"0.5945871",
"0.5936425",
"0.59345865",
"0.5920927",
... | 0.73878706 | 0 |
PUT /guide_posts/1 PUT /guide_posts/1.json | def update
@guide_post = GuidePost.find(params[:id])
@rivers = River.all
interested_users = TripsToUser.find_all_by_post_id(params[:id])
@interested_user_count = interested_users.count()
@users = []
interested_users.each do |u|
@users.push(User.find_by_id(u.user_who_agreed_id))
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @guide = Guide.find(params[:id])\n\n respond_to do |format|\n if @guide.update_attributes(params[:guide])\n format.html { redirect_to @guide, notice: 'Guide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.6386622",
"0.6386622",
"0.6386622",
"0.632931",
"0.632931",
"0.62026083",
"0.6187161",
"0.6119306",
"0.60914546",
"0.6080394",
"0.6059014",
"0.60362834",
"0.6028152",
"0.60159516",
"0.6015106",
"0.59737706",
"0.5970733",
"0.59695524",
"0.5960432",
"0.59345865",
"0.5930692"... | 0.57203305 | 37 |
DELETE /guide_posts/1 DELETE /guide_posts/1.json | def destroy
@guide_post = GuidePost.find(params[:id])
@guide_post.destroy
respond_to do |format|
format.html { redirect_to current_user, notice: 'Your post has been deleted.' }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @guide = Guide.find(params[:id])\n @guide.destroy\n respond_to do |format|\n format.html { redirect_to guides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @guide = Guide.find(params[:id])\n @guide.destroy\n\n respond_to do |format|\n form... | [
"0.73440796",
"0.7195281",
"0.7195281",
"0.717122",
"0.7154252",
"0.7138251",
"0.7128301",
"0.7116126",
"0.7100994",
"0.70572186",
"0.700356",
"0.6992179",
"0.69582236",
"0.6948075",
"0.69464153",
"0.693387",
"0.6931081",
"0.6931081",
"0.69239867",
"0.6909992",
"0.6909992",
... | 0.7770419 | 0 |
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
puts "test"
puts "11111111"
# reload guest_user to prevent caching problems before destruction
guest_user(with_retry = false).try(:reload).try(:... | {
"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.8972976",
"0.89307785",
"0.8852604",
"0.86945367",
"0.8651757",
"0.853395",
"0.853395",
"0.8513949",
"0.8457797",
"0.8418504",
"0.84031",
"0.8402678",
"0.839943",
"0.839943",
"0.8398982",
"0.8397229",
"0.83788675",
"0.83763117",
"0.83692396",
"0.8366224",
"0.83564925",
"... | 0.0 | -1 |
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.8472307",
"0.8455037",
"0.8437496",
"0.8352156",
"0.82589424",
"0.8223893",
"0.8223893",
"0.8217443",
"0.81866616",
"0.81638974",
"0.80793285",
"0.8057181",
"0.8028565",
"0.80178714",
"0.79502064",
"0.7940312",
"0.7864132",
"0.778853",
"0.7782167",
"0.77561736",
"0.7705154... | 0.7685685 | 23 |
called (once) when the user logs in, insert any code your application needs to hand off from guest_user to current_user. | def logging_in
# For example:
# guest_comments = guest_user.comments.all
# guest_comments.each do |comment|
# comment.user_id = current_user.id
# comment.save!
# end
puts "this is a test"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logging_in\n logger.debug \"ApplicationController:logging_in >>> \"\n current_user.transfer_data(guest_user)\n end",
"def logging_in\n current_user.absorb_from(guest_user)\n end",
"def logging_in\n\t\tguest_comments = guest_user.comments.all\n\t\tguest_comments.each do |comment|\n\t\t\tcomment.u... | [
"0.7654029",
"0.7560729",
"0.7416645",
"0.70993584",
"0.7067453",
"0.69966936",
"0.6959974",
"0.69598323",
"0.69598323",
"0.69598323",
"0.69598323",
"0.6956429",
"0.6955742",
"0.6951348",
"0.6908719",
"0.68936366",
"0.6839819",
"0.6786494",
"0.6774226",
"0.6768518",
"0.676163... | 0.67191 | 23 |
GET /house_hunters GET /house_hunters.json | def index
@house_hunters = HouseHunter.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_house_hunter\n @house_hunter = HouseHunter.find(params[:id])\n end",
"def set_house_hunter\n @house_hunter = HouseHunter.find(params[:id])\n end",
"def set_househunter\n @househunter = Househunter.find(params[:id])\n end",
"def index\n @hunter = Hunter.find(params[:hunter_id]) ... | [
"0.64189696",
"0.64189696",
"0.6255337",
"0.61952645",
"0.61870384",
"0.6164148",
"0.61100864",
"0.61089575",
"0.60851103",
"0.6066885",
"0.605842",
"0.6038606",
"0.60243744",
"0.60048485",
"0.5982869",
"0.5974456",
"0.5973747",
"0.5973205",
"0.5972857",
"0.5970338",
"0.59166... | 0.7298092 | 1 |
GET /house_hunters/1 GET /house_hunters/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @house_hunters = HouseHunter.all\n end",
"def index\n @house_hunters = HouseHunter.all\n end",
"def set_house_hunter\n @house_hunter = HouseHunter.find(params[:id])\n end",
"def set_house_hunter\n @house_hunter = HouseHunter.find(params[:id])\n end",
"def set_househunter... | [
"0.7061666",
"0.7061666",
"0.6687926",
"0.6687926",
"0.659438",
"0.63699436",
"0.6328197",
"0.6215485",
"0.6215485",
"0.6215485",
"0.618335",
"0.61438763",
"0.611411",
"0.608773",
"0.60839677",
"0.60839677",
"0.60827166",
"0.60827166",
"0.6080601",
"0.60783356",
"0.60592484",... | 0.0 | -1 |
POST /house_hunters POST /house_hunters.json | def create
if params[:create_for_user] != nil
params['house_hunter']['user_id'] = house_hunter_params[:create_for_user]
end
# puts params.inspect
@house_hunter = HouseHunter.new(house_hunter_params)
if (current_user.user_type != 1 and params['create_by_admin'] == 0) || house_hunter_params[:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_house_hunter\n @house_hunter = HouseHunter.find(params[:id])\n end",
"def set_house_hunter\n @house_hunter = HouseHunter.find(params[:id])\n end",
"def create\n @hasuk_house = HasukHouse.new(hasuk_house_params)\n\n respond_to do |format|\n if @hasuk_house.save\n format... | [
"0.65060383",
"0.65060383",
"0.6486752",
"0.6342713",
"0.6336611",
"0.62421143",
"0.6221397",
"0.6221397",
"0.62086964",
"0.61895275",
"0.61895275",
"0.6127572",
"0.612348",
"0.60920835",
"0.60884213",
"0.6057873",
"0.6057538",
"0.60479367",
"0.604508",
"0.6016188",
"0.599766... | 0.6321173 | 5 |
PATCH/PUT /house_hunters/1 PATCH/PUT /house_hunters/1.json | def update
respond_to do |format|
if @house_hunter.update(house_hunter_params)
format.html { redirect_to root_path, notice: 'House hunter was successfully updated.' }
format.json { render :show, status: :ok, location: @house_hunter }
else
format.html { render :edit }
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @house_hunter.update(house_hunter_params)\n format.html { redirect_to @house_hunter, notice: 'House hunter was successfully updated.' }\n format.json { render :show, status: :ok, location: @house_hunter }\n else\n format.html { render :edit... | [
"0.7068131",
"0.66875845",
"0.6623114",
"0.66165423",
"0.65597063",
"0.6519191",
"0.6492435",
"0.64808273",
"0.64491296",
"0.6409535",
"0.640792",
"0.63977623",
"0.63977623",
"0.63820124",
"0.6360599",
"0.634651",
"0.6324198",
"0.6298776",
"0.6298776",
"0.62983567",
"0.627533... | 0.71200204 | 0 |
DELETE /house_hunters/1 DELETE /house_hunters/1.json | def destroy
@house_hunter.destroy
respond_to do |format|
format.html { redirect_to root_path, notice: 'House hunter was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @house_hunter.destroy\n respond_to do |format|\n format.html { redirect_to house_hunters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @house_hunter.destroy\n respond_to do |format|\n format.html { redirect_to house_hunters_url, notice: 'House ... | [
"0.7633265",
"0.73863447",
"0.7205928",
"0.7160268",
"0.7135432",
"0.7135432",
"0.7133451",
"0.7133451",
"0.71088475",
"0.7086809",
"0.70258176",
"0.6989844",
"0.6988664",
"0.69863254",
"0.6974333",
"0.69658655",
"0.6960237",
"0.6959838",
"0.69542986",
"0.69542986",
"0.695429... | 0.7367017 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_house_hunter
@house_hunter = HouseHunter.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 house_hunter_params
params.require(:house_hunter).permit(:preferred_contact, :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.69795185",
"0.6782116",
"0.6745877",
"0.6742722",
"0.67368543",
"0.65932566",
"0.65048057",
"0.6497429",
"0.6481512",
"0.6478456",
"0.6455591",
"0.64391",
"0.6379068",
"0.6376498",
"0.636542",
"0.632084",
"0.630046",
"0.62998945",
"0.62943697",
"0.6293775",
"0.629097",
"... | 0.0 | -1 |
Cannot hook into this method without :prepend. | def include(*others)
IncludesTracker.reset!
__orig_include(*others)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepended(*args)\n quando_preposto *args\n end",
"def prepend_before(*args, &proc)\n add_callback(:prepend_before, *args, &proc)\n end",
"def prepend(root); end",
"def prepended(base = nil, &block)\n if base.nil?\n if instance_variable_defined?(:@_prepended_block)\n ... | [
"0.7653809",
"0.74940413",
"0.7042033",
"0.69003636",
"0.6892306",
"0.6888927",
"0.68727446",
"0.68466866",
"0.6835633",
"0.6775052",
"0.67177945",
"0.6703324",
"0.66571975",
"0.6637985",
"0.6637005",
"0.65812206",
"0.6555912",
"0.64854664",
"0.64807075",
"0.6470117",
"0.6446... | 0.0 | -1 |
input The String/Array that will be measured. Examples empty("Apa") => false Return true if the String or Array are longer than 0. | def empty(input)
string = input.to_s
if string.length != 0
return false
else
return true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_empty_strings(array)\narray.count \"\"\nend",
"def is_empty()\n if @length == 0\n true\n else\n false\n end\n end",
"def all_empty?(words = [])\n # words.all? { |word| word == '' }\n # words.all?(&:empty?)\n # words.reduce(:+).gsub(' ', ''... | [
"0.67761534",
"0.6724663",
"0.6661503",
"0.6622636",
"0.660537",
"0.6579932",
"0.65777576",
"0.65777576",
"0.65777576",
"0.65777576",
"0.6570684",
"0.6567982",
"0.65108323",
"0.65089524",
"0.6505187",
"0.6498694",
"0.64918095",
"0.6478293",
"0.64564013",
"0.64562404",
"0.6451... | 0.6831944 | 0 |
Storage size metrics (from dbStats) for WiredTiger | def run
d,c,sum,tot=0
memtotal=`grep MemTotal /proc/meminfo`
x=memtotal.split(" ")
ramsize=x[1].to_i
datasize=`mongo --eval "printjson(db.stats().dataSize)"`
indexsize=`mongo --eval "printjson(db.stats().indexSize)"`
datasize.each_line do |line|
d=line if line.match /^[0-9]*/
end
indexsize.each_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storage_throughput\n data[:storage_throughput]\n end",
"def size\n\t\tstat[:size]\n\tend",
"def size\n\t\tstat[:size]\n\tend",
"def s3_storage_used\n bytes = contents.sum(:size)\n backup_sources.gmail.each do |gmail|\n bytes += gmail.backup_emails.sum(:size)\n end\n # TODO: move ... | [
"0.72338873",
"0.717856",
"0.717856",
"0.71233153",
"0.706771",
"0.706146",
"0.7048274",
"0.70285285",
"0.70284384",
"0.6979425",
"0.6979187",
"0.6931557",
"0.6931557",
"0.6896512",
"0.6846179",
"0.6846179",
"0.6834863",
"0.681132",
"0.681132",
"0.6797786",
"0.6797786",
"0.... | 0.0 | -1 |
cpi_metadata_version must be an integer | def remove_vm_from_server_pools(vm_ip, vm_cid, cpi_metadata_version)
policy_load_balancer_pools_api.list_lb_pools.results.each do |server_pool|
original_size = server_pool.members&.length
server_pool.members&.each do |member|
if member.ip_address == vm_ip && ((cpi_metadata_version > 0 &&... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cloudversion\n clouddata && clouddata['version']\n end",
"def client_meta_version(version)\n regexp = /^([0-9]+\\.[0-9]+\\.[0-9]+)(\\.?[a-z0-9.-]+)?$/\n match = version.match(regexp)\n return \"#{match[1]}p\" if (match[2])\n\n version\n end",
"def validate_version(v... | [
"0.61762315",
"0.5803519",
"0.5703459",
"0.5682306",
"0.56084365",
"0.5590774",
"0.5585846",
"0.55773944",
"0.5564858",
"0.5556696",
"0.55469346",
"0.5527729",
"0.55155927",
"0.55089724",
"0.55089724",
"0.55089724",
"0.55089724",
"0.55089724",
"0.55089724",
"0.55089724",
"0.5... | 0.0 | -1 |
We don't page here but extremely unlikely to hit the pagination limit. | def retrieve_groups_by_name(group_display_names)
logger.info("Searching for Policy Groups with group display names: #{group_display_names}")
query = "resource_type:Group AND display_name:(#{group_display_names.join(" OR ")})"
search_api.query_search(query).results.map { |group_attrs| NSXTPolicy::Group... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginate; false; end",
"def paginated?\n false\n end",
"def pagination_needed?\n # Using #to_a stops active record trying to be clever\n # by converting queries to select count(*)s which then need to be repeated.\n @pagination_needed ||= primary_records.to_a.size > API_PAGE_SIZE\n end",
... | [
"0.7463406",
"0.72226804",
"0.6976403",
"0.6975436",
"0.6827927",
"0.6818018",
"0.6818018",
"0.6790242",
"0.676137",
"0.6747318",
"0.6745165",
"0.6741341",
"0.6701996",
"0.6688085",
"0.66862804",
"0.667221",
"0.6669084",
"0.66534686",
"0.66025436",
"0.6585764",
"0.6574546",
... | 0.0 | -1 |
We don't page here but extremely unlikely to hit the pagination limit. | def retrieve_groups_by_id(group_ids)
logger.info("Searching for Policy Groups with group ids: #{group_ids}")
query = "resource_type:Group AND id:(#{group_ids.join(" OR ")})"
search_api.query_search(query).results.map { |group_attrs| NSXTPolicy::Group.new(group_attrs) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginate; false; end",
"def paginated?\n false\n end",
"def pagination_needed?\n # Using #to_a stops active record trying to be clever\n # by converting queries to select count(*)s which then need to be repeated.\n @pagination_needed ||= primary_records.to_a.size > API_PAGE_SIZE\n end",
... | [
"0.7462328",
"0.7222394",
"0.6975485",
"0.69738317",
"0.68270725",
"0.6817851",
"0.6817851",
"0.67887574",
"0.67630506",
"0.67469037",
"0.6745208",
"0.6742199",
"0.67017174",
"0.66897666",
"0.66857845",
"0.66711414",
"0.666942",
"0.6653137",
"0.6604175",
"0.65843403",
"0.6573... | 0.0 | -1 |
GET /places/new GET /places/new.xml | def new
@place = Place.new
@title = "ახალი თარო"
session[:parent_id] = request[:parent_id]
if session[:parent_id]
@parent = Place.find(session[:parent_id])
end
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @place }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end",
"def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n ... | [
"0.7613996",
"0.7613996",
"0.7613996",
"0.7613996",
"0.7613996",
"0.7613996",
"0.7613996",
"0.716494",
"0.7062261",
"0.6932915",
"0.6932915",
"0.6932915",
"0.6932915",
"0.6932915",
"0.6906458",
"0.6868213",
"0.6797576",
"0.6737173",
"0.6726323",
"0.6692102",
"0.6675265",
"0... | 0.0 | -1 |
POST /places POST /places.xml | def create
@title = "ახალი თარო"
@place = Place.new(params[:place])
if session[:parent_id]
@parent = Place.find(session[:parent_id])
@place.parent = @parent
end
respond_to do |format|
if @place.save
flash[:notice] = "თარო #{@place.name} შექმნილია."
format.html { re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to(@place, :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html... | [
"0.61959743",
"0.61500394",
"0.61500394",
"0.6100632",
"0.60774857",
"0.60307026",
"0.5999663",
"0.5840357",
"0.5824058",
"0.57559174",
"0.57348144",
"0.57301897",
"0.5728085",
"0.5728085",
"0.5728085",
"0.5715726",
"0.5707649",
"0.5707487",
"0.5707487",
"0.5707487",
"0.57074... | 0.0 | -1 |
PUT /places/1 PUT /places/1.xml | def update
@place = Place.find(params[:id])
@title = "თაროს რედაქტირება"
respond_to do |format|
if @place.update_attributes(params[:place])
flash[:notice] = "თარო #{@place.name} განახლებულია."
format.html { redirect_to(:action=>'index', :parent_id => (@place.parent ? @place.parent : n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @place = @event.places.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n ... | [
"0.6676605",
"0.6421562",
"0.64040625",
"0.64040625",
"0.64040625",
"0.6393167",
"0.6391931",
"0.6391931",
"0.6365052",
"0.6226926",
"0.6151185",
"0.60688704",
"0.6041418",
"0.6041418",
"0.6041418",
"0.6041418",
"0.6041418",
"0.6040146",
"0.59661645",
"0.5952303",
"0.5890466"... | 0.54498935 | 62 |
DELETE /places/1 DELETE /places/1.xml | def destroy
@place = Place.find(params[:id])
parent = @place.parent
# შევამოწმოთ, არის თუ არა ეს თარო ცარიელი
if @place.children.empty? and @place.books.empty?
@place.destroy
else
flash[:notice] = 'ეს თარო არ არის ცარიელი.'
end
# გამოტანა იგივე გვერდის, სადაც ეს თარო იყო განთავ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to(places_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.h... | [
"0.7032682",
"0.7032682",
"0.7032682",
"0.7032682",
"0.7032682",
"0.7032682",
"0.7032682",
"0.7019525",
"0.67803085",
"0.6702724",
"0.67005825",
"0.66454726",
"0.6605662",
"0.6551402",
"0.6547136",
"0.65405244",
"0.65173507",
"0.6481668",
"0.64708424",
"0.6451609",
"0.6409846... | 0.6242554 | 37 |
Post are not displayed on their own. Showing one will jump to the post inside its topic | def show
post = Post.find(params[:id])
redirect_to post.permalink
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n index = Post.where(topic_id: @post.topic_id).order('created_at ASC').index(@post)\n page = index/Post.per_page + 1\n url = forum_topic_path(@post.topic.forum_id, @post.topic)\n anchor = \"post_#{@post.id}\"\n redirect_to \"#{url}?page=#{page}##{anchor}\"\n end",
"def show\n topic = ... | [
"0.756587",
"0.7236729",
"0.7235935",
"0.7110514",
"0.7096919",
"0.7091132",
"0.6929929",
"0.69175637",
"0.68619776",
"0.68346435",
"0.68127954",
"0.674491",
"0.6725069",
"0.6698062",
"0.66603476",
"0.6653277",
"0.65727955",
"0.6570791",
"0.65637755",
"0.65504575",
"0.6538965... | 0.0 | -1 |
Determine if user can post | def check_permission
# Check if user is signed in
signed_in_user
if (params[:topic_id]).nil?
topic = Post.find(params[:id]).topic
else
topic = Topic.find(params[:topic_id])
end
# Admins have unlimited power
if !current_user_is_admin?
# Moderators... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_manage_post\n raise ActionController::RoutingError 'Forbidden' if current_user.nil? || cannot?(:manage, @post)\n true\n end",
"def canManagePost(user)\n\t \t\t\t\n\t \t\t\tif user.nil? \n\t \t\t\t\treturn false\n\t \t\t\tend\n\n\t \t\t\tif user.has_role?(:admin)\n\t \t\t\t\treturn true\n\t ... | [
"0.82959783",
"0.79293257",
"0.7727284",
"0.74071515",
"0.7325766",
"0.72250354",
"0.7193804",
"0.713455",
"0.71017873",
"0.70938706",
"0.7068822",
"0.7060426",
"0.7060426",
"0.7012916",
"0.70061255",
"0.6983735",
"0.69392097",
"0.6932338",
"0.69195086",
"0.6860686",
"0.68271... | 0.6712273 | 25 |
Initialize a new game. | def index
@board = Board.new([1,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
session[:state] = @board.state
redirect_to action: 'show'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init\n\t\t@state = NewGame.new(self)\n\t\t# Deck.create({:game => self})\n\tend",
"def begin_game\n\t\t#Does this need really to be stored in a variable?\n\t\tg = Game.new(@name)\n\tend",
"def initialize\n Game.engine.draw(Game.engine.markdown.parse('# Bandit Mayhem'))\n selection = Game.engine.p... | [
"0.78444105",
"0.7768023",
"0.75714105",
"0.75459856",
"0.7321161",
"0.72556776",
"0.7093354",
"0.70714545",
"0.7070737",
"0.7056492",
"0.704281",
"0.7037558",
"0.70243984",
"0.70164996",
"0.69862443",
"0.6983065",
"0.69785804",
"0.69051796",
"0.6902496",
"0.68749774",
"0.684... | 0.0 | -1 |
Show valid moves defined for Board model. | def show_valid_moves
@board = Board.new(session[:state])
@board.show_valid_moves
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_moves\n\n end",
"def display_invalid_move_error\n puts \"That column is full.\"\n @board.display\n end",
"def valid_move?(move)\n # Array of all posiible moves , check the board and map out the possible moves from there.\n end",
"def available_moves\n @board.reject { |x| x.is_... | [
"0.7176869",
"0.7006102",
"0.6961959",
"0.6844133",
"0.6761317",
"0.67351884",
"0.67319614",
"0.67212355",
"0.6668746",
"0.6642067",
"0.6603043",
"0.658854",
"0.6572299",
"0.65683675",
"0.6564925",
"0.654919",
"0.65241945",
"0.648228",
"0.6469506",
"0.6451787",
"0.6437921",
... | 0.8579408 | 0 |
Set State No Peg In Top Position. | def set_state_top
session[:state] = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
flash[:success] = 'State changed successfully.'
redirect_to action: 'show'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assume_top_position\n update_attribute(:position, 1)\n end",
"def assume_top_position\n set_my_position(1)\n end",
"def assume_top_position\n set_my_position(1)\n end",
"def assume_top_position\n update_attribute(position_column, 1)\n end",
"def o... | [
"0.68170434",
"0.67078376",
"0.67078376",
"0.6430968",
"0.6350321",
"0.6197296",
"0.6088378",
"0.60851866",
"0.6066709",
"0.6066423",
"0.60470706",
"0.5998383",
"0.59773415",
"0.5973464",
"0.5870588",
"0.5861234",
"0.5824996",
"0.57742023",
"0.5741694",
"0.5696268",
"0.567702... | 0.6381194 | 4 |
Set State No Peg In Bottom Right Position. | def set_state_right
session[:state] = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]
flash[:success] = 'State changed successfully.'
redirect_to action: 'show'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right!(position_of_empty_tile)\n @state_array[position_of_empty_tile] = @state_array[position_of_empty_tile + 1]\n @state_array[position_of_empty_tile + 1] = @@empty\n @path += \"L\"\n self\n end",
"def bottomright=(bottomright)\n raise ArgumentError, \"Rect#bottomright= takes an Array of for... | [
"0.5922671",
"0.5869209",
"0.56795806",
"0.5660152",
"0.5660152",
"0.5523571",
"0.5505513",
"0.5496393",
"0.54905754",
"0.54686034",
"0.54467505",
"0.5401986",
"0.5324025",
"0.5307739",
"0.5299499",
"0.5283724",
"0.52745664",
"0.5271876",
"0.52476627",
"0.5243851",
"0.5216031... | 0.5032929 | 38 |
Set State No Peg In Bottom Left Position. | def set_state_left
session[:state] = [0,0,0,0,0,0,0,0,0,0,1,0,0,0,0]
flash[:success] = 'State changed successfully.'
redirect_to action: 'show'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left!(position_of_empty_tile)\n @state_array[position_of_empty_tile]=@state_array[position_of_empty_tile - 1]\n @state_array[position_of_empty_tile - 1] = @@empty\n @path += \"R\"\n self\n end",
"def assume_top_position\n update_attribute(:position, 1)\n end",
"def left\n ... | [
"0.60106677",
"0.5765162",
"0.5683258",
"0.56326383",
"0.5615495",
"0.56123084",
"0.5603155",
"0.5603155",
"0.55846006",
"0.557374",
"0.55650896",
"0.55650896",
"0.55581397",
"0.55289465",
"0.55289465",
"0.55176544",
"0.5488041",
"0.5471081",
"0.5466471",
"0.5466471",
"0.5452... | 0.52857584 | 30 |
Set Multiple Random Missing Peg Positions. | def set_state_random_all
session[:state] = [rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2)]
flash[:success] = 'State changed successfully.'
redirect_to action: 'show'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_random(n)\n n.times do\n set(rand(0...@x_size), rand(0...@y_size), :alive)\n end\n end",
"def fill_randomly\n #find which positions to fill\n self.players.each{|p| self.remove_player(p) }\n positions = self.position_array\n pos_taken = self.rosters_players.collect(&:position)... | [
"0.6604389",
"0.63040394",
"0.62058485",
"0.6103273",
"0.5950324",
"0.586703",
"0.5837898",
"0.5783013",
"0.56896394",
"0.56776863",
"0.5653256",
"0.56130254",
"0.5597196",
"0.5569279",
"0.5553283",
"0.5539938",
"0.55389917",
"0.55055916",
"0.5493102",
"0.54670864",
"0.546690... | 0.0 | -1 |
Set Single Random Missing Peg Position. | def set_state_random_single
random_state = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
random_state[rand(15)] = 1
session[:state] = random_state
flash[:success] = 'State changed successfully.'
redirect_to action: 'show'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_new_position\r\n\t\tloc_position = prng.rand(4)\r\n\t\treturn loc_position\r\n\r\n\tend",
"def initialize(position_variation = 1..100)\n @position = rand(position_variation)\n end",
"def meta_random_location(array)\n @plataforma_meta.x = array[0]\n @plataforma_meta.y = array[1] + 45\n end",
... | [
"0.63838995",
"0.620599",
"0.61601645",
"0.6121447",
"0.590062",
"0.58238",
"0.578919",
"0.5768939",
"0.57145005",
"0.5694159",
"0.5687927",
"0.56429213",
"0.5631952",
"0.55917215",
"0.5576027",
"0.5576027",
"0.5576027",
"0.5576027",
"0.54296",
"0.54131645",
"0.5410609",
"0... | 0.0 | -1 |
Handle end of game loser. | def game_over_lose
flash[:error] = 'Game Over: Better Luck Next Time!'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_game\n\n end",
"def end_game\n end",
"def end_game\r\n @game_over = true\r\n end",
"def end_game()\n get_winners()\n end",
"def end_game\n @state = 'stop'\n @winner = true\n get_winning_player\n puts \"================ ===================== ===================\"\... | [
"0.7803581",
"0.78009707",
"0.7779037",
"0.74967176",
"0.73998845",
"0.73101777",
"0.7254677",
"0.7215985",
"0.7209252",
"0.7204521",
"0.70817345",
"0.70817345",
"0.7032595",
"0.70249295",
"0.70174557",
"0.699169",
"0.69783145",
"0.6968123",
"0.69005543",
"0.6879241",
"0.6866... | 0.6057751 | 94 |
Handle end of game winner | def game_over_win
flash[:success] = 'Game Over: Great Job, You Won!'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_of_game_logic\n check_and_manage_winner\n show_winner_and_scores\n new_round?\n end",
"def end_game\n @state = 'stop'\n @winner = true\n get_winning_player\n puts \"================ ===================== ===================\"\n puts \"-------------------- GAME OVER! _... | [
"0.8174524",
"0.79474056",
"0.792978",
"0.79041255",
"0.7804022",
"0.7798508",
"0.7768736",
"0.76215255",
"0.7606825",
"0.7603778",
"0.75938636",
"0.75257206",
"0.74467444",
"0.73974264",
"0.7361337",
"0.7333004",
"0.731628",
"0.72723347",
"0.726562",
"0.7249203",
"0.7240522"... | 0.0 | -1 |
your code goes here | def begins_with_r(arr)
arr.each do |word|
if word[0] != 'r'
return false
end
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply\n\t\t\t\t\n\t\t\tend",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run\n end",
"def run\n \n end",
"def run\n \n end",
"def run\n end",
"def custom; end"... | [
"0.6193367",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.6169166",
"0.6124124",
"0.6124124",
"0.6094903",
"0.60627353",
"0.60627353",
"0.5983734",
"0.5979919",
"0.5979919",
"0.5897549",
"0.58... | 0.0 | -1 |
Check if a move is starpoint | def starpoint?(move)
if !move.is_a? Hash
raise "move param must be a Hash"
end
if move[:x] == 3 and move[:y] == 3
return true
elsif move[:x] == 15 and move[:y] == 3
return true
elsif move[:x] == 3 and move[:y] == 15
return true
elsif move[:x] == 15 and move[:y] == 15
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moving?\n !@start_move\n end",
"def standard_move?(x,y)\n return (x_diff(x) == 0) && (y_diff(y) == 1)\n end",
"def hit?(actual_move)\n return false unless self.length > 1\n\n with(self[0]) do |expected|\n return true if expected == \"*\"\n return true if expected == actual_move.nota... | [
"0.7176717",
"0.7170199",
"0.7155812",
"0.704751",
"0.7013077",
"0.6973092",
"0.69267166",
"0.6926575",
"0.6919552",
"0.69185555",
"0.6912796",
"0.67298704",
"0.6728055",
"0.67266166",
"0.66911316",
"0.66875076",
"0.66382474",
"0.6633947",
"0.6633361",
"0.66236997",
"0.661550... | 0.83066547 | 0 |
Returns a new relation, which includes results not matching any of the conditions passed as parameters. It's the negative version of any_of. This will return all active users : banned_users = User.where(banned: true) unconfirmed_users = User.where("confirmed_at IS NULL") active_users = User.where.none_of(banned_users, ... | def none_of(*queries)
raise ArgumentError, 'Called none_of() with no arguments.' if queries.none?
AlternativeBuilder.new(:negative, @scope, *queries).build
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users_not_responding\n # subscriptions_user_ids = self.plan_subscriptions.map {|subscription| subscription.user.id }\n subscribers_user_ids = subscribers.pluck(:id) #subscribers.map {|user| user.id }\n return group.users if subscribers_user_ids.empty?\n group.users.where('id NOT IN (?)',subscribe... | [
"0.62037027",
"0.6143557",
"0.6036331",
"0.5990209",
"0.59798205",
"0.5977817",
"0.59337837",
"0.5933344",
"0.5904512",
"0.5896091",
"0.5895142",
"0.58450234",
"0.5832362",
"0.5809161",
"0.58043796",
"0.57999086",
"0.577459",
"0.5771072",
"0.57599103",
"0.5759547",
"0.5756875... | 0.5314244 | 60 |
create function that checks the user input and filters it | def checkUserInputForCreateMenu(arr)
#initialize mainmenu selection characters array
@mainMenuCharSelection = ["p","v"];
#check user input for input validation
if(@mainMenuCharSelection.include? @userInput.downcase)
case @userInput.downcase
when "p"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_argument; end",
"def filter\n print 'Enter keywords(if no keyword press enter): '\n data = []\n data.push gets.chomp\n print 'Would you like to filter by Off Campus[Y/N]: '\n data.push gets.chomp.eql? 'Y'\n print 'Would you like to filter by On Campus[Y/N]: '\n data.push gets.chomp.eql? 'Y'\n ... | [
"0.7148634",
"0.6803682",
"0.67330474",
"0.6690832",
"0.6690832",
"0.66445965",
"0.6531638",
"0.649259",
"0.6358501",
"0.62528116",
"0.62528116",
"0.62528116",
"0.62426984",
"0.62389076",
"0.6157761",
"0.611217",
"0.6076805",
"0.60696185",
"0.60682726",
"0.60489494",
"0.59826... | 0.56196856 | 59 |
GET /themes GET /themes.xml | def index
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @themes }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_themes(options={})\n url = build_url options\n themes = Nokogiri::XML(open(url)).search('//item').map do |item|\n Kuler::Theme.new item.at('./kuler:themeItem')\n end\n themes\n end",
"def get_theme\n respond theme, 200, {'Content-Type' => 'text/plain'}\n end",
"def index\n @t... | [
"0.7430709",
"0.73719746",
"0.7194758",
"0.7143966",
"0.6714527",
"0.64748365",
"0.64463645",
"0.6441294",
"0.643904",
"0.643904",
"0.6425727",
"0.64091504",
"0.63848025",
"0.62058264",
"0.61682",
"0.60589546",
"0.6033907",
"0.6033907",
"0.6033907",
"0.6024005",
"0.5990004",
... | 0.7292159 | 2 |
GET /themes/1 GET /themes/1.xml | def show
redirect_to themes_path(:id => @theme)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @themes }\n end\n end",
"def get_theme\n respond theme, 200, {'Content-Type' => 'text/plain'}\n end",
"def index\n @themes = TemplateTheme.all\n\n respond_to do |format|\n format.htm... | [
"0.7395619",
"0.7280282",
"0.71937466",
"0.6894261",
"0.68259233",
"0.66947204",
"0.65454555",
"0.6454366",
"0.6454366",
"0.6453106",
"0.6449378",
"0.64396703",
"0.6413466",
"0.6358081",
"0.6224285",
"0.62233263",
"0.6193938",
"0.60617656",
"0.60617656",
"0.60617656",
"0.6021... | 0.58021367 | 32 |
GET /themes/new GET /themes/new.xml | def new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @theme }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @theme = TemplateTheme.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @theme }\n end\n end",
"def new\n @theme = Theme.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render :json => @theme }\n... | [
"0.76062775",
"0.71523935",
"0.71228015",
"0.71228015",
"0.7096578",
"0.7092687",
"0.709037",
"0.680255",
"0.66229147",
"0.6582686",
"0.6503962",
"0.6476862",
"0.64181423",
"0.63636595",
"0.63448954",
"0.63417506",
"0.62873954",
"0.6287337",
"0.6280066",
"0.6278524",
"0.62336... | 0.7651869 | 0 |
POST /themes POST /themes.xml | def create
@theme = Theme.new(params[:theme])
@copy_theme = Theme.find_by_id(params[:copy_theme_id])
if @copy_theme
@theme.clone_colors_from(@copy_theme)
end
respond_to do |format|
if @theme.save
flash[:notice] = 'Theme was successfully created.'
format.html { redirect_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @theme = Theme.new(params[:theme])\n\n respond_to do |format|\n if @theme.save\n format.html { redirect_to @theme, notice: 'Theme was successfully created.' }\n format.json { render json: @theme, status: :created, location: @theme }\n else\n format.html { render ac... | [
"0.6442856",
"0.6387142",
"0.63795745",
"0.63402885",
"0.6335914",
"0.6317102",
"0.62739366",
"0.6244091",
"0.62145",
"0.6188589",
"0.61448604",
"0.61064625",
"0.6072069",
"0.60536337",
"0.6024969",
"0.5946559",
"0.5941295",
"0.58683795",
"0.5861674",
"0.5859088",
"0.5806215"... | 0.57589036 | 28 |
PUT /themes/1 PUT /themes/1.xml | def update
respond_to do |format|
if @theme.update_attributes(params[:theme])
flash[:notice] = 'Theme was successfully updated.'
format.html { redirect_to(@theme) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml =>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @theme = TemplateTheme.find(params[:id])\n\n respond_to do |format|\n if @theme.update_attributes(params[:theme])\n format.html { redirect_to(@theme, :notice => 'TemplateTheme was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :a... | [
"0.6534107",
"0.65016615",
"0.65016615",
"0.65016615",
"0.63430786",
"0.632432",
"0.6322112",
"0.6256621",
"0.6227445",
"0.621628",
"0.62027586",
"0.61466265",
"0.60668546",
"0.6035064",
"0.6014366",
"0.5912914",
"0.58828783",
"0.5829411",
"0.58251786",
"0.5797758",
"0.572568... | 0.67131734 | 0 |
DELETE /themes/1 DELETE /themes/1.xml | def destroy
@theme.destroy
respond_to do |format|
format.html { redirect_to(themes_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @theme = TemplateTheme.find(params[:id])\n @theme.destroy\n\n respond_to do |format|\n format.html { redirect_to(template_themes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @theme = TemplateTheme.find(params[:id])\n @theme.destroy\n \... | [
"0.7311464",
"0.7244351",
"0.7168409",
"0.7074895",
"0.70585304",
"0.69420904",
"0.69311583",
"0.6883347",
"0.6877595",
"0.68503237",
"0.6830039",
"0.6830039",
"0.6743172",
"0.6741887",
"0.67390645",
"0.6662058",
"0.6603991",
"0.6546875",
"0.6483248",
"0.63164926",
"0.6282242... | 0.7532438 | 0 |
Display a report based on the entered userID POST /track_reports | def create
@report = Report.find_by(user_identifier: params[:victim_session][:user_identifier])
if @report
find_report @report #Call helper method to create session
redirect_to @report
else
flash.now[:danger] = 'User ID not found in the system'
render 'index'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_report\n report = User.find(params[:id]).reports.find(params[:r_id])\n render :json => report\n end",
"def show\n @saved_report = SavedReport.find_by_id( params[ :id ] )\n\n # Legacy report link, or missing / unauthorized report?\n\n if ( @saved_report.nil? && params.has_key?( :report ) ... | [
"0.7153967",
"0.70255893",
"0.7006519",
"0.69887567",
"0.69664806",
"0.6837396",
"0.6816685",
"0.68018967",
"0.6755563",
"0.66799533",
"0.6594979",
"0.6590974",
"0.6587032",
"0.6551674",
"0.65393263",
"0.65208924",
"0.6520081",
"0.65146685",
"0.6508163",
"0.64985585",
"0.6495... | 0.6561333 | 13 |
Show invalid properties with the reasons. Usually used together with valid? | def list_invalid_properties
invalid_properties = Array.new
return invalid_properties
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.... | [
"0.765058",
"0.765058",
"0.765058",
"0.765058",
"0.7638772",
"0.7638772",
"0.7638772",
"0.7638772",
"0.7638772",
"0.7638772",
"0.7638772",
"0.7638772",
"0.73569804",
"0.7336038",
"0.72692806",
"0.72394663",
"0.72318745",
"0.7226795",
"0.7209003",
"0.7177062",
"0.7171715",
"... | 0.0 | -1 |
Check to see if the all the properties in the model are valid | def valid?
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_properties\n true\n end",
"def validate_properties\n true\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :... | [
"0.78992486",
"0.78992486",
"0.70971805",
"0.70782334",
"0.7032205",
"0.7031276",
"0.69510347",
"0.6869891",
"0.6858077",
"0.6858077",
"0.68287027",
"0.6823878",
"0.6820306",
"0.68144894",
"0.6794656",
"0.6752167",
"0.66843414",
"0.6676546",
"0.6667755",
"0.66296124",
"0.6618... | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
cusip == o.cusip &&
ticker == o.ticker &&
security_name == o.security_name &&
security_type == o.security_type &&
title_of_class == o.title_of_class &&
stock_exchange == o.stock_excha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en... | [
"0.7291717",
"0.7188103",
"0.70395297",
"0.7007927",
"0.68874705",
"0.6861532",
"0.6707156",
"0.6660597",
"0.66147524",
"0.658478",
"0.6584619",
"0.6580019",
"0.65543133",
"0.6543933",
"0.65068495",
"0.6479513",
"0.6456241",
"0.6415999",
"0.6412208",
"0.6412208",
"0.6412208",... | 0.0 | -1 |
Calculates hash code according to all attributes. | def hash
[cusip, ticker, security_name, security_type, title_of_class, stock_exchange, filing_date, value, amount, type, investment_discretion, other_manager, sole_voting_authority, shared_voting_authority, no_voting_authority].hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ... | [
"0.71196765",
"0.70388246",
"0.70388246",
"0.70388246",
"0.70388246",
"0.70388246",
"0.70388246",
"0.70388246",
"0.6893673",
"0.6783645",
"0.67051166",
"0.6698055",
"0.6688322",
"0.6669119",
"0.648792",
"0.64605206",
"0.64605206",
"0.6443575",
"0.6411842",
"0.63952804",
"0.63... | 0.0 | -1 |
Builds the object from hash | def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end",
"def build_from_hash(attributes)\n\n end",
"def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ... | [
"0.8011192",
"0.74710494",
"0.745837",
"0.72571075",
"0.7244619",
"0.70055205",
"0.6972621",
"0.6954448",
"0.69452715",
"0.693933",
"0.6935897",
"0.6916681",
"0.6870851",
"0.67959535",
"0.6782485",
"0.6756477",
"0.6756477",
"0.67557365",
"0.6751677",
"0.67142427",
"0.6667296"... | 0.0 | -1 |
Deserializes the data based on type | def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s... | [
"0.7330926",
"0.7274019",
"0.72504056",
"0.7245751",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
... | 0.71796805 | 30 |
Returns the string representation of the object | def to_s
to_hash.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def serialize(object)\n object.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"de... | [
"0.901024",
"0.89506465",
"0.84703195",
"0.83409667",
"0.8337169",
"0.8337169",
"0.8332247",
"0.82546586",
"0.8145818",
"0.8144667",
"0.81357557",
"0.812714",
"0.8093436",
"0.8086725",
"0.8073356",
"0.8039774",
"0.80308646",
"0.80064154",
"0.80064154",
"0.80064154",
"0.800641... | 0.0 | -1 |
to_body is an alias to to_hash (backward compatibility) | def to_body
to_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_body\r\n to_hash\r\n end",
"def to_body\n to_hash\nend",
"def to_body\n to_hash\nend"
] | [
"0.8428273",
"0.8345093",
"0.8345093"
] | 0.0 | -1 |
Returns the object in the form of hash | def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n object\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n to_a.hash\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n return to_s.hash\n end",
"def hash\n @hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n ... | [
"0.8269158",
"0.7879479",
"0.78746766",
"0.7803831",
"0.7791617",
"0.77827746",
"0.7777764",
"0.7770165",
"0.7762157",
"0.7762157",
"0.77586275",
"0.77329206",
"0.77127856",
"0.77127856",
"0.77127856",
"0.77127856",
"0.77127856",
"0.77127856",
"0.77127856",
"0.77127856",
"0.7... | 0.0 | -1 |
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value | def _to_hash(value)
if value.is_a?(Array)
value.compact.map{ |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n value.hash\n end",
"def hash\n @value.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def to_hash\n @value\n end",
"def to_hash\n @va... | [
"0.6719518",
"0.6719518",
"0.666832",
"0.66565555",
"0.6586841",
"0.6452931",
"0.6414911",
"0.6414911",
"0.6382046",
"0.6346188",
"0.6302933",
"0.62237245",
"0.6151989",
"0.6101756",
"0.60795677",
"0.60795677",
"0.60717124",
"0.6035991",
"0.6021168",
"0.5936472",
"0.5903488",... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_podcast
@podcast = Podcast.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def podcast_params
params.fetch(:podcast, {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69480115",
"0.6813417",
"0.68023044",
"0.67950493",
"0.67457634",
"0.6741017",
"0.65274155",
"0.6519536",
"0.6491671",
"0.64317423",
"0.64317423",
"0.64317423",
"0.63975054",
"0.6354703",
"0.63543284",
"0.6346128",
"0.63437325",
"0.63382536",
"0.6327421",
"0.6327421",
"0.6... | 0.0 | -1 |
GET /guanliyuans GET /guanliyuans.json | def index
@guanliyuans = Guanliyuan.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end",
"def index\n @users = User.where(:alive => true).order(\"nick ASC\")\n @headline = t(:all_users)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render... | [
"0.6694335",
"0.6447366",
"0.6383447",
"0.6342811",
"0.6278281",
"0.62697077",
"0.62590194",
"0.6252092",
"0.62492716",
"0.62334657",
"0.6194163",
"0.61783355",
"0.6159699",
"0.61520284",
"0.61440676",
"0.6140691",
"0.6140643",
"0.61404353",
"0.61395264",
"0.61384255",
"0.612... | 0.626772 | 6 |
GET /guanliyuans/1 GET /guanliyuans/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end",
"def show\n @guille = Guille.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guille }\n end\n end",
"def index\n\t\... | [
"0.6742725",
"0.66397536",
"0.6531503",
"0.6520492",
"0.6520486",
"0.6475677",
"0.64664537",
"0.641569",
"0.63565147",
"0.6348822",
"0.6341104",
"0.6339987",
"0.6319159",
"0.6318077",
"0.6308008",
"0.63034016",
"0.6296962",
"0.6296185",
"0.62953466",
"0.62891215",
"0.62779325... | 0.0 | -1 |
POST /guanliyuans POST /guanliyuans.json | def create
@guanliyuan = Guanliyuan.new(guanliyuan_params)
respond_to do |format|
if @guanliyuan.save
format.html { redirect_to @guanliyuan, notice: 'Guanliyuan was successfully created.' }
format.json { render :show, status: :created, location: @guanliyuan }
else
format.htm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n \n\n respond_to do |format|\n if @huati.save\n format.html { redirect_to @huati, notice: 'Huati was successfully created.' }\n format.json { render json: @huati, status: :created, location: @huati }\n else\n format.html { render action: \"new\" }\n format.js... | [
"0.62403804",
"0.6211057",
"0.6142035",
"0.61334044",
"0.6108482",
"0.6084031",
"0.60666674",
"0.60644066",
"0.60290116",
"0.602378",
"0.60094637",
"0.60020703",
"0.59995484",
"0.59519416",
"0.59449047",
"0.5940435",
"0.5918782",
"0.59167475",
"0.59081495",
"0.59034747",
"0.5... | 0.64401597 | 0 |
PATCH/PUT /guanliyuans/1 PATCH/PUT /guanliyuans/1.json | def update
respond_to do |format|
if @guanliyuan.update(guanliyuan_params)
format.html { redirect_to @guanliyuan, notice: 'Guanliyuan was successfully updated.' }
format.json { render :show, status: :ok, location: @guanliyuan }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\... | [
"0.6820704",
"0.66128075",
"0.649736",
"0.6452147",
"0.64491594",
"0.6423935",
"0.6399075",
"0.63802177",
"0.63802177",
"0.6356793",
"0.63394094",
"0.63179934",
"0.6289511",
"0.6279642",
"0.62788343",
"0.62659156",
"0.62620276",
"0.62537205",
"0.6238869",
"0.6238869",
"0.6223... | 0.0 | -1 |
DELETE /guanliyuans/1 DELETE /guanliyuans/1.json | def destroy
@guanliyuan.destroy
respond_to do |format|
format.html { redirect_to guanliyuans_url, notice: 'Guanliyuan was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete path\n make_reque... | [
"0.73452514",
"0.7202696",
"0.71255505",
"0.71109736",
"0.71088994",
"0.7062426",
"0.7057843",
"0.7057843",
"0.7033374",
"0.7029797",
"0.7024818",
"0.7024818",
"0.70039725",
"0.698945",
"0.6986717",
"0.69829005",
"0.69829005",
"0.69829005",
"0.69829005",
"0.6934613",
"0.69331... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.