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
GET /reuniaos/1 GET /reuniaos/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end", "def index\n @ores = Ore....
[ "0.6835554", "0.66239315", "0.660497", "0.6590874", "0.65755045", "0.6559959", "0.6542012", "0.6522165", "0.6476013", "0.6416402", "0.6398064", "0.6359223", "0.62901163", "0.62607354", "0.62429893", "0.62006867", "0.6189394", "0.6177802", "0.6170365", "0.6169526", "0.61685765...
0.0
-1
POST /reuniaos POST /reuniaos.json
def create @reuniao = Reuniao.new(reuniao_params) @pautum=Pautum.new @reuniao.pautum =@pautum @reuniao.atum=Atum.new @reuniao.status="Preparação" @pautum.status="Preparação" respond_to do |format| if @reuniao.save @pautum.titulo=@reuniao.titulo @pautum.save format.html { redirect_to @reuniao, notice: 'Reuniao was successfully created.' } format.json { render :show, status: :created, location: @reuniao } else format.html { render :new } format.json { render json: @reuniao.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reuniao_params\n params.require(:reuniao).permit(:titulo, :data, :horaInicio, :horaFim, :status, :local_id, :pautum_id, :atum_id, :category_id)\n end", "def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n ...
[ "0.60499835", "0.5926077", "0.59232473", "0.5913695", "0.58958787", "0.5895139", "0.58525664", "0.5826046", "0.581657", "0.5809309", "0.5802128", "0.5794866", "0.57665503", "0.5765792", "0.5757169", "0.5743332", "0.57291186", "0.5700146", "0.567887", "0.56627274", "0.5660639"...
0.58151996
9
PATCH/PUT /reuniaos/1 PATCH/PUT /reuniaos/1.json
def update @teste=Reuniao.new(reuniao_params) if @reuniao.status =="finalizada" redirect_to @reuniao , notice: 'Desculpe mas,reuniao finalizada não pode ser auterada.' else respond_to do |format| if @reuniao.update(reuniao_params) @pautum=Pautum.search(@reuniao.pautum) @pautum[0].status=@reuniao.status @pautum[0].titulo=@reuniao.titulo @pautum[0].save @atum=Atum.search(@reuniao.atum) @atum[0].status=@reuniao.status @atum[0].save format.html { redirect_to @reuniao, notice: 'Reuniao was successfully updated.' } format.json { render :show, status: :ok, location: @reuniao } else format.html { render :edit } format.json { render json: @reuniao.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redirect_to @resto, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @resto ...
[ "0.64688647", "0.64192533", "0.64176005", "0.62967926", "0.62967926", "0.6294707", "0.62231827", "0.6209157", "0.62061113", "0.61960936", "0.6177071", "0.616208", "0.616208", "0.61334085", "0.61327076", "0.6122387", "0.61189955", "0.6118504", "0.60809875", "0.6080924", "0.606...
0.0
-1
DELETE /reuniaos/1 DELETE /reuniaos/1.json
def destroy if @reuniao.status=="Preparação" @reuniao.destroy respond_to do |format| format.html { redirect_to reuniaos_url, notice: 'Reuniao was successfully destroyed.' } format.json { head :no_content } end else redirect_to @reuniao , notice: 'Desculpe mas,reuniao já foi confirmada você não pode remove-la.' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @relogio = Relogio.fi...
[ "0.72026485", "0.715872", "0.7100239", "0.7082266", "0.70052516", "0.69481534", "0.6925414", "0.69232285", "0.6921669", "0.6910399", "0.6899702", "0.68919283", "0.6891002", "0.6883174", "0.6872833", "0.6872833", "0.6872833", "0.6872833", "0.68534666", "0.6843784", "0.6840353"...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_reuniao @reuniao = Reuniao.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.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def reuniao_params params.require(:reuniao).permit(:titulo, :data, :horaInicio, :horaFim, :status, :local_id, :pautum_id, :atum_id, :category_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Creates an instance of SeriesIndex for each series page, renders it, and writes the output to a file. +series_prefix+ is the String path to the series folder. +series+ is the series currently being processed.
def write_series_index(series_prefix, series, posts, authors) index = SeriesIndex.new(self, source, series_prefix, series, posts, authors) index.render(layouts, site_payload) index.write(dest) # Record the fact that this page has been added, otherwise Site::cleanup will remove it. pages << index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_series_indexes\n series_posts = {}\n\n series = posts.docs.flat_map { |p| p.data[\"series\"] }.compact.uniq\n series.each do |name|\n safe_name = name.gsub(/_|\\P{Word}/, '-').gsub(/-{2,}/, '-').downcase\n path = File.join(\"series\", safe_name)\n\n this_series_posts =...
[ "0.68740076", "0.60683554", "0.60683554", "0.58662814", "0.5787246", "0.5773513", "0.5765061", "0.5740758", "0.5740758", "0.5740758", "0.55970913", "0.5594287", "0.55917275", "0.55168784", "0.54875255", "0.5478108", "0.5463077", "0.54525703", "0.54490393", "0.54209954", "0.53...
0.7945249
0
Loops through the list of series pages and processes each one.
def write_series_indexes series_posts = {} series = posts.docs.flat_map { |p| p.data["series"] }.compact.uniq series.each do |name| safe_name = name.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase path = File.join("series", safe_name) this_series_posts = posts.select { |p| p.data["series"] == name }.sort { |x, y| x.date <=> y.date } series_posts[name] = this_series_posts authors = this_series_posts.map { |p| p.data["author"] }.flatten.uniq.map { |key| self.config['authors'][key] } write_series_index(path, name, series_posts, authors) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_process(pages)\n end", "def ingest_pages\n if @has_mets\n # This is basically equivalent to the BookPackage processing.\n sequence = 0\n @table_of_contents.unique_pages.each do |entry|\n sequence += 1\n label = entry.title ? Utils.xml_escape(entry.title) : \"Page #{sequ...
[ "0.6597607", "0.65578824", "0.650439", "0.6368041", "0.63670576", "0.61849767", "0.6150049", "0.59530354", "0.59478474", "0.59427464", "0.58712155", "0.587099", "0.58445007", "0.58286583", "0.5815935", "0.5815935", "0.581154", "0.5743007", "0.5743007", "0.5740021", "0.5737911...
0.0
-1
Gets a series name, and pulls out a markdown header file returning either the rendered markdown, or an empty string
def series_bio(series) bio_path = "_includes/_series_bio/#{to_series_id(series)}.md" return "" unless File.exist?(bio_path) markdownify(File.read(bio_path)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def markdown_title\n render_as_markdown title\n end", "def extract_md_title(item)\n\t\tif (item[:extension] != 'md')\n\t\t\treturn nil\n\t\tend\n\n\t\tcontent = item.raw_content.lines.each{|l|\n\t\t\tif (l.start_with?('# '))\n\t\t\t\treturn l[2..-1].strip()\n\t\t\tend\n\t\t}\n\t\tnil\n\tend", "def title()\...
[ "0.6470619", "0.636914", "0.6249694", "0.614175", "0.5929194", "0.5911448", "0.5909682", "0.5903798", "0.58985376", "0.5889356", "0.58799535", "0.5820013", "0.5725712", "0.5659979", "0.5659979", "0.5653578", "0.56455696", "0.55961025", "0.55942786", "0.55597687", "0.55541897"...
0.66396815
0
Series Name > Series ID for URLs
def to_series_id(series_name) series_name.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def series(id)\n get(\"/catalog/titles/series/#{id.to_s}?\")\n end", "def set_series\n @series = Series.friendly.find(params[:id])\n end", "def get_series (series_name)\n end", "def series_links(options = {})\n generate_links(:series, options)\n end", "def [] (series_id)\n Serie...
[ "0.6870031", "0.64083457", "0.63562787", "0.62019044", "0.6194172", "0.6138097", "0.6127454", "0.60452026", "0.59736353", "0.59736353", "0.5916976", "0.58610326", "0.58597565", "0.58401567", "0.58279127", "0.5824961", "0.57486075", "0.571796", "0.5689775", "0.5641594", "0.561...
0.6198841
4
subcommand 'console', 'Use console', Turbo::Cli::ConsoleCommand
def execute end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subcommand() __subcommand__ end", "def console\nend", "def console; end", "def console; end", "def __subcommand__!() @__subcommand__ end", "def subcommand!() __subcommand__! end", "def run_cmd(cmd)\n\t\tconsole.run_single(cmd)\n\tend", "def run_cmd(cmd)\n\t\tconsole.run_single(cmd)\n\tend", "de...
[ "0.72108346", "0.691552", "0.68188614", "0.68188614", "0.676146", "0.6731146", "0.6680069", "0.6680069", "0.6637479", "0.6637479", "0.66013145", "0.65844333", "0.65399045", "0.6534787", "0.6523297", "0.6523297", "0.64156973", "0.64156973", "0.64085", "0.64048654", "0.64008623...
0.0
-1
change the time of csv to array of the string
def state_time arr = [] @state_in_stock.each do |state| arr << state.time end arr.shift arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_to_array(csv); end", "def collect_registration_times(csv)\n registration_times = []\n csv.each do |row|\n registration_times.push(row[:regdate])\n end\n registration_times\nend", "def csv_to_array(csv)\n csv.split(\",\").map(&:strip)\n end", "def csv_to_array(csv)\n csv.split(\",\...
[ "0.7170756", "0.67584664", "0.6653008", "0.6653008", "0.6446374", "0.62670535", "0.62043846", "0.619307", "0.618639", "0.61657447", "0.60851187", "0.60675925", "0.59545547", "0.5935562", "0.58293605", "0.5824333", "0.57760686", "0.5769054", "0.5767165", "0.57640857", "0.57640...
0.0
-1
return the G of the memory_used
def memory_used_with_g self.memory_memused.map { |i| i / 1000000000.0} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def memused\n @memtotal - @memfree\n end", "def used_space\n size - free_space\n end", "def get_system_used_memory_mb\n # (`free -ml | grep 'Mem:' | awk -F' ' '{ print $3 }'`.strip.to_i rescue 0).round(MEMORY_PRECISION)\n get_system_memory_info_mb[:used_memory]\n end", "def u...
[ "0.8192482", "0.74618405", "0.73698425", "0.725158", "0.72443634", "0.7104819", "0.7021407", "0.6937105", "0.69258064", "0.68833137", "0.68330634", "0.68243206", "0.68224776", "0.67919606", "0.67892736", "0.6735222", "0.6727308", "0.66770434", "0.66379344", "0.6554792", "0.65...
0.8770565
0
Get MAC address for given network interface
def hwaddr(iface=nil) @hwaddr[iface || default_iface] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMAC(interface)\n cmd = `ifconfig #{interface}`\n mac = cmd.match(/(([A-F0-9]{2}:){5}[A-F0-9]{2})/i).captures\n @log.debug \"MAC of interface '#{interface}' is: #{mac.first}\"\n return mac.first\n end", "def get_mac_for_interface(interfaces, interface)\n interfaces[interface][:add...
[ "0.86720955", "0.7913026", "0.7414164", "0.69589853", "0.6948064", "0.682697", "0.6823449", "0.67889345", "0.6763014", "0.67299986", "0.67064154", "0.6683104", "0.6640576", "0.66256136", "0.66042554", "0.6578205", "0.6578205", "0.6457956", "0.64517826", "0.6446098", "0.643857...
0.64601237
17
Get IP address for given network interface
def ipaddr(iface=nil) @ipaddr[iface || default_iface] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getIP(interface)\n cmd = `ip addr show #{interface}`\n ip = cmd.match(/inet ((\\d{1,3}\\.){3}\\d{1,3})\\/\\d{1,2}/).captures\n @log.debug \"IP of interface '#{interface}' is: #{ip.first}\"\n return ip.first\n end", "def ip_by_interface(int)\n ip = `ifconfig #{int} | awk '/inet a...
[ "0.8555063", "0.81882817", "0.80670244", "0.7752608", "0.7602657", "0.73816", "0.73301166", "0.73058283", "0.7160127", "0.710863", "0.70996505", "0.70757955", "0.7054518", "0.6985641", "0.6961341", "0.6921595", "0.6913661", "0.67933446", "0.6764389", "0.6755075", "0.6745965",...
0.7572638
5
Get IPv6 addresses for given network interface
def ip6addr(iface=nil) @ip6addr[iface || default_iface] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ipv_6_address\n data[:ipv_6_address]\n end", "def get_network_by_interface(interface)\n\n ifconfig = `ifconfig`.split(\"\\n\\n\").index_by{|x| x[/\\w+/,0]}\n inet = ifconfig[interface][/inet addr:([^\\s]*)/, 1].split('.')\n broadcast = ifconfig[interface][/Bcast:([^\\s]*)/, 1].split('.')\n ...
[ "0.7116361", "0.6938847", "0.676212", "0.6639546", "0.6615338", "0.65693766", "0.6567787", "0.6519293", "0.64779574", "0.6440461", "0.6368515", "0.6365575", "0.634222", "0.6330421", "0.6313009", "0.6286359", "0.6276088", "0.62156713", "0.62151355", "0.6155032", "0.6131523", ...
0.732161
0
GET /vertices_scene3s GET /vertices_scene3s.json
def index @vertices_scene3s = VerticesScene3.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_vertices_scene3\n @vertices_scene3 = VerticesScene3.find(params[:id])\n end", "def index\n @position_scene3s = PositionScene3.all\n end", "def index\n @vertices_scene1s = VerticesScene1.all\n end", "def vertices_scene3_params\n params.require(:vertices_scene3).permit(:file_name, ...
[ "0.6947419", "0.6527479", "0.6461013", "0.64133304", "0.63261", "0.63257515", "0.6186886", "0.5959536", "0.57730824", "0.5721756", "0.5705856", "0.5575419", "0.55732656", "0.5552519", "0.55313027", "0.5500711", "0.54620427", "0.5449338", "0.54421437", "0.54275167", "0.5427031...
0.7805892
0
GET /vertices_scene3s/1 GET /vertices_scene3s/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @vertices_scene3s = VerticesScene3.all\n end", "def set_vertices_scene3\n @vertices_scene3 = VerticesScene3.find(params[:id])\n end", "def index\n @vertices_scene1s = VerticesScene1.all\n end", "def index\n @position_scene3s = PositionScene3.all\n end", "def create\n @ver...
[ "0.7945624", "0.7263451", "0.68080884", "0.6635257", "0.6621084", "0.6565784", "0.65183806", "0.6462523", "0.6331203", "0.6234234", "0.5992884", "0.58883584", "0.58582413", "0.5848805", "0.5848162", "0.57352114", "0.5658021", "0.5619813", "0.5617279", "0.5612266", "0.5575353"...
0.0
-1
POST /vertices_scene3s POST /vertices_scene3s.json
def create @vertices_scene3 = VerticesScene3.new(vertices_scene3_params) respond_to do |format| if @vertices_scene3.save format.html { redirect_to @vertices_scene3, notice: 'Vertices scene3 was successfully created.' } format.json { render :show, status: :created, location: @vertices_scene3 } else format.html { render :new } format.json { render json: @vertices_scene3.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertices_scene3_params\n params.require(:vertices_scene3).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end", "def index\n @vertices_scene3s = VerticesScene3.all\n end", "def set_vertices_scene3\n ...
[ "0.68933517", "0.6723877", "0.66946065", "0.6317433", "0.62770844", "0.61728966", "0.61580074", "0.61064494", "0.60265154", "0.594289", "0.5898349", "0.5845055", "0.5811973", "0.58016104", "0.5799848", "0.5784505", "0.5784068", "0.56881577", "0.5647149", "0.56080943", "0.5563...
0.71943593
0
PATCH/PUT /vertices_scene3s/1 PATCH/PUT /vertices_scene3s/1.json
def update respond_to do |format| if @vertices_scene3.update(vertices_scene3_params) format.html { redirect_to @vertices_scene3, notice: 'Vertices scene3 was successfully updated.' } format.json { render :show, status: :ok, location: @vertices_scene3 } else format.html { render :edit } format.json { render json: @vertices_scene3.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_vertices_scene3\n @vertices_scene3 = VerticesScene3.find(params[:id])\n end", "def update\n respond_to do |format|\n if @vertices_scene1.update(vertices_scene1_params)\n format.html { redirect_to @vertices_scene1, notice: 'Vertices scene1 was successfully updated.' }\n forma...
[ "0.7052359", "0.69707906", "0.6641705", "0.6636305", "0.6583439", "0.6511954", "0.63546145", "0.634106", "0.631423", "0.6267202", "0.618779", "0.61453265", "0.6047909", "0.6009059", "0.5997659", "0.5968267", "0.596286", "0.5947431", "0.58590555", "0.58210963", "0.5792335", ...
0.751043
0
DELETE /vertices_scene3s/1 DELETE /vertices_scene3s/1.json
def destroy @vertices_scene3.destroy respond_to do |format| format.html { redirect_to vertices_scene3s_url, notice: 'Vertices scene3 was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @vertices_scene1.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene1s_url, notice: 'Vertices scene1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vertices_scene2.destroy\n respond_to do |format|\n ...
[ "0.76638055", "0.7407991", "0.731544", "0.72432125", "0.7113815", "0.70814997", "0.70529634", "0.70463", "0.69181985", "0.679274", "0.6759311", "0.6703038", "0.6695807", "0.6664102", "0.65939665", "0.6548531", "0.65463", "0.65247935", "0.6513129", "0.6510034", "0.6486724", ...
0.8029167
0
Use callbacks to share common setup or constraints between actions.
def set_vertices_scene3 @vertices_scene3 = VerticesScene3.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 vertices_scene3_params params.require(:vertices_scene3).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Execute a read operation with retrying. This method performs server selection for the specified server selector and yields to the provided block, which should execute the initial query operation and return its result. The block will be passed the server selected for the operation. If the block raises an exception, and this exception corresponds to a read retryable error, and read retries are enabled for the client, this method will perform server selection again and yield to the block again (with potentially a different server). If the block returns successfully, the result of the block is returned. If modern retry reads are on (which is the default), the initial read operation will be retried once. If legacy retry reads are on, the initial read operation will be retried zero or more times depending on the :max_read_retries client setting, the default for which is 1. To disable read retries, turn off modern read retries by setting retry_reads: false and set :max_read_retries to 0 on the client.
def read_with_retry(session = nil, server_selector = nil, &block) if session.nil? && server_selector.nil? # Older versions of Mongoid call read_with_retry without arguments. # This is already not correct in a MongoDB 3.6+ environment with # sessions. For compatibility we emulate the legacy driver behavior # here but upgrading Mongoid is strongly recommended. unless $_mongo_read_with_retry_warned $_mongo_read_with_retry_warned = true Logger.logger.warn("Legacy read_with_retry invocation - please update the application and/or its dependencies") end # Since we don't have a session, we cannot use the modern read retries. # And we need to select a server but we don't have a server selector. # Use PrimaryPreferred which will work as long as there is a data # bearing node in the cluster; the block may select a different server # which is fine. server_selector = ServerSelector.get(mode: :primary_preferred) legacy_read_with_retry(nil, server_selector, &block) elsif session && session.retry_reads? modern_read_with_retry(session, server_selector, &block) elsif client.max_read_retries > 0 legacy_read_with_retry(session, server_selector, &block) else server = select_server(cluster, server_selector, session) yield server end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_with_retry(session = nil, server_selector = nil, &block)\n if session.nil? && server_selector.nil?\n deprecated_legacy_read_with_retry(&block)\n elsif session&.retry_reads?\n modern_read_with_retry(session, server_selector, &block)\n elsif client.max_read_retries > 0...
[ "0.7606874", "0.7516937", "0.7469495", "0.70588434", "0.6869285", "0.6843921", "0.5708621", "0.56916887", "0.55448127", "0.5526731", "0.5522171", "0.552151", "0.53208464", "0.5317746", "0.52924037", "0.5275784", "0.5245559", "0.5212862", "0.5204242", "0.5203501", "0.5188061",...
0.8007451
0
Execute a read operation with a single retry on network errors. This method is used by the driver for some of the internal housekeeping operations. Applicationrequested reads should use read_with_retry rather than this method.
def read_with_one_retry(options = nil) yield rescue Error::SocketError, Error::SocketTimeoutError => e retry_message = options && options[:retry_message] log_retry(e, message: retry_message) yield end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_with_one_retry(options = nil)\n yield\n rescue *retryable_exceptions, Error::PoolError => e\n raise e unless e.write_retryable?\n\n retry_message = options && options[:retry_message]\n log_retry(e, message: retry_message)\n yield\n end", "def retry_read(origi...
[ "0.7040673", "0.69741064", "0.6954268", "0.6710739", "0.6425707", "0.6406525", "0.63887227", "0.6345055", "0.63359636", "0.6294157", "0.62598115", "0.6087128", "0.60760576", "0.60479987", "0.5969055", "0.58734405", "0.586398", "0.5840996", "0.58271146", "0.58090657", "0.58001...
0.7404647
0
Retryable writes wrapper for operations not supporting modern retryable writes. If the driver is configured to use modern retryable writes, this method yields to the passed block exactly once, thus not retrying any writes. If the driver is configured to use legacy retryable writes, this method delegates to legacy_write_with_retry which performs write retries using legacy logic.
def nro_write_with_retry(session, write_concern, &block) if session && session.client.options[:retry_writes] server = select_server(cluster, ServerSelector.primary, session) yield server else legacy_write_with_retry(nil, session, &block) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def legacy_write_with_retry(server = nil, session = nil)\n # This is the pre-session retry logic, and is not subject to\n # current retryable write specifications.\n # In particular it does not retry on SocketError and SocketTimeoutError.\n attempt = 0\n begin\n attempt += 1\n ...
[ "0.7332594", "0.62673813", "0.60600805", "0.6027896", "0.5854627", "0.57909036", "0.5641635", "0.56081116", "0.5550251", "0.54582137", "0.5435709", "0.5403387", "0.53221714", "0.5262427", "0.51594913", "0.5137914", "0.5129182", "0.5110893", "0.50913984", "0.5053862", "0.50491...
0.7439151
0
Implements legacy write retrying functionality by yielding to the passed block one or more times. This method is used for operations which are not supported by modern retryable writes, such as delete_many and update_many.
def legacy_write_with_retry(server = nil, session = nil) # This is the pre-session retry logic, and is not subject to # current retryable write specifications. # In particular it does not retry on SocketError and SocketTimeoutError. attempt = 0 begin attempt += 1 server ||= select_server(cluster, ServerSelector.primary, session) yield server rescue Error::OperationFailure => e server = nil if attempt > client.max_write_retries raise end if e.write_retryable? && !(session && session.in_transaction?) log_retry(e, message: 'Legacy write retry') cluster.scan!(false) retry else raise end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retry\n raise \"#{@error_msg_prefix} must be passed a block\" unless block_given?\n\n attempts = 0\n start_time = Time.now\n begin\n attempts += 1\n yield attempts\n rescue InfluxError => e\n if attempts > @max_retries\n @api_client.log(:error, 'Maximum re...
[ "0.6986061", "0.6653464", "0.63490075", "0.6196515", "0.60775375", "0.5983991", "0.5978165", "0.59623253", "0.5922175", "0.5881764", "0.5860333", "0.57798904", "0.57437915", "0.56934613", "0.56842095", "0.5648848", "0.5647232", "0.5636999", "0.56354123", "0.5615424", "0.55967...
0.67037195
1
This is a separate method to make it possible for the test suite to assert that server selection is performed during retry attempts.
def select_server(cluster, server_selector, session) server_selector.select_server(cluster, nil, session) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unsupported_with_retry_and_fail\n msg = mk_message({'error' => 'Unsupported type',\n 'error_code' => 'unsupported-type',\n 'assoc_type' => 'HMAC-SHA1',\n 'session_type' => 'DH-SHA1',\n })\n\n assert_log...
[ "0.6239674", "0.6226784", "0.6111998", "0.6076167", "0.6062614", "0.60483474", "0.60483474", "0.5989712", "0.5844185", "0.5825205", "0.58239114", "0.5798254", "0.57300836", "0.5719041", "0.5692996", "0.5646301", "0.5628459", "0.5611078", "0.55926144", "0.55818194", "0.5577724...
0.0
-1
Log a warning so that any application slow down is immediately obvious.
def log_retry(e, options = nil) message = if options && options[:message] options[:message] else "Retry" end Logger.logger.warn "#{message} due to: #{e.class.name} #{e.message}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warning(msg) log(4, msg); end", "def log_warning(message)\n log(message, DebugType::WARNING)\n end", "def warn(msg)\n puts \"WARNING: #{msg}\"\n end", "def warning(context, options = nil)\n options = options.merge(level: 'warning')\n log(context, options)\n en...
[ "0.7569668", "0.72883403", "0.706101", "0.70421386", "0.70386136", "0.70006114", "0.69831985", "0.6962385", "0.693978", "0.69324446", "0.69212496", "0.6917777", "0.6876546", "0.685673", "0.68340224", "0.682543", "0.682543", "0.682543", "0.682261", "0.68158", "0.67673105", "...
0.0
-1
Retry writes on MMAPv1 should raise an actionable error; append actionable information to the error message and preserve the backtrace.
def raise_unsupported_error(e) new_error = Error::OperationFailure.new("#{e.class}: #{e} "\ "This MongoDB deployment does not support retryable writes. Please add "\ "retryWrites=false to your connection string or use the retry_writes: false Ruby client option") new_error.set_backtrace(e.backtrace) raise new_error end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_error!(error, retry_interval = nil)\n self.attempts += 1\n self.run_at = Time.now.utc + (retry_interval * attempts) if retry_interval\n self.error = \"#{error.class.name}: #{error.message}\\n#{error.backtrace.join(\"\\n\")[0, 4000]}\"\n self.lock = nil\n begin\n...
[ "0.6248928", "0.6105354", "0.59540343", "0.5940495", "0.5921533", "0.58566594", "0.5832966", "0.5717418", "0.56797385", "0.55847794", "0.55472517", "0.5547213", "0.5424537", "0.5424079", "0.53913605", "0.5380799", "0.53568566", "0.5350403", "0.53491926", "0.534391", "0.533753...
0.51979864
33
Use callbacks to share common setup or constraints between actions.
def set_element @element = Element.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 element_params params.require(:element).permit(:folio_id, :title, :description, :citation, :image, :document, :image_content_type, :document_content_type, :audio, :audio_content_type, :element_link, :font) 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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
should equal the name of this class
def test_tst_suite_name assert_equal "TcNameStuff", tst_suite_name, "Test suite name is wrong" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_name; end", "def class_name; end", "def name\n @class_name\n end", "def name\n raise \"No name defined for #{self.class}\"\n end", "def name; self.class.name; end", "def name\n\t\tself.class.name\n\tend", "def name; end", "def name; end", "def name; end", "def name; end"...
[ "0.75142574", "0.75142574", "0.7472441", "0.73902273", "0.7323503", "0.7188993", "0.71887153", "0.71887153", "0.71887153", "0.71887153", "0.71887153", "0.71887153", "0.71887153", "0.71887153", "0.71887153", "0.71887153", "0.71887153", "0.71887153", "0.71887153", "0.71887153", ...
0.0
-1
You are writing the user registration page for a secure web site. On the registration page, the user has to enter a user ID and a password, which has to adhere to the to following criteria: User ID and password cannot be the same User ID and password have to be at least six characters long Password has to contain at least one of: !$ User ID cannot contain the following characters: !$ and space Password cannot be the word "password" Challenge: Write a function called same that takes a user ID and a password, and returns true if they are, and false otherwise.
def same (user_id, password) if user_id.downcase == password.downcase puts "User ID and password cannot be the same" else puts "Acceptable" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def same(userID, password)\n if (userID != password)\n false\n else (userID == password)\n true\n end\nend", "def validate_password\n puts \"Enter your User ID and Password here.\"\n user_id = gets.chomp\n password = gets.chomp\n\n same(user_id, password)\n long_enough(user_...
[ "0.76981306", "0.75316346", "0.7478769", "0.73651356", "0.7336832", "0.7139013", "0.7021972", "0.70057064", "0.69959897", "0.69346416", "0.68962824", "0.6889446", "0.6813908", "0.67890525", "0.6770607", "0.6770607", "0.67283314", "0.6713639", "0.6695211", "0.66751957", "0.665...
0.76284504
1
Challenge: Write a function called long_enough that checks whether a String is at least six characters long, and returns true if it is, and false otherwise.
def long_enough(string) if string.length < 6 puts "Must be at least 6 characters in length" else puts "Acceptable" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def long_enough(string)\n if (string.length >= 6)\n true\n else\n false\n end\nend", "def long_enough(string)\n if (string.length >= 6)\n true\n else\n false\n end\nend", "def not_long_enough?(string)\n if string.length >= 6\n false\n else\n true\n end\nend", "def lon...
[ "0.9014257", "0.89802146", "0.88297135", "0.7104552", "0.7021023", "0.6966158", "0.66987735", "0.65627867", "0.65511954", "0.6503209", "0.64535564", "0.64353335", "0.6427704", "0.64167655", "0.6374952", "0.6371698", "0.636941", "0.63484925", "0.6346467", "0.6330152", "0.63144...
0.8281891
3
Challenge Write a function called does_not_contain_special which checks to see if !, , $ is not contained in a given String.
def does_not_contain_special(user_id) if user_id.include?("!") || user_id.include?("#") || user_id.include?("$") puts "User ID cannot contain these characters: !, #, or $" else puts "Acceptable" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def does_not_contain_special str\n !(str.include?(\"#\") || str.include?(\"!\") || str.include?(\"$\"))\n end", "def does_not_contain_special?(string)\n if string.include?(\"!\") || string.include?(\"#\") || string.include?(\"$\")\n false\n else\n true\n end\nend", "def does_not_contain_special(st...
[ "0.87164503", "0.85450435", "0.84527457", "0.7684753", "0.76714414", "0.75634795", "0.74500483", "0.70066607", "0.6873331", "0.6779606", "0.6685548", "0.6646588", "0.64807165", "0.6382931", "0.63530886", "0.6341893", "0.63106877", "0.6266322", "0.62487614", "0.62434065", "0.6...
0.72890615
7
Challenge Write a method called contains_special which checks to see if !, , $ is contained in a given String.
def contains_special(password) if password.include?("!") || password.include?("#") || password.include?("$") puts "Acceptable" else puts "Password must contain at least one of the following: !, #, or $" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains_special?(string)\n if string.include?(\"!\") || string.include?(\"#\") || string.include?(\"$\")\n true\n else\n false\n end\nend", "def contains_special(string)\n if (string.include?('!') || string.include?('#') || string.include?('$'))\n true\n else\n false\n end\nend", "def co...
[ "0.84712976", "0.8430692", "0.83371276", "0.8253317", "0.81377345", "0.80772114", "0.7588429", "0.74152094", "0.7158445", "0.7154891", "0.66996646", "0.6554445", "0.6542838", "0.6531838", "0.6446926", "0.6413242", "0.6253345", "0.6041377", "0.5766639", "0.57584035", "0.571934...
0.73792225
8
Function that accepts a password and determins if it is the word "password." If so, inform the user that the password cannot be the word "password." Else, return acceptable.
def is_password(password) if password.downcase == "password" puts "Password cannot be the word password" else puts "Acceptable" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_password_password(pass)\n if pass.downcase == 'password'\n 'Sorry, password cannot be password.'\n else\n 'Yay, password is not password.'\n end\nend", "def valid_password?(password); end", "def valid_password?(password)\n true\n end", "def password?\n password\n end", "def ...
[ "0.8635047", "0.8300314", "0.7876978", "0.7759409", "0.77545303", "0.7731918", "0.767898", "0.7655154", "0.751973", "0.75145894", "0.7486795", "0.74745005", "0.7455801", "0.73718923", "0.7338057", "0.7338057", "0.73269415", "0.73203856", "0.7289988", "0.728503", "0.72575027",...
0.84099275
1
Challenge Write a method that inputs user ID and password from the user, and then tells the user if the they are acceptable. Write a main method called validate_password that: First lets a user input both user ID and password, Then use the methods above to evaluate if the user ID and password combination is acceptable or not Tells user what the result is.
def validate_password puts "Enter your User ID and Password here." user_id = gets.chomp password = gets.chomp same(user_id, password) long_enough(user_id) long_enough(password) does_not_contain_special(user_id) contains_special(password) is_password(password) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input(user_id, password)\n if user_id == password\n 'Password and username cannot be the same'\n elsif user_id.length <= 6 && password.length <= 6\n 'Password and username must be at least six characters long'\n end\nend", "def valid_password?(password); end", "def validate_password\n puts 'Enter...
[ "0.787579", "0.738624", "0.72956103", "0.7281831", "0.72310627", "0.72258794", "0.71474636", "0.71118766", "0.70909023", "0.69785327", "0.69628257", "0.69377697", "0.68654037", "0.68412006", "0.68141174", "0.6794655", "0.6747935", "0.67042255", "0.66906774", "0.6677294", "0.6...
0.8541679
0
Searching for names of faculties, courses and groups to store in db
def names(options_tag) names = options_tag.map { |option| option.text } names.reject! { |s| s.nil? || s.strip.empty? || s == '\n' || s == "\u00A0"} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_festival_database(list_festival_name, year)\n # try to find festival's in database for each name\n list_festival_name.each do |festival_name|\n festival = Festival.find_one_by_name_and_year(\n festival_name.tr('-', ' '),\n festival_name, year\n )\n ...
[ "0.58550936", "0.55796844", "0.55724686", "0.5561325", "0.5550329", "0.554557", "0.55351835", "0.53986657", "0.5368069", "0.53614306", "0.53497964", "0.53475016", "0.5339391", "0.5318524", "0.5298524", "0.5273039", "0.52696407", "0.52674156", "0.52652025", "0.5246684", "0.523...
0.0
-1
METHODS Method names use lower case snake_case by convention
def count puts 1 puts 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snake_case(name); end", "def camelize_methodname\n self.titleize.gsub(' ', '').camelize(:lower)\n end", "def sanitize_method_name( name )\n name.to_s.camelize\n end", "def method_name\n\n end", "def method_name\n\n end", "def method_name\n\n end", "def lowercase_name\n ...
[ "0.77629614", "0.77124107", "0.72157097", "0.71090543", "0.71090543", "0.71090543", "0.7090032", "0.7049478", "0.7022118", "0.69969404", "0.69457877", "0.6909394", "0.6909394", "0.6909394", "0.6909394", "0.6909394", "0.6909394", "0.6909394", "0.6909394", "0.6909394", "0.69093...
0.0
-1
Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. I worked on this challenge [by myself]. 1. Pseudocode What is the input? What is the output? (i.e. What should the code return?) What are the steps needed to solve the problem? =begin Total Method: Input is an array of numbers (string or floats) Output is number SET variable, sum, to 0 ITERATE over array of numbers and add each element to sum RETURN sum =end =begin Sentence Maker Method: Input is an array of strings Output is string formatted to a sentence SET variable, sentence, to capitalized first letter in array. ADD period to last element in array. ITERATE over array of strings from second element on and add each element to sentence with a space seperation RETURN sentence =end 2. Initial Solution
def total(array) =begin Input: Array of integers or floats Output: Integer or float =end #SET variable, sum, to 0 #ITERATE over array of numbers and add each element to sum sum = 0 array.each{|x| sum += x } #RETURN sum return sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sentence_maker(array)\n x = 0\n sum = \"\"\n while x <= array.length-1\n sum += array[x].to_s + \" \"\n x += 1\n end\n sum.rstrip!\n sum += \".\"\n sum.capitalize!\n return sum\nend", "def sentence_maker(array)\n\tx = 0\n\tsum = \"\"\n\twhile x <= array.length-1\n\t\tif x == array.length-1\n\t\...
[ "0.7448059", "0.7412422", "0.72410434", "0.7204586", "0.69159865", "0.68765104", "0.6868407", "0.68632215", "0.68014175", "0.68006635", "0.6769875", "0.67697287", "0.67697287", "0.67697287", "0.6762957", "0.675488", "0.67473716", "0.67310673", "0.67092305", "0.6705538", "0.67...
0.0
-1
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.account_activation.subject
def account_activation(user) @user = user mail to: user.email, subject: "Account activation" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subje...
[ "0.661661", "0.66157335", "0.66091734", "0.6607639", "0.66059273", "0.65407974", "0.64996886", "0.64913183", "0.64067274", "0.6397239", "0.6349244", "0.634307", "0.63418543", "0.6336745", "0.63333845", "0.62989044", "0.6283756", "0.6230694", "0.62289786", "0.6189513", "0.6151...
0.5737796
77
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.password_reset.subject
def password_reset(user) @user = user mail to: user.email, subject: "Password reset" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_reset(user)\n @user = user\n mail :to => user.email, :subject => I18n.t(\"reset_password\")\n end", "def forgot_password(user)\n setup_email(user)\n subject \"Password Reset\"\n end", "def reset_password(user)\n @recipients = user.email\n @from = \"#{Site.current.email}\"\n ...
[ "0.6849209", "0.6812218", "0.67440695", "0.6704444", "0.66813886", "0.6637522", "0.65938175", "0.6573038", "0.65559816", "0.650747", "0.6482231", "0.6470183", "0.64564645", "0.6451043", "0.6443142", "0.6412122", "0.64092064", "0.64008343", "0.6397685", "0.6389013", "0.6387808...
0.6201523
68
TODO(dtan4): Use terraform's utility method
def apply_template(client) ERB.new(open(template_path).read, nil, "-").result(binding) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_terraform_output\n {\n 'chef_server_ip' => `terraform output chef-server-ip`.chomp,\n 'chef_server_dns' => `terraform output chef-server-private-dns`.chomp,\n 'test_db_ip' => `terraform output test-db-ip`.chomp,\n 'test_db_dns' => `terraform output test-db-private-dns`.chomp,\n 't...
[ "0.62017715", "0.593084", "0.5926508", "0.56366265", "0.5444777", "0.5442593", "0.54364836", "0.5414038", "0.53086793", "0.5278864", "0.52619886", "0.5252788", "0.5230826", "0.5204503", "0.5137038", "0.51270634", "0.5096929", "0.5084236", "0.50839394", "0.50828624", "0.507804...
0.0
-1
Nokogiri XML DOM for the current Brominet XML representation of the GUI
def dom_for_gui @dom = Nokogiri::XML self.dump end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def document_root_element; end", "def document\n @doc ||= Nokogiri::XML(@xml)\n end", "def xml_page\n page = BR.html\n Nokogiri::HTML(page)\nend", "def to_dom\n end", "def root_element\n root.xml \n end", "def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n ...
[ "0.66034204", "0.6129919", "0.60748994", "0.60726964", "0.5955403", "0.5942814", "0.5925995", "0.5840247", "0.58319783", "0.58319783", "0.58211374", "0.5702781", "0.5672204", "0.5640138", "0.5640138", "0.5640138", "0.5640138", "0.5599672", "0.5513765", "0.55127746", "0.550664...
0.7758821
0
moving in from SummaryReportsController
def evaluate load_activities @ta_delivery_methods = TaDeliveryMethod.all @intensity_levels = IntensityLevel.all @ta_categories = TaCategory.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reports\r\n ReportsController.instance\r\n end", "def index\n @action_reports = ActionReport.all\n end", "def index\n @villagesummaryreports = Villagesummaryreport.all\n end", "def index\n @reports = current_user.reports.all\n\n end", "def show\n @summaries = Summary.all \n end"...
[ "0.6820663", "0.64884424", "0.6374498", "0.63075167", "0.6290353", "0.6286144", "0.6264552", "0.6249338", "0.6248855", "0.62458616", "0.6241818", "0.62269765", "0.62269765", "0.62269765", "0.62269765", "0.62269765", "0.62269765", "0.62269765", "0.62269765", "0.62269765", "0.6...
0.0
-1
method will get the availability set using the resource group and availability set name will return whether or not the availability set exists.
def get(resource_group, availability_set) begin promise = @client.availability_sets.get(resource_group, availability_set).value! promise.body rescue MsRestAzure::AzureOperationError => e # if the error is that the availability set doesn't exist, # just return a nil if e.response.status == 404 puts 'Availability Set Not Found! Create It!' return nil end OOLog.fatal("Error getting availability set: #{e.body}") rescue => ex OOLog.fatal("Error getting availability set: #{ex.message}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get\n begin\n @compute_client.availability_sets.get(@rg_name, @as_name)\n rescue MsRestAzure::AzureOperationError => e\n # if the error is that the availability set doesn't exist,\n # just return a nil\n if e.response.status == 404\n puts 'Availability Set Not Fou...
[ "0.7890201", "0.6424305", "0.63078326", "0.62401146", "0.6052578", "0.594958", "0.5788202", "0.5751019", "0.5751019", "0.5751019", "0.5751019", "0.5686802", "0.5665306", "0.563477", "0.5490222", "0.547429", "0.5470106", "0.54405504", "0.54319423", "0.5431734", "0.5400787", ...
0.809806
0
this method will add the availability set if needed. it first checks to make sure the availability set exists, if not, it will create it.
def add(resource_group, availability_set, location) # check if it exists existance_promise = get(resource_group, availability_set) if !existance_promise.nil? OOLog.info("Availability Set #{existance_promise.name} exists in the #{existance_promise.location} region.") else # need to create the availability set OOLog.info("Creating Availability Set '#{availability_set}' in #{location} region") avail_set = get_avail_set_props(location) begin start_time = Time.now.to_i response = @client.availability_sets.create_or_update(resource_group, availability_set, avail_set).value! response.body end_time = Time.now.to_i duration = end_time - start_time OOLog.info("Availability Set created in #{duration} seconds") rescue MsRestAzure::AzureOperationError => e OOLog.fatal("Error adding an availability set: #{e.body}") rescue => ex OOLog.fatal("Error adding an availability set: #{ex.message}") end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add\n # check if it exists\n as_exist = @compute_client.availability_sets.check_availability_set_exists(@rg_name, @as_name)\n if as_exist\n OOLog.info(\"Availability Set #{@as_name} exists in the #{@location} region.\")\n else\n # need to create the availability set\n O...
[ "0.7660444", "0.61491245", "0.59813905", "0.58553535", "0.58325064", "0.58325064", "0.58325064", "0.58325064", "0.57462674", "0.5707677", "0.5688543", "0.56762767", "0.56389725", "0.56216985", "0.5620077", "0.5520083", "0.5517219", "0.5509976", "0.5502146", "0.5430218", "0.53...
0.6881376
1
create the properties object for creating availability sets
def get_avail_set_props(location) avail_set_props = Azure::ARM::Compute::Models::AvailabilitySetProperties.new # At least two domain faults avail_set_props.platform_fault_domain_count = 2 avail_set_props.platform_update_domain_count = 2 # At this point we do not have virtual machines to include avail_set_props.virtual_machines = [] avail_set_props.statuses = [] avail_set = Azure::ARM::Compute::Models::AvailabilitySet.new avail_set.location = location avail_set.properties = avail_set_props avail_set end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_avail_set_properties(location)\n avail_set_props = Azure::ARM::Compute::Models::AvailabilitySetProperties.new\n # At least two domain faults\n avail_set_props.platform_fault_domain_count = 2\n avail_set_props.platform_update_domain_count = 2\n # At this point we...
[ "0.73205966", "0.6218059", "0.62093174", "0.61300576", "0.6094609", "0.60843354", "0.6009558", "0.5990049", "0.59778494", "0.5895734", "0.585492", "0.58155525", "0.58021295", "0.57202053", "0.57202053", "0.5701352", "0.5646623", "0.55853707", "0.55706793", "0.5565353", "0.547...
0.71745366
1
Marks the current model as a canhaz subject for authorizations
def acts_as_canhaz_object include Canhaz::Mongoid::ObjectExtensions class_eval do has_many :permissions_subjects, :class_name => 'Canhaz::Mongoid::Permission', :inverse_of => 'cobject' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_canned_subject\n self.subject = canned_subject\n end", "def set_customer\n @customer = Customer.find(params[:id])\n \tauthorize [:admin, @customer]\n end", "def authorizer\n current_ability\n end", "def set_course\n @course = Course.find(params[:id])\n authorize @cours...
[ "0.64719343", "0.5896642", "0.57816106", "0.5768552", "0.5690575", "0.56610197", "0.55483085", "0.55109125", "0.5484293", "0.54701066", "0.5452519", "0.5452519", "0.5452519", "0.54390347", "0.5424163", "0.5422204", "0.5422204", "0.54215163", "0.54131734", "0.5393618", "0.5380...
0.60927516
1
GET /ingresos GET /ingresos.xml
def index @ingresos = Ingreso.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @ingresos } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @ingreso = Ingreso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingreso }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n ...
[ "0.67602265", "0.6271438", "0.62083125", "0.60266566", "0.5962408", "0.59559155", "0.59559155", "0.58988243", "0.58932346", "0.58791804", "0.5857486", "0.585649", "0.58455694", "0.583912", "0.583427", "0.5833589", "0.5796497", "0.5776844", "0.5776839", "0.57741034", "0.577281...
0.71346986
0
GET /ingresos/1 GET /ingresos/1.xml
def show @ingreso = Ingreso.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @ingreso } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ingresos = Ingreso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ingresos }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "d...
[ "0.6978563", "0.64224344", "0.6353134", "0.61663", "0.6113216", "0.6072116", "0.6072116", "0.6062996", "0.60625", "0.59631974", "0.59577423", "0.5953989", "0.5944342", "0.5931804", "0.5924002", "0.59162825", "0.588399", "0.5879852", "0.58795863", "0.58775866", "0.5870448", ...
0.6912649
1
GET /ingresos/new GET /ingresos/new.xml
def new @ingreso = Ingreso.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @ingreso } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coating }\n end\n end", "def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end...
[ "0.668019", "0.6678379", "0.66758555", "0.6655681", "0.6642961", "0.6627256", "0.65785176", "0.6572661", "0.656599", "0.656554", "0.656096", "0.65548366", "0.65413344", "0.652003", "0.6502952", "0.64999324", "0.6478015", "0.64550453", "0.64550453", "0.64550453", "0.6444026", ...
0.72669965
0
POST /ingresos POST /ingresos.xml
def create @ingreso = Ingreso.new(params[:ingreso]) respond_to do |format| if @ingreso.save format.html { redirect_to(@ingreso, :notice => 'Ingreso was successfully created.') } format.xml { render :xml => @ingreso, :status => :created, :location => @ingreso } else format.html { render :action => "new" } format.xml { render :xml => @ingreso.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def send_request( xml )\n write( xml )\n read\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application...
[ "0.58762264", "0.5812487", "0.5627592", "0.5627289", "0.55471057", "0.5541224", "0.55269754", "0.5508053", "0.5506226", "0.5467767", "0.54398656", "0.5438833", "0.53721565", "0.5359356", "0.53447753", "0.5324208", "0.53221524", "0.5316563", "0.52632326", "0.5260282", "0.52530...
0.58996
0
PUT /ingresos/1 PUT /ingresos/1.xml
def update @ingreso = Ingreso.find(params[:id]) respond_to do |format| if @ingreso.update_attributes(params[:ingreso]) format.html { redirect_to(@ingreso, :notice => 'Ingreso was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @ingreso.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def res...
[ "0.65444356", "0.63453865", "0.60204685", "0.5852977", "0.5817236", "0.58085746", "0.5745322", "0.5735997", "0.5732192", "0.55846906", "0.5580532", "0.5545674", "0.5545674", "0.5510069", "0.54981196", "0.5494719", "0.54808456", "0.547798", "0.5461792", "0.544397", "0.5385207"...
0.614213
2
DELETE /ingresos/1 DELETE /ingresos/1.xml
def destroy @ingreso = Ingreso.find(params[:id]) @ingreso.destroy respond_to do |format| format.html { redirect_to(ingresos_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def delete()\n response = send_post_request(@xml_api_del...
[ "0.697945", "0.68795466", "0.6879137", "0.68102634", "0.65807986", "0.6395754", "0.63243705", "0.6322572", "0.6319816", "0.63187414", "0.63141567", "0.62983614", "0.6297758", "0.6286887", "0.6279561", "0.62663656", "0.62656796", "0.62638044", "0.62575054", "0.62342495", "0.62...
0.7006518
0
CB1 move to IMPI
def hit action = params[:req] name = params[:name] || params[:id] render api_not_supported action, name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_coor_msg(pid, msg)\n buffer = $b.clone\n buffer[:type] = \"COORDINATOR\"\n buffer[:msg] = msg\n\n # najdu dalsi aktivni proces\n succ = next_pid(pid)\n while($processes[succ][:active] != true)\n succ = next_pid(succ)\n end\n\n $processes[succ][:buffer] = buffer\nend", "def...
[ "0.5238375", "0.5189966", "0.49847272", "0.4805643", "0.4705259", "0.46188003", "0.4591349", "0.45681703", "0.45561075", "0.4543775", "0.45390335", "0.45353398", "0.45353398", "0.45353398", "0.45161006", "0.44785985", "0.44779825", "0.44703984", "0.44643474", "0.44448236", "0...
0.0
-1
RESTful DELETE of the node resource
def destroy n = Node.find_key(params[:id] || params[:name]) render api_delete Node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n authorize! :destroy, @node\n\n @node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\...
[ "0.8125971", "0.809001", "0.8016774", "0.8016774", "0.8016774", "0.8004176", "0.8004176", "0.8004176", "0.8004176", "0.8004176", "0.79829395", "0.7981677", "0.79283303", "0.7916526", "0.78869337", "0.77878803", "0.77592057", "0.77592057", "0.77592057", "0.76455164", "0.763688...
0.81326723
0
RESTfule POST of the node resource
def create n = Node.create! params render api_show :node, Node, n.id.to_s, nil, n end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n megam_rest.post_node(to_hash)\n end", "def method_missing(method, *args, &block)\n data = { method: method, parameters: args }\n request.post(path: nodes_path, data: data, auth_token: auth_token)\n end", "def post\n resource.post(request, response)\n end", "def creat...
[ "0.7697888", "0.7548058", "0.730033", "0.7048858", "0.6979888", "0.6955983", "0.6954871", "0.6890593", "0.6887321", "0.6784469", "0.67794067", "0.67570615", "0.67487293", "0.6744508", "0.6744508", "0.6744508", "0.6733869", "0.66912776", "0.6690686", "0.6670682", "0.66677064",...
0.6878999
9
RESTfule PUT of the node resource CB1 please review & update
def update_remove get_node_and_network(params[:id] || params[:name]) if params[:submit] == t('nodes.edit.allocate') @node.allocated = true flash[:notice] = t('nodes.edit.allocate_node_success') if save_node elsif params[:submit] == t('nodes.edit.save') flash[:notice] = t('nodes.edit.save_node_success') if save_node else Rails.logger.warn "Unknown action for node edit: #{params[:submit]}" flash[:notice] = "Unknown action: #{params[:submit]}" end redirect_to nodes_path(:selected => @node.name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n authorize! :manage, @node\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n ...
[ "0.6895477", "0.6892224", "0.68580204", "0.6730648", "0.67242765", "0.67242765", "0.67242765", "0.67068183", "0.66991657", "0.66757154", "0.6635539", "0.6635539", "0.6635539", "0.6607454", "0.66069", "0.66003865", "0.65621966", "0.6557654", "0.6527879", "0.6507732", "0.650020...
0.0
-1
Creates a new session
def new @session = Session.new('') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_session\n @connection.create_session(@config || {})\n end", "def create!(*args)\n session = new(*args)\n session.save!\n session\n end", "def create_session\n login, password = get_login_and_password\n create_session_with authenticate_user(logi...
[ "0.85836065", "0.7939415", "0.7878301", "0.7827873", "0.78236717", "0.78236717", "0.78221744", "0.781109", "0.75607276", "0.7535805", "0.7512194", "0.7357752", "0.7325104", "0.72701156", "0.72445536", "0.71911633", "0.7148841", "0.712402", "0.712297", "0.709245", "0.7089648",...
0.7707305
8
Formula for side (2 cos[((n2) pi)/ (2 n)]
def side_length top = (@num_sides - 2) * Math::PI angle = top / (2 * @num_sides) @side_length = 2 * Math.cos(angle) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def side_from_sas(side1, angle, side2)\n Math.sqrt(\n (\n side1**2 + side2**2\n ) - (\n 2 * side1 * side2 * Math.cos(\n (angle * (Math::PI / 180))\n )\n )\n )\n end", "def cosine_omega\r\n lat_r = @latitude * @d2r\r\n d...
[ "0.65044355", "0.6304851", "0.62605315", "0.62544316", "0.62100244", "0.6194194", "0.61713237", "0.6136885", "0.6047905", "0.60448945", "0.5999373", "0.59327984", "0.5929859", "0.5905732", "0.58814245", "0.5877291", "0.58489364", "0.58431923", "0.5799411", "0.5769594", "0.576...
0.6352075
1
Area = (1/2)nr^2 sin(2pi/n)
def calculate_area if @num_sides.is_a?(Fixnum) angle = (Math::PI * 2)/@num_sides # add *(r**2) if you want radius solved = (0.5)*@num_sides*Math.sin(angle) @solved = solved end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcularArea(raio)\n return Math::PI * raio**2\nend", "def calculoArea(raio)\n return raio ** 2 * Math::PI\nend", "def computeArea(r) #Call to create function computeArea with parameter r\n PI * r ** 2 #Calculates the area using parameter r and constant pi\nend", "def shapeArea(n)\n return (n*n) ...
[ "0.68843174", "0.685642", "0.66598266", "0.6621696", "0.6534662", "0.64460844", "0.63729", "0.6372493", "0.6320674", "0.63043904", "0.62688583", "0.61950827", "0.61857027", "0.6180434", "0.6166312", "0.612263", "0.6105308", "0.61051494", "0.60311836", "0.6022549", "0.5986301"...
0.6299952
10
Agent filters are always present no matter what, so we cant raise an error if the capabilities suggest the discovery method cant do agents we just have to rely on the discovery plugin to not do stupid things in the presense of a agent filter
def check_capabilities(filter) capabilities = ddl.discovery_interface[:capabilities] unless capabilities.include?(:classes) raise "Cannot use class filters while using the '%s' discovery method" % discovery_method unless filter["cf_class"].empty? end unless capabilities.include?(:facts) raise "Cannot use fact filters while using the '%s' discovery method" % discovery_method unless filter["fact"].empty? end unless capabilities.include?(:identity) raise "Cannot use identity filters while using the '%s' discovery method" % discovery_method unless filter["identity"].empty? end unless capabilities.include?(:compound) raise "Cannot use compound filters while using the '%s' discovery method" % discovery_method unless filter["compound"].empty? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_filter(agent, filters, vars)\n agent.reset\n if filters[:discovery]\n agent.discover({:nodes => filters[:discovery]})\n else\n ['identity', 'fact', 'class', 'compound'].each do |kind|\n next unless filters[kind]\n add_filter = agent.method(\"#{kind}_filter\".to_sym)\n if filters[kin...
[ "0.6517474", "0.61861545", "0.5951934", "0.58789355", "0.5854995", "0.5852562", "0.5740693", "0.57117724", "0.5682581", "0.5487009", "0.54166657", "0.54166657", "0.52910566", "0.52450705", "0.5234832", "0.5220964", "0.5194587", "0.51904994", "0.51809955", "0.51784015", "0.517...
0.6375558
1
checks if compound filters are used and then forces the 'mc' discovery plugin
def force_discovery_method_by_filter(filter) unless discovery_method == "mc" unless filter["compound"].empty? Log.info "Switching to mc discovery method because compound filters are used" @client.options[:discovery_method] = "mc" return true end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def or_filters_provided?\n true\n end", "def advanced_filters_provided?\n true\n end", "def apply_filter_config\r\n exec(\r\n 'require_once(\"shaper.inc\");',\r\n 'require_once(\"filter.inc\");',\r\n 'filter_configure_sync();'\r\n )\r...
[ "0.60175973", "0.5943134", "0.58652806", "0.58121777", "0.5759418", "0.5694268", "0.56464165", "0.5602484", "0.5596665", "0.55617255", "0.5529939", "0.552418", "0.55021983", "0.54675096", "0.5450949", "0.5450949", "0.54447466", "0.5443823", "0.5436667", "0.53854954", "0.53738...
0.7692432
0
if a compound filter is specified and it has any function then we read the DDL for each of those plugins and sum up the timeout declared in the DDL
def timeout_for_compound_filter(compound_filter) return 0 if compound_filter.nil? || compound_filter.empty? timeout = 0 compound_filter.each do |filter| filter.each do |statement| if statement["fstatement"] pluginname = Data.pluginname(statement["fstatement"]["name"]) ddl = DDL.new(pluginname, :data) timeout += ddl.meta[:timeout] end end end timeout end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ts_apply_filters\n # TODO: Make filters for Thinking Sphinx\n end", "def postFetchFilter\n @filtered= Filter.new(@detail.waypoints)\n\n # caches with warnings we choose not to include.\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['includeArchived']\n @appliedFilter...
[ "0.5582322", "0.5468602", "0.54093206", "0.53345585", "0.5278474", "0.52157444", "0.52079964", "0.51683015", "0.516706", "0.49910915", "0.49835807", "0.496885", "0.496885", "0.49558488", "0.49135563", "0.49094322", "0.4895519", "0.48122942", "0.48080233", "0.474341", "0.47434...
0.74729615
0
Facebook returns 'account_ids' without the 'act_' prefix, so we have to treat account_ids special and make sure they begin with act_
def normalize_account_id(id) return id if id.to_s.start_with?('act_') "act_#{id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facebook_account_ids\n @facebook_account_ids ||=\n current_user\n .accounts\n .where(type: :facebook)\n .map { |a| a.data[:id] }\n end", "def account_ids()\n return [1, 2]\n end", "def account_ids\n user.app_metadata.fetch('account_ids', [])\n end", "def acc_ids\n\t ...
[ "0.7085103", "0.67231196", "0.6414345", "0.6071187", "0.6061755", "0.59726983", "0.56954247", "0.56156", "0.5528877", "0.55052185", "0.550076", "0.54788977", "0.5445059", "0.53569794", "0.53485715", "0.5348114", "0.5347844", "0.5340301", "0.5204472", "0.5203263", "0.51797694"...
0.61813277
3
This should be called if you cannot find a paper through other means.
def fallback_to_first_possible_paper_reference model = @model_hash.values.detect { |model| model.try(:paper) } model.try(:paper) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def no_in_paper(paper = nil)\n if paper\n self.exam_papers_sections_exercises.where(exam_paper_id: paper.id).first.no_in_paper\n else\n # TODO\n self.exam_papers_sections_exercises.first.no_in_paper\n end\n end", "def best_hand\n raise\n end", "def associate_paper\n @paper = par...
[ "0.572399", "0.5189357", "0.5138551", "0.5111548", "0.5028924", "0.48507679", "0.48505953", "0.48331365", "0.4818173", "0.4807173", "0.479361", "0.47638682", "0.47476536", "0.47286904", "0.47204068", "0.4695673", "0.4673442", "0.4673442", "0.4673442", "0.4673442", "0.4673442"...
0.5293596
1
generate css and js, they are do not need current menu
def generate_assets raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def css; end", "def css; end", "def css; end", "def copy_styles_and_js\n base_dir = @generator.base_dir\n Dir.mkdir(\"#{base_dir}/js\")\n FileUtils.cp(\"#{Amy::BASE_DIR}/views/js/amy.min.js\", \"#{base_dir}/js/amy.js\")\n FileUtils.cp(\"#{Amy::BASE_DIR}/views/js/data.json\", \"#{base_dir}...
[ "0.6485849", "0.6485849", "0.6485849", "0.64739686", "0.6299058", "0.61935127", "0.61459655", "0.61226565", "0.6059311", "0.6055932", "0.59855545", "0.59567815", "0.5956619", "0.59234136", "0.59033644", "0.5898321", "0.5866324", "0.5847276", "0.5825192", "0.5819462", "0.58081...
0.0
-1
To be overloaded, but here to prevent errors if we don't define initialize def initialize(config) end
def children @children ||= {} child_definitions.keys.each{|p| @children[p] ||= cell(p)} unless child_definitions.nil? @children end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(_config)\n raise NotImplementedError, \"must implement ##{__method__}\"\n end", "def initialize(config = {})\n\t\tsuper # check syntax\n\tend", "def initialize(config = {})\n\t\tsuper # check syntax\n\tend", "def initialize(config)\n\t\tend", "def initialize(config = {})\n super...
[ "0.8678481", "0.8411713", "0.8411713", "0.8376905", "0.8345786", "0.82627934", "0.82627934", "0.81267637", "0.7954233", "0.7929972", "0.7929972", "0.7929972", "0.7869929", "0.7866758", "0.7866758", "0.7859709", "0.78158414", "0.7810258", "0.7810258", "0.7810258", "0.77975273"...
0.0
-1
Read a yaml file containing a menu
def read_yml_menu(filename) # Load the yaml file into a hash settings = YAML::load_file filename # These are now hashes with ingredient name as key # with hashes representing ingredients, that contain metadata such as prices meats = settings[:ingredients][:meats] vegetables = settings[:ingredients][:vegetables] dressings = settings[:ingredients][:dressings] leaf = settings[:ingredients][:leaf] # Convert to format using ingredient classes ingredients = { :meats => hash_to_ingredient(meats), :vegetables => hash_to_ingredient(vegetables), :dressings => hash_to_ingredient(dressings), :leaf => hash_to_ingredient(leaf)} sizes = settings[:sizes] return ingredients, sizes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read file=STDIN\n\n yaml = case file\n when String\n raise \"Input file not defined\" unless file\n raise \"Input file does not exist\" unless File.exist? file\n raise \"Input file is not readable \" unless File.readable? file\n \n ...
[ "0.6833438", "0.68146545", "0.6746245", "0.67328376", "0.6678069", "0.6618213", "0.66043437", "0.65463096", "0.6497463", "0.6431694", "0.63932216", "0.6368525", "0.6357535", "0.63554156", "0.6302693", "0.6274248", "0.6261842", "0.6261842", "0.6194424", "0.61614686", "0.615865...
0.73081005
0
Convert a hash of ingredients with metadata to a list of Ingredient objects
def hash_to_ingredient(dict) ingredients = Array.new # Each ingredient has name as key, and metadata as a dictionary. # At this point, we just extract the price, but we can expand this later dict.each do |name,ingr| ingredients.push(Salads::Ingredient.new(name, ingr["price"])) end return ingredients end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ingredients\n recipe_ingredients.map do |r|\n r.ingredient\n end\n end", "def ingredients\n recipeingredient.map {|ri| ri.ingredient}\n end", "def parse_ingredients(ingredients)\n ret = {}\n ingredients.each do |ingredient|\n ing = parse_ingredient ingredient\n ret[ing.name....
[ "0.67869824", "0.6668641", "0.65020543", "0.63234955", "0.63051885", "0.6261077", "0.6194189", "0.6178999", "0.6157826", "0.61116165", "0.6081471", "0.5999418", "0.5971214", "0.5936107", "0.59352404", "0.5934728", "0.58762556", "0.58576584", "0.58471256", "0.5819716", "0.5809...
0.77040833
0
always use a sorted (desc) array with 2 elements
def dices=(arr) @dices = ((arr + [0,0,0]).sort.reverse)[0..1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two(array)\n array.sort\nend", "def array_2(array2)\n array2.sort!\n return array2\nend", "def sort_array_desc(array)\n new = array.sort\n new.reverse\nend", "def sort2(array, max_value)\n\nend", "def sort_array_desc(array)\n array.sort {|x,y| y <=>x }\nend", "def sort_array_desc(array)\n ar...
[ "0.7559666", "0.7184702", "0.70549345", "0.7013775", "0.69970465", "0.6966031", "0.69424576", "0.6924849", "0.69045836", "0.6900568", "0.6889592", "0.6863037", "0.68422234", "0.6816883", "0.6816883", "0.6816883", "0.6816883", "0.6816883", "0.6811878", "0.68076956", "0.6806719...
0.0
-1
GET /urls GET /urls.json
def index @urls = Url.all.order("pageviews DESC").limit(100) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @urls = Url.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @urls }\n end\n end", "def index\n @urls = @site.urls.paginate(:page => params[:page])\n render json: @urls\n end", "def url_list\n urls = current_user.mini_urls\n ...
[ "0.72622925", "0.70533806", "0.6914229", "0.6791078", "0.6790144", "0.6723092", "0.6704383", "0.66312903", "0.6551795", "0.65379965", "0.6494516", "0.64851487", "0.64801353", "0.6451444", "0.6408628", "0.64008194", "0.63861555", "0.6346339", "0.63178754", "0.6289575", "0.6287...
0.0
-1
This method stores actual URL in database The actual URL Corresponding shorten URL
def create @url = Url.create_update_with(url_params) @short_url = "#{request.host_with_port}/#{@url.short_url}" redirect_to root_path(short_url: @short_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shorturl\n return nil if self.new_record?\n return self.surl unless self.surl.nil?\n\n self.surl = encode_url\n\n self.save\n return surl\n end", "def shorten_url\n db = Sequel.connect('postgres://username:password@localhost:5432/shorty')\n data = db[:data]\n params[:url] = \"http://\"+par...
[ "0.7802982", "0.7425553", "0.73461205", "0.72590965", "0.713846", "0.70028114", "0.6941988", "0.6923177", "0.6892262", "0.6862915", "0.6851851", "0.6840349", "0.6803636", "0.6791712", "0.6782709", "0.6760949", "0.6757774", "0.6713098", "0.67095643", "0.6703079", "0.66878426",...
0.6447203
33
Never trust parameters from the scary internet, only allow the white list through.
def url_params params.require(:url).permit(:original_url, :short_url) 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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
Logs the action click
def log_action_click(interface, slot, item_id) case interface when 3214 # Inventory = EquipItem or Eat food, or break a teletab (not really) log "Got Inventory Tab 1stActionClick: [slot]: #{slot} || [item]: #{item_id} || [interface]: #{interface}" when 1688 # EquipmentTab log "Got Equipment Tab 1stActionClick: [slot]: #{slot} || [item]: #{item_id} || [interface]: #{interface}" else log! "ActionClick: [slot]: #{slot} || [item]: #{item_id} || [interface]: #{interface}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action\n trigger :click\n end", "def log_action msg\n\t\t\t\tputs '=> ' + msg\n\t\t\tend", "def log_action actions, opts={}\n make_log_action_call actions, opts\n end", "def log(action, *args)\n say format('%15s %s', action, args.join(' '))\n end", "def click_action\n ...
[ "0.7361727", "0.7144176", "0.6754271", "0.6728537", "0.67092156", "0.6479343", "0.6474727", "0.63606113", "0.6337426", "0.63166696", "0.629809", "0.629809", "0.629809", "0.6292891", "0.62788", "0.6252514", "0.6192347", "0.6139331", "0.6138641", "0.6094006", "0.60742503", "0...
0.6429884
7
Then add another method underneath it:
def after_confirmation_path_for(resource_name, resource) if user_signed_in? root_path else new_user_session_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def methods() end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def custom; end", "def custom; end", ...
[ "0.6957196", "0.694145", "0.694145", "0.694145", "0.694145", "0.694145", "0.694145", "0.694145", "0.694145", "0.694145", "0.694145", "0.694145", "0.694145", "0.69077253", "0.69077253", "0.67951405", "0.67152345", "0.6605862", "0.6605862", "0.6605862", "0.6605862", "0.654147...
0.0
-1
Retourne TRUE si c'est un module de type suivi de projet
def suivi? ; self.abs_module.nombre_jours.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def module?\n @type == :module\n end", "def module?\n @type == :module\n end", "def module?\n true\n end", "def module?\n true\n end", "def module?\n false\n end", "def should_donate?\n @type == :module\n end", "def has_classes_or_modules?\n has_clas...
[ "0.8037305", "0.8037305", "0.774926", "0.774926", "0.7597174", "0.7207169", "0.7041173", "0.69586426", "0.68679357", "0.6843675", "0.6816408", "0.6800288", "0.67774236", "0.6763845", "0.6739602", "0.66654336", "0.66647565", "0.66647565", "0.66369385", "0.65960693", "0.6596069...
0.6582336
22
def adds_2_and_2 assert_equal 4, add(2, 2) end def adds_positive_numbers assert_equal 8, add(2, 6) end subtract takes two parameters and subtracts the second from the first
def subtract (number1, number2) number1 - number2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_subtracts_numbers\n\t\tassert_equal 6, subtract(10, 4)\n\tend", "def subtract(first_number, second_number)\n first_number - second_number\nend", "def subtract(first_number, second_number)\n return first_number - second_number\nend", "def subtract(first_number , second_number)\n return first_numbe...
[ "0.7993425", "0.7703202", "0.7654675", "0.764909", "0.75930357", "0.756251", "0.7551079", "0.7547029", "0.7547029", "0.7538183", "0.7517505", "0.7508702", "0.7508702", "0.7508702", "0.7508702", "0.7497784", "0.7443198", "0.74004686", "0.73702407", "0.7367406", "0.7359952", ...
0.7341015
23
sum takes an array of numbers and adds them all together This one is a bit trickier!
def sum(n) result = 0 n.each do |number| result = result + number end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum(array)\n\tarray.reduce(:+)\nend", "def sum array\n\tsum = 0\n\tarray.each do |number|\n\t\tsum = sum + number\n\tend\n\tsum\nend", "def sum(array)\n\ttotal = 0\n\tfor number in array #could do each do instead of for loop\n\t\ttotal += number\n\tend\n\treturn total\nend", "def sum(array)\n\treturn arr...
[ "0.8539114", "0.85326296", "0.84852904", "0.8444516", "0.8386815", "0.83837205", "0.83380973", "0.8325479", "0.83118373", "0.83118373", "0.83092767", "0.8308449", "0.829765", "0.8279262", "0.82774466", "0.82728654", "0.82638484", "0.825984", "0.825612", "0.8256119", "0.825173...
0.0
-1
GET /stock_medicas GET /stock_medicas.json
def index @stock_medicas = StockMedica.all @ficha_medicas = FichaMedica.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_stock_medica\n @stock_medica = StockMedica.find(params[:id])\n end", "def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end", "def show\n @sp500_stock = Sp500Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json...
[ "0.6608475", "0.66066617", "0.6447631", "0.64406407", "0.64406407", "0.64406407", "0.64406407", "0.64390206", "0.64215827", "0.64080596", "0.64051867", "0.64020777", "0.6385608", "0.63731736", "0.63195616", "0.6225285", "0.6181717", "0.6180003", "0.617852", "0.61690027", "0.6...
0.6583219
2
GET /stock_medicas/1 GET /stock_medicas/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end", "def set_stock_medica\n @stock_medica = StockMedica.find(params[:id])\n end", "def show\n @sp500_stock = Sp500Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json...
[ "0.6845957", "0.68016255", "0.67128974", "0.6669692", "0.6669692", "0.6669692", "0.6669692", "0.6651201", "0.6634665", "0.6553768", "0.65205777", "0.6444504", "0.64346814", "0.6422576", "0.6419904", "0.6416216", "0.6408983", "0.6395929", "0.63851357", "0.6383683", "0.63604337...
0.0
-1
POST /stock_medicas POST /stock_medicas.json
def create @stock_medica = StockMedica.new(stock_medica_params) respond_to do |format| if @stock_medica.save format.html { redirect_to @stock_medica, notice: 'Fue Crado stock' } format.json { render :show, status: :created, location: @stock_medica } else format.html { render :new } format.json { render json: @stock_medica.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock_medica_params\n params.require(:stock_medica).permit(:cantidad, :medicamento_id)\n end", "def medicine_stock_params\n params.require(:medicine_stock).permit(:nome, :validade, :quantidade, :doenca)\n end", "def set_stock_medica\n @stock_medica = StockMedica.find(params[:id])\n ...
[ "0.68674546", "0.6660177", "0.6512324", "0.6466735", "0.6261089", "0.61612463", "0.61439186", "0.61146367", "0.6107671", "0.6107671", "0.6107671", "0.6107671", "0.6090492", "0.6090492", "0.6090492", "0.6090492", "0.6090492", "0.6090492", "0.60767686", "0.60551775", "0.6045734...
0.70743656
0
PATCH/PUT /stock_medicas/1 PATCH/PUT /stock_medicas/1.json
def update respond_to do |format| if @stock_medica.update(stock_medica_params) format.html { redirect_to @stock_medica, notice: 'Stock medica was successfully updated.' } format.json { render :show, status: :ok, location: @stock_medica } else format.html { render :edit } format.json { render json: @stock_medica.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @mateStock = MateStock.find(params[:id])\n\n respond_to do |format|\n if @mateStock.update_attributes(params[:mate_stock])\n format.html { redirect_to action: 'index', notice: 'Mate Stock was successfully updated.' }\n format.json { head :no_content }\n else\n form...
[ "0.6946556", "0.67807496", "0.67807496", "0.67807496", "0.67689514", "0.6759047", "0.6759047", "0.67585766", "0.67543346", "0.6736714", "0.6713804", "0.6711271", "0.670289", "0.6688767", "0.6688767", "0.6688767", "0.6688767", "0.6688767", "0.6688767", "0.6688767", "0.6688767"...
0.7168848
0
DELETE /stock_medicas/1 DELETE /stock_medicas/1.json
def destroy @stock_medica.destroy respond_to do |format| format.html { redirect_to stock_medicas_url, notice: 'Stock medica was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n ...
[ "0.7307248", "0.7307248", "0.72975355", "0.7288655", "0.72691363", "0.72635055", "0.72635055", "0.72635055", "0.72635055", "0.72635055", "0.72635055", "0.72067565", "0.7117722", "0.7105835", "0.7072678", "0.7072678", "0.7072678", "0.7072678", "0.7072678", "0.7072678", "0.7072...
0.7680024
0
Use callbacks to share common setup or constraints between actions.
def set_stock_medica @stock_medica = StockMedica.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.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def stock_medica_params params.require(:stock_medica).permit(:cantidad, :medicamento_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
only admin can use new and create
def index locals(competitions: Competition.all) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_as_admin\n create\n end", "def authorized_for_create?\n current_user.is_admin\n end", "def create?\n !@current_user.admin?\n end", "def admin?; false end", "def admin_cannot_actions\n [:new, :create].freeze\n end", "def isnew?\n if Admin.new\n return fal...
[ "0.7523823", "0.7339545", "0.72762287", "0.72588664", "0.7222626", "0.7183943", "0.7161643", "0.7131063", "0.7120569", "0.70905083", "0.7045237", "0.7045237", "0.7045237", "0.7045237", "0.70156217", "0.698366", "0.6980158", "0.6941494", "0.69409287", "0.69409287", "0.69409287...
0.0
-1
create my 4 custom actions here for each role
def doctorView end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_permissions\n alias_action :show, :manifest, to: :read\n alias_action :color_pdf, :pdf, :edit, :browse_everything_files, :structure, :file_manager, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end", "def custom_permission...
[ "0.68636507", "0.68636507", "0.64600545", "0.6405471", "0.6205574", "0.61972517", "0.61972517", "0.61972517", "0.61966115", "0.61343515", "0.61289835", "0.6113697", "0.609196", "0.60667604", "0.60510135", "0.60510135", "0.6049785", "0.60309315", "0.59790367", "0.59754115", "0...
0.0
-1
The number of rotational degrees required to display this image as upright
def required_rotation_for_upright_display required_rotation_orientation_in_degrees = (360 - self.orientation) % 360 return required_rotation_orientation_in_degrees end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_angle\n 6 * self.min\n end", "def max_tilt_angle; end", "def orientation \n @position - @prev_position\n end", "def degrees\n self * Math::PI / 180\n end", "def anglecw\n 360 - angle\n end", "def degrees\n self * Math::PI / 180.0\n end", "def height\n a = se...
[ "0.6687296", "0.6622544", "0.65924317", "0.65175134", "0.6424557", "0.6412511", "0.63951766", "0.6316775", "0.6288307", "0.6240502", "0.6186721", "0.6171652", "0.6130817", "0.6097932", "0.603196", "0.60202736", "0.6016953", "0.6011782", "0.59828997", "0.5945087", "0.59216946"...
0.78179806
0
Allowed degrees arg values: 0, 90, 180, 270
def orientation=(degrees) degrees = degrees % 360 raise "Invalid value for degrees. Must be a right angle (0, 90, 180, etc.)" unless (degrees % 90 == 0) self.clear_relationship(:orientation) self.add_relationship(:orientation, DEGREES_TO_EXIF_ORIENTATIONS[degrees], true) return degrees # Hide RDF backing structure and make this look like a simple setter method end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def degrees\n self * Math::PI / 180\n end", "def degrees\n self * Math::PI / 180.0\n end", "def degrees\n\t\t@degrees ||= cardinal.keys.sort + [360.0]\n\tend", "def angle_deg\n angle * RAD_TO_DEG\n end", "def convert_to_radians(degrees)\n degrees * PI / 180\nend", "def deg2deg(deg)\r\n re...
[ "0.7549207", "0.7465218", "0.7446889", "0.7429923", "0.7275836", "0.7241338", "0.7214998", "0.7178858", "0.71258056", "0.71189755", "0.7118153", "0.7056974", "0.7015916", "0.6925798", "0.6879587", "0.68576306", "0.6838242", "0.68314844", "0.68309325", "0.6771606", "0.67659044...
0.643628
46
Returns a hash of itunes_app_id => array of features. country_name:: Name of the country to collect featuring for.
def crawl(country_name) http = Net::HTTP.new("itunes.apple.com", 80) headers = ITUNES_UA_HEADERS.merge("X-Apple-Store-Front" => COUNTRY_TO_STORE_FRONTS[ country_name ]) body = http.get(ITUNES_STORE_FRONT_URL, headers).body base_store_url = CGI.unescapeHTML(body.match(/\<string\>(http\:\/\/[^\<]+)\<\/string\>/m)[1]) urls = [ base_store_url + ITUNES_IPAD_URL_SUFFIX, base_store_url + ITUNES_IPHONE_URL_SUFFIX ] crawled_urls = {} result = {} # while we have the URLs to crawl on stack while urls.present? # pop an URL url, store = store_and_url_from_url(urls.pop) # check for duplicate visit next if crawled_urls[ url_signature(url) ] puts "Fetching #{ url }..." body = http.get(url, headers).body unless body =~ /\<body/ next if body =~ /\<key\>failureType\<\/key\>/ go_to_url = CGI.unescapeHTML(body.match(/\<string\>(http\:\/\/[^\<]+)\<\/string\>/m)[1]) puts "Just got a plist from #{url} - redirecting ourselves to #{go_to_url}" crawled_urls[ url_signature(url) ] = true urls << url_for_store(go_to_url, store) next end document = Hpricot(body) title = document.search("title").first.to_plain_text # mark the URL so that we don't visit it again now crawled_urls[ url_signature(url) ] = true puts "#{url} - #{ title } for #{ store }, still has to fuck through #{ urls.size }" page = Featuring::Page::Base.for_uid(store, uid_from_path(url, base_store_url), title) # iterate over all features {Featuring::Feature::Super => SUPER_FEATURING_CSS_PATH, Featuring::Feature::Brick => BRICK_FEATURING_BRICK_CSS_PATH, Featuring::Feature::Item => SWOOSH_FEATURING_BRICK_CSS_PATH}.each do |klass, css| index = -1 document.search(css).each do |link| index += 1 next unless link["href"].starts_with?("http://") url = page_path_from_url(link["href"]) uid = uid_from_path(url, base_store_url) if uid.first == :app featuring = klass.find_or_create_by_page_id_and_rank(page.id, index) result[ uid.last ] ||= [] result[ uid.last ] << featuring else urls << url_for_store(url, store) if (uid.first.present? and crawled_urls[url_signature(url)].blank?) end end end # iterate over quick links document.search(QUICK_LINKS_CSS_PATH).each do |link| url = page_path_from_url(link["href"]) uid = uid_from_path(url, base_store_url) urls << url_for_store(url, store) if (uid.first.present? and uid.first != :app and crawled_urls[url_signature(url)].blank?) end # iterate over all categories document.search(CATEGORIES_CSS_PATH).each do |opt| url = page_path_from_url(opt["value"]) uid = uid_from_path(url, base_store_url) urls << url_for_store(url, store) if (uid.first.present? and uid.first != :app and crawled_urls[url_signature(url)].blank?) end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def features\n @features ||= {}\n @features.keys\n end", "def features\n hash = {}\n hash['price_range'] = [(our_price_range_low / 100).floor, \n (our_price_range_high / 100).floor]\n hash['locality'] = venue.locality\n hash['category'] = categories\n return hash\n...
[ "0.5782342", "0.573104", "0.53873247", "0.5369993", "0.5345619", "0.5227491", "0.5190118", "0.51772517", "0.5160532", "0.51203156", "0.5093773", "0.5076243", "0.5031272", "0.50273335", "0.50128525", "0.50105536", "0.50038576", "0.49816334", "0.49594", "0.49593666", "0.4951927...
0.4722869
54
Extracts path from an URL.
def page_path_from_url(url) ::URI.parse(url).request_uri end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_from_url(url)\n\tresult = url.sub(/https*:\\/\\/[^\\/]*/, '') # Eliminate http[s]:// and beyond to first slash\nend", "def path\r\n url.gsub(/https?:\\/\\/[^\\/]+\\//i, '').scan(/([^&]+)/i).first().first()\r\n end", "def url_2_path(url)\n\t\t#puts \"Retrieve the relative path component of ...
[ "0.7998433", "0.79272467", "0.7721616", "0.7499426", "0.7474633", "0.7410951", "0.73539007", "0.703869", "0.70268947", "0.68111867", "0.67571276", "0.671376", "0.6650692", "0.6601437", "0.6601437", "0.6586168", "0.651133", "0.6369279", "0.6337915", "0.63268566", "0.63140506",...
0.6506784
17
Extracts an UID (room, grouping or app) from an URL/path.
def uid_from_path(url, base_store_url) return [:main, 0] if url.include?(base_store_url) return [:category, url.match(/viewGenre\?id\=(\d+)/)[1]] if url.include?("viewGenre?id=") return [:category, url.match(/viewGrouping\?id\=(\d+)/)[1]] if url.include?("viewGrouping?id=") return [:room, url.match(/viewMultiRoom\?fcId\=(\d+)/)[1]] if url.include?("viewMultiRoom?fcId=") return [:app, url.match(/.+id(\d+)/)[1]] if url =~ /\/id\d+/ [nil, nil] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_id\n return link.split(\"/\")[2]\n end", "def parse_site_user_id_from_url url\n url.scan(/cc\\/blog\\/([^\\/]+)/)[0][0].downcase rescue nil\n end", "def uid\n return nil unless user_id\n user_id.split('/').first\n end", "def uid\n return nil unless user_id\n user_id.split('/').f...
[ "0.7059051", "0.69124836", "0.6678153", "0.6678153", "0.6591005", "0.65751207", "0.65533423", "0.65050286", "0.6481659", "0.6453909", "0.6449052", "0.6428161", "0.63630307", "0.6361559", "0.6317997", "0.62547845", "0.6245712", "0.60574", "0.6031949", "0.60137314", "0.59629047...
0.741962
0
Use callbacks to share common setup or constraints between actions.
def set_company @company = Company.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.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
certinfos should be a hashlike where each entry describes a certificate. defaulthostname should be a string that will be inserted into %HOSTNAME% in certificate subject lines.
def initialize(certinfos, defaulthostname, config={}) @config = config @defaulthostname = defaulthostname @parenthostname = defaulthostname.sub(/^[\w-]+\./, '') # remove left-most label @certinfos = certinfos @certificates = {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_subject_alternative_names(cert, factory, alt_names)\n fail 'alt_names must be an Array' unless alt_names.is_a?(Array)\n\n name_list = alt_names.map { |m| \"DNS:#{m}\" }.join(',')\n ext = factory.create_ext('subjectAltName', name_list, false)\n cert.add_extension(ext)\...
[ "0.5406824", "0.5148661", "0.50500333", "0.5033091", "0.50141954", "0.5010699", "0.50072384", "0.5003043", "0.49615765", "0.496073", "0.49592632", "0.49552926", "0.49547872", "0.49527764", "0.4935965", "0.49324802", "0.48976794", "0.48876724", "0.4883321", "0.4829508", "0.479...
0.74490815
0
is a variable holding the number of guesses allowed by the game/client. If the requirements change, At any time this will allow us to change the maximum number of guesses.
def guess(rand_word) puts "enter a letter" letter = gets.chomp.downcase display_word(rand_word,letter) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_limit\n\t\tguesses \n\tend", "def guess_count\n\t\t @number_of_guesses -= 1\n\tend", "def set_attempts_amount\n max_number <= 10 ? 2 : 10\nend", "def get_num_of_guesses\r\n return @numOfGuessesLeft\r\n end", "def max_attempts_count\n @options[:max_attempts_count]\n end", "d...
[ "0.73779637", "0.69830453", "0.6855155", "0.68487716", "0.66632986", "0.66460335", "0.66279846", "0.6550518", "0.65471596", "0.65455335", "0.6538615", "0.64914024", "0.6479974", "0.6479974", "0.64745444", "0.6405938", "0.63665056", "0.63659036", "0.63643223", "0.6349223", "0....
0.0
-1
These methods are created so I can include them in the response to the user. Should make it a litle interesting ;)
def right_leg(g_tally) if g_tally == 1 puts "you have lost your right leg" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def respond(); end", "def who_we_are\r\n end", "def probers; end", "def formation; end", "def weber; end", "def custom; end", "def custom; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def extra; end", "def methods() end", "d...
[ "0.6831467", "0.6559056", "0.64254284", "0.6265983", "0.6159022", "0.6110158", "0.6084273", "0.6084273", "0.60697305", "0.60697305", "0.60697305", "0.60697305", "0.6004596", "0.59772474", "0.59358495", "0.59358495", "0.59358495", "0.59358495", "0.59358495", "0.59358495", "0.5...
0.0
-1