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 |
|---|---|---|---|---|---|---|
Extend `render` (which is already being extended by the trailblazerrails gem to allow Cells to be rendered directly without going through the ActionView layer) so that if you're directly rendering a cell from the controller and the cell responds to `title` (that's as an instance method, not a class method `render` deal... | def render(cell = nil, opts = {}, *, &block)
if cell.is_a?(::Cell::ViewModel) && cell.respond_to?(:title)
@cell_title = cell.title
end
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_cell(*)\n Capybara.string super\n end",
"def show\n @string = 'I am a cell instance variable from Home::Cell::Index, you can use me in the view'\n render\n end",
"def render_attributes\n self.wiki_title = self.title.to_wiki_title\n self.body_html = Formatter.new(se... | [
"0.6259",
"0.6217482",
"0.61022866",
"0.604841",
"0.603708",
"0.6000398",
"0.59930885",
"0.59894",
"0.59894",
"0.598071",
"0.5968073",
"0.5939387",
"0.5934855",
"0.5915237",
"0.5913685",
"0.59086335",
"0.5898228",
"0.5892508",
"0.5892508",
"0.5892508",
"0.5892508",
"0.58925... | 0.7640568 | 0 |
Pass these options by default into Trailblazer operations when calling them with 'run'. This needs to live here rather than AuthenticatedUserController so that 'current_account' will be set in Account::Dashboard | def _run_options(options)
options['current_account'] = current_account if current_account
options['current_admin'] = current_admin if current_admin
options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options_for_klient(options = {})\n user_tenant_options = Kaui.current_tenant_user_options(current_user, session)\n user_tenant_options.merge(options)\n user_tenant_options\n end",
"def options_for_klient(options = {})\n user_tenant_options = Kaui.current_tenant_user_options(current_user, session... | [
"0.639597",
"0.6075735",
"0.5996692",
"0.5934152",
"0.5840547",
"0.57955164",
"0.5707825",
"0.5677361",
"0.5668565",
"0.56368995",
"0.560236",
"0.5600074",
"0.5594823",
"0.55930156",
"0.557195",
"0.5564532",
"0.5564532",
"0.55635107",
"0.54979837",
"0.545896",
"0.5433891",
... | 0.77812225 | 0 |
Show detailed error output to loggedin admins. Note that this only works for 500 errors, not 404s. Also note that this method is only called when config.consider_all_requests_local is false; when it's true (e.g. in the development environment), all requests show detailed exceptions anyway so this method is irrelevant. | def show_detailed_exceptions?
!!current_admin
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @error = ErrorDetails.new(request.env)\n Rails.logger.error(\"#{@error.reference} for #{@error.message}\")\n template = (@error.status_code == 404 ? '404' : '500')\n render template, status: @error.status_code\n end",
"def server_error\n messages = [\"Captain!\", \"Man overbo... | [
"0.6736877",
"0.62089705",
"0.61753654",
"0.6165649",
"0.60701334",
"0.6065532",
"0.60175866",
"0.59433",
"0.5913423",
"0.58571607",
"0.5847008",
"0.5792701",
"0.57901233",
"0.5757184",
"0.5735301",
"0.56813747",
"0.5671688",
"0.5671638",
"0.56562257",
"0.5631903",
"0.5630842... | 0.5874087 | 9 |
Gets guides for current action | def guides
@guides ||= Guides::GuidesRetriever.get_guides(action)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guides\n @guides ||= Guides::GuidesRetriever.get_guides(action).input\n end",
"def guides\n self.pages.select {|p| p.full_url =~ GUIDE_PAGE_RE}\n end",
"def recommended_actions\n return @recommended_actions\n end",
"def user_guides_label\n $tracer.trace(__method... | [
"0.8397009",
"0.63405657",
"0.5998767",
"0.5984796",
"0.5871517",
"0.58145916",
"0.57313675",
"0.5456228",
"0.5456228",
"0.5419687",
"0.53640103",
"0.5279615",
"0.52392614",
"0.5174398",
"0.51356494",
"0.5090502",
"0.5037785",
"0.5023268",
"0.5004359",
"0.49911165",
"0.497255... | 0.84031993 | 0 |
Renames keys of received params using guides | def rename_keys(guides)
parsed_result = {}
data.each do |key, value|
xml_name = guides.find_input_result(key)
parsed_result[xml_name] = value
end
parsed_result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rename_keys(guides)\n parsed_result = {}\n data.each do |key, value|\n xml_name = guides.find { |hash| hash[:input] == key }[:result]\n parsed_result[xml_name] = value\n end\n parsed_result\n end",
"def rename_params(json_params, action)\n params_renamer = ParamsOperators::Renamer.n... | [
"0.6549456",
"0.59939533",
"0.594152",
"0.5843423",
"0.58040357",
"0.579489",
"0.5762459",
"0.564888",
"0.5616087",
"0.56065804",
"0.559368",
"0.5569554",
"0.5539558",
"0.55025256",
"0.5485482",
"0.5451224",
"0.54460585",
"0.544198",
"0.54413944",
"0.5439604",
"0.53470296",
... | 0.6636571 | 0 |
get the latest file related to date | def latest_file_path(name)
files = Dir["#{ ENV["HOME"] }/workspace/*#{ name }*.txt"]
throw RuntimeError if files.empty?
files.sort_by! do |file_name|
file_match_data = FILE_NAME_FORMAT.match file_name
date_match_data = file_match_data.to_s.match DATE_FORMAT
DateTime.parse(date... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest_file(glob)\n require 'find'\n return FileList[glob].map{|path| [path, File.mtime(path)]}.sort_by(&:last).map(&:first).last\n end",
"def latest_version_file\n sorted_files.first\n end",
"def get_latest_file(dir, pattern)\n # Get list of files using the pattern and max'es out\n ... | [
"0.787986",
"0.76643175",
"0.74320656",
"0.6986638",
"0.69436157",
"0.6938258",
"0.690804",
"0.68994594",
"0.6786546",
"0.67120785",
"0.670438",
"0.6490737",
"0.6484756",
"0.64404863",
"0.6411085",
"0.6410566",
"0.640767",
"0.63878137",
"0.63838434",
"0.6374879",
"0.63447726"... | 0.71841395 | 3 |
if array.length == 1 array.join(" ") elsif array.length == 2 array.join(" and ") elsif array.length > 2 array.insert(2, "and") array[0..1].join(", ") else array.join end end | def oxford_comma(array)
case array.size
when 0
""
when 1
array.first
when 2
array.join(' and ')
else
[array[0..-2].join(', '), array.last].join(', and ')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def oxford_comma(array)\nif array.count == 1 then array.join\nelsif array.count == 2 then array.join(\" and \")\nelsif array.count >= 3\n array[-1].insert(0, \"and \")\n array.join(', ')\nend\nend",
"def format_comma_and(array)\n return array.join if array.length <= 1\n array[0..-2].join(', ') + \" and #{a... | [
"0.8724007",
"0.86085063",
"0.84615964",
"0.8403505",
"0.82500046",
"0.81964684",
"0.8107352",
"0.796466",
"0.79472613",
"0.7791181",
"0.7638425",
"0.76292795",
"0.7601086",
"0.7596322",
"0.7596322",
"0.74321574",
"0.740775",
"0.7371922",
"0.73268294",
"0.7284367",
"0.7227529... | 0.80071783 | 7 |
GET /orc_atas/1 GET /orc_atas/1.xml | def show
@orc_ata = OrcAta.find(params[:id])
@orc_ata_itens = OrcAtaIten.find(:all, :conditions => ['orc_ata_id=? ',@orc_ata.id ])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @orc_ata }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tso.to_xml(:except => [ :created_at, :updated_at ]) }\n end\n end",
"def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n... | [
"0.65976167",
"0.6474895",
"0.6459316",
"0.64558345",
"0.6324738",
"0.62887096",
"0.62008286",
"0.61464494",
"0.61365205",
"0.6099336",
"0.6091384",
"0.6072452",
"0.60380775",
"0.6033974",
"0.60309184",
"0.60025805",
"0.5987412",
"0.5975075",
"0.59667385",
"0.59500164",
"0.59... | 0.64006484 | 4 |
GET /orc_atas/new GET /orc_atas/new.xml | def new
@orc_ata = OrcAta.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @orc_ata }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end",
"def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\... | [
"0.75128686",
"0.7223818",
"0.7217566",
"0.7106731",
"0.70553356",
"0.7019241",
"0.6993524",
"0.69206506",
"0.69168323",
"0.68981165",
"0.6879209",
"0.68584543",
"0.68581253",
"0.6856893",
"0.6852867",
"0.68487734",
"0.68444204",
"0.6830667",
"0.6829281",
"0.6824936",
"0.6823... | 0.72510415 | 1 |
POST /orc_atas POST /orc_atas.xml | def create
@orc_ata = OrcAta.new(params[:orc_ata])
respond_to do |format|
if @orc_ata.save
session[:news_itens]= @orc_ata.id
@ata = OrcAta.find(:all, :conditions =>['id=?',@orc_ata.id])
flash[:notice] = 'SALVO COM SUCESSO'
format.html { redirect_to( {:action => "edit"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_xml(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_XML)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n ... | [
"0.6039028",
"0.59986264",
"0.5895364",
"0.58632886",
"0.58284646",
"0.571369",
"0.5702142",
"0.5671178",
"0.5622884",
"0.56139773",
"0.55795765",
"0.5557487",
"0.5547813",
"0.55366945",
"0.5519832",
"0.5482917",
"0.5478118",
"0.5447649",
"0.54385614",
"0.5428505",
"0.5421067... | 0.54869986 | 15 |
PUT /orc_atas/1 PUT /orc_atas/1.xml | def update
@orc_ata = OrcAta.find(params[:id])
respond_to do |format|
if @orc_ata.update_attributes(params[:orc_ata])
flash[:notice] = 'SALVO COM SUCESSO'
format.html { redirect_to(@orc_ata) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"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 res... | [
"0.68260604",
"0.64490265",
"0.63316727",
"0.6294711",
"0.6279681",
"0.6225425",
"0.615154",
"0.61166316",
"0.5996893",
"0.59827524",
"0.5834622",
"0.58320826",
"0.5813322",
"0.5784754",
"0.5780984",
"0.5771653",
"0.574571",
"0.5735246",
"0.5719611",
"0.5695612",
"0.5676264",... | 0.65432465 | 1 |
DELETE /orc_atas/1 DELETE /orc_atas/1.xml | def destroy
@orc_ata = OrcAta.find(params[:id])
@orc_ata.destroy
@ata =
respond_to do |format|
format.html { redirect_to( home_path ) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n RestClient.delete \"#{REST_A... | [
"0.7000569",
"0.69400704",
"0.69344616",
"0.65855247",
"0.65208346",
"0.65082633",
"0.6426647",
"0.63923985",
"0.6377696",
"0.6299484",
"0.62968445",
"0.6291842",
"0.6291842",
"0.62467504",
"0.6238167",
"0.6221438",
"0.62211955",
"0.6220511",
"0.6212173",
"0.6211309",
"0.6201... | 0.67558074 | 3 |
FIXME: refactor dupplicate code | def notify_supplier_final_payment_paid
WeixinsJob.perform_later({:event => 'delivery_final_payment_paid', :id => self.id}) if supplier.weixin
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def without_duplicates(bindings); end",
"def deep_dup; end",
"def _test_replicate(sql)\n sql = [ sql ] unless sql.is_a? Enumerable\n connection do |c|\n c.query \"select setval('t_seq', 1, false)\"\n sql.each do |q|\n c.query q\n end\n end\n\n config['backend']['nodes'].map do... | [
"0.59124786",
"0.5675942",
"0.5507213",
"0.5336631",
"0.5322058",
"0.53049934",
"0.5302365",
"0.52296627",
"0.5219692",
"0.5218118",
"0.52102166",
"0.5205971",
"0.5202897",
"0.5195989",
"0.519073",
"0.5141803",
"0.5141461",
"0.5140088",
"0.5112",
"0.5104294",
"0.50888354",
... | 0.0 | -1 |
GET /blogs GET /blogs.json | def index
@blogs = Blog.all.order(created_at: :desc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @blogs = Blog.all\n render json: @blogs\n end",
"def index\n @blogs = Blog.all\n\n render json: @blogs\n end",
"def index\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"... | [
"0.7926349",
"0.788539",
"0.7776141",
"0.7776141",
"0.7727541",
"0.74658227",
"0.74037105",
"0.73855",
"0.71543986",
"0.7058602",
"0.7058602",
"0.70490706",
"0.6990023",
"0.6989874",
"0.69503206",
"0.69025564",
"0.69025564",
"0.686907",
"0.686907",
"0.6867432",
"0.6811407",
... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_blog
@blog = Blog.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 blog_params
params.require(:blog).permit(:title, :subtitle, :content, :image, :secondtitle, :secondsubtitle, :secondcontent, :secondimage)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
Uses Arrayreduce instead of imperative code and always use a Range in the reduction array. | def cont? x, y
y == x.end + 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_518(val, _values, result)\n result = @builder.range_inclusive(val[0], val[1], val[2])\n \n result\nend",
"def _reduce_516(val, _values, result)\n result = @builder.range_inclusive(val[0], val[1], val[2])\n \n result... | [
"0.7430191",
"0.7419417",
"0.7362466",
"0.73505884",
"0.73141634",
"0.73141634",
"0.73104537",
"0.7308969",
"0.7248856",
"0.72478545",
"0.72328347",
"0.72298616",
"0.7213032",
"0.7210404",
"0.7177195",
"0.71393543",
"0.6665479",
"0.66153395",
"0.66153395",
"0.65910774",
"0.65... | 0.0 | -1 |
Given a hash with numeric values, return the key for the smallest value | def key_for_min_value(name_hash)
return nil if name_hash.empty?
max = 0
name_hash.each {|name, value| max = value if value > max}
key = ""
min = max
name_hash.each do |name, value|
if min > value
min = value
key = name
end
end
return key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n... | [
"0.8821222",
"0.8777674",
"0.87769854",
"0.8745862",
"0.8689437",
"0.86553806",
"0.865241",
"0.86165065",
"0.8587693",
"0.8572328",
"0.85674095",
"0.8550907",
"0.8529734",
"0.8529734",
"0.85182345",
"0.84936565",
"0.8475531",
"0.8475531",
"0.8466132",
"0.8449126",
"0.84490585... | 0.0 | -1 |
Initializes our module. mod: Module object. basePath: dir in which the modules furthest ancestor is located. | def initialize( mod, basePath )
ArgTest::type( "module", mod, Module )
ArgTest::type( "basePath", basePath, String )
@mod = mod
@basePath = File.expand_path( basePath )
@vars = Hash[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize current_dir,configuration\n @current_dir=current_dir\n @configuration=configuration\n @base_dir=File.expand_path(@configuration['base_dir'])\n @base_src=File.join(@base_dir,'src')\n end",
"def initialize(site, base, dir, name); end",
"def initialize(base)\n @root = F... | [
"0.5756387",
"0.56454855",
"0.56270784",
"0.55775505",
"0.5556905",
"0.5533387",
"0.545517",
"0.54382825",
"0.5378237",
"0.5368999",
"0.536577",
"0.536577",
"0.536577",
"0.536577",
"0.536577",
"0.536577",
"0.536577",
"0.536577",
"0.53553474",
"0.53466874",
"0.5324791",
"0.5... | 0.78064126 | 0 |
Returns a String Array of the modules Hierarchy, starting with the most distant ancestor, ending with the current module's name. | def hierarchy()
fullName().split( "::" )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_hierarchy\n hierarchy = []\n current_location = self\n hierarchy << current_location.name\n while(1)\n if (current_location.location)\n location = current_location.location\n hierarchy << location.name\n current_location = location\n else\n break\n en... | [
"0.6584659",
"0.6565504",
"0.61602855",
"0.61105806",
"0.60388064",
"0.6027502",
"0.6003809",
"0.58349293",
"0.58260626",
"0.58158594",
"0.57930505",
"0.57645535",
"0.5582857",
"0.5569446",
"0.5544472",
"0.5542666",
"0.5534755",
"0.55313927",
"0.5522625",
"0.5510716",
"0.5508... | 0.65538996 | 2 |
Returns the module name, with it's full namespace, as a String. | def fullName()
@mod.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def module_name\n root? ? nil : @name.camelize\n end",
"def full_module_name\n self.class.ndx_full_module_names([id_handle]).values.first\n end",
"def name\n @module.name\n end",
"def module_name(module_path)\n dir_name = File.dirname(module_path)\n base_name = File.basename... | [
"0.78269887",
"0.77807355",
"0.7708972",
"0.7619851",
"0.76181847",
"0.74493515",
"0.7406815",
"0.73325956",
"0.7270274",
"0.7262177",
"0.7238308",
"0.72000706",
"0.7154441",
"0.7035162",
"0.69901186",
"0.6981434",
"0.69737095",
"0.6959779",
"0.68958473",
"0.68848956",
"0.686... | 0.6899731 | 18 |
Returns the path in which the module files reside, without the trailing slash, as a String. | def path()
@basePath + "/" + hierarchy().join( "/" )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\n end",
"def module_root\n metadata_path = find_upwards('metadata.json')\n if metadata_path\n File.dirname(metadata_path)\n elsif in_module_root?\n Dir.pwd\n end\n ... | [
"0.71869904",
"0.7094588",
"0.6997096",
"0.6956801",
"0.6948362",
"0.6943914",
"0.6897417",
"0.68162537",
"0.6775404",
"0.6769105",
"0.6764542",
"0.67597854",
"0.67301947",
"0.67250204",
"0.6608076",
"0.6532147",
"0.65306133",
"0.6522638",
"0.6521143",
"0.6509562",
"0.6502373... | 0.0 | -1 |
Requires (or load, if 'reload') all classes, files and all child modules if 'recursive'. | def load( reload = false, recursive = false )
puts ( "[Module] #{fullName()}" ) if ( ( defined? $LoaderModule ) && $LoaderModule.getVar( "Verbose" ) >= Kesh::Loader::VERBOSE_MODULE )
loadFiles( reload )
loadClasses( reload )
loadChildModules( reload, recursive ) if recursive
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadChildModules( reload = false, recursive = false )\n\t\t\t\tKesh::ArgTest::valueRange( \"recursive\", recursive, [ true, false ] )\n\t\t\t\tKesh::ArgTest::valueRange( \"reload\", reload, [ true, false ] )\n\t\t\t\t\n\t\t\t\tchildModules().each do |mi|\n\t\t\t\t\tmi.loadClasses( reload )\n\t\t\t\t\tmi.loadCh... | [
"0.77856153",
"0.6398098",
"0.63217586",
"0.6292695",
"0.6237595",
"0.6197134",
"0.6193911",
"0.61394215",
"0.61049044",
"0.6093811",
"0.6063486",
"0.6015869",
"0.60052824",
"0.5976098",
"0.59694034",
"0.5953749",
"0.5952531",
"0.5935876",
"0.5903788",
"0.589215",
"0.5889429"... | 0.7241057 | 1 |
Returns a ModuleInfo object representing a child of this module. Can go deeper than just 1 layer, if the appropriate namepace is given. E.g. ModuleInfo( Blah ).childModule( Moo::Argh ) returns Blah::Moo::Arg | def childModule( name )
ArgTest::type( "name", name, String )
ArgTest::stringLength( "name", name, 1 )
return ModuleInfo.parse( @basePath, "#{fullName()}::#{name}" )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_module\n @parent_module ||= name.deconstantize\n end",
"def get_child(name)\n Vidalia::checkvar(name,String,self.class.ancestors,\"name\")\n @children[name]\n end",
"def derive_child(field_hash:, name:, parent:)\n self.class.new(\n rectype: @rectype,\n ... | [
"0.54272217",
"0.52907443",
"0.5167462",
"0.5156004",
"0.5090518",
"0.5088835",
"0.50762856",
"0.5075979",
"0.5056246",
"0.50351155",
"0.5011156",
"0.5009199",
"0.49460778",
"0.48594254",
"0.4829652",
"0.48219934",
"0.48215994",
"0.4792688",
"0.47919577",
"0.47905225",
"0.477... | 0.76991427 | 0 |
Returns an Array of ModuleInfos of this module's child modules. | def childModules()
list = []
dir = Dir.new( path() )
dir.each do |file|
next unless File.directory?( path() + "/" + file )
next if ( file[/^([A-Z][a-z]*)+$/] == nil )
list << childModule( $1 )
end
return list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end",
"def modules\n @modules.values\n end",
"def modules\n @modules.values\n end",
"def get_children\n return children\n end",
"def children\n result = []\n ... | [
"0.684203",
"0.6774832",
"0.6774832",
"0.67359495",
"0.6700174",
"0.66479653",
"0.6621187",
"0.6566211",
"0.65413934",
"0.6482572",
"0.64373463",
"0.6385629",
"0.6384045",
"0.63421935",
"0.63421935",
"0.6331564",
"0.6300387",
"0.62887836",
"0.62887836",
"0.6287807",
"0.628382... | 0.7432877 | 0 |
Require (or load, if 'reload') all child modules for this module. | def loadChildModules( reload = false, recursive = false )
Kesh::ArgTest::valueRange( "recursive", recursive, [ true, false ] )
Kesh::ArgTest::valueRange( "reload", reload, [ true, false ] )
childModules().each do |mi|
mi.loadClasses( reload )
mi.loadChildModules( reload, recursive ) if recurs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load( reload = false, recursive = false )\n\t\t\t\tputs ( \"[Module] #{fullName()}\" ) if ( ( defined? $LoaderModule ) && $LoaderModule.getVar( \"Verbose\" ) >= Kesh::Loader::VERBOSE_MODULE )\n\t\t\t\tloadFiles( reload )\n\t\t\t\tloadClasses( reload )\n\t\t\t\tloadChildModules( reload, recursive ) if recursive... | [
"0.7022857",
"0.66206414",
"0.65302455",
"0.6445069",
"0.63400704",
"0.62535423",
"0.60352236",
"0.60170025",
"0.6000626",
"0.596158",
"0.59394157",
"0.593782",
"0.5927659",
"0.5833087",
"0.5833087",
"0.5830784",
"0.5812845",
"0.5792555",
"0.578494",
"0.5697674",
"0.56940055"... | 0.79189783 | 0 |
Return a ClassInfo representing a class in this ModuleInfo. | def clazz( name )
Kesh::ArgTest::type( "name", name, String )
Kesh::ArgTest::stringLength( "name", name, 1 )
return Kesh::Loader::ClassInfo.new( self, name )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def klass\n info.klass\n end",
"def class_info?; \"#{self.class.name}\" end",
"def class_for(cls)\n return nil unless cls # superclass will return nil when none\n fqn = cls.qualified_type_name\n return classes[fqn] if classes[fqn]\n classes[fqn] = JClass.parse(self, cls)\n en... | [
"0.63279337",
"0.5915664",
"0.5845817",
"0.5815527",
"0.577609",
"0.577609",
"0.577609",
"0.5757087",
"0.5729985",
"0.57255816",
"0.5678462",
"0.565478",
"0.565478",
"0.5646015",
"0.5625746",
"0.5622997",
"0.56108916",
"0.56108916",
"0.5557813",
"0.54892474",
"0.54423875",
... | 0.5709292 | 10 |
Returns an Array of ClassInfos of this module's classes. These are files that match the pattern .class.rb | def classes()
list = []
dir = Dir.new( path() )
dir.each do |file|
next if File.directory?( path() + "/" + file )
next if ( file[/^([A-Z][A-Za-z]*)+\.class\.rb$/] == nil )
list << clazz( $1 )
end
return list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_classes\n puppetClasses = []\n Dir.glob( SpkDashboard::MANIFEST_ROOT + \"/modules/**/*.pp\" ).each do |manifest|\n File.read( manifest ).each do |line|\n foundClass = line.match(/^class (\\S+).*\\{/)\n if foundClass and puppetClasses.include?( foundClass[1] ) == false\n ... | [
"0.7394519",
"0.7336234",
"0.7265704",
"0.7174885",
"0.6768781",
"0.6731861",
"0.6709294",
"0.66962695",
"0.66860926",
"0.66860926",
"0.6648445",
"0.6648368",
"0.66019344",
"0.6492216",
"0.6461574",
"0.64597875",
"0.64523435",
"0.6446778",
"0.63784754",
"0.63772506",
"0.63290... | 0.8386 | 0 |
Require (or load, if 'reload') all classes in this module's dir. Returns an array of Class Symbols of the classes loaded. | def loadClasses( reload = false )
loaded = []
classes().each do |clazz|
clazz.load( reload )
loaded << clazz
end
return loaded
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_classes\n return @@loaded_classes if @@classes_loaded\n\n path = File.join( File.dirname(__FILE__), '*.rb')\n Dir[path].each do |file|\n ActiveSupport::Dependencies.require_or_load(file)\n end\n @@classes_loaded = true\n\n @@loaded_classes\n... | [
"0.7457868",
"0.6853887",
"0.66747284",
"0.657989",
"0.6519492",
"0.64642954",
"0.6404896",
"0.6332142",
"0.63025475",
"0.6219902",
"0.6188586",
"0.61790246",
"0.61783296",
"0.6177508",
"0.6129446",
"0.6119876",
"0.60787666",
"0.605751",
"0.60003364",
"0.59732836",
"0.5918094... | 0.7732239 | 0 |
Return a FileInfo representing a class in this ModuleInfo. | def file( name )
Kesh::ArgTest::type( "name", name, String )
Kesh::ArgTest::stringLength( "name", name, 1 )
return Kesh::Loader::FileInfo.new( self, name )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fileinfo(info)\n return info if info.respond_to?(:filetype)\n\n Aur::FileInfo.new(info)\n end",
"def module_info(build_module)\n if build_module.module?\n module_metainf_dir = FilePath.new(self.classes_directory(build_module.subtree('src')), 'META-INF')\n manifest = FilePath.new(mod... | [
"0.6176132",
"0.6003271",
"0.5997325",
"0.5913609",
"0.56248105",
"0.5601048",
"0.55997574",
"0.54462427",
"0.54094666",
"0.5407202",
"0.536837",
"0.5282301",
"0.5272715",
"0.52334267",
"0.522737",
"0.5223806",
"0.5223806",
"0.5193981",
"0.5188872",
"0.5180956",
"0.5163222",
... | 0.48811615 | 50 |
Returns a Array of FileInfos representing files in this ModuleInfos that are not dirs and do not match the pattern .class.rb | def files()
list = []
dir = Dir.new( path() )
dir.each do |f|
next if File.directory?( path() + "/" + f )
next unless ( f[/^([A-Z][A-Za-z]*)+\.class\.rb$/] == nil )
list << file( f )
end
return list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classes()\n\t\t\t\tlist = []\n\t\t\t\tdir = Dir.new( path() )\n\t\t\t\t\n\t\t\t\tdir.each do |file|\n\t\t\t\t\tnext if File.directory?( path() + \"/\" + file )\n\t\t\t\t\tnext if ( file[/^([A-Z][A-Za-z]*)+\\.class\\.rb$/] == nil )\n\t\t\t\t\tlist << clazz( $1 )\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn list\n\t\t... | [
"0.6711416",
"0.651219",
"0.6329754",
"0.62870944",
"0.6215333",
"0.6129891",
"0.61202055",
"0.6065405",
"0.6013452",
"0.5993037",
"0.5982995",
"0.5968086",
"0.5914398",
"0.59019226",
"0.5899514",
"0.5885088",
"0.5882023",
"0.5878738",
"0.5874276",
"0.5828735",
"0.5823479",
... | 0.7217058 | 0 |
Require (or load, if 'reload') all files in this module's dir. | def loadFiles( reload = false )
files().each do |file|
file.load( reload )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload\n Dir.glob(\"lib/**/*.rb\").each { |file|\n load file\n }\nend",
"def load!\n # TODO Don't load a module that's already loaded\n\n # Load the main file\n fname = path(\"#{name}.rb\")\n require fname unless fname.nil?\n\n # Load the basic things usually autoloaded.\n ... | [
"0.74371356",
"0.6960218",
"0.6954383",
"0.6937768",
"0.69135004",
"0.684274",
"0.6811778",
"0.68072754",
"0.67449325",
"0.66937757",
"0.6689562",
"0.66360444",
"0.66328",
"0.66119605",
"0.66119605",
"0.66119605",
"0.66119605",
"0.66119605",
"0.66119605",
"0.66119605",
"0.661... | 0.6681031 | 11 |
Get a variable associated with the module. | def getVar( name )
ArgTest::type( "name", name, String )
name.strip!()
ArgTest::stringLength( "name", name, 1 )
return @vars[ name ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_variable(name)\n @variables[name]\n end",
"def variable_get(name)\n assert_type name, :String, :name\n environment.caller.var(name.value)\n end",
"def variable_get(ref)\n variable_table.get(self, setup_package_id(ref))\n end",
"def get_variable(var_name)\n ... | [
"0.74975854",
"0.7385829",
"0.7332413",
"0.7103981",
"0.7085342",
"0.6966877",
"0.6948593",
"0.6806636",
"0.67990816",
"0.6745799",
"0.67417073",
"0.67117053",
"0.6662529",
"0.6639994",
"0.6595756",
"0.6586742",
"0.6571171",
"0.6563234",
"0.6510678",
"0.645011",
"0.6432251",
... | 0.6867328 | 7 |
Set a variable associated with the module. | def setVar( name, value )
ArgTest::type( "name", name, String )
name.strip!()
ArgTest::stringLength( "name", name, 1 )
ArgTest::type( "value", value, Object, true )
@vars[ name ] = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_variable(name, value)\n @variables[name] = value\n end",
"def set_variable\n @variable = Variable.find(params[:id])\n end",
"def set_variable\n @variable = Variable.find(params[:id])\n end",
"def set(variable, value)\n controller.instance_variable_set(\"@#{variable}\", va... | [
"0.74489844",
"0.7335436",
"0.7335436",
"0.7212809",
"0.7209703",
"0.7113913",
"0.7061485",
"0.7041138",
"0.7019356",
"0.69972616",
"0.6990392",
"0.69787884",
"0.6913722",
"0.6881826",
"0.6713298",
"0.6707597",
"0.6693553",
"0.66666514",
"0.6623741",
"0.6623741",
"0.65563166"... | 0.7088016 | 6 |
Return true if the module has the variable, false otherwise. | def hasVar?( name )
ArgTest::type( "name", name, String )
name.strip!()
ArgTest::stringLength( "name", name, 1 )
return @vars.has_key?( name )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include_variable?\n VariableTable.check_include_variable(@value)\n end",
"def include_variable?\n return VariableTable.check_include_variable(@content)\n end",
"def variable_definition?\n @variable\n end",
"def variable?\n !@variable_id.nil?\n end",
"def vari... | [
"0.7448167",
"0.7426289",
"0.7406664",
"0.70263135",
"0.70227104",
"0.7010762",
"0.689018",
"0.6888114",
"0.6888114",
"0.6842055",
"0.6797014",
"0.67641395",
"0.6705401",
"0.6697988",
"0.6679788",
"0.6650126",
"0.66314846",
"0.6617809",
"0.6573711",
"0.65276605",
"0.65096587"... | 0.6866128 | 9 |
go right to the translation we have the nrefs too, not sure if we need them actually | def original
@original ||= @container[:translation].original
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refs_at; end",
"def replace_refs\n doc.xpath('.//ref').each_with_index.map do |node, index|\n text = node.inner_html\n\n ref_node = create_ref_node(node, index + 1)\n node.replace(ref_node)\n\n text\n end\n end",
"def handle_references_label(vals)\n ... | [
"0.57933664",
"0.5792428",
"0.5694185",
"0.5630855",
"0.5630855",
"0.5630855",
"0.5630855",
"0.55632794",
"0.55632794",
"0.55632794",
"0.55632794",
"0.55202895",
"0.55202895",
"0.55202895",
"0.55202895",
"0.5498775",
"0.5438369",
"0.5430903",
"0.5412128",
"0.54022884",
"0.540... | 0.0 | -1 |
Prints out all the players and their number of wins that exist in the database in a descensding order. | def leaderboard
@players = Player.order(number_of_wins: :desc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def who_win\n @players.each do |player|\n result_sum = 0\n player.cards_wins.each do |cards|\n result_sum += cards.value.to_i\n end\n player.points = result_sum\n end\n players_win = @players.sort_by(&:points).reverse![0]\n puts 'GANADOR--------GANADOR---------GANADOR----'\n ... | [
"0.7105109",
"0.6912338",
"0.69050896",
"0.68601537",
"0.68503636",
"0.6793031",
"0.67874426",
"0.6778402",
"0.6754098",
"0.66591704",
"0.6646294",
"0.6634586",
"0.6550749",
"0.65291035",
"0.65026534",
"0.6421572",
"0.636955",
"0.63606745",
"0.6357522",
"0.63512594",
"0.63175... | 0.7333747 | 0 |
Loads an appropriate page with message indicating that there is no winner. | def draw
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_public_league_pop_up_should_not_be_displayed\n\n page.should_not have_content(read_file_content(JOIN_A_PUBLIC_LEAGUE_PATH))\n sleep(THREAD_SLEEP_1)\n\n end",
"def your_league_pop_up_should_not_be_displayed\n\n page.should_not have_content(read_file_content(YOUR_LEAGUES))\n sleep(THREAD_SLEE... | [
"0.61586106",
"0.6042792",
"0.6036576",
"0.5805022",
"0.57980067",
"0.57724833",
"0.576367",
"0.57170373",
"0.566226",
"0.5627275",
"0.5612194",
"0.5580136",
"0.5545775",
"0.553109",
"0.5525903",
"0.5515886",
"0.55062044",
"0.5505826",
"0.54828095",
"0.54646426",
"0.5460195",... | 0.0 | -1 |
Update full_name of current user | def update
if @user.update(user_params)
NotificationMailer.new(@user).personal_details_changed
render json: @user, status: :ok
else
render json: @user.errors.full_messages, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name= full_name\n @full_name = full_name\n end",
"def edit_real_name(user, real_name)\n user.real_name = real_name\n user.save_data\n end",
"def full_name\n\t\tself.user_fname.capitalize + \" \" + self.user_lname.capitalize\n\tend",
"def proper_name # method to get the full na... | [
"0.7664577",
"0.7641157",
"0.7537383",
"0.75057894",
"0.73841375",
"0.73597336",
"0.7359578",
"0.7285233",
"0.7260106",
"0.7259021",
"0.7248966",
"0.7244946",
"0.7204922",
"0.7137233",
"0.7122901",
"0.70659006",
"0.7063456",
"0.70545197",
"0.70312417",
"0.6979808",
"0.6945672... | 0.0 | -1 |
GET /companies GET /companies.xml | def index
@companies = current_user.companies.paginate(:page => 1, :page => params[:page], :order => "name DESC")
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @companies }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\t\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render... | [
"0.75398785",
"0.75327474",
"0.75327474",
"0.75327474",
"0.75327474",
"0.7497508",
"0.7146844",
"0.6935157",
"0.6935157",
"0.6935157",
"0.69347507",
"0.6854752",
"0.6823983",
"0.68223643",
"0.6816815",
"0.67808086",
"0.6750553",
"0.6741065",
"0.67320025",
"0.67320025",
"0.673... | 0.6850258 | 12 |
GET /companies/1 GET /companies/1.xml | def show
@company = current_user.companies.find(params[:id])
@events = @company.events.paginate(:page => 1, :page => params[:page], :per_page => 10, :order => "created_at DESC")
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @company }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml ... | [
"0.7401491",
"0.7401491",
"0.7401491",
"0.7401491",
"0.7348382",
"0.7346334",
"0.714079",
"0.7128595",
"0.7128595",
"0.7128595",
"0.7042543",
"0.68976426",
"0.683106",
"0.68117946",
"0.67653096",
"0.67072254",
"0.6640394",
"0.66199267",
"0.66157115",
"0.6611598",
"0.6559619",... | 0.6153623 | 69 |
GET /companies/new GET /companies/new.xml | def new
@company = Company.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @company }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @title = \"New Company\"\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"def new\n @company = Company.new\n \n respond_to do |format|\n format.html # new.html.erb\n format... | [
"0.7960298",
"0.788587",
"0.76531094",
"0.7506649",
"0.74244523",
"0.74129343",
"0.7285969",
"0.72825",
"0.72069234",
"0.71909106",
"0.71823084",
"0.71807116",
"0.71621877",
"0.7156122",
"0.71448666",
"0.71448666",
"0.71448666",
"0.71448666",
"0.71448666",
"0.71448666",
"0.71... | 0.7872135 | 7 |
POST /companies POST /companies.xml | def create
@company = Company.new(params[:company])
@profile = Profile.new
respond_to do |format|
if @company.save
@profile.company = @company
@profile.user = current_user
@profile.save
@role = Role.new
@role.name = @company.name + "_admin"
@role.clien... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to(@company, :notice => 'Company was successfully created.') }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n ... | [
"0.6599383",
"0.6599383",
"0.6599383",
"0.6528881",
"0.64868504",
"0.6303317",
"0.6256015",
"0.62385666",
"0.62341565",
"0.6211788",
"0.61972684",
"0.6196382",
"0.6196382",
"0.6196382",
"0.6196382",
"0.6196382",
"0.61924773",
"0.6191616",
"0.6191616",
"0.6191616",
"0.6191616"... | 0.0 | -1 |
PUT /companies/1 PUT /companies/1.xml | def update
@company = current_user.companies.find(params[:id])
respond_to do |format|
if @company.update_attributes(params[:company])
flash[:notice] = 'Company was successfully updated.'
format.html { redirect_to(@company) }
format.xml { head :ok }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action... | [
"0.66647834",
"0.66467565",
"0.66402173",
"0.66402173",
"0.66365665",
"0.6634516",
"0.64066434",
"0.6377332",
"0.6319827",
"0.6316748",
"0.63053",
"0.6301914",
"0.6301914",
"0.6301914",
"0.6301914",
"0.6301914",
"0.6301914",
"0.63002545",
"0.6288188",
"0.6284866",
"0.6221488"... | 0.64509845 | 6 |
DELETE /companies/1 DELETE /companies/1.xml | def destroy
@company = current_user.companies.find(params[:id])
@company.destroy
respond_to do |format|
format.html { redirect_to(companies_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n... | [
"0.73547524",
"0.7294619",
"0.7294619",
"0.7294619",
"0.7294619",
"0.7294619",
"0.7294619",
"0.7294619",
"0.72838765",
"0.7242777",
"0.6968639",
"0.6968201",
"0.6868082",
"0.68481386",
"0.6794488",
"0.66675",
"0.6642913",
"0.6627114",
"0.66241276",
"0.6618075",
"0.6598122",
... | 0.703207 | 10 |
Dashboard where post setup metrics can be seen Author: Puneet Date: 02/02/2018 Reviewed By: | def dashboard
@response = CompanyApi::Request::Economy.new(
CompanyApi::Response::Formatter::Economy,
request.cookies,
{"User-Agent" => http_user_agent}
).fetch_dashboard_details
# Check if error present or not?
unless @response.success?
render_error_response(@response)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dashboard\n @meta_data = {:page_title => \"Chicago Ideas Week | Dashboard\", :og_image => \"\", :og_title => \"Chicago Ideas Week\", :og_type => \"article\", :og_desc => \"\"}\n @user = current_user\n end",
"def user_dashboard\n @progress_count = Resource.in_progress.where(user_id: @user.id).coun... | [
"0.6221469",
"0.59210336",
"0.5749579",
"0.5749579",
"0.5749579",
"0.5641006",
"0.563496",
"0.5587874",
"0.5574343",
"0.5517953",
"0.5497103",
"0.54799616",
"0.54485935",
"0.54485935",
"0.5433734",
"0.54272777",
"0.54144883",
"0.5412249",
"0.5409388",
"0.54092854",
"0.5360005... | 0.0 | -1 |
Planner to perform economy setup step one Author: Puneet Date: 02/02/2018 Reviewed By: | def planner
@response = CompanyApi::Request::Economy.new(
CompanyApi::Response::Formatter::Economy,
request.cookies,
{"User-Agent" => http_user_agent}
).fetch_planner_step_one_details
# Check if error present or not?
unless @response.success?
render_error_response(@respon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n # Build the portfolio\n self.portfolio = Portfolio.new(:login => self.login)\n self.portfolio.save\n \n # Build the design editor\n self.design = Design.new\n self.design.save\n \n # Set the plan at level 1\n self.plan = Plan.new(:level => 1)\n self.plan.save\n \n ... | [
"0.59479415",
"0.58268464",
"0.57883316",
"0.5764183",
"0.56669986",
"0.5661523",
"0.5636058",
"0.5617101",
"0.55944574",
"0.5435907",
"0.54235625",
"0.5413777",
"0.54074347",
"0.5403758",
"0.5393596",
"0.5382753",
"0.5379405",
"0.5369771",
"0.53692704",
"0.5354029",
"0.53465... | 0.56817555 | 4 |
Planner to perform economy setup step two Author: Puneet Date: 02/02/2018 Reviewed By: | def planner_step_two
@response = CompanyApi::Request::Economy.new(
CompanyApi::Response::Formatter::Economy,
request.cookies,
{"User-Agent" => http_user_agent}
).fetch_planner_step_two_details
# Check if error present or not?
unless @response.success?
render_error_respons... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n @enduser = Enduser.new(\n username: \"tony\",\n password: \"Password!23\", \n password_confirmation: \"Password!23\",\n first_name: \"Tony\", \n last_name: \"Mao\", \n date_of_birth: \"2018-01-01\",\n email: \"tony@example.com\", \n contact_number: \"04225327... | [
"0.5863107",
"0.57843816",
"0.57470477",
"0.5744358",
"0.56348634",
"0.558675",
"0.5573609",
"0.5550029",
"0.55498976",
"0.5510389",
"0.55026406",
"0.54740626",
"0.546528",
"0.54150677",
"0.54138505",
"0.5403032",
"0.53994",
"0.5384002",
"0.53792024",
"0.53673804",
"0.5366264... | 0.55249125 | 9 |
Planner to perform economy setup step three Author: Puneet Date: 02/02/2018 Reviewed By: | def planner_step_three
@response = CompanyApi::Request::Economy.new(
CompanyApi::Response::Formatter::Economy,
request.cookies,
{"User-Agent" => http_user_agent}
).fetch_planner_step_three_details
# Check if error present or not?
unless @response.success?
render_error_res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n # Build the portfolio\n self.portfolio = Portfolio.new(:login => self.login)\n self.portfolio.save\n \n # Build the design editor\n self.design = Design.new\n self.design.save\n \n # Set the plan at level 1\n self.plan = Plan.new(:level => 1)\n self.plan.save\n \n ... | [
"0.57630944",
"0.57172877",
"0.56031764",
"0.55725163",
"0.5485014",
"0.5471753",
"0.54717004",
"0.54649025",
"0.5442505",
"0.54183894",
"0.5412012",
"0.540349",
"0.53530645",
"0.5345235",
"0.53332067",
"0.5322859",
"0.5322481",
"0.53216577",
"0.5308498",
"0.5297606",
"0.5259... | 0.57298344 | 1 |
Token Supply stats and section to mint more coins Author: Puneet Date: 02/02/2018 Reviewed By: | def token_supply
@response = CompanyApi::Request::Economy.new(
CompanyApi::Response::Formatter::Economy,
request.cookies,
{"User-Agent" => http_user_agent}
).fetch_supply_details
# Check if error present or not?
unless @response.success?
render_error_response(@response)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token\n end",
"def list_top_coins\n # here doc - http://blog.jayfields.com/2006/12/ruby-multiline-strings-here-doc-or.html\n puts <<-DOC.colorize(:cyan)\n ____ ____ ____ _________ ____ ____ ____ ____ ____ ____ _________ ____ ____ ____ ____ ____ ____\n ||T |||h |||e ||| |||C |||r |||y |||p... | [
"0.57403105",
"0.56510097",
"0.5648677",
"0.55980486",
"0.55980486",
"0.55980486",
"0.55980486",
"0.55980486",
"0.55980486",
"0.5587942",
"0.5558041",
"0.53645414",
"0.53481954",
"0.5343",
"0.5343",
"0.5343",
"0.5343",
"0.5343",
"0.5343",
"0.5343",
"0.5343",
"0.5337515",
... | 0.47974107 | 100 |
manage users Author: Puneet Date: 02/02/2018 Reviewed By: | def users
@response = CompanyApi::Request::Economy.new(
CompanyApi::Response::Formatter::Economy,
request.cookies,
{"User-Agent" => http_user_agent}
).fetch_user_details
# Check if error present or not?
unless @response.success?
render_error_response(@response)
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modified_by(user)\n #none by default\n end",
"def modified_by(user)\n #none by default\n end",
"def author \n user.firstname + ' ' + user.lastname\n end",
"def reviewed_by=(value)\n @reviewed_by = value\n end",
"def author\n user\n end",
"def review_authors #... | [
"0.6597622",
"0.6597622",
"0.64413875",
"0.64054364",
"0.6363355",
"0.63188094",
"0.6302741",
"0.6273906",
"0.62425363",
"0.6221785",
"0.6196463",
"0.6179328",
"0.6162265",
"0.6134731",
"0.6110891",
"0.6074842",
"0.6073338",
"0.60669273",
"0.6058895",
"0.6049409",
"0.60465187... | 0.0 | -1 |
manage transaction types Author: Puneet Date: 02/02/2018 Reviewed By: | def transactions
@response = CompanyApi::Request::Economy.new(
CompanyApi::Response::Formatter::Economy,
request.cookies,
{"User-Agent" => http_user_agent}
).fetch_transaction_kinds_details
# Check if error present or not?
unless @response.success?
render_error_response(@... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transaction_type_description(transaction_type)\n case transaction_type\n when 'initial_fee'\n 'Fee de Campaña'\n when 'payment'\n 'Pago de Social Target'\n when 'tweet_fee'\n 'Públicación Tweet'\n when 'tweet_revenue'\n 'Ingreso por Tweet'\n when 'influen... | [
"0.62626666",
"0.584913",
"0.58456826",
"0.5827251",
"0.5783011",
"0.57753915",
"0.5740286",
"0.56098634",
"0.56041944",
"0.5566012",
"0.55532956",
"0.55146605",
"0.55117166",
"0.54945296",
"0.54897577",
"0.5486819",
"0.5482894",
"0.5478396",
"0.54358006",
"0.5408232",
"0.538... | 0.0 | -1 |
Simulator to run a transaction & render list of executed transactions Author: Puneet Date: 02/02/2018 Reviewed By: | def simulator
if GlobalConstant::Base.main_sub_environment?
redirect_to :dashboard, status: GlobalConstant::ErrorCode.permanent_redirect
end
@response = CompanyApi::Request::Economy.new(
CompanyApi::Response::Formatter::Economy,
request.cookies,
{"User-Agent" => http_user_age... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_transactions\n items = @db.execute \"SELECT * FROM Items\"\n\n items.each do |item|\n puts \"Item Name: #{item[1]}\"\n puts \"Available Quantity: #{item[2] - item[3]}\"\n\n transactions = @db.execute \"SELECT * FROM Transactions WHERE item_id = #{item[0]}\"\n\n unless transaction... | [
"0.6765523",
"0.66635025",
"0.647009",
"0.64465535",
"0.63568485",
"0.61178035",
"0.5910582",
"0.5817864",
"0.57835066",
"0.5764467",
"0.5720048",
"0.5700294",
"0.5679845",
"0.56764525",
"0.5674286",
"0.5657269",
"0.565504",
"0.5645428",
"0.5628545",
"0.5626219",
"0.5610415",... | 0.0 | -1 |
token design Author: Puneet Date: 02/02/2018 Reviewed By: | def developer_api_console
@response = CompanyApi::Request::Economy.new(
CompanyApi::Response::Formatter::Economy,
request.cookies,
{"User-Agent" => http_user_agent}
).fetch_developer_api_console_details
# Check if error present or not?
unless @response.success?
render_err... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token\n end",
"def token; end",
"def token; end",
"def token; end",
"def token; end",
"def token; end",
"def token; end",
"def token\n @token\n end",
"def token!\n # at line 1:8: ( HTML | HEAD | TITLE | BODY | H1 | H2 | H3 | H4 | H5 | H6 | P | DIV | I | B | U | TABLE | TR | TH | TD | ... | [
"0.695953",
"0.6853033",
"0.6853033",
"0.6853033",
"0.6853033",
"0.6853033",
"0.6853033",
"0.661738",
"0.6582135",
"0.64514524",
"0.64166963",
"0.64144814",
"0.63938636",
"0.63818324",
"0.63818324",
"0.63818324",
"0.63818324",
"0.63818324",
"0.63818324",
"0.63818324",
"0.6381... | 0.0 | -1 |
GET /folders GET /folders.json | def index
# base_url, token, app_id, app_secret
temp = @folder_client.index({id_parent_folder: -1})
@contents = temp[:data]
temp2 = @document_client.index(id_parent_folder: -1)
@contents = @contents + temp2[:data]
@current_folder = Folder.new({name: 'Root'})
@success = temp[:status] and temp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_folders\n http_get(:uri=>\"/folders\", :fields=>x_cookie)\n end",
"def get_list_folders()\n\t\trefresh_access_token()\n\t\trequest_url = \"https://www.googleapis.com/drive/v2/files?q=mimeType='application/vnd.google-apps.folder'&access_token=#{@access_token}\"\n\n\t\tresponse = RestClient.get re... | [
"0.82521564",
"0.78815645",
"0.7792347",
"0.7405012",
"0.73951226",
"0.7353356",
"0.7316257",
"0.7212083",
"0.7193713",
"0.7189141",
"0.7183356",
"0.71402705",
"0.71189636",
"0.70745736",
"0.703969",
"0.70182896",
"0.70105934",
"0.6994895",
"0.69233656",
"0.6831861",
"0.68251... | 0.5861256 | 81 |
GET /folders/1 GET /folders/1.json | def show
temp = @folder_client.index(id_parent_folder: get_id)
@contents = temp[:data]
temp2 = @folder_client.find(get_id)
@folder = temp2[:data]
temp3 = @document_client.index(id_parent_folder: get_id)
@contents = @contents + temp3[:data]
@success = temp[:status] and temp2[:status] and temp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @folders = current_user.folders.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @folders }\n end\n end",
"def show\n @folder = current_user.folders.find_by_name(params[:id])\n\n respond_to do |format|\n format.html # show.ht... | [
"0.75024503",
"0.7390647",
"0.7372937",
"0.7368616",
"0.724997",
"0.7243339",
"0.71677804",
"0.70709276",
"0.7025346",
"0.696125",
"0.6945263",
"0.69212973",
"0.6814542",
"0.6807573",
"0.67759544",
"0.675277",
"0.67481583",
"0.66611",
"0.6655784",
"0.66485417",
"0.6638421",
... | 0.59111166 | 76 |
POST /folders POST /folders.json | def create
temp = @folder_client.create(params_create_folder)
if temp[:status]
flash_message(:notice,"#{t('folder.folder')} #{t('succesfully_created')}")
folder_path(temp[:data].id)
else
flash_message(:error, 'Problema creando Carpeta')
redirect_to root_path
end
@success = te... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_folder_request(dir_name)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\... | [
"0.7008037",
"0.6947491",
"0.6941389",
"0.68995506",
"0.6763058",
"0.6754646",
"0.67372674",
"0.672412",
"0.6666547",
"0.6644846",
"0.6559774",
"0.65086496",
"0.6504523",
"0.6470491",
"0.64601886",
"0.643648",
"0.64039326",
"0.64026177",
"0.6394586",
"0.63664854",
"0.63515013... | 0.6258119 | 25 |
PATCH/PUT /folders/1 PATCH/PUT /folders/1.json | def update
temp = @folder_client.update(get_id, params_create_folder)
if temp[:status]
flash_message(:notice,"#{t('folder.folder')} #{t('succesfully_updated')}")
redirect_to folder_path(temp[:data].id)
else
flash_message(:error, 'Problema actualizando Carpeta')
redirect_to root_path
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.json { render :show, status: :ok, location: @folder }\n else\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @folder.update(fold... | [
"0.6978382",
"0.68816954",
"0.68765193",
"0.68648076",
"0.68648076",
"0.6801141",
"0.6699259",
"0.66291004",
"0.66291004",
"0.66291004",
"0.6580432",
"0.6558841",
"0.6514522",
"0.6481859",
"0.63978606",
"0.6387755",
"0.63698316",
"0.63020027",
"0.629177",
"0.624089",
"0.62266... | 0.639283 | 15 |
DELETE /folders/1 DELETE /folders/1.json | def destroy
temp = @folder_client.destroy(get_id, force)
if temp[:status]
flash_message(:notice,"#{t('folder.folder')} #{t('succesfully_destroyed')}")
redirect_to folders_path
else
if temp[:code] == 403
@id = get_id
@message = temp[:response]['message']
else
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @folder.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @folder.destroy\n respond_to do |format|\n format.html { redirect_to '/folders/1' }\n format.json { head :no_content }\n end\n\n\n end",
"def destroy\n @f... | [
"0.7251623",
"0.71748894",
"0.7129106",
"0.71289545",
"0.7038487",
"0.7015824",
"0.70104843",
"0.6848716",
"0.6840999",
"0.6798631",
"0.6798631",
"0.67747355",
"0.6774435",
"0.67659867",
"0.67659867",
"0.67651606",
"0.6705379",
"0.6691974",
"0.6653233",
"0.6614794",
"0.660994... | 0.63790977 | 33 |
Store auth token in selected token store(eg, redis) and return it | def get_and_store_credentials(token)
credentials_hash = JSON.parse @credentials
authorizer = create_authorizer_with(credentials_hash)
credentials = authorizer.get_credentials(@username)
if credentials.nil?
# store credentials in redis with key like "g-user-token:@username"
credentials = auth... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_token\n self.token ||= Digest::MD5.hexdigest(login + Time.now.to_i.to_s)[0..5]\n $redis.set \"#{KEY}:#{login}:token\", token\n $redis.set \"#{KEY}:#{token}:login\", login\n end",
"def token\n auth_client.token(settings.oauth2_token).tap do |token|\n settings.save_oauth2_t... | [
"0.75564176",
"0.72897726",
"0.702433",
"0.7013443",
"0.693016",
"0.6917473",
"0.6910765",
"0.6904612",
"0.6904612",
"0.6892654",
"0.68884",
"0.6867845",
"0.6850365",
"0.68365467",
"0.68278897",
"0.67770135",
"0.6772038",
"0.67496544",
"0.67469674",
"0.670677",
"0.67050534",
... | 0.66596025 | 24 |
Run the specified command in the rails root directory. | def run_cmd(cmd)
Dir.chdir(Rails.root) {
#@output = `cd #{CTMWEB_PATH} && #{cmd} 2>&1`
cmd = "#{cmd}"
@output = `#{cmd}`
}
result = $?.success?
if result
print "OK\n".green
else
print "ERROR\n".red
puts "#{@output.to_s.red}"
send_to_flowdock("CTMWEB", "Deployment for #{Rails.env.up... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rails_command(command, options = {})\n execute_command :rails, command, options\n end",
"def run(command, log_action = true)\r\n log 'executing', \"#{command} from #{Dir.pwd}\" if log_action\r\n `#{command}`\r\n end",
"def run_app(command, arguments)\nend",
"def run(command)\n\t... | [
"0.70099306",
"0.63348824",
"0.6302735",
"0.6291442",
"0.61779016",
"0.61406994",
"0.6073867",
"0.6046493",
"0.601778",
"0.601778",
"0.601778",
"0.6004152",
"0.5996057",
"0.5974065",
"0.5957982",
"0.5950904",
"0.5950904",
"0.5937647",
"0.5921802",
"0.5898356",
"0.58884853",
... | 0.5369278 | 77 |
vi: set ft=ruby : home is a small helper function that translates the home path string. there is probably a cleaner way to do this, but this works | def home
@home ||= ENV.fetch("HOME").tr("\\", "/")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home_path\n File.expand_path(\"~\")\n end",
"def home\n @home ||= File.expand_path('~')\n end",
"def tildize (path)\n\tpath.gsub(`echo $HOME`.chomp, \"~\")\nend",
"def home_file(*path)\n File.join(ENV['HOME'], *path)\nend",
"def home_file(*path)\n File.join(ENV['HOME'], *path)\nend",
... | [
"0.7200945",
"0.70960784",
"0.70191824",
"0.701024",
"0.701024",
"0.692195",
"0.665065",
"0.6583733",
"0.656418",
"0.65452766",
"0.6512823",
"0.64918053",
"0.6418528",
"0.63919747",
"0.63914466",
"0.6379268",
"0.6346291",
"0.63117695",
"0.62739456",
"0.62714386",
"0.6265697",... | 0.7529081 | 0 |
username is a small helper function for grabbing your username from the env variables | def username
ENV.fetch("USERNAME")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def username\n ENV['USER']\n end",
"def username\n ENV['DESK_USERNAME']\n end",
"def username\n config['couch_username_key'] ? \"#{ENV[config['couch_username_key']]}\" : \"\"\n end",
"def find_username\n @username || $config.fetch(:username) || prompt_username\n end",
"def usern... | [
"0.8648179",
"0.78835475",
"0.7677102",
"0.7675098",
"0.76501995",
"0.75636333",
"0.75211006",
"0.7498608",
"0.7486174",
"0.7460738",
"0.7419605",
"0.74149495",
"0.7365311",
"0.733336",
"0.7269621",
"0.7218121",
"0.71474785",
"0.7144556",
"0.7053578",
"0.7035762",
"0.6946639"... | 0.87191814 | 1 |
Returns a SearchableArray containing all tests parsed from flows, this is intended to be the main API for accessing parsed test program attributes and should be a consistent method that is implemented accross all tester models. Direct access to the underlying structure (which will be specific to the tester model) can b... | def tests
parser.flow_items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tests\n @tests ||= @spec['tests'].collect do |test|\n Test.new(@data, test)\n end\n end",
"def getTests\n\t\t\ttests = Array.new\n\t\t\t@language.each do |test,data|\n\t\t\t\ttests << test\n\t\t\tend\n\n\t\t\treturn tests\n\t\tend",
"def tests\n @test_definitions.collect ... | [
"0.6659126",
"0.61761534",
"0.6051617",
"0.6051617",
"0.59822196",
"0.59811085",
"0.58795196",
"0.5829831",
"0.57029927",
"0.5690567",
"0.56272215",
"0.5593051",
"0.55824685",
"0.5568381",
"0.5516701",
"0.5483758",
"0.54768586",
"0.5425351",
"0.5390752",
"0.53742665",
"0.5358... | 0.68234277 | 0 |
The image ranking comes in the range of [0..4] This is the correct behaviour: The lowest ranked image (4) will get a rank_multiplier 1 | def calculate_result
process_events(@events)
elements = {}
i = 0
@images.each do |image|
element_list = image['elements'].split(',')
rank_multiplier = 5 - @final_rank[i]
element_list.each do |element_name|
# "cf:" is a legacy prefix, if it exist... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rank; end",
"def rank; end",
"def calc_rank\n return (self.score * 20001) + self.speaks;\n end",
"def nist_alternate_rank(percentile, size)\n # n = ((P / 100) * (N - 1)) + 1\n (((percentile / 100.0) * (size - 1)) + 1)\n end",
"def army_rank; end",
"def navy_rank; end",
"def r... | [
"0.6425445",
"0.6425445",
"0.6361827",
"0.6323916",
"0.63118714",
"0.62111276",
"0.6152487",
"0.6130511",
"0.61029845",
"0.60937375",
"0.5950947",
"0.5940481",
"0.58950645",
"0.58835965",
"0.5879505",
"0.58637774",
"0.5850585",
"0.5822397",
"0.5807989",
"0.57963467",
"0.57513... | 0.0 | -1 |
before_action :is_owner, only: [:edit,:update,:destroy] (marche pas) | def index
@gossips=Gossip.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_organisms_url\n end\n\n end",
"def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \... | [
"0.74278504",
"0.73547167",
"0.7334269",
"0.70622474",
"0.7050198",
"0.70390326",
"0.7015336",
"0.696942",
"0.6882038",
"0.68782616",
"0.6876865",
"0.6876865",
"0.6876865",
"0.686287",
"0.683762",
"0.683597",
"0.6831894",
"0.6825351",
"0.6797368",
"0.67960554",
"0.6783005",
... | 0.0 | -1 |
For exercise 5, I simply changed it to a function | def number_range num
case num
when 0..50
puts "The number is less than 50."
when 51..100
puts "The number is less than 100, but above 50."
else
if num < 0
puts "The number is a negative!"
elsif num > 100
puts "That's over 100!"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution4(input)\n end",
"def exercise_1113 (matrix)\n end",
"def exercise_119 (number)\n end",
"def suivre; end",
"def anchored; end",
"def\n \nend\n\n\n# 6. sentence_maker refactored solution",
"def p15\n\t\nend",
"def king_richard_iii; end",
"def alg; end",
"def schubert; end",... | [
"0.67926425",
"0.61433893",
"0.5969885",
"0.5949292",
"0.5892738",
"0.5817773",
"0.57661206",
"0.57546353",
"0.5676465",
"0.5660867",
"0.5655408",
"0.562051",
"0.56048256",
"0.558584",
"0.55799985",
"0.55364656",
"0.5491258",
"0.54896635",
"0.54810524",
"0.5478782",
"0.547878... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.prospect_mailler_mailer.contact.subject | def first_contact
mail(
to:
cc:
subject: "We will contact you soon!"
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def message_subject=(value)\n ... | [
"0.752378",
"0.73420686",
"0.72843343",
"0.7274085",
"0.7120622",
"0.70499456",
"0.6906727",
"0.6872625",
"0.6861549",
"0.68606514",
"0.68110037",
"0.6797003",
"0.6786422",
"0.6784748",
"0.67718625",
"0.6703659",
"0.66993487",
"0.6680322",
"0.6678234",
"0.6639463",
"0.6588406... | 0.0 | -1 |
print documentation ri 'Arraypop' Array.ri Array.ri :pop arr.ri :pop | def ri(method = nil)
unless method && method =~ /^[A-Z]/ # if class isn't specified
klass = self.kind_of?(Class) ? name : self.class.name
method = [klass, method].compact.join('#')
end
system 'ri', method.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def using_pop(array)\n array.pop()\nend",
"def \n \n using_pop(array)\n \n\n array.pop()\n \nend",
"def pop\r\n @arr.shift\r\n end",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(arr)\n arr.pop\nend",
"def using_pop(array)\n element = ... | [
"0.799176",
"0.79755014",
"0.79277897",
"0.7905381",
"0.78680336",
"0.78471625",
"0.7819591",
"0.7793254",
"0.7793254",
"0.7793254",
"0.7793254",
"0.7793254",
"0.7793254",
"0.7793254",
"0.7793254",
"0.7793254",
"0.7649921",
"0.7580484",
"0.74786574",
"0.72796726",
"0.72515035... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_moment
@moment = Moment.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 moment_params
params.require(:moment).permit(:message, :user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
The upper case alpha ASCII ranges as a singlemember Array. (0x41..0x5a A..Z) | def range_upper_alphas
[ range(:upper_alphas) ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alphabet_array\n ('A'..'Z').to_a\n end",
"def range_all\n [ range(:upper_alphas), \n range(:lower_alphas), \n range(:numerals), \n range(:symbols_1), \n range(:symbols_2), \n range(:symbols_3), \n range(:symbols_4), \n range(:symbols_5), \n range(:symbols_6),\n ... | [
"0.6626658",
"0.6590018",
"0.64498174",
"0.64119834",
"0.6328392",
"0.59852594",
"0.59765226",
"0.59765226",
"0.59075457",
"0.59051895",
"0.590339",
"0.5899966",
"0.5862133",
"0.5809859",
"0.57549447",
"0.57455623",
"0.5740086",
"0.5735091",
"0.5677",
"0.5668079",
"0.56569785... | 0.66107994 | 1 |
The lower case alpha ASCII range as a singlemember Array. (0x61..0x7a a..z) | def range_lower_alphas
[ range(:lower_alphas) ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alphabet_array\n ('A'..'Z').to_a\n end",
"def letter_array (name)\n\tname.chars\nend",
"def letters_before(char)\n (\"a\"...char).to_a\nend",
"def char_to_unary_array char\n index = char.downcase[0].ord - 'a'.ord\n result = Array.new 26, 0\n result[index] = 1\n return result\nend",
"def alphab... | [
"0.6929463",
"0.68555456",
"0.6525061",
"0.6523915",
"0.65118444",
"0.6511556",
"0.64703023",
"0.64703023",
"0.6325084",
"0.6303432",
"0.60518503",
"0.60385853",
"0.6030503",
"0.6018914",
"0.60073906",
"0.5973985",
"0.59561056",
"0.59382707",
"0.59380984",
"0.59327453",
"0.58... | 0.6745899 | 2 |
The numeral ASCII ranges as a singlemember Array. 0x30..0x30 0..9 | def range_numerals
[ range(:numerals) ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range_all\n [ range(:upper_alphas), \n range(:lower_alphas), \n range(:numerals), \n range(:symbols_1), \n range(:symbols_2), \n range(:symbols_3), \n range(:symbols_4), \n range(:symbols_5), \n range(:symbols_6),\n range(:single_quotes),\n range(:double_quo... | [
"0.68596566",
"0.68464327",
"0.6579782",
"0.6329758",
"0.6289766",
"0.6230277",
"0.62226045",
"0.62224096",
"0.6093799",
"0.60724485",
"0.6064557",
"0.6032835",
"0.60227466",
"0.6010748",
"0.59868306",
"0.59747434",
"0.5972971",
"0.59316134",
"0.59193045",
"0.59094757",
"0.58... | 0.60274 | 12 |
All the ranges except the quote ranges (ie single, double, and backtick). | def range_all_except_quotes
[ range(:upper_alphas),
range(:lower_alphas),
range(:numerals),
range(:symbols_1),
range(:symbols_2),
range(:symbols_3),
range(:symbols_4),
range(:symbols_5),
range(:symbols_6) ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range_double_quotes\n [ range(:double_quotes) ]\n end",
"def range_single_quotes\n [ range(:single_quotes) ]\n end",
"def range_all\n [ range(:upper_alphas), \n range(:lower_alphas), \n range(:numerals), \n range(:symbols_1), \n range(:symbols_2), \n range(:symbols_3), \... | [
"0.71983486",
"0.7039569",
"0.7005652",
"0.67676824",
"0.65482724",
"0.620277",
"0.6195945",
"0.6170351",
"0.5903104",
"0.58696085",
"0.5802315",
"0.5739653",
"0.57323104",
"0.5672084",
"0.5664583",
"0.5569161",
"0.5569161",
"0.551811",
"0.55020833",
"0.5496062",
"0.5472758",... | 0.8033015 | 0 |
The single quotes ASCII ranges as a singlemember Array. (0x27..0x27 ') | def range_single_quotes
[ range(:single_quotes) ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_of_single_char_substrings\n @array_of_single_char_substrings ||= (97..122).map {|int| int.chr } << \"'\"\n end",
"def range_all\n [ range(:upper_alphas), \n range(:lower_alphas), \n range(:numerals), \n range(:symbols_1), \n range(:symbols_2), \n range(:symbols_3), \n ... | [
"0.66748536",
"0.6593112",
"0.65271646",
"0.6239421",
"0.62317216",
"0.61132437",
"0.6094401",
"0.60148567",
"0.60107917",
"0.5946742",
"0.5934431",
"0.5928735",
"0.5888619",
"0.58823514",
"0.5874462",
"0.5849151",
"0.5838224",
"0.5831718",
"0.5823281",
"0.5807401",
"0.580392... | 0.6646499 | 1 |
The double quotes ASCII ranges as a singlemember Array. (0x22..0x22 ") | def range_double_quotes
[ range(:double_quotes) ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range_all\n [ range(:upper_alphas), \n range(:lower_alphas), \n range(:numerals), \n range(:symbols_1), \n range(:symbols_2), \n range(:symbols_3), \n range(:symbols_4), \n range(:symbols_5), \n range(:symbols_6),\n range(:single_quotes),\n range(:double_quo... | [
"0.63587105",
"0.6329309",
"0.61841905",
"0.6163765",
"0.61516726",
"0.59773815",
"0.5913499",
"0.5910659",
"0.58812726",
"0.5870979",
"0.58509403",
"0.584404",
"0.57506883",
"0.5730245",
"0.57187897",
"0.57024515",
"0.56986403",
"0.5670185",
"0.5662947",
"0.56619763",
"0.566... | 0.6158625 | 4 |
The backtick ASCII ranges as a singlemember Array. (0x60..0x60 `) | def range_backtick
[ range(:backtick) ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range_all\n [ range(:upper_alphas), \n range(:lower_alphas), \n range(:numerals), \n range(:symbols_1), \n range(:symbols_2), \n range(:symbols_3), \n range(:symbols_4), \n range(:symbols_5), \n range(:symbols_6),\n range(:single_quotes),\n range(:double_quo... | [
"0.673803",
"0.6476661",
"0.6234431",
"0.6145597",
"0.61452454",
"0.60314465",
"0.5923138",
"0.5895965",
"0.5861872",
"0.58325076",
"0.5830642",
"0.5824658",
"0.5780023",
"0.5712613",
"0.56769305",
"0.56665725",
"0.5628312",
"0.5602043",
"0.55871516",
"0.55868083",
"0.5581965... | 0.6976651 | 0 |
All the ranges except the quote ranges (ie single, double, and backtick). | def range_all
[ range(:upper_alphas),
range(:lower_alphas),
range(:numerals),
range(:symbols_1),
range(:symbols_2),
range(:symbols_3),
range(:symbols_4),
range(:symbols_5),
range(:symbols_6),
range(:single_quotes),
range(:double_quotes),
rang... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range_all_except_quotes\n [ range(:upper_alphas), \n range(:lower_alphas), \n range(:numerals), \n range(:symbols_1), \n range(:symbols_2), \n range(:symbols_3), \n range(:symbols_4), \n range(:symbols_5), \n range(:symbols_6) ]\n end",
"def range_double_quotes\n ... | [
"0.8033015",
"0.71983486",
"0.7039569",
"0.67676824",
"0.65482724",
"0.620277",
"0.6195945",
"0.6170351",
"0.5903104",
"0.58696085",
"0.5802315",
"0.5739653",
"0.57323104",
"0.5672084",
"0.5664583",
"0.5569161",
"0.5569161",
"0.551811",
"0.55020833",
"0.5496062",
"0.5472758",... | 0.7005652 | 3 |
GET /theses GET /theses.json | def index
@theses = Thesis.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dteors = Dteor.all\n @thems = get_tem\n respond_to do |format|\n if get_tem\n format.html # index.html.erb\n format.json { render json: @dteors } \n else\n format.html { redirect_to new_student_path, notice: t(:vvedit_dani)}\n end\n \n end\n... | [
"0.6402527",
"0.6017638",
"0.600036",
"0.5965816",
"0.59654146",
"0.5938242",
"0.59239227",
"0.59069437",
"0.5900935",
"0.589305",
"0.58911335",
"0.58688456",
"0.5852131",
"0.5821155",
"0.57990354",
"0.5798127",
"0.5789343",
"0.57751185",
"0.57751185",
"0.57740587",
"0.574600... | 0.6013917 | 2 |
GET /theses/1 GET /theses/1.json | def show
@line_investigation = @thesis.line_investigation
@area_interests = @thesis.project.area_interests
role = Role.where(descripcion: "Participante").first
@users = role.users
role = Role.where(descripcion: "Profesor").first
@users1 = role.users
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @tetramod = Tetramod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tetramod }\n end\n end",
"def index\n @dteors = Dteor.all\n @thems = get_tem\n respond_to do |format|\n if get_tem\n format.html # index... | [
"0.6293351",
"0.6241742",
"0.6224423",
"0.61423",
"0.6105692",
"0.6059083",
"0.6059083",
"0.6053765",
"0.6037831",
"0.5983277",
"0.597134",
"0.59459233",
"0.59331197",
"0.5932592",
"0.5928408",
"0.59265304",
"0.5920392",
"0.5918167",
"0.5912718",
"0.590782",
"0.59064466",
"... | 0.0 | -1 |
POST /theses POST /theses.json | def create
@thesis = Thesis.new(thesis_params)
project = Project.find(@thesis.project_id)
@thesis.titulo = project.titulo
@thesis.line_investigation_id = project.line_investigation.id
@thesis.tutor = project.tutor
respond_to do |format|
if @thesis.save
Tracing.create(thesis_id: @th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def create\n @thre = Thre.new(thre_params)\n\n respond_to do |format|\n if @thre.save\n format.html { redirect_to @thre, notice: 'Thr... | [
"0.59494627",
"0.5801789",
"0.57203376",
"0.5670085",
"0.566821",
"0.565944",
"0.55571645",
"0.55529916",
"0.5539145",
"0.55212134",
"0.55034",
"0.54976463",
"0.54873514",
"0.5468117",
"0.5463857",
"0.5460319",
"0.5453623",
"0.5450713",
"0.5448978",
"0.5439674",
"0.542759",
... | 0.0 | -1 |
PATCH/PUT /theses/1 PATCH/PUT /theses/1.json | def update
respond_to do |format|
if @thesis.update(thesis_params)
format.html { redirect_to @thesis }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @thesis.errors, status: :unprocessable_entity }
end
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n fo... | [
"0.6395333",
"0.6375449",
"0.636603",
"0.6324773",
"0.6295478",
"0.62760323",
"0.6273385",
"0.62729305",
"0.62668073",
"0.6266481",
"0.6255778",
"0.6244538",
"0.62416667",
"0.62351644",
"0.6221364",
"0.61951166",
"0.619446",
"0.6190742",
"0.61853784",
"0.618017",
"0.6166488",... | 0.6377398 | 1 |
DELETE /theses/1 DELETE /theses/1.json | def destroy
@thesis.destroy
respond_to do |format|
format.html { redirect_to theses_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @tetramod = Tetramod.find(params[:id])\n @tetramod.destroy\n\n respond_to do |format|\n format.html { redirect_to tetramods_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.del... | [
"0.729513",
"0.706523",
"0.7012111",
"0.7008725",
"0.69958395",
"0.6962424",
"0.6957779",
"0.6957779",
"0.6941949",
"0.69213384",
"0.6911435",
"0.6902952",
"0.6875556",
"0.686753",
"0.6865595",
"0.68624705",
"0.6862463",
"0.6838938",
"0.6835848",
"0.68337077",
"0.6829463",
... | 0.7186144 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_thesis
@thesis = Thesis.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 thesis_params
params.require(:thesis).permit(:projectid, :tutor, :descripcion, :user_id, :area_interest_id,:line_investigations, :line_investigation_id, :program_id, :cohorts_id, :titulo, :project_id, :thesis_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.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.629... | 0.0 | -1 |
Dynamically defines getter methods for path types. Each getter method returns a Pathname. | def path_reader(*types)
types.each do |type|
m = :"#{type}_path"
define_method(m) { Lesson.public_send m, self.name }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type path\n end",
"def method_missing key, *sig, &blk\n if match = /(\\w+_|\\b)koi_(\\w+)_path$/.match(key)\n prefix, suffix = match.to_a.drop 1\n koi_engine.send :\"#{ prefix }#{ suffix }_path\", *sig, &blk\n else\n super\n end\n end",
"def path(*) end",
"def pa... | [
"0.6275442",
"0.62522936",
"0.6189394",
"0.6186824",
"0.61069965",
"0.6072096",
"0.6022596",
"0.5998396",
"0.59901565",
"0.5985086",
"0.59721917",
"0.5961079",
"0.5945507",
"0.5929957",
"0.59245807",
"0.59177727",
"0.59034485",
"0.5887665",
"0.5887665",
"0.5887665",
"0.587653... | 0.7839215 | 0 |
This method returns text of the first element | def first_element_name
return $browser.as(:class, 'message')[0].text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_text\n first_ele static_text_class\n end",
"def first_text\n first_ele UIAStaticText\n end",
"def first_text\n first_ele TEXT_VIEW\n end",
"def extract_first_text(xhtml)\n texts = extract_text_from_elements(xhtml)\n texts.empty? ? '' : texts[0]\n end",
"def first_no... | [
"0.8548159",
"0.82723475",
"0.81394815",
"0.80778396",
"0.7663767",
"0.7350397",
"0.72960234",
"0.7232885",
"0.7128517",
"0.706002",
"0.7056298",
"0.70096993",
"0.69300705",
"0.68585736",
"0.68582684",
"0.68532646",
"0.68532646",
"0.68532646",
"0.6849022",
"0.67678624",
"0.67... | 0.6895428 | 13 |
This method clicks the commit for which detailed information is to be seen | def click_commit(i)
$browser.as(:class, 'message')[i].click
sleep(15)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click_commit(session: self)\n session.first(:button, type: \"submit\").click\n end",
"def commit(driver)\n\telement = driver.find_element(:name => \"commit\").click()\nend",
"def click; end",
"def click; end",
"def click; end",
"def clicked\n # @cancel.clicked\n end",
"def on_click\n\t\... | [
"0.68095183",
"0.64350533",
"0.61668676",
"0.61668676",
"0.61668676",
"0.5958957",
"0.595129",
"0.594714",
"0.5864745",
"0.58163226",
"0.58094805",
"0.5764202",
"0.57473147",
"0.5718789",
"0.5717799",
"0.5715531",
"0.57115924",
"0.56819004",
"0.56819004",
"0.56782496",
"0.566... | 0.6645187 | 1 |
Sending mails of issues report to the prescribed contacts | def maillist
@cntcts = current_user.organization.contacts
@tmrec = Array.new
params[:ids].split(",").map do |id|
@tmrec << TimeRecord.find_by_id(id)
end
@tmrec_array = params[:ids]
render :partial => "maillist", :layout => false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_report_issue(params)\n http_helper.send_post_request(\"#{@url_prefix}/#{get_user_id!(params)}/email/report-issue\", params)\n end",
"def issues\n dashboard = fetch_email_dashboard\n respond_with Emails.new(dashboard.issues, issues_emails_url)\n end",
"def send_notifications\n\t\tph... | [
"0.69468284",
"0.6660607",
"0.665588",
"0.6652474",
"0.66223663",
"0.6542197",
"0.6514364",
"0.6480017",
"0.6470249",
"0.64424825",
"0.6432489",
"0.6417083",
"0.640445",
"0.63452405",
"0.6343331",
"0.63356894",
"0.63180876",
"0.63097066",
"0.6292564",
"0.6289164",
"0.6280501"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_gelato
@gelato = Gelato.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def gelato_params
ActiveModelSerializers::Deserialization
.jsonapi_parse(
params, only: [
:name, :id, :flavor_id
]
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
helper method used by methods above | def update_roles_and_groups(user, roles, groups)
if self.access_to_roles?(roles) && self.access_to_groups?(groups)
roles = Role.find(roles || [])
groups = Group.find(groups || [])
user.roles += roles
user.groups += groups
user.center = groups.first.center unless groups.empty? or user... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def suivre; end",
"def custom; end",
"def custom; end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def weber; end",
"def who_we_are\... | [
"0.73337793",
"0.6485598",
"0.6398264",
"0.620814",
"0.620814",
"0.620814",
"0.620814",
"0.6181958",
"0.61763436",
"0.61763436",
"0.6105256",
"0.6105256",
"0.6105256",
"0.60320395",
"0.5967092",
"0.5943018",
"0.59289575",
"0.58779246",
"0.5872358",
"0.5862913",
"0.5859959",
... | 0.0 | -1 |
is User part of any groups in hierarchy | def belongs_to?(group)
group.all_users.include? self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_in_group?(_user_id)\n Rails.cache.fetch \"UserGroup:is_in_group_#{id}_#{_user_id}\" do\n user_relationships.where(user_id: _user_id).any?\n end\n end",
"def can_be_created_by?(user)\n \n not (user.usergroups & usergroups).empty?\n\n end",
"def in_group?(group_or_id)\n group... | [
"0.719589",
"0.70417696",
"0.698661",
"0.69602203",
"0.69276947",
"0.6899314",
"0.68639314",
"0.67770445",
"0.6754538",
"0.67458904",
"0.66947764",
"0.66919863",
"0.6689832",
"0.6683097",
"0.6671903",
"0.6663262",
"0.6634853",
"0.66014385",
"0.6587669",
"0.658321",
"0.657938"... | 0.7218281 | 1 |
not strict, localadm also has access | def team_member?(team)
id = (team.instance_of? Team) ? team.id : team
self.teams.map { |t| t.id }.include? id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_admin\n grant_access?(\"index\", \"users\")\n #position?('admin')\n end",
"def is_admin\n test_access :admin\n end",
"def local_acl\n acl = {\n \"#{self.user.email}\" => (Rails.env.production? && FireCloudClient::COMPUTE_DENYLIST.include?(self.firecloud_project)) ? 'Edit' : 'Ow... | [
"0.6252886",
"0.61774945",
"0.6134163",
"0.6055912",
"0.60186356",
"0.60146266",
"0.59734875",
"0.594298",
"0.5921355",
"0.5891876",
"0.58709097",
"0.5842868",
"0.5842868",
"0.58235854",
"0.5808512",
"0.5808512",
"0.5808512",
"0.5802856",
"0.57959783",
"0.57714206",
"0.577029... | 0.0 | -1 |
TODO rewrite if user.center works | def center_and_teams
if(self.has_access?(:admin))
Group.center_and_teams #find(:all, :conditions => ['type != ?', "Journal"])
elsif self.has_access? :team_show_admin # self.center
if self.centers.size > 1 # some people have more centers
self.centers + self.centers.map { |c| c.teams }.flatten... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_center\n @center = current_user.center\n end",
"def center\n end",
"def center\n Center.find(center_ids.first)\n end",
"def set_center\n @center = Center.find(params[:id])\n @general_setting = GeneralSetting.first\n @user = User.first\n end",
"def center\n\t\t\tcenter... | [
"0.7625287",
"0.67911834",
"0.6582089",
"0.6534445",
"0.6061799",
"0.6004318",
"0.5943757",
"0.5906616",
"0.5906616",
"0.5855526",
"0.5854456",
"0.5838547",
"0.5838547",
"0.5825983",
"0.5815454",
"0.58058894",
"0.5746127",
"0.57371205",
"0.57371205",
"0.5734799",
"0.57308507"... | 0.6245483 | 4 |
returns only active surveys which user's centers are subscribed to | def subscribed_surveys
if self.has_access?(:survey_show_all)
s = Survey.all(:order => :position)
# s.delete_if {|s| s.title =~ /Test/}
# s
elsif self.has_access?(:survey_show_subscribed)
self.center.subscribed_surveys
elsif self.has_access?(:survey_show_login)
surveys = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribed_surveys\n if self.has_access?(:survey_show_all)\n s = Survey.all.order(:position)\n # s.delete_if {|s| s.title =~ /Test/}\n # s\n elsif self.has_access?(:survey_show_subscribed)\n self.center.subscribed_surveys\n elsif self.has_access?(:survey_show_login)\n surveys ... | [
"0.7401978",
"0.6193622",
"0.6193622",
"0.58567137",
"0.57781625",
"0.5769454",
"0.5755149",
"0.5742129",
"0.5667421",
"0.5665105",
"0.5644836",
"0.5608362",
"0.5606425",
"0.5599954",
"0.55939376",
"0.55866164",
"0.5584057",
"0.5563593",
"0.5548437",
"0.55458564",
"0.5542675"... | 0.7416095 | 1 |
must reload from DB | def teams(reload = false)
options = {:include => [:center, :users]}
teams =
if self.has_access?(:team_show_all)
Team.find(:all, options)
elsif self.has_access?(:team_show_admin)
Team.in_center(self.center_id) # Team.find(:all, :conditions => ['parent_id = ?', self.center_id])
elsif self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload\n @data = self.class.db.single(self.class.table, {:id => @id})\n raise Errno::ENOENT, \"Could not find any data for the object with ID: '#{@id}' in the table '#{self.class.table}'.\" if !@data\n @should_reload = false\n end",
"def reload\n return if new_record?\n refresh\n end",... | [
"0.74616855",
"0.72854567",
"0.7260318",
"0.7260318",
"0.7260318",
"0.7260318",
"0.7186884",
"0.7165927",
"0.71251404",
"0.7066881",
"0.7060835",
"0.7060835",
"0.7060835",
"0.7060835",
"0.7060835",
"0.7060835",
"0.7060835",
"0.70604616",
"0.705471",
"0.7043363",
"0.7011659",
... | 0.0 | -1 |
journals a user has access to behandler should only have access to journals in his teams (groups), thus excluding journals from other teams, but not the center | def journals(options = {})
options[:page] ||= 1
options[:per_page] ||= REGISTRY[:journals_per_page]
journals =
if self.has_access?(:journal_show_all)
if options[:page].to_i < 4 # only cache first pages, since they're used more often
Rails.cache.fetch("journals_all_paged_#{options[:page]}_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def administered_journals\n journal_query = Journal.all\n journal_query = yield(journal_query) if block_given?\n if site_admin?\n journal_query\n else\n roles = [:manage_users, :administer]\n filter_authorized_set(roles, journal_query)\n end\n end",
"def any_logged_in(user)\n ca... | [
"0.6272144",
"0.6261546",
"0.6057881",
"0.59728706",
"0.5967594",
"0.59084547",
"0.58572966",
"0.5808295",
"0.57889545",
"0.5774043",
"0.57202154",
"0.5677586",
"0.56404763",
"0.56368953",
"0.56367236",
"0.5625438",
"0.56182057",
"0.5614346",
"0.56042135",
"0.5597919",
"0.559... | 0.0 | -1 |
returns journal ids that this user can access. Used by check_access. SQL optimized | def journal_ids
j_ids =
if self.has_access?(:journal_show_all)
journal_ids = Rails.cache.fetch("journal_ids_user_#{self.id}") { Journal.all(:select => "id") }
elsif self.has_access?(:journal_show_centeradm)
journal_ids = Rails.cache.fetch("journal_ids_user_#{self.id}") { Journal.in_center(self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def journal_ids\n group_ids = [center_id] + teams.map(&:id)\n j_ids = \n if self.has_access?(:journal_show_all)\n journal_ids = Journal.all(:select => \"id\")\n elsif self.has_access?(:journal_show_centeradm)\n journal_ids = Journal.in_center(self.center).all(:select => \"id\")\n elsif sel... | [
"0.78021693",
"0.77805334",
"0.6283086",
"0.614833",
"0.6132096",
"0.6004868",
"0.59425384",
"0.5850439",
"0.58369",
"0.57513815",
"0.5739319",
"0.5735021",
"0.5687406",
"0.567847",
"0.56323636",
"0.563194",
"0.56142414",
"0.56103873",
"0.56103873",
"0.5593307",
"0.5586963",
... | 0.84442407 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.