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 |
|---|---|---|---|---|---|---|
Return locale from link | def locale_from_link(link)
locale = link[/^https?:\/\/([^.]+)\./i, 1]
locale unless locale.nil? || locale == 'static'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_with_locale(url)\n params.to_unsafe_h.include?('locale') ? \"#{url}?locale=#{I18n.locale}\" : url\n end",
"def locale_switch_link(language)\n path = request.original_fullpath\n if params.to_unsafe_h.include? 'locale'\n path.gsub(%r{locale=#{I18n.locale}}, \"locale=#{language}\")\n elsi... | [
"0.827962",
"0.767623",
"0.752582",
"0.7270222",
"0.7101622",
"0.682049",
"0.68166006",
"0.675718",
"0.66870236",
"0.6672928",
"0.6565459",
"0.655827",
"0.6540271",
"0.6540271",
"0.6540271",
"0.6540271",
"0.6540271",
"0.6540271",
"0.6540271",
"0.6526807",
"0.6506178",
"0.64... | 0.73637575 | 4 |
Return locale from pair | def locale_from_pair(pair, domain: DEFAULT_DOMAIN)
code = pair.first
{
"name" => pair.last.strip,
"code" => code,
"url" => "https://#{code}.#{domain}"
} if code
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locale\r\n read_attribute(:locale).to_sym\r\n end",
"def locale\n return nil if errors\n\n locale = YAML.safe_load(@text).keys.first\n locale.to_sym\n end",
"def to_deepl_compatible_locale(locale)\n locale.to_s.split('-', 2).first.upcase\n end",
"def locale=(_arg0); end",
"def... | [
"0.7021401",
"0.6945439",
"0.683302",
"0.6739474",
"0.6729219",
"0.67016375",
"0.67016375",
"0.67016375",
"0.67016375",
"0.67016375",
"0.67016375",
"0.67016375",
"0.66707516",
"0.66526514",
"0.662541",
"0.64569855",
"0.64324355",
"0.6417554",
"0.6416193",
"0.64142066",
"0.641... | 0.7197514 | 0 |
GET /brew_types GET /brew_types.json | def index
@brew_types = BrewType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def types\n @client.make_request :get, reports_path\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q... | [
"0.66428286",
"0.65668905",
"0.63931304",
"0.6381003",
"0.62677246",
"0.6242897",
"0.61964154",
"0.6163651",
"0.6122317",
"0.61066794",
"0.6083829",
"0.60836464",
"0.6054346",
"0.6043692",
"0.60317147",
"0.6030043",
"0.60169756",
"0.6002035",
"0.59975785",
"0.5973191",
"0.596... | 0.7325401 | 0 |
GET /brew_types/1 GET /brew_types/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @brew_types = BrewType.all\n end",
"def set_brew_type\n @brew_type = BrewType.find(params[:id])\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"... | [
"0.7314619",
"0.6436385",
"0.635791",
"0.6335768",
"0.62963134",
"0.6288488",
"0.6252945",
"0.62352747",
"0.62175685",
"0.6190095",
"0.6190095",
"0.61661154",
"0.61385596",
"0.60535383",
"0.6020647",
"0.60198367",
"0.59421724",
"0.5916657",
"0.5916254",
"0.58986026",
"0.58896... | 0.0 | -1 |
POST /brew_types POST /brew_types.json | def create
@brew_type = BrewType.new(brew_type_params)
respond_to do |format|
if @brew_type.save
format.html { redirect_to @brew_type, notice: 'Brew type was successfully created.' }
format.json { render :show, status: :created, location: @brew_type }
else
format.html { rend... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def brew_type_params\n params.require(:brew_type).permit(:name, :description)\n end",
"def types\n commit('types', nil)\n end",
"def set_brew_type\n @brew_type = BrewType.find(params[:id])\n end",
"def create_break_type(body:)\n new_api_call_builder\n .request(new_request_... | [
"0.6680012",
"0.6227711",
"0.61330557",
"0.6092164",
"0.6032019",
"0.6032019",
"0.6023468",
"0.6023468",
"0.59973633",
"0.5932362",
"0.59323114",
"0.59212035",
"0.58085406",
"0.56935567",
"0.56932765",
"0.5667428",
"0.56498307",
"0.5631404",
"0.5629553",
"0.560729",
"0.556643... | 0.7090827 | 0 |
PATCH/PUT /brew_types/1 PATCH/PUT /brew_types/1.json | def update
respond_to do |format|
if @brew_type.update(brew_type_params)
format.html { redirect_to @brew_type, notice: 'Brew type was successfully updated.' }
format.json { render :show, status: :ok, location: @brew_type }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @type.update(type_params)\n end",
"def update_break_type(id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/labor/break-types/{id}',\n 'defaul... | [
"0.6370202",
"0.6350493",
"0.6277606",
"0.62628967",
"0.61491334",
"0.61452943",
"0.6144088",
"0.6144088",
"0.6144088",
"0.6144088",
"0.6144088",
"0.6144088",
"0.6144088",
"0.6144088",
"0.6144088",
"0.6144088",
"0.6144088",
"0.6144088",
"0.6144088",
"0.6144088",
"0.6144088",
... | 0.73024297 | 0 |
DELETE /brew_types/1 DELETE /brew_types/1.json | def destroy
@brew_type.destroy
respond_to do |format|
format.html { redirect_to brew_types_url, notice: 'Brew type was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @ref_mkb_type = Ref::MkbType.find(params[:id])\n @ref_mkb_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_mkb_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @yarn_type.destroy\n respond_to do |format|\n format.html { red... | [
"0.6614038",
"0.66031665",
"0.6587904",
"0.6568258",
"0.6520758",
"0.6500936",
"0.64969516",
"0.64410764",
"0.63748693",
"0.6370527",
"0.63535684",
"0.6340671",
"0.6330195",
"0.6312702",
"0.63111544",
"0.63031167",
"0.63019574",
"0.6283404",
"0.62755334",
"0.6273109",
"0.6269... | 0.7746984 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_brew_type
@brew_type = BrewType.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 brew_type_params
params.require(:brew_type).permit(:name, :description)
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 |
read JSON data from file | def read_json_file(filepath)
file = File.open(filepath)
file_data = file.read
return JSON.parse(file_data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read\n file = File.read(@filename)\n JSON.parse(file)\n end",
"def read_from_json\n JSON.parse File.new(@filepath).read\n end",
"def read\n return nil unless File.file?(\"./#{filename}\")\n JSON.parse(IO.read(filename))\n end",
"def parse json; return JSON.parse File.read js... | [
"0.85271066",
"0.83360934",
"0.8202789",
"0.81921184",
"0.81921184",
"0.805044",
"0.80276906",
"0.798526",
"0.7976192",
"0.79581374",
"0.7766101",
"0.7673162",
"0.76236045",
"0.7616556",
"0.7616556",
"0.75346076",
"0.7518859",
"0.7487628",
"0.74605674",
"0.7403171",
"0.736746... | 0.79193956 | 10 |
write JSON data to file | def write_json_file(json, filepath)
File.open(filepath,"w") do |f|
f.write(json.to_json)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_json(file)\n open(file, \"w\") do |io|\n \tio.write(JSON.pretty_generate(@data))\n end\n end",
"def generate_json(json_file_name, data)\n File.open(json_file_name, 'w') do |f|\n f.puts(data.to_json)\n end\n end",
"def save\n File.open(json_file, 'w') {|f| f.write(to... | [
"0.81612796",
"0.79975134",
"0.79593116",
"0.79593116",
"0.78159946",
"0.78158104",
"0.7798379",
"0.7700747",
"0.7649267",
"0.760684",
"0.75409454",
"0.75287616",
"0.75267005",
"0.75045604",
"0.749766",
"0.74747175",
"0.7459391",
"0.7441648",
"0.7416363",
"0.7407443",
"0.7387... | 0.81790173 | 0 |
[Create Assignment Story 4.27] To create a new testcase related to acertain problem. Parameters: new_test_case_params[]: parameters needed to save new test case. Returns: A message if the test case is saved or not Author: Nadine Adel | def create
@problem = AssignmentProblem.find_by_id(new_test_case_params[:assignment_problem_id])
@test_case = TestCase.new(new_test_case_params)
@test_case.input = new_test_case_params[:input]
@test_case.output = new_test_case_params[:output]
@test_case.assignment_problem_id = new_test_case_params[:assignment... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @test_case = TestCase.new(test_case_params)\n\n respond_to do |format|\n if @test_case.save\n TestMailer.admin_new_test_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully added.' }\n format.json { render actio... | [
"0.66262764",
"0.6518962",
"0.6460127",
"0.6457553",
"0.6428644",
"0.6347337",
"0.6158011",
"0.6097911",
"0.60784674",
"0.60361975",
"0.59561",
"0.58729947",
"0.5779193",
"0.5759032",
"0.5754775",
"0.56486505",
"0.5630211",
"0.5610779",
"0.5553916",
"0.5533302",
"0.5523723",
... | 0.6483269 | 2 |
Strips arguments and anchors from the given URL. | def _prepare( url )
url = super
if !self._strip!( url, '?' )
self._strip!( url, '#' )
end
url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_url(href)\n # TODO: A better way would be to split by / then take the last section, strip off the anchor then cgi escape\n URI.unescape(href.strip).gsub(\" \", \"%20\")\n end",
"def clean(url)\n url\n end",
"def remove_url_anchor url\n url.gsub!(/#.*/, '') if url =~ /#/\n url\nend"... | [
"0.6804149",
"0.679654",
"0.6739733",
"0.67246777",
"0.67098445",
"0.6671383",
"0.66604245",
"0.6659123",
"0.65413857",
"0.6537202",
"0.6531777",
"0.65287864",
"0.6521529",
"0.65068537",
"0.64832747",
"0.6478254",
"0.6452557",
"0.6415002",
"0.6411451",
"0.64014256",
"0.640061... | 0.610047 | 34 |
Strips the end of a string after a delimiter. | def _strip!( url, delimiter )
index = url.rindex( delimiter )
found = !index.is_nil?
if found
url = url[ 0..index ]
end
found
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def without_end(str)\n str[1...str.length - 1]\n end",
"def exclude_ends(str)\n str.slice(1,str.length-2)\n end",
"def strip_end(str)\n str.split('.')[0..-3].join('.')\nend",
"def stripped_step(step, left_delimiter, right_delimiter)\n unless left_delimiter.nil? || right_delimiter.nil?\n ... | [
"0.6563147",
"0.63675916",
"0.61974716",
"0.60766864",
"0.6007278",
"0.587374",
"0.586608",
"0.5853589",
"0.5847226",
"0.5844057",
"0.5801349",
"0.5773593",
"0.5763212",
"0.57214427",
"0.5706439",
"0.56955457",
"0.5682614",
"0.567829",
"0.567829",
"0.567829",
"0.567829",
"0... | 0.6710507 | 0 |
cars = 40 trucks = 15 Checks two conditionals with results and gives a result for anything else if cars > people puts "We should take the cars" elsif cars cars puts "That's too many trucks." elsif trucks trucks puts "Alright, let's just take the trucks." else puts "Fine, let's stay home then." end puts "You enter a dar... | def water_status(minutes)
if minutes < 7
puts "The water is not boiling yet."
elsif minutes == 7
puts "It's just barely boiling"
elsif minutes == 8
puts "It's boiling!"
else
puts "Hot! Hot! Hot!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crust\n\tprint \"what kind of crust would you like?\"\n\tcrust = gets.chomp\n\tif crust == (\"pan\" || \"hand tossed\" || \"thin\")\n\t\tputs \"sounds great!\"\n\telsif crust == \"whats good?\"\n\t\tputs \"I would suggest the traditional hand tossed\"\n\tend\nend",
"def garage\n prompt = TTY::Prompt.new\n... | [
"0.6552826",
"0.65164906",
"0.6510597",
"0.64913565",
"0.6466243",
"0.6436521",
"0.637201",
"0.6370517",
"0.636867",
"0.6315217",
"0.6292587",
"0.6289391",
"0.62850887",
"0.6258856",
"0.6257595",
"0.6234529",
"0.62337154",
"0.62312603",
"0.6173945",
"0.6159111",
"0.61577827",... | 0.0 | -1 |
Dispatch according to who is logged on | def index
if current_user.nil?
show_empty
elsif current_user.role.id == 1
show_analist
elsif current_user.role.id == 2
show_qa_analist
elsif current_user.role.id == 3
show_planner
elsif current_user.role.id == 5
show_admin
else
show_empty
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_to(who)\n case who\n when 'logged_in' then redirect_to root_path if !current_user\n when 'logged_out' then redirect_to home_path if current_user\n end\n end",
"def get_user_to_act_on\n @user = session[:user]\n end",
"def get_user_to_act_on\n @user = session[:user]\n end",
"... | [
"0.6216603",
"0.6147264",
"0.6147264",
"0.6105725",
"0.6064578",
"0.606288",
"0.60217494",
"0.60074955",
"0.5967818",
"0.5949514",
"0.5944843",
"0.58992696",
"0.586922",
"0.5868198",
"0.585089",
"0.5826947",
"0.580897",
"0.58010614",
"0.57959",
"0.5790955",
"0.5789966",
"0.... | 0.0 | -1 |
Nobody logged on show empty screen | def show_empty
screen_name("Inicial")
respond_to do |format|
format.html { render action: "show_empty" }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_log_show\n if !session[:user_id]\n flash[:notice] = \"Please log in or sign up!\"\n redirect_to root_path\n end\n end",
"def show\n redirect_to(default_url) unless logged_in? || User.count > 0\n @user = current_user\n end",
"def login_display\n\t\tsystem(\"clear\")\n puts ... | [
"0.7717658",
"0.6947773",
"0.6855001",
"0.6710698",
"0.66920364",
"0.66530657",
"0.66390544",
"0.66135806",
"0.66135806",
"0.66064245",
"0.6594313",
"0.6544497",
"0.6543747",
"0.6523706",
"0.65170205",
"0.64982605",
"0.64433026",
"0.64309055",
"0.6420441",
"0.64149225",
"0.64... | 0.6427112 | 18 |
Show QA analist's trays | def show_qa_analist
screen_name("Inicial-Analista-QA")
distribute_ots
respond_to do |format|
format.html { render action: "show_qa_analist" }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_status_bar_speech_menu_exammple\n m = menu do |main|\n main.item :speak, \n :on_action => proc { speech_synthesizer.speak('I have a lot to say.') }\n end\n status_item :title => 'Speech Demo', :menu => m\n end",
"def spawn_trayicon\n return nil if @ti\n @ti... | [
"0.5747982",
"0.5522262",
"0.54539305",
"0.53271717",
"0.523604",
"0.5212105",
"0.5212105",
"0.51573175",
"0.51205456",
"0.51056343",
"0.5102724",
"0.50491345",
"0.5047617",
"0.5044463",
"0.50373423",
"0.50109315",
"0.50063396",
"0.49742025",
"0.49590626",
"0.4950721",
"0.495... | 0.54425776 | 3 |
Show admin's trays, similar to planner's | def show_admin
screen_name("Inicial-Admin")
distribute_ots
respond_to do |format|
format.html { render action: "show_admin" }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin\n self.sitemap\n self.follow('dtime:dashboard:admin')\n self.get\n self\n end",
"def tip?\n admin.nobody?\n end",
"def admin_labels\n labels = []\n if admin?\n labels << \"Admin\"\n else\n labels << \"User Admin\" if user_admin?\n labels << \"Moderat... | [
"0.5664607",
"0.56581646",
"0.553435",
"0.55341315",
"0.549586",
"0.5423822",
"0.54012984",
"0.5363406",
"0.5337809",
"0.53377604",
"0.5325192",
"0.53125674",
"0.52997935",
"0.52796",
"0.5276623",
"0.52731234",
"0.52610505",
"0.5255766",
"0.52521956",
"0.52450055",
"0.5240584... | 0.5864928 | 0 |
Show a specific OT | def show_ot
screen_name("Mostrar-OT")
@ot = Ot.find(params[:ot_id])
@ot.mark_read
@am_results = AmResult.where("ot_id = #{@ot.id}").order("run_date DESC")
@observations = Observation.where("ot_id = #{@ot.id}")
@log = Audit.where("ot_id = #{@ot.id}").order("created_at DESC").paginate(:page => p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show() end",
"def show() end",
"def show() end",
"def show\n e = first_element('show')\n text = e ? e.text : nil\n case text\n when 'away' then :away\n when 'chat' then :chat\n when 'dnd' then :dnd\n when 'xa' then :xa\n else nil\n end\n end",
"... | [
"0.6328349",
"0.6328349",
"0.6328349",
"0.6322663",
"0.6272987",
"0.6267549",
"0.6264907",
"0.62314546",
"0.61997086",
"0.61997086",
"0.61997086",
"0.61997086",
"0.61997086",
"0.61997086",
"0.61997086",
"0.61997086",
"0.61997086",
"0.6173216",
"0.6128075",
"0.60413086",
"0.60... | 0.6245709 | 7 |
Since this isn't a real ActiveRecord object, we'll fake an ID for it: | def id
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def temp_id\n #reverting to just plain id, see issue #89\n self.id\n end",
"def real_id\n @id\n end",
"def real_id\n @id\n end",
"def id()\n #This is a stub, used for indexing\n end",
"def id\n __id\n end",
"def id; 1; end",
"def id; 1; end",
"def i... | [
"0.7707897",
"0.76205873",
"0.76205873",
"0.74119234",
"0.72540843",
"0.7188592",
"0.7136657",
"0.7075305",
"0.7075305",
"0.70603263",
"0.7002988",
"0.6998454",
"0.6986664",
"0.69852173",
"0.69439733",
"0.6928936",
"0.69172716",
"0.69172716",
"0.69172716",
"0.69172716",
"0.69... | 0.65021473 | 79 |
This object mutates the injected +context+ | def initialize(_, context = Ramom::Schema::Definition::Context.new)
super
infer_base_relations
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_context\n old_context = self.context\n self.context = self\n yield\n self.context = old_context\n end",
"def context=(ctx)\n @context = ctx\n end",
"def context=(ctx)\n @context.local = ctx\n end",
"def with_context\n self.context_cache = {}\n yield\n ... | [
"0.7217101",
"0.71705407",
"0.70663166",
"0.698738",
"0.69821286",
"0.6941642",
"0.6933885",
"0.69307023",
"0.6883554",
"0.6794607",
"0.67466265",
"0.6741398",
"0.67193854",
"0.66925997",
"0.6681005",
"0.6681005",
"0.6661895",
"0.6624254",
"0.65995675",
"0.65600085",
"0.65600... | 0.0 | -1 |
require 'debug' Part 1: fun with strings | def palindrome?( string )
word = string.downcase.gsub(/[^a-z]/, '')
if word == word.reverse
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug1(text) debug text, 1 end",
"def debug(s)\n\t#puts \"DEBUG: #{s}\"\nend",
"def debug_msg( str )\n puts str if @debug == true\n end",
"def debug string\n puts string if $DEBUG\nend",
"def debug(stuff)\n puts \"DEBUG: #{stuff}\"\nend",
"def debug(s) if $DEBUG then $stderr.print(\"#{s}\\n\")... | [
"0.7906329",
"0.7527135",
"0.7510128",
"0.7238498",
"0.7001266",
"0.700114",
"0.6874493",
"0.68252486",
"0.6806478",
"0.66715586",
"0.6646252",
"0.6587822",
"0.658495",
"0.657243",
"0.657243",
"0.6537987",
"0.65117973",
"0.6481988",
"0.6481988",
"0.6481988",
"0.64425313",
"... | 0.0 | -1 |
p palindrome?( "Madam, I'm Adam" ) p palindrome?( "Abracadabra" ) | def count_words( string )
h = Hash.new
arr = string.downcase.gsub(/[^a-z ]/, '').split.each { |word|
if h.include?( word )
h[word] = h[word].next
else
h[word] = 1
end
}
return h
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def real_palindrome?(string)\n remove_nonalphanumeric(string) # => nil, nil, \"MadamImAdam\", nil, nil, nil\n palindrome?(string.downcase) # => true, true, true, true, true, false\nend",
"def palindrome_word? word\n output = word.downcase\n output.reverse == output\nend",
"def palindrome_word?(word)\n ... | [
"0.83248615",
"0.8276021",
"0.8251576",
"0.8244882",
"0.8217902",
"0.8212577",
"0.8192724",
"0.8192524",
"0.8190654",
"0.8186755",
"0.81718194",
"0.8117172",
"0.81060565",
"0.8100573",
"0.80999684",
"0.80948377",
"0.80717593",
"0.806368",
"0.8048769",
"0.8039105",
"0.8034565"... | 0.0 | -1 |
Enqueues the ActiveJob job to be performed. For use by Rails; you should generally not call this directly. | def enqueue(active_job)
enqueue_at(active_job, nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enqueue!\n return nil unless persisted?\n \"#{job_type.camelize}Job\".constantize.perform_later(self)\n end",
"def enqueue\n # We need to save before passing to perform_later b/c perform_later will need our ID.\n # For this reason, the job_id col can't have a null constraint.\n save! unless p... | [
"0.7444212",
"0.74106634",
"0.7193566",
"0.69346946",
"0.6845125",
"0.6834059",
"0.66649455",
"0.66008127",
"0.6550908",
"0.6440803",
"0.642174",
"0.6411332",
"0.6355693",
"0.6351864",
"0.63091004",
"0.6302921",
"0.6260019",
"0.6230357",
"0.6213464",
"0.6199909",
"0.6193914",... | 0.7429919 | 1 |
Enqueues an ActiveJob job to be run at a specific time. For use by Rails; you should generally not call this directly. | def enqueue_at(active_job, timestamp)
good_job = GoodJob::Job.enqueue(
active_job,
scheduled_at: timestamp ? Time.zone.at(timestamp) : nil,
create_with_advisory_lock: execute_inline?
)
if execute_inline?
begin
good_job.perform
ensure
good_jo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enqueue_at(_job, _timestamp)\n raise NotImplementedError, 'This queueing backend does not support scheduling jobs.'\n end",
"def enque!(time = Time.now.utc)\n @last_enqueue_timestamp = time.to_i\n @next_enqueue_timestamp = calculate_next_enqueue_time(time).to_i\n\n save_enque... | [
"0.719611",
"0.71695125",
"0.713734",
"0.687987",
"0.6829343",
"0.6767677",
"0.67082757",
"0.66731036",
"0.6606888",
"0.6474301",
"0.64673185",
"0.64569056",
"0.64160097",
"0.62372875",
"0.62325954",
"0.6205709",
"0.6184837",
"0.6116544",
"0.6108359",
"0.6104258",
"0.60934705... | 0.7008541 | 3 |
Gracefully stop processing jobs. Waits for termination by default. | def shutdown(wait: true)
@notifier&.shutdown(wait: wait)
@poller&.shutdown(wait: wait)
@scheduler&.shutdown(wait: wait)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop\n log(:debug) { 'Graceful shutdown requested.' }\n\n @running = false\n idle.each { |worker| worker.terminate }\n idle.clear\n\n if busy.any?\n log(:debug) { \"Wait for #{busy.size} workers to terminate.\" }\n\n wait :shutdown\n end\n\n log(:debug) { 'Grace... | [
"0.7871233",
"0.71928495",
"0.715206",
"0.7138377",
"0.7116419",
"0.7088933",
"0.7074007",
"0.7027178",
"0.7006892",
"0.6952778",
"0.6898737",
"0.6870204",
"0.6815097",
"0.6780259",
"0.6769991",
"0.67530084",
"0.67373085",
"0.6711549",
"0.6682241",
"0.66336775",
"0.6603761",
... | 0.0 | -1 |
Whether in +:async+ execution mode. | def execute_async?
@execution_mode == :async
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def async?\n @args.include? :async\n end",
"def async?\n !!@async\n end",
"def async?\n false\n end",
"def asynchronous?() false end",
"def asynchronous?\n @asynchronous\n end",
"def async=(value)\n @async = value == true ? default_async_processor : value\n end",
... | [
"0.83806854",
"0.8241065",
"0.8227374",
"0.7751524",
"0.76365006",
"0.7465058",
"0.74065274",
"0.7307471",
"0.7188207",
"0.69277316",
"0.68821573",
"0.67304397",
"0.6707406",
"0.66592014",
"0.66517746",
"0.662054",
"0.6436043",
"0.6406316",
"0.63367796",
"0.6326986",
"0.62749... | 0.88489276 | 0 |
Whether in +:external+ execution mode. | def execute_externally?
@execution_mode == :external
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def external?\n @external\n end",
"def external?\n false\n end",
"def required_for_external?\n false\n end",
"def required_for_external?\n false\n end",
"def required_for_external?\n false\n end",
"def required_for_external?\n true\n end",
"def external?\n ... | [
"0.77206844",
"0.76570934",
"0.73758185",
"0.73758185",
"0.73758185",
"0.73023796",
"0.7299054",
"0.72512376",
"0.67063075",
"0.6492964",
"0.6357884",
"0.62808144",
"0.62321913",
"0.6231149",
"0.6165859",
"0.60814464",
"0.6075397",
"0.60150146",
"0.6006357",
"0.59693986",
"0.... | 0.8453291 | 0 |
Whether in +:inline+ execution mode. | def execute_inline?
@execution_mode == :inline
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inline?\n @test_mode == :inline\n end",
"def inline?; false; end",
"def inline?; false; end",
"def inline!\n @inline = true\n end",
"def inline?\n Resque.inline?\n end",
"def inline!(&block)\n switch_test_mode(:inline, &block)\n end",
"def all_inline?... | [
"0.8527812",
"0.77865154",
"0.77865154",
"0.754732",
"0.7386422",
"0.72487193",
"0.71070904",
"0.6961266",
"0.6866236",
"0.6681749",
"0.66790843",
"0.6521522",
"0.64917284",
"0.64091414",
"0.62466425",
"0.6242026",
"0.61321414",
"0.6118599",
"0.56809366",
"0.5644852",
"0.5615... | 0.90897894 | 0 |
(deprecated) Whether in +:inline+ execution mode. | def inline?
ActiveSupport::Deprecation.warn('GoodJob::Adapter::inline? is deprecated; use GoodJob::Adapter::execute_inline? instead')
execute_inline?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_inline?\n @execution_mode == :inline\n end",
"def inline?; false; end",
"def inline?; false; end",
"def inline?\n @test_mode == :inline\n end",
"def inline!\n @inline = true\n end",
"def inline!(&block)\n switch_test_mode(:inline, &block)\n end",
"def inl... | [
"0.86896527",
"0.79979897",
"0.79979897",
"0.7949692",
"0.7724741",
"0.7398801",
"0.7170127",
"0.70595175",
"0.6912895",
"0.6883417",
"0.66897714",
"0.62424767",
"0.61141366",
"0.6096753",
"0.60496193",
"0.6046464",
"0.5881088",
"0.56966543",
"0.568484",
"0.5650584",
"0.56505... | 0.7625708 | 5 |
creating data, to push for 100% code coverage. | def create_some_data
Sunspot.remove_all! # isn't always necessary
StudySubject.solr_reindex
assert StudySubject.search.hits.empty?
subject1 = FactoryBot.create(:complete_case_study_subject)
FactoryBot.create(:sample, :study_subject => subject1,
:sample_type => SampleType['marrowdiag'])
subject2 = Fac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_from_data\n data = @test_record.all_text\n \n creation_test do |record|\n record.create_from_data('', data)\n end\n end",
"def initialize_data\n end",
"def init_data\n end",
"def create(data)\n file = File.open(@file, \"w\")\n CSV(file, col_... | [
"0.6897121",
"0.6736473",
"0.6641226",
"0.6566496",
"0.65530777",
"0.65109885",
"0.64864963",
"0.6438453",
"0.6322008",
"0.62552494",
"0.62493086",
"0.6244924",
"0.62018883",
"0.6143998",
"0.6143998",
"0.6143998",
"0.6143998",
"0.6143998",
"0.6143998",
"0.6143998",
"0.6143998... | 0.63663864 | 8 |
Initialize OPSA object Example: >> OPSA.new(:lang => OPSA::Language.new) Arguments: params: (Hash) :language: OPSA::Language | def initialize(params)
if lang = params[:language]
@lang = lang
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(language)\r\n @lang = language\r\n end",
"def initialize(language)\r\n @lang = language\r\n end",
"def initialize(language)\n @lang = language\n end",
"def initialize(language = :english)\n @language = language\n end",
"def initialize(**args)\n @language = args[:language] ... | [
"0.76123846",
"0.76123846",
"0.757288",
"0.7339344",
"0.73328483",
"0.72936195",
"0.71063",
"0.69847155",
"0.6979877",
"0.67028147",
"0.6494502",
"0.6383111",
"0.6349092",
"0.62948567",
"0.6264719",
"0.62266606",
"0.6221345",
"0.62042165",
"0.6183862",
"0.6148369",
"0.6129922... | 0.76954556 | 0 |
Read words and process with OPSA::Language Example: >> robot = OPSA.new(:language => OPSA::Language.new) >> robot.r("echo:hello") Arguments: words: (String) | def r(words)
return @lang.input(words)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_words(text) #no!, two methods named get_words, see word_search.rb\n \twords = text.split('')\n \twords.each do |word|\n \t\t#how to check if word is correct or not?\n \t\tWord.new(name: word, ngsl: false, list: self.id )\n \t\t# example = Wordnik.word.get_top_example(word)['text']\n \tend\n end",
... | [
"0.6333936",
"0.60586876",
"0.60341835",
"0.6027323",
"0.59869725",
"0.5932032",
"0.5910944",
"0.58601934",
"0.5843454",
"0.5820627",
"0.58071923",
"0.5785785",
"0.57679075",
"0.5718852",
"0.5713107",
"0.5710198",
"0.5680381",
"0.56458426",
"0.5633247",
"0.5616642",
"0.560218... | 0.7583838 | 0 |
gor_quarters methods returns values for US fiscal year (10th month) otherwise it returns the values for Rwanda fiscal year | def build_rows(csv, activity)
if @is_budget
amount_q1 = activity.budget_gor_quarter(1)
amount_q2 = activity.budget_gor_quarter(2)
amount_q3 = activity.budget_gor_quarter(3)
amount_q4 = activity.budget_gor_quarter(4)
amount_total ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fiscal_years\n get_fiscal_years\n end",
"def current_quarter\n \n case self.month\n \n when 1..3 then 1\n when 4..6 then 2\n when 7..9 then 3\n else 4\n end\n \n end",
"def get_all_fiscal_years\n get_fiscal_years(Date.today - 4.years)\n end",
"def... | [
"0.70031047",
"0.6997714",
"0.67657113",
"0.6673369",
"0.659245",
"0.64090073",
"0.63293576",
"0.6301233",
"0.6295943",
"0.6288125",
"0.6254359",
"0.61979717",
"0.61865956",
"0.61773926",
"0.61762613",
"0.6168004",
"0.6158355",
"0.6158355",
"0.6126585",
"0.61199",
"0.6068956"... | 0.0 | -1 |
GET /project_evaluations GET /project_evaluations.json | def index
@project_evaluations = ProjectEvaluation.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_evaluations\n ProjectEvaluation.where(user_id: @id)\n end",
"def index\n if params[:project_team_id] && params[:project_id]\n @evaluations = Evaluation.joins(:project, team: :project_teams)\n .where project_teams: { id: params[:project_team_id] }, projects: { id: params[:project_id... | [
"0.7624667",
"0.6834057",
"0.66004336",
"0.6579591",
"0.6520226",
"0.6484331",
"0.64528525",
"0.6440463",
"0.6440463",
"0.6440463",
"0.6440463",
"0.6440463",
"0.64188087",
"0.6389581",
"0.62850916",
"0.620143",
"0.6188831",
"0.61684126",
"0.6145594",
"0.6084756",
"0.6075996",... | 0.7580181 | 1 |
GET /project_evaluations/1 GET /project_evaluations/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @project_evaluations = ProjectEvaluation.all\n end",
"def project_evaluations\n ProjectEvaluation.where(user_id: @id)\n end",
"def get_eval\n\t\t@student = Student.find(params[:student_id])\n\t\t@evaluation = @student.evaluations.find(params[:eval_id])\n\t\trender json: @evaluation\n\tend",... | [
"0.7438125",
"0.7247642",
"0.68449825",
"0.65776587",
"0.65286684",
"0.6436442",
"0.6431491",
"0.64289385",
"0.6377922",
"0.63731635",
"0.63731635",
"0.63731635",
"0.63731635",
"0.63731635",
"0.63261086",
"0.6315761",
"0.63067174",
"0.6295004",
"0.62877357",
"0.6244494",
"0.6... | 0.0 | -1 |
POST /project_evaluations POST /project_evaluations.json | def create
@project_evaluation = ProjectEvaluation.new(project_evaluation_params)
respond_to do |format|
if @project_evaluation.save
format.html { redirect_to @project_evaluation, notice: 'Project evaluation was successfully created.' }
format.json { render :show, status: :created, locati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_evaluation_params\n params.require(:project_evaluation).permit(:questions, :answers)\n end",
"def update\n if @pe.update(update_project_evaluation_params)\n render json: @pe, status: :ok\n else\n render json: format_errors(@pe.errors), status: :unprocessable_entity\n end\n ... | [
"0.6657529",
"0.65982527",
"0.6592406",
"0.6560897",
"0.654976",
"0.6523994",
"0.6500667",
"0.6490327",
"0.6374913",
"0.6351167",
"0.6325408",
"0.62935245",
"0.6273426",
"0.6256689",
"0.6256689",
"0.62405163",
"0.6224809",
"0.61889654",
"0.61200714",
"0.6117193",
"0.6098927",... | 0.7193528 | 0 |
PATCH/PUT /project_evaluations/1 PATCH/PUT /project_evaluations/1.json | def update
respond_to do |format|
if @project_evaluation.update(project_evaluation_params)
format.html { redirect_to @project_evaluation, notice: 'Project evaluation was successfully updated.' }
format.json { render :show, status: :ok, location: @project_evaluation }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @pe.update(update_project_evaluation_params)\n render json: @pe, status: :ok\n else\n render json: format_errors(@pe.errors), status: :unprocessable_entity\n end\n end",
"def update\n if ENV[\"NEW_EVALUATION\"] == nil\n raise ActionController::RoutingError\n retur... | [
"0.73663515",
"0.63723236",
"0.633906",
"0.633906",
"0.6330001",
"0.6307499",
"0.6304863",
"0.62341344",
"0.62061",
"0.620233",
"0.620233",
"0.620233",
"0.615998",
"0.61357707",
"0.61258686",
"0.6117821",
"0.6108446",
"0.61012125",
"0.60947543",
"0.6089989",
"0.604415",
"0.... | 0.7023493 | 1 |
DELETE /project_evaluations/1 DELETE /project_evaluations/1.json | def destroy
@project_evaluation.destroy
respond_to do |format|
format.html { redirect_to project_evaluations_url, notice: 'Project evaluation was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @evaluacion = Evaluacion.find(params[:id])\n @evaluacion.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluaciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Incomplete.where(project_id: @project.id, &:destroy)\n Evaluation.w... | [
"0.70573455",
"0.70272696",
"0.70068437",
"0.70068437",
"0.69655406",
"0.6859292",
"0.68366104",
"0.6836399",
"0.6802372",
"0.67725",
"0.6771701",
"0.67712665",
"0.675931",
"0.675931",
"0.675931",
"0.675931",
"0.675931",
"0.675931",
"0.6747221",
"0.67461693",
"0.6691945",
"... | 0.73851097 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_project_evaluation
@project_evaluation = ProjectEvaluation.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 project_evaluation_params
params.require(:project_evaluation).permit(:questions, :answers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /liquor_licenses/1 GET /liquor_licenses/1.xml | def view
@liquor_license = LiquorLicense.find(params[:id])
@valid_user = User.find(:first, :conditions => ["username = ? ", session[:user_id]])
if session[:user_id] != nil and session[:user_id] != ''
@valid_user = User.find(:first, :conditions => ["username = ? ", session[:user_id]])
if @valid_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @license = License.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @license }\n end\n end",
"def retrieve_license(url)\n (@licenses ||= {})[url] ||= Net::HTTP.get(URI(url))\n end",
"def license_url\n ... | [
"0.6387292",
"0.6095407",
"0.6092685",
"0.6056291",
"0.59744906",
"0.5962432",
"0.59504944",
"0.593316",
"0.593316",
"0.5880211",
"0.58747715",
"0.58676684",
"0.5833579",
"0.5790099",
"0.57797384",
"0.5767363",
"0.57226104",
"0.57219225",
"0.5719651",
"0.57022935",
"0.5692906... | 0.0 | -1 |
GET /liquor_licenses/1 GET /liquor_licenses/1.xml | def show
@liquor_license = LiquorLicense.find(params[:id])
@liquor_license_auctions = LiquorLicenseAuction.where(:liquor_license_id => params[:id]).find :all, :order => 'price desc'
logger.info @liquor_license_auctions
respond_to do |format|
format.html # show.html.erb
format.xml { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @license = License.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @license }\n end\n end",
"def retrieve_license(url)\n (@licenses ||= {})[url] ||= Net::HTTP.get(URI(url))\n end",
"def license_url\n ... | [
"0.6386642",
"0.60921806",
"0.6089941",
"0.5971855",
"0.59590006",
"0.5950329",
"0.5930845",
"0.5930845",
"0.58822197",
"0.5873332",
"0.586424",
"0.58309907",
"0.5788075",
"0.5776941",
"0.57672286",
"0.5721723",
"0.5719421",
"0.5718583",
"0.5698953",
"0.569338",
"0.5675129",
... | 0.6054943 | 3 |
GET /liquor_licenses/new GET /liquor_licenses/new.xml | def new
@valid_user = User.find(:first, :conditions => ["username = ? ", session[:user_id]])
if session[:user_id] != nil and session[:user_id] != ''
@valid_user = User.find(:first, :conditions => ["username = ? ", session[:user_id]])
if @valid_user == nil
flash[:error] = "You don't have acc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @license = License.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @license }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @licence }\n end\n end",
"def new... | [
"0.7598206",
"0.73247886",
"0.6881248",
"0.6878083",
"0.6837604",
"0.67978746",
"0.6680989",
"0.6680989",
"0.6664631",
"0.6624169",
"0.6587119",
"0.6528218",
"0.65014",
"0.65014",
"0.65014",
"0.6475022",
"0.645307",
"0.64447165",
"0.6434691",
"0.6434691",
"0.64099",
"0.6390... | 0.0 | -1 |
POST /liquor_licenses POST /liquor_licenses.xml | def create
@valid_user = User.find(:first, :conditions => ["username = ? ", session[:user_id]])
@liquor_license = @valid_user.liquor_licenses.create(params[:liquor_license])
@state_first = GeoinfoState.find(:first, :order => 'name asc')
if params[:liquor_license][:state_id]
@state_first = GeoinfoS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_licenses\n \n end",
"def create\n megam_rest.post_license(to_hash)\n end",
"def add_licenses=(value)\n @add_licenses = value\n end",
"def create\n @license = License.new(params[:license])\n\n respond_to do |format|\n if @li... | [
"0.69219476",
"0.6464245",
"0.6271564",
"0.6220755",
"0.61789864",
"0.60420346",
"0.60193014",
"0.60036623",
"0.59891796",
"0.59738547",
"0.59716785",
"0.59390926",
"0.58572906",
"0.58374333",
"0.5790158",
"0.5773172",
"0.5761972",
"0.5754806",
"0.5748039",
"0.57330036",
"0.5... | 0.0 | -1 |
PUT /liquor_licenses/1 PUT /liquor_licenses/1.xml | def update
@liquor_license = LiquorLicense.find(params[:id])
respond_to do |format|
if @liquor_license.update_attributes(params[:liquor_license])
format.html { redirect_to(@liquor_license, :notice => 'Liquor license was successfully updated.') }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_licenses\n \n end",
"def update\n @license = License.find(params[:id])\n @license.update_attributes(params[:license])\n respond_with(@license, :location => licenses_path)\n end",
"def update\n @license = License.find(params[:id])\n\n respond_to do |format|\n if @license.upda... | [
"0.6503644",
"0.64965886",
"0.63593197",
"0.6286674",
"0.61030424",
"0.60357404",
"0.60357404",
"0.6015485",
"0.59792036",
"0.59782064",
"0.5935271",
"0.587116",
"0.5839462",
"0.5756324",
"0.5704808",
"0.57004464",
"0.5679422",
"0.5677705",
"0.56574386",
"0.5617194",
"0.55418... | 0.6740633 | 0 |
DELETE /liquor_licenses/1 DELETE /liquor_licenses/1.xml | def delete_record
@liquor_license = LiquorLicense.find(params[:id])
@valid_user = User.find(:first, :conditions => ["username = ? ", session[:user_id]])
if session[:user_id] != nil and session[:user_id] != ''
@valid_user = User.find(:first, :conditions => ["username = ? ", session[:user_id]])
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @license = License.find(params[:id])\n @license.destroy\n\n respond_to do |format|\n format.html { redirect_to(licenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @licence.destroy\n\n respond_to do |format|\n format.html { redirect_to(licences_u... | [
"0.66412985",
"0.66075087",
"0.6333489",
"0.63094234",
"0.6239437",
"0.6185473",
"0.61540866",
"0.6118246",
"0.6088204",
"0.6076083",
"0.6062351",
"0.6034561",
"0.59961236",
"0.59915835",
"0.59756553",
"0.5928698",
"0.59040827",
"0.5846863",
"0.5846863",
"0.5835723",
"0.58298... | 0.0 | -1 |
title Cannot be repeated by the same artist in the same year release_year Optional if released is false release_year Must be less than or equal to the current year | def current_year
Time.current.year
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def title_unique?\n song = Song.find_by(title: self.title)\n if song && song.release_year == self.release_year\n errors.add(:title, \"Artist cannot release same song in one year.\")\n end\n end",
"def same_year? \n same_year_songs = Song.all.select{|song| song.release_year == release_year}\n ... | [
"0.75408995",
"0.6674324",
"0.6596271",
"0.6419892",
"0.6414532",
"0.6394522",
"0.6357666",
"0.6312536",
"0.62280613",
"0.5904702",
"0.58945054",
"0.5680325",
"0.56749636",
"0.5643155",
"0.5610868",
"0.56099135",
"0.5558377",
"0.5547915",
"0.5545122",
"0.5496935",
"0.5491639"... | 0.0 | -1 |
USER INPUT METHODS Prompts user to enter a season and handles the input | def select_season
puts "Pick an NBA Season by typing in the starting year (1979-2018) or type 'exit' to quit.\n(ex. 2018 shows 2018-2019 season):"
input = gets.strip
# Checks if user entered exit
if exit?(input)
self.exit_program
#Checks if input is a valid ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_menu(season)\n self.print_main_menu(season)\n\n input = gets.strip.downcase\n\n # Uses case statement to check input\n case input \n when \"1\"\n self.handle_standings(season)\n when \"2\"\n self.handle_home_court_records(season)\n whe... | [
"0.6811355",
"0.6199704",
"0.61812776",
"0.6143907",
"0.6135747",
"0.6115586",
"0.6067906",
"0.6021762",
"0.6020573",
"0.59861314",
"0.59847885",
"0.59521055",
"0.5890876",
"0.58815503",
"0.58587915",
"0.5854661",
"0.58318406",
"0.58109826",
"0.57942957",
"0.57796013",
"0.577... | 0.8247154 | 0 |
Prompts user to choose an option from the main menu and then handles input | def main_menu(season)
self.print_main_menu(season)
input = gets.strip.downcase
# Uses case statement to check input
case input
when "1"
self.handle_standings(season)
when "2"
self.handle_home_court_records(season)
when "3"
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_option\n print_menu\n @choice = gets.chomp\n perform_selection\n end",
"def main_menu\n while true\n print_main_menu\n user_selected = gets.chomp.to_s\n call_option(user_selected)\n end\n end",
"def main_menu\n options = [\"View recipe book\", \"Search by in... | [
"0.8392514",
"0.8067047",
"0.80329317",
"0.79227793",
"0.78564495",
"0.7849081",
"0.7839184",
"0.7768121",
"0.7757576",
"0.77567065",
"0.7756344",
"0.7751854",
"0.77328336",
"0.77318704",
"0.7685158",
"0.7682032",
"0.7668824",
"0.76662326",
"0.7655604",
"0.7653921",
"0.764994... | 0.0 | -1 |
Prompts user to select a team and handles input | def select_team(season)
puts "Type in the name of the team or the city they are based in or type 'exit' to quit:"
input = gets.strip.downcase
# Checks if input is exit
if exit?(input)
self.exit_program
# Check if input matches a team; if matches, return the team
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_team\n return $prompt.select(\"Select team\", $nbl_league.print_team_names)\nend",
"def another_team?\n puts \"Would you Like to view another Team's Players?(Yes or No to Exit)\"\n another_team_input = gets.strip.upcase\n check_end_of_program(another_team_input)\n puts \"Which team Would... | [
"0.8136983",
"0.73448765",
"0.6978923",
"0.6946136",
"0.69138235",
"0.690543",
"0.6706066",
"0.658017",
"0.6567262",
"0.65202135",
"0.64405",
"0.64374435",
"0.6405455",
"0.63879657",
"0.63864225",
"0.63864225",
"0.63575554",
"0.63496786",
"0.6295553",
"0.6261448",
"0.6261448"... | 0.7948878 | 1 |
Prompts user to select the 2 teams needed for headtohead data and hands off teams to print | def select_head_to_head(season)
# selecting first team
puts "Select the first team:"
team1 = self.select_team(season)
self.add_line_break
# selecting second team
puts "Select the second team:"
team2 = self.select_team(season)
# Checks if teams are the sa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_team\n return $prompt.select(\"Select team\", $nbl_league.print_team_names)\nend",
"def teams_data\n # selected_team = self.class.all[prompt.to_i-1]\n puts \"\"\n puts \"---------------------------\"\n puts \"Team Name: \" + self.full_name\n puts \"City: \" + self.... | [
"0.7623209",
"0.7236595",
"0.71767795",
"0.68461823",
"0.6818316",
"0.6717803",
"0.6674701",
"0.66743195",
"0.6566405",
"0.6549217",
"0.65473527",
"0.6491265",
"0.6381058",
"0.6263022",
"0.6216883",
"0.6190094",
"0.6185844",
"0.6161664",
"0.6152143",
"0.61302674",
"0.60882854... | 0.6670293 | 8 |
checks if user enters exit | def exit?(input)
input == "exit"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exit_checker(arg)\n if arg == \"exit\"\n puts \"Goodbye!\"\n return exit\n end\n end",
"def exit?\n type == :exit\n end",
"def exit?\n user_input == \"q\" || user_input == \"quit\"\n end",
"def exit?\n @exit\n end",
"def game_exit\n Message.game_quit\n ... | [
"0.8088133",
"0.8033129",
"0.79431957",
"0.7848503",
"0.7455041",
"0.74502134",
"0.73887175",
"0.7293466",
"0.7236477",
"0.72235996",
"0.7200871",
"0.71566594",
"0.7154785",
"0.715056",
"0.715056",
"0.715056",
"0.7121426",
"0.70972806",
"0.7088841",
"0.70650876",
"0.7034851",... | 0.83553356 | 0 |
HANDLE MAIN MENU INPUT | def handle_standings(season)
self.print_standings(season)
self.main_menu(season)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_menu\n @ui.input_1_change\n @ui.user_input1.downcase\n unless %w[trains routes stations cars].include? @ui.user_input1\n puts 'There is no such option in the main menu.'\n end\n main_menu_choose_option(@ui.user_input1)\n end",
"def main_menu\n while true\n print_main_menu\n ... | [
"0.7979291",
"0.766776",
"0.7563174",
"0.7436687",
"0.741064",
"0.74104863",
"0.7363773",
"0.73217154",
"0.7306532",
"0.7301863",
"0.7279684",
"0.7253751",
"0.7237753",
"0.7237285",
"0.721038",
"0.72081596",
"0.71922153",
"0.7183833",
"0.7169024",
"0.71575725",
"0.7150717",
... | 0.0 | -1 |
API CALL Uses the Season constructor to create a season given the year for the season by calling the API | def load_season(year)
puts "Loading the #{year}-#{year.to_i+1} season..."
season = NbaAdvancedStats::Season.find_or_create_with_api(year)
puts "Data Ready."
self.add_line_break
self.main_menu(season)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def season(year, **options) = get(\"/seasons/#{year}\", **{ sportId: 1 }.merge(options))",
"def create\n @season = Season.new(season_params)\n\n if @season.save\n render :show, status: :created\n else\n render json: @season.errors, status: :unprocessable_entity\n end\n end",
"def create\... | [
"0.80405253",
"0.6979685",
"0.68465674",
"0.6797674",
"0.6794043",
"0.67690307",
"0.67468995",
"0.67394835",
"0.67394835",
"0.67394835",
"0.67394835",
"0.6463136",
"0.6425891",
"0.6411208",
"0.64086276",
"0.63986516",
"0.6353531",
"0.63047624",
"0.6292089",
"0.6256492",
"0.62... | 0.65677464 | 11 |
product image and variant images | def whole_images
( self.images + self.variant_images ).uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_images(product)\n self.image_labels.each_with_index do |label, position|\n\n self.image_file_extensions.each do |extension|\n file_name = self.image_path + value('image') + '_' + label + extension\n next unless File.exist?(file_name)\n\n types = []\n\n unl... | [
"0.7057174",
"0.7034451",
"0.69185024",
"0.67824644",
"0.6739281",
"0.6721228",
"0.66474336",
"0.66009045",
"0.65934426",
"0.65660036",
"0.65452266",
"0.6522169",
"0.6512883",
"0.6471341",
"0.642017",
"0.6409562",
"0.63895005",
"0.6375972",
"0.63676095",
"0.6360155",
"0.63547... | 0.67106074 | 6 |
Make + work with nil | def method_missing(name, *args)
[].send(name, *args) # Proxy nil onto []
rescue NoMethodError
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nil?() end",
"def nil?() end",
"def null?; false end",
"def null\n end",
"def nil?; false; end",
"def returns_nil; end",
"def null?; @null; end",
"def none?; end",
"def none?; end",
"def none?; end",
"def nil?() true; end",
"def maybe; end",
"def add_nums(x)\n \t# nil + nil\nend",
"d... | [
"0.66180634",
"0.66180634",
"0.6553118",
"0.6430911",
"0.6383271",
"0.6376792",
"0.6359807",
"0.63344383",
"0.63344383",
"0.63344383",
"0.6266293",
"0.61525136",
"0.61515796",
"0.6145362",
"0.60620904",
"0.5854353",
"0.5842881",
"0.58399683",
"0.58314455",
"0.5824096",
"0.579... | 0.0 | -1 |
Handle multipleairity methods being passed a list/block magically | def magic_send(message, arg)
arity = method(message).arity
if arity == 0
send(message, &arg)
elsif arity == 1
send(message, arg)
else
case arg
when nil
send(message)
when Array
if arg.length > arity.abs && arg.last.is_a?(Proc)
blk = arg.pop
send(message, *arg, &blk)
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multi(&block); end",
"def list_block()\n\nend",
"def blocks; end",
"def blocks; end",
"def blocks; end",
"def blocks() end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; en... | [
"0.7180511",
"0.7086347",
"0.70148027",
"0.70148027",
"0.70148027",
"0.69562924",
"0.68910086",
"0.68910086",
"0.68910086",
"0.68910086",
"0.68910086",
"0.68910086",
"0.68910086",
"0.68910086",
"0.68910086",
"0.68910086",
"0.68910086",
"0.68910086",
"0.68910086",
"0.68910086",
... | 0.0 | -1 |
toggles the articles featured attribute | def toggle!
self.featured = !self.featured
save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle_featured!\n self.update_attribute(:featured, !self.featured?)\n self.featured?\n end",
"def toggle_featured\n authorize! @cookbook\n\n @cookbook.update(featured: !@cookbook.featured)\n\n redirect_to(\n cookbook_path(@cookbook),\n notice: t(\n \"cookbook.featured\",\n ... | [
"0.8716608",
"0.7811652",
"0.76716965",
"0.76716965",
"0.7395394",
"0.7025589",
"0.6885995",
"0.6885995",
"0.68400973",
"0.65340406",
"0.6333583",
"0.6164633",
"0.60949665",
"0.6049211",
"0.60434884",
"0.60249513",
"0.6009359",
"0.6009359",
"0.6009359",
"0.59164023",
"0.59091... | 0.8288903 | 1 |
GET /tags/1 GET /tags/1.json | def show
@tag = Tag.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @tag }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags\n get('tags')\n end",
"def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end",
"def tags\n @tags_with_count = Asset.tag_counts_on(:tags)\n \n @tags = @tags_with_count.map{|tag_hash| tag_hash = tag_ha... | [
"0.7841505",
"0.7612557",
"0.7493275",
"0.7401228",
"0.7207367",
"0.71431935",
"0.7123889",
"0.70965606",
"0.7029651",
"0.69644773",
"0.69596124",
"0.6939314",
"0.68929696",
"0.6886842",
"0.68744135",
"0.6864103",
"0.68359417",
"0.6822819",
"0.68169296",
"0.67671245",
"0.6754... | 0.6745085 | 25 |
GET /tags/new GET /tags/new.json | def new
@tag = Tag.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @tag }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @tag = Tag.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tag }\n end\n end",
"def new\n get_status\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tag }\n end... | [
"0.80480677",
"0.7897595",
"0.7861523",
"0.7861523",
"0.7711944",
"0.7690126",
"0.7509567",
"0.7441448",
"0.7409764",
"0.7391192",
"0.73422575",
"0.7315394",
"0.73117083",
"0.7310875",
"0.7303562",
"0.7265349",
"0.7246642",
"0.7246642",
"0.72461045",
"0.72433686",
"0.7209086"... | 0.79461527 | 3 |
POST /tags POST /tags.json | def create
@tag = Tag.new(params[:tag])
set_user_column @tag
respond_to do |format|
begin
@tag.save!
format.html { redirect_to @tag, notice: 'Tag was successfully created.' }
format.json { render json: @tag, status: :created, location: @tag }
rescue ActiveRecord::RecordI... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag!(params = {})\n self.post params, edge: :tags\n end",
"def create\n @tag = Tag.new(tag_params)\n if @tag.save\n render json: @tag\n else\n render json: @tag.errors, status: :unprocessable_entity\n end\n end",
"def create\r\n @tag = Tag.new(tag_params)\r\n\r\n if... | [
"0.7692835",
"0.7152648",
"0.7079401",
"0.69583875",
"0.68204635",
"0.677452",
"0.6769902",
"0.67647225",
"0.67260826",
"0.66941917",
"0.6688469",
"0.66698825",
"0.6658007",
"0.660596",
"0.659979",
"0.6581441",
"0.6563798",
"0.6547826",
"0.6547316",
"0.65432066",
"0.653725",
... | 0.0 | -1 |
PUT /tags/1 PUT /tags/1.json | def update
@tag = Tag.find(params[:id])
@tag.attributes = params[:tag]
set_user_column @tag
respond_to do |format|
begin
@tag.save!
format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }
format.json { head :no_content }
rescue ActiveRecord::RecordI... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n bod... | [
"0.7205384",
"0.7147123",
"0.68801117",
"0.67290765",
"0.6670296",
"0.66023207",
"0.65643096",
"0.6541451",
"0.65410334",
"0.6507774",
"0.6494705",
"0.64896363",
"0.648434",
"0.64789766",
"0.64522034",
"0.6415144",
"0.64134103",
"0.6404194",
"0.64038527",
"0.6386176",
"0.6382... | 0.0 | -1 |
DELETE /tags/1 DELETE /tags/1.json | def destroy
@tag = Tag.find(params[:id])
@tag.deleted = 9
set_user_column @tag
@tag.save!
respond_to do |format|
format.html { redirect_to tags_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(tag)\n api_client.tags.multi_delete(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n end",
"def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n \n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n\n ... | [
"0.77049047",
"0.7578366",
"0.75631344",
"0.75317156",
"0.75252473",
"0.7507605",
"0.7507605",
"0.7507605",
"0.74904907",
"0.74870014",
"0.7461779",
"0.7456964",
"0.7387652",
"0.73832756",
"0.73818654",
"0.7368147",
"0.73671025",
"0.7343283",
"0.7313129",
"0.72514915",
"0.723... | 0.67044926 | 98 |
GET /events/1 GET /events/1.json | def show
@system_information = SystemInformation.find(params[:id])
respond_to do |format|
format.html # show.html.erb
#format.json { render json: @event }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @event = Event.find(params[:id])\n render json: @event\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @use... | [
"0.75029767",
"0.74019474",
"0.7361382",
"0.7348975",
"0.73475033",
"0.7338018",
"0.7317425",
"0.72875094",
"0.72813755",
"0.7246173",
"0.72317284",
"0.7219172",
"0.7219172",
"0.7218839",
"0.7218839",
"0.721464",
"0.7204848",
"0.71989256",
"0.7196662",
"0.71925515",
"0.719221... | 0.0 | -1 |
GET /events/new GET /events/new.json | def new
@system_information = SystemInformation.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @system_information }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @event = Event.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
... | [
"0.81609446",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513",
"0.81505513"... | 0.0 | -1 |
GET /events/1/edit POST /events POST /events.json | def create
@system_information = SystemInformation.new(system_information_params)
respond_to do |format|
if @system_information.save
format.html { redirect_to @system_information, notice: 'Information was successfully created.' }
format.json { render json: @system_in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n @event = Event.find(params[:id])\n end",
"def edit\n @event = Event.find(params[:id])\n end",
"def edit\n @event = Event.find(params[:id])\n\n end",
"def edit\n\t\t@event = Event.find(params[:id])\n\tend",
"def edit\n#\t\t@event = Event.find(params[:id])\n\tend",
"def edit\n\n @... | [
"0.80062217",
"0.80062217",
"0.7975635",
"0.7853818",
"0.78028536",
"0.7781945",
"0.77665377",
"0.7736129",
"0.7665792",
"0.7569565",
"0.752085",
"0.7475912",
"0.739051",
"0.7374809",
"0.7374807",
"0.7374807",
"0.7374807",
"0.7370767",
"0.7370047",
"0.7368646",
"0.735652",
... | 0.0 | -1 |
PATCH/PUT /events/1 PATCH/PUT /events/1.json | def update
@system_information = SystemInformation.find(params[:id])
respond_to do |format|
if @system_information.update_attributes(system_information_params)
format.html { redirect_to @system_information, notice: 'Information was successfully updated.' }
format.json { head :no_content }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j... | [
"0.75299805",
"0.7372486",
"0.71766764",
"0.7172103",
"0.7170955",
"0.71424884",
"0.70959055",
"0.7082709",
"0.7082709",
"0.7057662",
"0.70209146",
"0.6989379",
"0.69825095",
"0.69775003",
"0.69601995",
"0.6954494",
"0.6954494",
"0.6951992",
"0.692109",
"0.692109",
"0.692109"... | 0.0 | -1 |
DELETE /events/1 DELETE /events/1.json | def destroy
@system_information = SystemInformation.find(params[:id])
@system_information.destroy
redirect_to system_informations_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_... | [
"0.76929694",
"0.7688217",
"0.7688217",
"0.7688217",
"0.7681325",
"0.7585923",
"0.75685203",
"0.7560765",
"0.7541314",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.... | 0.0 | -1 |
Use this method to whitelist the permissible parameters. Example: params.require(:person).permit(:name, :age) Also, you can specialize this method with peruser checking of permissible attributes. | def system_information_params
params.require(:system_information).permit(:access, :hdd_capacity, :lan, :monitor_type, :os_installed, :ram, :ram_type, :sw_details, :system_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def strong_params\n params.require(:user).pe... | [
"0.7718049",
"0.7674393",
"0.75203633",
"0.7155289",
"0.7141448",
"0.71168",
"0.71030074",
"0.70796794",
"0.7039245",
"0.7006154",
"0.7003157",
"0.7001283",
"0.7001283",
"0.6953358",
"0.6937002",
"0.6936348",
"0.69344914",
"0.68808407",
"0.67972",
"0.67354065",
"0.67044556",
... | 0.0 | -1 |
Initialize the class with the path to the 'config_file' The class objects are dynamically generated by the name of the 'param' in the config file. Therefore, if the config file is 'param = value' then the itializer | def initialize(config_file)
@config_file = config_file
raise Errno::EACCES, "#{self.config_file} is not readable" unless File.readable?(self.config_file)
open(self.config_file).each { |line|
line.chomp
unless (/^\#/.match(line))
if(/\s*=\s*/.match(line))
param, value = line.sp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @config = config_from_file || empty_config\n end",
"def initialize(config_file=nil)\n @config_file = config_file\n @params = {}\n @groups = []\n \n if(self.config_file)\n self.validate_config()\n self.import_config()\n end\n end",
"def initialize(config)\n ... | [
"0.7545475",
"0.7446514",
"0.7357158",
"0.7238776",
"0.71662176",
"0.71450555",
"0.69926685",
"0.69566476",
"0.6884838",
"0.68613136",
"0.6749745",
"0.67473054",
"0.67176706",
"0.67128235",
"0.66765213",
"0.6561904",
"0.65613323",
"0.6557024",
"0.6531065",
"0.65112734",
"0.64... | 0.7847591 | 0 |
This method is simple. Should you need to override a value dynamically, use override_value(param, value) where 'param' is the name of the paramater in the config file. | def override_value(param, value)
self.instance_variable_set("@#{param}", value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config=(value); end",
"def _handle_config(name, value=nil, override=false)\n if !self.const_defined?(\"CONFIG\")\n self.class_eval(\"CONFIG = {}\")\n end\n \n if value != nil\n if override or self::CONFIG[name] == nil\n self::CONFIG[name] = value \n end\n ... | [
"0.7532799",
"0.71638495",
"0.6804697",
"0.6804697",
"0.6464756",
"0.6409923",
"0.635872",
"0.6342083",
"0.6330432",
"0.6271806",
"0.6257908",
"0.62452793",
"0.6209983",
"0.61735976",
"0.6165789",
"0.61359364",
"0.6115453",
"0.6107294",
"0.61036295",
"0.60838234",
"0.6057262"... | 0.6713985 | 4 |
Requirement: width/height must be in range 1250 | def test_grid_new_badargs
[ -10, 0, 251 ].each do |arg|
assert_raises ArgumentError do
grid = Grid.new(arg, 10)
end
assert_raises ArgumentError do
grid = Grid.new(10, arg)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acceptable_size?\n \n return true if width > 50 and\n width < 100 and\n height > 50 and\n height < 100\n \n end",
"def validate_dimensions\n if width > 440 or height > 220\n raise DimensionsError,\n \"Map dimensions may not exceed 440x... | [
"0.7171209",
"0.6843603",
"0.657342",
"0.65602064",
"0.65411365",
"0.6427212",
"0.64041984",
"0.634339",
"0.6332874",
"0.62937",
"0.6259398",
"0.6248537",
"0.6242641",
"0.62144965",
"0.61058396",
"0.60944027",
"0.60875463",
"0.6082542",
"0.6064421",
"0.6059355",
"0.6047436",
... | 0.0 | -1 |
recursively try to find the pattern in the major mode and its parent modes. | def resolve(pattern, parents)
keymap_result = keymap[pattern]
case keymap_result
when Incomplete # try to find a full or longer match in parents
resolve_incomplete(pattern, parents, keymap_result)
when Impossible # anything better than that.
resolve_impossible(pattern, parents, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan_patterns\n @max_level = 0\n @root.bfs do |r|\n reached = false\n curr_instances = yield(r.parent_id)\n curr_instances.each do |c_instance|\n q = @query.new.extend(Pbuilder::Query)\n q = q.search_next_instances(c_instance.uri, r.node.edge, r.node.value)\n ... | [
"0.57122594",
"0.53216034",
"0.5276752",
"0.52373147",
"0.522899",
"0.5157209",
"0.5155796",
"0.50832003",
"0.50586617",
"0.47768348",
"0.47765192",
"0.47709814",
"0.47231466",
"0.46705565",
"0.4617547",
"0.45152715",
"0.45063832",
"0.4492339",
"0.44852775",
"0.44654563",
"0.... | 0.48408017 | 9 |
Crear un metodo que lea el archivo, lo abra y devuelva la cantidad de lineas que posee. | def lines_counter
f = File.open('peliculas.txt', 'r')
print f.readlines.length
f.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monta_trailer_arquivo(nro_lotes, sequencial)\n raise Brcobranca::NaoImplementado, 'Sobreescreva este método na classe referente ao banco que você esta criando'\n end",
"def line_maker\n @lines = File.readlines(path, chomp: true)\n end",
"def contar_lineas\n line = read_alumnos\n c... | [
"0.56401795",
"0.5464619",
"0.543584",
"0.5415772",
"0.5392133",
"0.53191096",
"0.5277497",
"0.5272725",
"0.5227276",
"0.5219071",
"0.52148694",
"0.52066576",
"0.5192692",
"0.51899457",
"0.51790977",
"0.5162175",
"0.5117147",
"0.5106104",
"0.5094187",
"0.5093648",
"0.5044187"... | 0.0 | -1 |
Use the title in the collection hash | def title
@title ||= hash.fetch('title') { |key|
raise "Page id=#{id} is missing #{key}"
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def title\n item_hash.deep_find(:title)\n end",
"def title\n @hash[\"Title\"]\n end",
"def source_collection_title\n self['source_collection_title_ssim']\n end",
"def add_title\n @bib.title.to_bibtex @item\n end",
"def publisher_collection_title\n @descriptive_detai... | [
"0.7288424",
"0.7260869",
"0.7246236",
"0.7119261",
"0.701514",
"0.6988054",
"0.6876132",
"0.6876132",
"0.68393373",
"0.6838106",
"0.6812943",
"0.6803217",
"0.6796089",
"0.6794849",
"0.6780792",
"0.6771309",
"0.67599314",
"0.6746697",
"0.6746697",
"0.67449826",
"0.673734",
... | 0.6758337 | 17 |
Changes relative url attributes in the doc to be absolute Changes http embedded scripts/images/iframes to https | def converted_doc
# In the future, change to point to reference material within Tutor
return @converted_doc unless @converted_doc.nil?
@converted_doc = doc.dup
@converted_doc.css("[src]").each do |link|
src = link.attributes["src"]
uri = Addressable::URI.parse(src.value)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_img_src_urls_protocol_relative(doc)\n doc.search(\"img\").each do |img|\n next if img[\"src\"].nil?\n\n src = img[\"src\"].strip\n if src.start_with? \"http\"\n img[\"src\"] = src.sub!(/\\Ahttps?:/, \"\")\n end\n end\n\n doc\n end",
"def relative_ur... | [
"0.6674174",
"0.6559608",
"0.6472311",
"0.6472311",
"0.6472311",
"0.64475894",
"0.63826966",
"0.63345623",
"0.633449",
"0.63232815",
"0.624428",
"0.61829007",
"0.61822885",
"0.61702543",
"0.61641645",
"0.61556983",
"0.61556983",
"0.60998046",
"0.60666174",
"0.6055879",
"0.599... | 0.6249751 | 10 |
POST /songs POST /songs.json | def create
@song = Song.new(song_params)
@song.artist_id = params[:artist_id]
if @song.save
redirect_to songs_path
else
render 'new'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\t\tparams = song_params\n\t\tsongkey = params['song_key']\n\t\tparams.delete('song_key')\n\n songtags = params['tags']\n params.delete('tags')\n\n\t\t@song = Song.new(params)\n\n\t\trespond_to do |format|\n\t\t\tif @song.save\n\n\t\t\t\tif songkey.to_s.length > 0\n\t\t\t\t\t@song.song_ke... | [
"0.73157895",
"0.7304832",
"0.7290315",
"0.72273165",
"0.72147673",
"0.7177101",
"0.7172705",
"0.7172705",
"0.7122533",
"0.7122533",
"0.7122533",
"0.7095",
"0.7068517",
"0.706235",
"0.7046306",
"0.7038219",
"0.7026587",
"0.70128095",
"0.6970287",
"0.69490415",
"0.69486827",
... | 0.0 | -1 |
Extrapolates the digits of the birthdate into integers | def birth_path_number(date)
no1 = date[0].to_i
no2 = date[1].to_i
no3 = date[2].to_i
no4 = date[3].to_i
no5 = date[4].to_i
no6 = date[5].to_i
no7 = date[6].to_i
no8 = date[7].to_i
# Adds all the digits of the birthdate
number = no1 + no2 + no3 + no4 + no5 + no6 + no7 + no8
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_birthday\r\n\tbirthdate_str = get_birthday\r\n\tyour_number = birthdate_str[0].to_i + birthdate_str[1].to_i + birthdate_str[2].to_i \r\n\tyour_number = your_number + birthdate_str[3].to_i + birthdate_str[4].to_i + birthdate_str[5].to_i \r\n\tyour_number = your_number + birthdate_str[6].to_i + birthdate... | [
"0.76271707",
"0.7258432",
"0.70455253",
"0.7027887",
"0.6987742",
"0.688861",
"0.68443835",
"0.68443835",
"0.6803446",
"0.67400706",
"0.67013717",
"0.66808045",
"0.6661969",
"0.6660532",
"0.65603065",
"0.6543025",
"0.6446075",
"0.6431827",
"0.6413121",
"0.64110667",
"0.63845... | 0.7283668 | 1 |
Adds the numbers again, this time from a double digit number | def birth_path_number_again(digits)
no1 = digits[0].to_i
no2 = digits[1].to_i
number = no1 + no2
number = number.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plus_one(digits)\n leftover = 1\n \n digits.reverse!.each_with_index do |digit, idx|\n digits[idx] += leftover\n leftover = 0 \n if digits[idx] >= 10\n leftover = 1\n digits[idx] %= 10\n end\n end\n\n leftover > 0 ? digits.push(leftover).reverse : ... | [
"0.72326845",
"0.7033654",
"0.6909396",
"0.6897246",
"0.6880845",
"0.6817862",
"0.67584836",
"0.6730018",
"0.6709792",
"0.66084075",
"0.660596",
"0.6601346",
"0.6575539",
"0.6570018",
"0.6546578",
"0.65364176",
"0.6491628",
"0.6427758",
"0.64047515",
"0.6371928",
"0.6363774",... | 0.6081414 | 37 |
Puts out the user's numerology | def numerology(number)
case number
when "1"
puts "You are a Number 1.\nOne is the leader. The number one indicates the ability to stand alone and is a strong vibration. Ruled by the Sun."
when "2"
puts "You are a Number 2.\nThis is the mediator and peace-lover. The number two indicates the d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_numerology (your_number)\r\n\tcase your_number\r\n\t\twhen 1\r\n\t\t\tputs \"You are a ONE! One is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\"\r\n\t\twhen 2\r\n\t\t\tputs \"You are a TWO! This is the mediator and peace-lover. The number tw... | [
"0.6448771",
"0.5845588",
"0.5741388",
"0.5727383",
"0.57047004",
"0.57003474",
"0.5695467",
"0.5607245",
"0.5547606",
"0.5501539",
"0.54911256",
"0.5469318",
"0.54667515",
"0.5448148",
"0.54260427",
"0.5425172",
"0.5399134",
"0.539517",
"0.5386635",
"0.5379623",
"0.5369516",... | 0.6469823 | 0 |
Does the necessary iterations until a single digit is established | def one_digit(number)
if number.length > 1
number = birth_path_number_again(number)
one_digit(number)
else
numerology(number)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def featured(int)\n int += 1\n int += 1 until int % 7 == 0 && int.odd?\n \n loop do\n double_check = int.to_s.split(\"\")\n if double_check.uniq == double_check\n return int\n else\n int += 14\n end \n break if int >= 9_876_543_210 \n end\n \"There is no possible number that fulfill... | [
"0.66557556",
"0.65633744",
"0.65076584",
"0.6505898",
"0.64884806",
"0.6466552",
"0.6445291",
"0.642496",
"0.6410427",
"0.6380586",
"0.63727194",
"0.635744",
"0.6351568",
"0.63256997",
"0.6308752",
"0.62885475",
"0.6273067",
"0.62715256",
"0.6245646",
"0.62112755",
"0.62073"... | 0.0 | -1 |
Need the path to the binary... | def run(bot_name)
registry = JSON.load(open("registry.js", "r").read())[bot_name]
if !registry
puts "Don't know anything about bot #{bot_name}; do you need to register it?"
exit 1
else
cmd = "#{registry["path"]}/#{registry["executable"]}"
options = {}
command_output_each_line(cmd, options) do ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def executable_path; end",
"def chef_binary_path(binary)\n return binary if !@config.binary_path\n return File.join(@config.binary_path, binary)\n end",
"def bin\n File.join(@root, 'bin')\n end",
"def bin_file(name)\n File.join bin_dir, name\n end",
"def bin(name)\n ... | [
"0.7562527",
"0.7469606",
"0.7367316",
"0.7213203",
"0.7205946",
"0.7178834",
"0.7089039",
"0.70569843",
"0.70569843",
"0.70569843",
"0.695524",
"0.69188",
"0.691728",
"0.6884335",
"0.68070906",
"0.6786557",
"0.6758236",
"0.67405343",
"0.67275786",
"0.671505",
"0.6561127",
... | 0.0 | -1 |
Consider moving to a separate library | def command_output_each_line(command, options)
Open3::popen3(command, options) do |_, stdout, stderr, wait_thread|
loop do
check_output_with_timeout(stdout)
begin
yield stdout.readline
rescue EOFError
break
end
end
status = wait_thread.value.exitstatus
if statu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def library; end",
"def library; end",
"def implementation; end",
"def implementation; end",
"def wrapper; end",
"def external; end",
"def internal; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def custom; end",
"def custom; end",
... | [
"0.76018107",
"0.680291",
"0.680291",
"0.66868544",
"0.66868544",
"0.6573797",
"0.6469465",
"0.64360064",
"0.6126746",
"0.6126746",
"0.6126746",
"0.6126746",
"0.6099595",
"0.6099595",
"0.60971117",
"0.609433",
"0.604851",
"0.5972056",
"0.5972056",
"0.5971047",
"0.5971047",
... | 0.0 | -1 |
TODO: it seems that there should be a better way to just get raw parameters (not sure why the nil key bug doesn't seem to be fixed in my installation) ...also, there seems to be some interaction with Mongrel as well that can cause the parameters to fail | def lookup_request_parameter(request, key) # :nodoc:
# Depending on the user's version of Rails, this may fail due to a bug in Rails parsing of
# nil keys: http://dev.rubyonrails.org/ticket/5137, so we have a backup plan
begin
# this should work on most Rails installations
return req... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_params(auth); end",
"def query_params=(_arg0); end",
"def magic_params_not_truly_understood\n \"timekey=#{@timekey}&custom_search=0\"\n end",
"def query_parameters; end",
"def query_params; end",
"def query_parameters\n end",
"def raw_params\n\t\t\treturn @raw_params if @raw_params\n... | [
"0.6904067",
"0.6658691",
"0.66170883",
"0.65810174",
"0.6442851",
"0.6436684",
"0.6203481",
"0.619132",
"0.6184834",
"0.61785316",
"0.61785316",
"0.61785316",
"0.60959935",
"0.6083646",
"0.60547817",
"0.60547817",
"0.6048616",
"0.6041301",
"0.60111004",
"0.59817344",
"0.5966... | 0.0 | -1 |
category: String The category that the product belongs to, e.g.: skincare, makeup. id: Integer The unique id of the product. name: String The name of the product. | def initialize(category:, id:, name:)
@category, @id, @name = category, id, name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_product\n @product = Product.find(params[:id])\n if params[:category_id]\n @category = Category.find(params[:category_id])\n end\n end",
"def set_category_product\n @category_product = CategoryProduct.find(params[:id])\n end",
"def set_product1\n @sub_category = Su... | [
"0.6779462",
"0.6763458",
"0.67394227",
"0.67293704",
"0.6665885",
"0.6665885",
"0.6599064",
"0.6591639",
"0.6589775",
"0.65876776",
"0.65720993",
"0.65720993",
"0.65720993",
"0.64970654",
"0.64965385",
"0.64856327",
"0.64599466",
"0.6449537",
"0.6439856",
"0.6418447",
"0.641... | 0.0 | -1 |
GET /trips/1 GET /trips/1.json | def show
@trip = Trip.find(params[:id])
@meta_title = " Thrill Engine - #{@trip.categories.map(&:name).to_sentence} in #{@trip.location} staying at #{@trip.title} "
@meta_description = @trip.description
@meta_keywords = " #{@trip.location}, #{@trip.categories.map(&:name).to_sentence}, #{@trip.title}, #... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all... | [
"0.79471594",
"0.77817446",
"0.77817446",
"0.77365565",
"0.77221555",
"0.76181865",
"0.74433213",
"0.7313426",
"0.72672933",
"0.72672933",
"0.72672933",
"0.72672933",
"0.72672933",
"0.72672933",
"0.72672933",
"0.716429",
"0.7132913",
"0.7085405",
"0.70826983",
"0.70765644",
"... | 0.0 | -1 |
GET /trips/new GET /trips/new.json | def new
@trip = Trip.new
5.times { @trip.images.build }
6.times { @trip.accomodations.build }
6.times { @trip.lessons.build }
6.times { @trip.packages.build }
3.times { @trip.reviews.build }
respond_to do |format|
format.html # new.html.erb
format.json { render :json =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"d... | [
"0.76229274",
"0.76229274",
"0.75446206",
"0.7408982",
"0.73447603",
"0.7309385",
"0.72926533",
"0.7120292",
"0.701098",
"0.6980342",
"0.6980342",
"0.6980342",
"0.69607586",
"0.69172734",
"0.69123536",
"0.6911164",
"0.6898782",
"0.68915474",
"0.6866884",
"0.6832732",
"0.68185... | 0.63261783 | 71 |
POST /trips POST /trips.json | def create
@trip = Trip.new(params[:trip])
respond_to do |format|
if @trip.save
format.html { redirect_to @trip, :notice => 'Trip was successfully created.' }
format.json { render :json => @trip, :status => :created, :location => @trip }
else
format.html { render :action => ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trips\n get '/gtfs/trips'\n end",
"def create\n trip = current_user.trips.new(trip_params)\n if trip.save\n render json: {\n status: :created,\n trip: trip\n }\n else\n render json: {\n status: 500,\n errors: trip.errors.full_messages\n }\n ... | [
"0.7208045",
"0.70307076",
"0.6864295",
"0.68321437",
"0.6772133",
"0.6772133",
"0.6692161",
"0.66867685",
"0.664916",
"0.6610407",
"0.6559959",
"0.6522311",
"0.6514665",
"0.63697636",
"0.6347624",
"0.6323213",
"0.6318997",
"0.6318997",
"0.6318997",
"0.6318997",
"0.6318997",
... | 0.6384032 | 13 |
PUT /trips/1 PUT /trips/1.json | def update
@trip = Trip.find(params[:id])
params[:trip][:category_ids] ||= []
params[:trip][:type_ids] ||= []
respond_to do |format|
if @trip.update_attributes(params[:trip])
format.html { redirect_to @trip, :notice => 'Trip was successfully updated.' }
format.json {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @trip = Trip.find(params[:id])\n\n if @trip.update(trip_params)\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Trip update failed.\"]}\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n... | [
"0.66057086",
"0.6525809",
"0.6516202",
"0.64967173",
"0.64967173",
"0.64464897",
"0.6389474",
"0.6305629",
"0.6271271",
"0.62672496",
"0.62488014",
"0.6225689",
"0.61977637",
"0.619759",
"0.6185555",
"0.6146393",
"0.6141491",
"0.6141491",
"0.6141491",
"0.6141491",
"0.6141491... | 0.60592437 | 34 |
DELETE /trips/1 DELETE /trips/1.json | def destroy
@trip = Trip.find(params[:id])
@trip.destroy
respond_to do |format|
format.html { redirect_to trips_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to find_trips_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @trip = Trips.find_trip( params[ :id ])\n end",
"def destroy\n @trip = Trip.find(par... | [
"0.7412237",
"0.7403145",
"0.73722553",
"0.73722553",
"0.73722553",
"0.73020166",
"0.7279324",
"0.725161",
"0.725161",
"0.725161",
"0.7189",
"0.7189",
"0.7189",
"0.71809065",
"0.7139468",
"0.7119348",
"0.7000634",
"0.69164777",
"0.6903403",
"0.68640584",
"0.68640584",
"0.68... | 0.738269 | 3 |
export RUBY_GC_MALLOC_LIMIT=1000000000 export RUBY_FREE_MIN=500000 export RUBY_HEAP_MIN_SLOTS=40000 | def main
# GC::Profiler.enable
# limit = 10 ** 6
limit = 5 * (10 ** 7)
prime_limit = (limit * Math.sqrt(2)).to_i
prime_cache = Prime::Cache.new(prime_limit)
primes = prime_cache.primes.select {|prime| prime % 8 == 1 || prime % 8 == 7}
prime_cache = nil
prime_length = primes.length
puts "Primes cached.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ruby_gc_malloc_limit_growth_factor\n 1.4\n end",
"def ruby_gc_heap_free_slots\n 4096\n end",
"def ruby_gc_init_slots\n 10_000\n end",
"def ruby_gc_malloc_limit_max\n 32 * MEGABYTE\n end",
"def ruby_gc_heap_growth_max_factor\n 0\n end",
"def nakayoshi_gc\n 4.ti... | [
"0.7679008",
"0.7537356",
"0.7497209",
"0.7398302",
"0.7059058",
"0.6807195",
"0.6163048",
"0.6163048",
"0.6112915",
"0.59658486",
"0.57607675",
"0.5678699",
"0.56217724",
"0.5593513",
"0.5523244",
"0.5447049",
"0.5437118",
"0.5407988",
"0.53968406",
"0.5384969",
"0.5366701",... | 0.5467162 | 15 |
GET /cpm_files GET /cpm_files.json | def index
@cpm_files = CpmFile.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_files\n source_dir = Path.new(params[:source_dir])\n if params.has_key?(:show_catalogues)\n show_catalogues = params[:show_catalogues]\n else\n show_catalogues = false\n end\n if params[:ext].present?\n file_type = params[:ext]\n else\n file_type = nil\n end\n r... | [
"0.6997684",
"0.67103344",
"0.667008",
"0.6582823",
"0.6554944",
"0.65449965",
"0.6476266",
"0.6472468",
"0.64145666",
"0.6401304",
"0.6394147",
"0.6370581",
"0.63020456",
"0.6208226",
"0.61831903",
"0.6180376",
"0.6175447",
"0.61682755",
"0.6151656",
"0.6146515",
"0.61338663... | 0.72027487 | 0 |
GET /cpm_files/1 GET /cpm_files/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cpm_files = CpmFile.all\n end",
"def get_file(file_id)\n\tputs \"Getting file: \" + file_id\n\tresponse = request_get('/api/partner/file/' + file_id)\n\tputs response.body\nend",
"def server_get_file(server, path)\n request(\n :path => \"containers/#{server.id}/files\",\n ... | [
"0.6999498",
"0.6784006",
"0.66860455",
"0.65886104",
"0.6504979",
"0.64954185",
"0.64662635",
"0.6462397",
"0.6456103",
"0.6410327",
"0.63590866",
"0.634312",
"0.6322978",
"0.6313593",
"0.6313299",
"0.62427825",
"0.6196907",
"0.61581326",
"0.61507016",
"0.6145003",
"0.613653... | 0.0 | -1 |
POST /cpm_files POST /cpm_files.json | def create
@cpm_file = CpmFile.new(cpm_file_params)
respond_to do |format|
if @cpm_file.save
format.html { redirect_to @cpm_file, notice: 'Cpm file was successfully created.' }
format.json { render :show, status: :created, location: @cpm_file }
else
format.html { render :new... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cpm_file_params\n params.require(:cpm_file).permit(:cpm_user_id, :cpm_task_id, :cpm_issue_id, :cpm_comment_id, :file_path)\n end",
"def create\n\n params['file'].each{|f|\n doc = Community::File.new(community_file_params)\n doc.file = f\n community_file_params[:title].blank? ? doc.t... | [
"0.6566623",
"0.6509117",
"0.61954606",
"0.61283433",
"0.60734123",
"0.6059427",
"0.6055984",
"0.6041812",
"0.6028058",
"0.602329",
"0.60065055",
"0.59914994",
"0.5938091",
"0.5934368",
"0.59013927",
"0.58634764",
"0.58577454",
"0.5837446",
"0.5822138",
"0.5814185",
"0.578460... | 0.67703545 | 0 |
PATCH/PUT /cpm_files/1 PATCH/PUT /cpm_files/1.json | def update
respond_to do |format|
if @cpm_file.update(cpm_file_params)
format.html { redirect_to @cpm_file, notice: 'Cpm file was successfully updated.' }
format.json { render :show, status: :ok, location: @cpm_file }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes... | [
"0.69420254",
"0.6701996",
"0.6426215",
"0.6325245",
"0.63058865",
"0.6265829",
"0.6262535",
"0.6250605",
"0.6233776",
"0.6215644",
"0.6203104",
"0.6200457",
"0.61509717",
"0.6127205",
"0.61174774",
"0.6108546",
"0.61053216",
"0.61042696",
"0.6099019",
"0.60769486",
"0.607403... | 0.69652534 | 0 |
DELETE /cpm_files/1 DELETE /cpm_files/1.json | def destroy
@cpm_file.destroy
respond_to do |format|
format.html { redirect_to cpm_files_url, notice: 'Cpm file was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_file(path)\n \n puts \"Sending path via MCollective Files client\"\n @mc.delete(:path => path)\n printrpcstats\n \n end",
"def b2_delete_file(file)\n\n if parse_files_json(file) == {}\n\n puts \"File not present\"\n\n else\n \n result_hash = convert_json(b2_delete... | [
"0.7306729",
"0.7086638",
"0.7063428",
"0.7036795",
"0.70115584",
"0.7005568",
"0.6945608",
"0.6933545",
"0.69317347",
"0.688369",
"0.6847073",
"0.68368584",
"0.68229073",
"0.67834705",
"0.6776119",
"0.6769641",
"0.6757172",
"0.6749306",
"0.67418873",
"0.6712825",
"0.66994745... | 0.7370596 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_cpm_file
@cpm_file = CpmFile.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 cpm_file_params
params.require(:cpm_file).permit(:cpm_user_id, :cpm_task_id, :cpm_issue_id, :cpm_comment_id, :file_path)
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.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.