query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Returns a key's value from container. Raises if an unknown key is requested. | def get_config_val(container, key, raise_on_unknown_key = true)
key = key.to_sym
if raise_on_unknown_key && !container.keys.include?(key)
raise RtfileError.new("You requested an unknown key: #{ key.inspect }")
end
container[key]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(key)\n position = find(key)\n if position != nil\n @values[position]\n else\n nil\n end\n end",
"def get_value(key)\n self[key]\n end",
"def [](key)\n find_value(key)\n end",
"def get_value(collection, key)\n @data[collection][key]\n end",
"def get(key... | [
"0.73172235",
"0.7229446",
"0.7085598",
"0.7029533",
"0.6913697",
"0.69006",
"0.68984866",
"0.68797725",
"0.68726885",
"0.68641365",
"0.6853405",
"0.6795311",
"0.6770131",
"0.6765758",
"0.6765758",
"0.6765758",
"0.6765758",
"0.67622083",
"0.6749583",
"0.6721235",
"0.6697227",... | 0.74965435 | 0 |
title:legend: xAxis: yAxis: tooltip: credits: :plotOptions | def defaults_options
self.title({ :text=>"example test title from highcharts gem"})
self.legend({ :layout=>"vertical", :style=>{} })
self.xAxis({})
self.yAxis({ :title=> {:text=> nil}, :labels=>{} })
self.tooltip({ :enabled=>true })
self.credits({ :enabled => false})
self.plot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defaults_options\n self.title({:text => nil})\n self.legend({:layout => \"vertical\", :style => {}})\n self.xAxis({})\n self.yAxis({:title => {:text => nil}, :labels => {}})\n self.tooltip({:enabled => true})\n self.credits({:enabled => false})\n self.plotOptions({:areaspline... | [
"0.6519339",
"0.6435553",
"0.6315414",
"0.6166688",
"0.61170375",
"0.61118585",
"0.60911965",
"0.6042981",
"0.5959802",
"0.5945858",
"0.5863141",
"0.58454424",
"0.5831566",
"0.58306175",
"0.5789699",
"0.5780289",
"0.5719986",
"0.5702264",
"0.5658842",
"0.56321466",
"0.5618909... | 0.68676376 | 0 |
This method will generate the options as a string suitable for straight use. This is required because of the addition of the datetime capability put in. The dates need to be formatted in a JS specific way. | def options_string
options_collection = []
options.keys.each do |key|
k = key.to_s.camelize.gsub!(/\b\w/) { $&.downcase }
options_collection << "\"#{k}\": #{options[key].to_json}"
end
# This check is put in to catch for those graphs that are time series charts. In that event th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_format_options\n DATE_FORMATS.collect {|f| [\"#{Date.today.strftime(f)} - #{f}\", f]}\n end",
"def to_s\n @options.join \" \"\n end",
"def to_s\n \"<#{options.inspect}>\"\n end",
"def date(options = {})\n res = \"\"\n res += \"#{I18n.localize(self.starts_at, :format... | [
"0.7026954",
"0.6607382",
"0.65895784",
"0.65024924",
"0.6455781",
"0.64212936",
"0.63766897",
"0.637559",
"0.6292775",
"0.6292775",
"0.62664443",
"0.6252394",
"0.617951",
"0.6178819",
"0.6174106",
"0.61636543",
"0.61605626",
"0.6149303",
"0.6121917",
"0.610379",
"0.61020166"... | 0.69654065 | 1 |
Generates a test which tests authorization code. It assumes a method called access_denied? on the test case. The access_denied? method should return true when access is denied (ie. a 403 status code) and false in other cases. Example: should.allow.get :index | def allow
Test::Spec::Rails::Macros::Authorization::TestGenerator.new(test_case,
:access_denied?, false,
'Expected access to be allowed'
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_index_authorized\n authorize @valid_user\n get :index\n assert_response :success\n assert_template \"index\"\n end",
"def test_auth_only\n make_controller :auth_only\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_protected\n end",
"def test_a... | [
"0.6475531",
"0.6461225",
"0.631084",
"0.628509",
"0.61865973",
"0.6093812",
"0.59790725",
"0.58264005",
"0.58198",
"0.5784285",
"0.57606477",
"0.57557863",
"0.57557863",
"0.5750277",
"0.5736917",
"0.57228917",
"0.5657903",
"0.56317997",
"0.5629605",
"0.5628198",
"0.56252605"... | 0.8330039 | 0 |
Generates a test which tests authorization code. It assumes a method called access_denied? on the test case. The login_required? method should return true when the visitor was asked for credentials (ie. a 401 status code or a redirect to a login page) and false in other cases. Example: should.require_login.get :index | def require_login
Test::Spec::Rails::Macros::Authorization::TestGenerator.new(test_case,
:login_required?, true,
'Expected login to be required'
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow\n Test::Spec::Rails::Macros::Authorization::TestGenerator.new(test_case,\n :access_denied?, false,\n 'Expected access to be allowed'\n )\n end",
"def test_auth_only\n make_controller :auth_only\n get :index\n assert_response :success\n get :secret_ferret... | [
"0.7289826",
"0.6315427",
"0.622207",
"0.619686",
"0.60465807",
"0.5963903",
"0.59197307",
"0.59197307",
"0.59197307",
"0.5904193",
"0.58407605",
"0.582522",
"0.5821838",
"0.575604",
"0.57368356",
"0.5714388",
"0.5705717",
"0.5691622",
"0.56840664",
"0.5645945",
"0.5645802",
... | 0.72369117 | 1 |
Build a class object using a Flat scope so we can pass through variables Then pass it as an object to setup_privileges | def objbuilder(user, type="", group="", password="")
# user becomes group when adding / deleting groups
# objbuilder("#{@thmgroupname}", "addgroup")
designobj = Class.new do
attr_reader :type, :gr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(user)\n define_global_privileges\n define_user_privileges(user) if user\n define_admin_privileges(user) if user and user.admin?\n end",
"def initialize(scope, user, params, &block)\n @scope = scope\n @params = params.dup\n @user = user\n\n instance_ev... | [
"0.6345937",
"0.5929545",
"0.5720007",
"0.5630158",
"0.5619377",
"0.55986136",
"0.55954444",
"0.5595042",
"0.5594009",
"0.5542252",
"0.554117",
"0.5527415",
"0.55245847",
"0.54903954",
"0.54378486",
"0.5411845",
"0.53952074",
"0.5372943",
"0.5342187",
"0.5330649",
"0.53270376... | 0.603767 | 1 |
Enables the WebAudio domain and starts sending context lifetime events. | def enable
{
method: "WebAudio.enable"
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable\n\t\t\t@last_request = nil\n\t\t\tBase.instance.add_observer(self)\n\t\tend",
"def active_support_timers_start(env); end",
"def main_audio ; end",
"def enable_audio(on: true)\n\n # Set the flag\n @audio_handler.audio = on\n\n # Update the icon\n @audio_sprite.path =\n ... | [
"0.52226603",
"0.5178497",
"0.51085854",
"0.50974566",
"0.5092195",
"0.5063775",
"0.5046831",
"0.5042426",
"0.50311345",
"0.50112045",
"0.50009376",
"0.494665",
"0.49414673",
"0.49284717",
"0.4923882",
"0.49152082",
"0.49092498",
"0.48973376",
"0.48753217",
"0.48735997",
"0.4... | 0.67978 | 0 |
Disables the WebAudio domain. | def disable
{
method: "WebAudio.disable"
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsilence\n lightstreamer_subscription.unsilence\n end",
"def disable_subscription(name)\n typed_exec(\"ALTER SUBSCRIPTION #{connection.quote_ident(name)} DISABLE\")\n end",
"def disable_private_who_is(domain)\n validate_list([ [\"Domain\", domain, :domain_format] ])\n opt... | [
"0.62375414",
"0.6026919",
"0.5863623",
"0.5857022",
"0.584489",
"0.58150816",
"0.5790704",
"0.5787989",
"0.5761655",
"0.57405245",
"0.5713707",
"0.5685493",
"0.5660492",
"0.5630568",
"0.55931056",
"0.554675",
"0.55461794",
"0.5489659",
"0.5480845",
"0.5475446",
"0.54735994",... | 0.79204506 | 0 |
Fetch the realtime data from the registered contexts. | def get_realtime_data(context_id:)
{
method: "WebAudio.getRealtimeData",
params: { contextId: context_id }.compact
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_context\n synchronize do\n # The URL to get the context list from sesame\n dir = \"#{@options[\"host\"]}:#{@options[\"port\"]}/openrdf-sesame/repositories/#{@options[\"repo\"]}/contexts\"\n\n # Asks for the context list\n RestClient.get dir, :content_type=>'application/spar... | [
"0.64655477",
"0.61454755",
"0.59322417",
"0.5926333",
"0.57833904",
"0.5738207",
"0.5692313",
"0.5625469",
"0.56071573",
"0.5576035",
"0.55699784",
"0.5557334",
"0.55421406",
"0.54988605",
"0.5480596",
"0.54701126",
"0.5451086",
"0.54372704",
"0.54148805",
"0.54106694",
"0.5... | 0.65922636 | 0 |
Return the supplied array as a single line CSV string | def to_csv(array)
@io.rewind
@io.truncate(0)
@csv << array
@io.rewind
@io.string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csv(array)\n nilfix = array.map { |s| blank(s) ? \"\" : s }\n quoted = nilfix.map { |s| '\"' + s.gsub('\"',\"'\") + '\"' }\n return quoted.join(',')\nend",
"def csv(rows)\n rows.map { |r| r.join(';') }.join(\"\\n\")\n end",
"def save_as_csv(array)\n final_array = array\n CSV.open(\"emails94.csv\... | [
"0.7749197",
"0.75764453",
"0.7026806",
"0.68263113",
"0.67877656",
"0.67877656",
"0.67139345",
"0.66098017",
"0.66019064",
"0.6571392",
"0.650231",
"0.64866585",
"0.6443145",
"0.6411524",
"0.63872844",
"0.6382767",
"0.635947",
"0.63576275",
"0.6352149",
"0.63205427",
"0.6306... | 0.7778386 | 0 |
Crawl Method which will hit the provided service and fetch the offers. This method will filter out the merchants and offers from the set of links fetched. A merchant is created with its respective offer. | def crawl
Offer.fetch_offers
redirect_to offers_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrape_offers_for(item)\n return [] unless valid_offers_url?(item.more_offers_url)\n root = Nokogiri::HTML(get_more_offers_page(item.more_offers_url))\n scraped_offers = scrape_offers(root)\n publish(:on_offers_scrapped_for, item, scraped_offers)\n scraped_offers\n end",
"def parse_offers(loc... | [
"0.6432751",
"0.6138299",
"0.5883554",
"0.5861007",
"0.57116294",
"0.5688116",
"0.56359416",
"0.55497795",
"0.5473344",
"0.544266",
"0.5442365",
"0.538268",
"0.53784615",
"0.53584105",
"0.53509974",
"0.53274655",
"0.53165084",
"0.5311219",
"0.5311219",
"0.5311219",
"0.5311219... | 0.70724845 | 0 |
GET /medidas/1 GET /medidas/1.json | def show
@medida = Medida.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @medida }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @unidade_medida = UnidadeMedida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unidade_medida }\n end\n end",
"def show\n @medio = Medio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n... | [
"0.7510774",
"0.740872",
"0.72993684",
"0.72367114",
"0.7225734",
"0.7225199",
"0.7131402",
"0.7000157",
"0.6958874",
"0.6956784",
"0.69363207",
"0.6844287",
"0.6825304",
"0.677263",
"0.66992515",
"0.66816735",
"0.66404593",
"0.66384715",
"0.6624641",
"0.6611369",
"0.6602949"... | 0.7767065 | 0 |
GET /medidas/new GET /medidas/new.json | def new
@medida = Medida.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @medida }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @unidade_medida = UnidadeMedida.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unidade_medida }\n end\n end",
"def new\n @medicamento = Medicamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { ... | [
"0.7673849",
"0.76505196",
"0.7626473",
"0.7541467",
"0.746644",
"0.74476576",
"0.74274206",
"0.74026173",
"0.73853487",
"0.736431",
"0.7359774",
"0.7297636",
"0.7295517",
"0.72739285",
"0.7269561",
"0.7235112",
"0.7203534",
"0.71738094",
"0.71652657",
"0.71181333",
"0.711339... | 0.7999669 | 0 |
POST /medidas POST /medidas.json | def create
@medida = Medida.new(params[:medida])
respond_to do |format|
if @medida.save
format.html { redirect_to @medida, notice: 'Medida se ha creado con éxito.' }
format.json { render json: @medida, status: :created, location: @medida }
else
format.html { render action: "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @medalha = Medalha.new(medalha_params)\n\n respond_to do |format|\n if @medalha.save\n format.html { redirect_to @medalha, notice: 'Medalha was successfully created.' }\n format.json { render :show, status: :created, location: @medalha }\n else\n format.html { rend... | [
"0.67229056",
"0.66952366",
"0.6500264",
"0.64886737",
"0.6481001",
"0.6388687",
"0.6354134",
"0.63438195",
"0.63438195",
"0.6328977",
"0.63096803",
"0.62992144",
"0.62935644",
"0.6271856",
"0.6208299",
"0.6199227",
"0.616915",
"0.61403954",
"0.61023295",
"0.60560876",
"0.604... | 0.69736016 | 0 |
PUT /medidas/1 PUT /medidas/1.json | def update
@medida = Medida.find(params[:id])
respond_to do |format|
if @medida.update_attributes(params[:medida])
format.html { redirect_to @medida, notice: 'Medida se ha actualizado correctamente.' }
format.json { head :no_content }
else
format.html { render action: "edit"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @medida.update(medida_params)\n format.html { redirect_to @medida, notice: 'Unidad medida was successfully updated.' }\n format.json { render :show, status: :ok, location: @medida }\n else\n format.html { render :edit }\n format.json... | [
"0.6921429",
"0.6847556",
"0.67260194",
"0.6720236",
"0.6683383",
"0.6668607",
"0.665465",
"0.6643562",
"0.66112393",
"0.66082436",
"0.65730864",
"0.65675664",
"0.65178573",
"0.6512114",
"0.64614624",
"0.6389441",
"0.6381887",
"0.6380272",
"0.6359773",
"0.6358228",
"0.6305697... | 0.7033592 | 0 |
Retrieve keys from file/stdin | def get_keys_from_commandline(filename=nil)
ARGV << filename unless filename.nil?
return_keys = []
ARGF.each do |line|
return_keys << line.chomp!
end
ARGV << '-' # close ARGF
return_keys.each { |key| verify_key(key) }
return_keys
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_keys_file(path)\n return [] unless File.exists?(path)\n File.readlines(path).map! { |l| l.chomp.strip }\n end",
"def read_key_file_for_add(file)\n if file.nil?\n if $stdin.tty?\n info \"Paste a public key, then hit <ctrl+d> twice.\"\n key = Dotgpg::Key.read($st... | [
"0.7070969",
"0.6890355",
"0.64317423",
"0.6419398",
"0.6386319",
"0.63223076",
"0.62945116",
"0.6243742",
"0.61785877",
"0.6175719",
"0.6165203",
"0.61060333",
"0.6092908",
"0.6077547",
"0.60535413",
"0.5995376",
"0.5968735",
"0.5958796",
"0.5922167",
"0.58999497",
"0.587430... | 0.7374161 | 0 |
called (once) when the user logs in, insert any code your application needs to hand off from guest_user to current_user. | def logging_in
current_user.absorb_from(guest_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logging_in\n logger.debug \"ApplicationController:logging_in >>> \"\n current_user.transfer_data(guest_user)\n end",
"def logging_in\n\t\tguest_comments = guest_user.comments.all\n\t\tguest_comments.each do |comment|\n\t\t\tcomment.user_id = current_user.id\n\t\t\tcomment.save!\n\t\tend\n\t\tguest_not... | [
"0.76545906",
"0.7417004",
"0.70993006",
"0.7069182",
"0.69960326",
"0.69612724",
"0.6960114",
"0.6960114",
"0.6960114",
"0.6960114",
"0.69566405",
"0.6956096",
"0.69517374",
"0.6908953",
"0.68947226",
"0.68411946",
"0.67875904",
"0.6775122",
"0.67685986",
"0.6762087",
"0.672... | 0.7561395 | 1 |
POST request to change show to watched | def watched_tvshow
@watch = Watchlist.find_by(show_watched: false, user_id: params[:user_id], tv_show_id: params[:tv_show_id])
if @watch
@watch.update(show_watched: true)
render json: @watch
else
render json: {
error: "Something went wrong"
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_show\n server_id = params[:server]\n user_id = @current_user.id\n show = params[:show]\n\n if server_id.nil? || show.nil?\n render :json => {error:'please enter correct params'}\n return\n end\n\n up = UserPermission.where(user_id:user_id, server_id:server_id).first\n\n un... | [
"0.61067456",
"0.60135585",
"0.5896506",
"0.5805469",
"0.57810664",
"0.5769888",
"0.5765345",
"0.5715358",
"0.5691228",
"0.5686285",
"0.5686265",
"0.5648426",
"0.5613828",
"0.5613828",
"0.56109285",
"0.56007516",
"0.55607694",
"0.55492556",
"0.55348974",
"0.552976",
"0.552976... | 0.73290175 | 0 |
GET /leaf_spot_imm_searches GET /leaf_spot_imm_searches.json | def index
@leaf_spot_imm_searches = LeafSpotImmSearch.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_leaf_spot_imm_search\n @leaf_spot_imm_search = LeafSpotImmSearch.find(params[:id])\n end",
"def leaf_spot_imm_search_params\n params.require(:leaf_spot_imm_search).permit(:search_id, :leaf_spot_imm_id)\n end",
"def index\n @search = WordRoot.ransack(params[:q])\n @word_roots = @... | [
"0.7002329",
"0.6680524",
"0.6360336",
"0.6002374",
"0.594759",
"0.5936186",
"0.59035736",
"0.58770686",
"0.5854715",
"0.5835244",
"0.5832496",
"0.5823618",
"0.57928723",
"0.57237566",
"0.5723646",
"0.5707511",
"0.57050204",
"0.5703179",
"0.5700361",
"0.56868213",
"0.5672963"... | 0.7771079 | 0 |
PATCH/PUT /leaf_spot_imm_searches/1 PATCH/PUT /leaf_spot_imm_searches/1.json | def update
respond_to do |format|
if @leaf_spot_imm_search.update(leaf_spot_imm_search_params)
format.html { redirect_to @leaf_spot_imm_search, notice: 'Leaf spot imm search was successfully updated.' }
format.json { render :show, status: :ok, location: @leaf_spot_imm_search }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_leaf_spot_imm_search\n @leaf_spot_imm_search = LeafSpotImmSearch.find(params[:id])\n end",
"def leaf_spot_imm_search_params\n params.require(:leaf_spot_imm_search).permit(:search_id, :leaf_spot_imm_id)\n end",
"def update\n respond_to do |format|\n if @leaf.update(leaf_params)\n... | [
"0.6511506",
"0.6430987",
"0.593413",
"0.5877458",
"0.5822385",
"0.5667287",
"0.5568403",
"0.55408686",
"0.5534161",
"0.54694426",
"0.5451681",
"0.54371697",
"0.54137814",
"0.539564",
"0.5387593",
"0.5346209",
"0.53414595",
"0.5297225",
"0.526672",
"0.52615017",
"0.52585065",... | 0.7513949 | 0 |
DELETE /leaf_spot_imm_searches/1 DELETE /leaf_spot_imm_searches/1.json | def destroy
@leaf_spot_imm_search.destroy
respond_to do |format|
format.html { redirect_to leaf_spot_imm_searches_url, notice: 'Leaf spot imm search was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @leaf.destroy\n respond_to do |format|\n format.html { redirect_to leafs_url, notice: DELETE_SUCCESS }\n format.json { head :no_content }\n end\n end",
"def destroy\n @advance_search.destroy\n respond_to do |format|\n format.html { redirect_to advance_searches_url }\n... | [
"0.6636038",
"0.6626745",
"0.6483126",
"0.6445629",
"0.6438108",
"0.6425712",
"0.64251727",
"0.6358157",
"0.63345337",
"0.63231456",
"0.6321574",
"0.6321574",
"0.6321574",
"0.6321574",
"0.6321574",
"0.6316388",
"0.6258293",
"0.6256212",
"0.62497807",
"0.6242029",
"0.6236143",... | 0.7589751 | 0 |
GET /festivals/1/films/1 GET /festivals/1/films/1.xml | def show
@film = @festival.films.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @film }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @fam = Fam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fam }\n end\n end",
"def show\n @film = Film.published.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { re... | [
"0.6422294",
"0.5945609",
"0.58748734",
"0.5871135",
"0.58684886",
"0.57827955",
"0.5766279",
"0.57577723",
"0.57332265",
"0.57319516",
"0.572501",
"0.571337",
"0.57076037",
"0.56797373",
"0.5678734",
"0.56785995",
"0.56589586",
"0.56578887",
"0.56469846",
"0.56448746",
"0.56... | 0.72963136 | 0 |
GET /festivals/1/films/new GET /festivals/1/films/new.xml | def new
@film = @festival.films.new
respond_to do |format|
format.html { raise NonAjaxEditsNotSupported }
format.js # new.rjs
format.xml { render :xml => @film }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @fam = Fam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fam }\n end\n end",
"def new\n @feat = @person.feats.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n ... | [
"0.70557725",
"0.6827975",
"0.664286",
"0.66235065",
"0.65458953",
"0.6537541",
"0.64939666",
"0.64841455",
"0.64806056",
"0.6450843",
"0.6450843",
"0.64481574",
"0.6440349",
"0.64398605",
"0.6430357",
"0.641874",
"0.64111334",
"0.64075786",
"0.640542",
"0.6377793",
"0.635061... | 0.68759835 | 1 |
POST /festivals/1/films POST /festivals/1/films.xml | def create
@film = @festival.films.new(params[:film])
@saved = @film.save
respond_to do |format|
format.html { raise NonAjaxEditsNotSupported }
format.js
if @saved
format.xml { render :xml => @film, :status => :created, :location => @film }
else
format.xml { re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @fam = Fam.new(params[:fam])\n\n respond_to do |format|\n if @fam.save\n flash[:notice] = 'Fam was successfully created.'\n format.html { redirect_to(@fam) }\n format.xml { render :xml => @fam, :status => :created, :location => @fam }\n else\n format.html {... | [
"0.6207764",
"0.5970602",
"0.5744422",
"0.5744422",
"0.56854284",
"0.5611808",
"0.56021523",
"0.5564345",
"0.54632294",
"0.54605484",
"0.5451148",
"0.54456246",
"0.53912866",
"0.53912276",
"0.53831565",
"0.5380625",
"0.53759617",
"0.5354884",
"0.5345772",
"0.53380185",
"0.527... | 0.63393736 | 0 |
PUT /festivals/1/films/1 PUT /festivals/1/films/1.xml | def update
@film = @festival.films.find(params[:id])
@updated = @film.update_attributes(params[:film])
respond_to do |format|
format.html { raise NonAjaxEditsNotSupported }
format.js # update.rjs
if @updated
format.xml { head :ok }
else
format.xml { render :xml... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @fam = Fam.find(params[:id])\n\n respond_to do |format|\n if @fam.update_attributes(params[:fam])\n flash[:notice] = 'Fam was successfully updated.'\n format.html { redirect_to(@fam) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edi... | [
"0.6519106",
"0.6207139",
"0.62046474",
"0.6149017",
"0.60566956",
"0.6034293",
"0.60188466",
"0.59054023",
"0.5810741",
"0.5789958",
"0.57750154",
"0.57720196",
"0.57038635",
"0.5689641",
"0.56299114",
"0.56247145",
"0.5614178",
"0.5607249",
"0.5601533",
"0.5598347",
"0.5594... | 0.6404152 | 1 |
Look up a matching handler for the line and process it The process method on a handler always returns a Contexts object | def parse_line line, contexts
line = line.encode Encoding::UTF_8 if encode_lines?
handler = handler_for_line line
handler.process line, contexts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle(line)\n parsed = parse(line)\n return unless parsed\n\n handle_parsed(parsed)\n end",
"def process_line(line)\n if (@custom_processor && @custom_processor.class.method_defined?(:process_line))\n @custom_processor.process_line line\n else\n line.split ' '\n ... | [
"0.6575301",
"0.6278986",
"0.60873467",
"0.5979731",
"0.5973956",
"0.59736633",
"0.59658754",
"0.5962331",
"0.5956132",
"0.5916274",
"0.5835513",
"0.5824703",
"0.5763471",
"0.57351506",
"0.56787103",
"0.55791795",
"0.55451995",
"0.552181",
"0.55182767",
"0.55119985",
"0.54861... | 0.67651904 | 0 |
def create_hashes(rows) headers = ["name", "capacity", "storage"] hashes = rows.map do |row| Hash[headers.zip(row)] end hashes end Write to file | def csv_writer(rows)
headers = ["name", "capacity", "storage"]
CSV.open("reservoir_data.csv", 'w') do |csv|
csv << headers
rows.each do |row|
csv << row
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def machine_hash(headers,rows)\n # This is just to give a nice data structure (a hash of )\n rows.each_with_index.map do |row, index|\n # todo - rearrange the hash so it is sorted - do we need the row index?\n Hash[headers.each_with_index.map { |header, pos| \n [header, row[pos] ]}\n ].... | [
"0.71236014",
"0.6468792",
"0.6459042",
"0.6358782",
"0.628336",
"0.6224471",
"0.6188475",
"0.61865014",
"0.614731",
"0.61054206",
"0.60396963",
"0.60146755",
"0.59880847",
"0.59871787",
"0.59838164",
"0.5963479",
"0.5943188",
"0.59374887",
"0.5872913",
"0.5847528",
"0.582373... | 0.65567064 | 1 |
GET /guards/1 GET /guards/1.xml | def show
@guard = Guard.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @guard }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @guardian = Guardian.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @guardian }\n end\n end",
"def show\n @guide = Guide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xm... | [
"0.5788277",
"0.57758784",
"0.57613766",
"0.57572806",
"0.57301974",
"0.56725246",
"0.5670936",
"0.5670066",
"0.5657093",
"0.5628463",
"0.5618517",
"0.5616494",
"0.559104",
"0.5576799",
"0.556168",
"0.55555737",
"0.5518697",
"0.5512807",
"0.55050904",
"0.55013466",
"0.5493536... | 0.60650074 | 0 |
GET /guards/new GET /guards/new.xml | def new
@guard = Guard.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @guard }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @compliance }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end",
"def... | [
"0.69041663",
"0.6827875",
"0.6790674",
"0.6775494",
"0.6773475",
"0.67727506",
"0.6768087",
"0.6756935",
"0.67148274",
"0.6694192",
"0.6648209",
"0.6644479",
"0.6644479",
"0.6644479",
"0.6644299",
"0.66318166",
"0.6611558",
"0.66030514",
"0.6597194",
"0.65963095",
"0.6596309... | 0.71009535 | 0 |
DELETE /guards/1 DELETE /guards/1.xml | def destroy
@guard = Guard.find(params[:id])
@guard.destroy
respond_to do |format|
format.html { redirect_to(guards_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @guarantor = Guarantor.find(params[:id])\n @guarantor.destroy\n applicant=Applicant.find(@guarantor.applicant_id)\n respond_to do |format|\n format.html { redirect_to(applicant, :notice => 'Guarantor deleted.') }\n format.xml { head :ok }\n end\n end",
"def delete()\n ... | [
"0.636203",
"0.6321088",
"0.6265856",
"0.62530905",
"0.6244561",
"0.6178069",
"0.6176648",
"0.6153654",
"0.61462575",
"0.6127529",
"0.6124317",
"0.60945207",
"0.60943735",
"0.6070501",
"0.6039952",
"0.6032935",
"0.6011977",
"0.6008153",
"0.6003945",
"0.59994155",
"0.59917456"... | 0.66825676 | 0 |
return all roles related with self and self account_groups | def all_roles
_role_ids_ = (account_groups.map(&:role_ids) + role_ids).flatten.uniq
Role.where(id: _role_ids_)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_roles\n result = Array.new\n \n# for role in self.roles\n# result << role.ancestors_and_self\n# end\n \n for group in self.groups\n result << group.all_roles\n end\n \n result.flatten!\n result.uniq!\n \n return result\n end",
"def roles\n groups.find(:all, :cond... | [
"0.739752",
"0.7090536",
"0.68356854",
"0.66487414",
"0.6629416",
"0.6606212",
"0.6347266",
"0.63248616",
"0.6312422",
"0.62840325",
"0.62070054",
"0.61775064",
"0.6159339",
"0.6139426",
"0.6110836",
"0.61017835",
"0.6078071",
"0.6049364",
"0.60354936",
"0.60335445",
"0.60307... | 0.7625081 | 0 |
Append to an option. | def append_option(key, *value)
@options[key] = ((@options[key] || []) + [value]).flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_option(option)\n @options += [option]\n end",
"def addOption(option)\n\t\t@list.last.merge!(option)\n\tend",
"def add_option(choice, *args, &block)\n self.options << choice\n self.builder.add_choice(choice, *args, &block)\n end",
"def append_opt(opt)\n if opt.name == :dhcp_messa... | [
"0.8213087",
"0.7177456",
"0.71597177",
"0.71308154",
"0.68898356",
"0.68823177",
"0.67696524",
"0.6692969",
"0.6630291",
"0.66029876",
"0.6599891",
"0.6581243",
"0.6559765",
"0.6517126",
"0.6511164",
"0.64537925",
"0.64380985",
"0.64332277",
"0.6340348",
"0.6288536",
"0.6261... | 0.77726835 | 1 |
Adjust a list of files to include the path to the test file. | def adjust(files)
files.map { |file| @options[:path] + "/" + file }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_files=(list)\n @test_files = list\n end",
"def add_files(*files)\n @source_paths &= files\n end",
"def expanded_file_list\n test_files = Rake::FileList[pattern].compact\n test_files += @test_files.to_a if @test_files\n test_files\n end",
"def test_files\n fil... | [
"0.6746312",
"0.6739699",
"0.664375",
"0.649044",
"0.64880854",
"0.6390702",
"0.61977226",
"0.6128834",
"0.6110002",
"0.6014145",
"0.6010524",
"0.6001569",
"0.59968156",
"0.59964406",
"0.58759105",
"0.5849682",
"0.58485955",
"0.5846049",
"0.58370394",
"0.5774988",
"0.5763194"... | 0.7261856 | 0 |
is a certain type of auto configuration enabled? | def auto_config? name
return auto_config[name] if !auto_config[name].nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config\n mode == \"autoinst_config\"\n end",
"def configured?\n true\n end",
"def configured?; false; end",
"def configuration?\n get_mode.to_s.include?('config')\n end",
"def auto_config? name\n return auto_config[name] if !auto_config[name].nil?\n Troles::Con... | [
"0.7918839",
"0.73479337",
"0.7234662",
"0.71866626",
"0.71792614",
"0.6892769",
"0.689206",
"0.6886087",
"0.685284",
"0.6741846",
"0.6737845",
"0.6735295",
"0.6599472",
"0.6599472",
"0.65645564",
"0.6540362",
"0.65352446",
"0.6523569",
"0.65149254",
"0.64861846",
"0.64832115... | 0.7429825 | 1 |
get the orm name | def orm
@orm || self.class.default_orm
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orm\n @orm ||= :none\n end",
"def name\n @db_name\n end",
"def orm\n if @orm\n return @orm\n else\n self.orm = ENV['ORM']\n end\n @orm\n end",
"def orm\n @orm ||= begin\n if defined?(ActiveRecord::Base) && ActiveRecord::Base.connected? && S... | [
"0.7173224",
"0.712456",
"0.69726235",
"0.6966767",
"0.677164",
"0.66634834",
"0.6635984",
"0.6625153",
"0.65889144",
"0.65889144",
"0.6560384",
"0.6560384",
"0.65079117",
"0.6498855",
"0.6463175",
"0.64550096",
"0.6430718",
"0.642821",
"0.6414036",
"0.6414004",
"0.6411984",
... | 0.7326106 | 1 |
Writes bytes directly to the IO object. | def write(bytes)
@io.write(bytes)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(bytes)\r\n end",
"def write(io)\n io = BinData::IO.new(io) unless BinData::IO === io\n\n do_write(io)\n io.flush\n self\n end",
"def write bytes\n r = response_object\n r.body \"\" if r.body_io.nil?\n r.body_io.write bytes\n end",
"def io(data, io)\n io.wr... | [
"0.77240044",
"0.767987",
"0.72430104",
"0.72015387",
"0.6981127",
"0.6953536",
"0.69503915",
"0.68942535",
"0.68942535",
"0.68886614",
"0.68806094",
"0.68796396",
"0.6869945",
"0.6813113",
"0.67795295",
"0.67501783",
"0.67364347",
"0.6633813",
"0.66079766",
"0.65959054",
"0.... | 0.8240759 | 0 |
Writes an 8bit boolean to the IO object. | def write_boolean(boolean)
boolean ? write_int8(1) : write_int8(0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_bool(*b); end",
"def write_booleanr(bool)\n\t\twrite_byte(1)\n\t\twrite_boolean(bool)\n\tend",
"def bool_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @object_table[saved_object_count] = val ? \"\\x9\" : \"\\x8\" # 0x9 is 1001, type indica... | [
"0.7299487",
"0.7149008",
"0.61976385",
"0.59821904",
"0.59737766",
"0.58780134",
"0.57552665",
"0.56953734",
"0.5683204",
"0.5656538",
"0.55406576",
"0.5491624",
"0.543189",
"0.54240245",
"0.54226005",
"0.5382854",
"0.5350557",
"0.53317887",
"0.5328034",
"0.52960986",
"0.527... | 0.7627317 | 0 |
Writes an 8bit integer to the IO object. | def write_int8(int)
write([int].pack("C"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_i(i)\n z.write i.p32\nend",
"def write_varint(int)\n int = int << 1\n int = ~int | 1 if int < 0\n\n chunks = []\n while int >> 7 != 0\n chunks << (int & 0x7f | 0x80)\n int >>= 7\n end\n chunks << int\n write(chunks.pack(\"C*\"))\n ... | [
"0.6684698",
"0.6608419",
"0.6507216",
"0.64572746",
"0.6446795",
"0.6424291",
"0.63450706",
"0.6329984",
"0.6321829",
"0.6317031",
"0.62843823",
"0.62360305",
"0.62215775",
"0.6158286",
"0.61564684",
"0.6070906",
"0.6049056",
"0.60213804",
"0.6014682",
"0.59742707",
"0.59560... | 0.7866866 | 0 |
Writes a 16bit integer to the IO object. | def write_int16(int)
write([int].pack("s>"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write16(val)\n\tval = (-val) | 0x8000 if val < 0\n\tputc((val >> 8) & 0xff)\n\tputc(val & 0xff)\n end",
"def encode_and_write_int16(int, mode='file')\n\t\t# make sure 'byte' arrays are clear\n\t\t@byte1.clear\n\t\t@byte2.clear\n\t\t# convert int argument into binary, put in arrays\n\t\t15.downto(8) do |... | [
"0.70209384",
"0.68871415",
"0.68432695",
"0.63513136",
"0.62037164",
"0.60883254",
"0.5981403",
"0.59678274",
"0.5954523",
"0.59169126",
"0.5911222",
"0.5844161",
"0.58246",
"0.5823545",
"0.57841533",
"0.5775634",
"0.57191944",
"0.571265",
"0.5712276",
"0.5706617",
"0.569546... | 0.826333 | 0 |
Writes a 32bit integer to the IO object. | def write_int32(int)
write([int].pack("l>"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def int32(val)\n raise ArgumentError, \"int32() requires an Integer argument\" \\\n unless val.is_a?(Integer)\n raise RangeError, \"argument to int32() must be in the range \" +\n \"-2**31 <= arg <= 2**31-1\" \\\n unless val >= -2**31 ... | [
"0.7225985",
"0.721072",
"0.7194844",
"0.69908506",
"0.6926294",
"0.6872787",
"0.67737365",
"0.67489505",
"0.6748842",
"0.6649834",
"0.6597686",
"0.6584023",
"0.65757567",
"0.645551",
"0.6442932",
"0.6356821",
"0.6314031",
"0.629214",
"0.62657666",
"0.6098168",
"0.5954551",
... | 0.83171153 | 0 |
Writes a 64bit integer to the IO object. | def write_int64(int)
write([int].pack("q>"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_int64(*n); end",
"def put_i64(arg)\n @data += [(arg >> 32) & UINT_MASK, arg & UINT_MASK].pack(\"NN\")\n self\n end",
"def write_long(*n); end",
"def write_int(file, int, md)\n int = [int].pack('N')\n md << int\n file.write(int)\n end",
"def write_int(value, stream =... | [
"0.7757498",
"0.68079746",
"0.6679131",
"0.6667459",
"0.63482016",
"0.6277216",
"0.62628424",
"0.6244755",
"0.6167701",
"0.6150978",
"0.6141332",
"0.6095988",
"0.6059898",
"0.6049532",
"0.60115427",
"0.6002218",
"0.599803",
"0.59032845",
"0.5860196",
"0.5860196",
"0.58596677"... | 0.83039373 | 0 |
Writes an array to the IO object. Each item in the specified array will be yielded to the provided block; it's the responsibility of the block to write those items using the encoder. | def write_array(array, &block)
if array.nil?
# An array can be null, which is different from it being empty.
write_int32(-1)
else
write_int32(array.size)
array.each(&block)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_array(array)\n\t\twrite_byte(10)\n\t\twrite_word32_network(array.length)\n\t\tarray.each do |el| \n\t\t\twrite(el)\n\t\tend\n\tend",
"def write_varint_array(array, &block)\n if array.nil?\n write_varint(-1)\n else\n write_varint(array.size)\n array.each(&block)\... | [
"0.6863102",
"0.6826727",
"0.6097435",
"0.6035484",
"0.58435345",
"0.5754701",
"0.57182705",
"0.5709481",
"0.5704442",
"0.5658664",
"0.56524307",
"0.5605451",
"0.5545483",
"0.5530539",
"0.5524677",
"0.5524677",
"0.54987806",
"0.545878",
"0.54545754",
"0.5447909",
"0.540853",
... | 0.7923702 | 0 |
rand generates pseudo random from 01 rand(10) generates pseudo random from 010 we use it to get something like 4.41445946155691 | def random_float
rand * rand(10)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_random()\n begin\n r = Kernel.rand()\n end while r == 0.0\n \n if use_flt?\n BigDecimal(r.to_s)\n else\n r\n end\n end",
"def rand\n return extract_number / (2**32 -1).to_f\n end",
"def random\n 1 + (10 * rand(0))\n end",
"def ran... | [
"0.7837686",
"0.77281445",
"0.7547714",
"0.71551806",
"0.71075815",
"0.71075815",
"0.7002897",
"0.6914746",
"0.68725765",
"0.68639934",
"0.6802012",
"0.6802012",
"0.67990583",
"0.67890334",
"0.6755617",
"0.67540085",
"0.6747877",
"0.67228144",
"0.67228144",
"0.67228144",
"0.6... | 0.8145263 | 0 |
comprobar que el departamento se corresponde al del usuario logeado, si no es administrador. Si es adm se debera corresponder a la empresa. | def correct_dpto
if current_user.role<3 && !params[:department].nil?
unless current_user.department_id==params[:department].to_i
flash[:danger] = "ERROR: No tiene acceso al recurso solicitado"
redirect_to current_user
end
elsif current_user.role==3
redirect_to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_departments(user=current_user)\n if user.role? :superadmin\n @departments = Department.active\n else\n @departments = @department || user.department\n end\n end",
"def set_admin_departamento\n @admin_departamento = Admin::Departamento.find(params[:id])\n end",
"def get_depa... | [
"0.63323087",
"0.63115716",
"0.6158076",
"0.6103626",
"0.5995021",
"0.5987482",
"0.5873196",
"0.58308876",
"0.58051515",
"0.5761376",
"0.57514656",
"0.5695848",
"0.5689716",
"0.5677122",
"0.5670629",
"0.56586474",
"0.5652256",
"0.56519073",
"0.5625365",
"0.56181085",
"0.56111... | 0.6475799 | 0 |
Find the legacy access controls From the Sufia.Frakenversion (Sufia6F) codebase. Create equivalent_permissions for the GenericWork or FileSet. Destroy the legacy access controls. | def migrate_permissions_for(object)
# Find any access controls for this work. The must be sufia6F style in order to not show up on the Work.
legacy_access_controls = access_controls_for object
puts "#{legacy_access_controls.count} AccessControls for #{object.class}: #{object.id}"
puts "#{object... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setable_permissions\n setable_permissions = Erp::AccessControl.permissions - Erp::AccessControl.public_permissions\n setable_permissions -= Erp::AccessControl.members_only_permissions if builtin == BUILTIN_NON_MEMBER\n setable_permissions -= Erp::AccessControl.loggedin_only_permissions if builtin == B... | [
"0.54069215",
"0.5394768",
"0.5394768",
"0.5243208",
"0.51110125",
"0.51008105",
"0.50688976",
"0.50420976",
"0.4997379",
"0.49165583",
"0.4913748",
"0.4897455",
"0.4861618",
"0.4841139",
"0.48138663",
"0.48138663",
"0.48012033",
"0.47829705",
"0.47727913",
"0.47565815",
"0.4... | 0.6743784 | 0 |
Sift through all AccessControls and fine the ones that specify access to the given work id. | def access_controls_for(object)
all_acls.select{ |ac| ac.access_to_id == object.id }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_access_control\n @access_control = AccessControl.find(params[:id])\n end",
"def check_access_control_account_all\n @account = Account.find(params[:account_id])\n\n response_access_denied unless current_user.has_role?(:admin) || current_user.id == @account.user_id\n rescue\n resp... | [
"0.61088336",
"0.5771665",
"0.5768473",
"0.5598489",
"0.5573087",
"0.55460536",
"0.5509252",
"0.54257214",
"0.54257214",
"0.54257214",
"0.54257214",
"0.54257214",
"0.5422771",
"0.53708947",
"0.53124815",
"0.53081685",
"0.53018373",
"0.52960354",
"0.5266907",
"0.5257056",
"0.5... | 0.64365894 | 0 |
Get array of GenericWorks that are missing creator and description metadata. | def works_with_missing_metadata
GenericWork.all.select do |gw|
gw.description == [] && gw.creator == []
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creatable_works\n all_works.select do |work|\n can?(:create, work)\n end\n end",
"def missing_list\n list = []\n regular_workers.each do |w|\n if w.sum_time_in_seconds(DateTime.now - 14.days, DateTime.now) == 0\n list << w\n end\n end\n return list\n ... | [
"0.5886883",
"0.5348945",
"0.53283125",
"0.5142102",
"0.5132125",
"0.51179856",
"0.50782174",
"0.50779605",
"0.50741905",
"0.5022318",
"0.4969895",
"0.4919487",
"0.4869716",
"0.48494473",
"0.47848085",
"0.47560102",
"0.4749283",
"0.47350717",
"0.4710902",
"0.47080576",
"0.470... | 0.79984206 | 0 |
Get array of FileSets that have an original file which is missing technical metadata. Minimally, check for size as a surrogate. | def file_sets_missing_metadata
FileSet.all.select do |fs|
fs.original_file && fs.original_file.file_size == []
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_sets\n @iss_file.file_sets.select {|fs| fs.components.include? name }\n end",
"def staged\n @files.select { |k, f| f.sha_index != \"0000000000000000000000000000000000000000\" && f.type != nil }\n end",
"def relevant_itemsets\n frequent_itemsets.reject do |itemset|\n ... | [
"0.5951391",
"0.58240366",
"0.5803019",
"0.5778906",
"0.5763632",
"0.5749727",
"0.56249124",
"0.561522",
"0.5559767",
"0.55465734",
"0.551472",
"0.546619",
"0.5438188",
"0.5438188",
"0.54299843",
"0.53837687",
"0.5373799",
"0.5342839",
"0.5305659",
"0.52989376",
"0.52727896",... | 0.834574 | 0 |
Take property value from Sufia6F predicate DC.creator write it to the current property (which uses DC11.creator as the predicate) | def update_creator_of(object)
object.creator = object.get_values(::RDF::Vocab::DC.creator)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creator=(name)\n creator = DCMES.new\n creator.content = name\n self.dc_creators = [creator]\n name\n end",
"def direct_write_predicate(predicate, value)\n ActiveRDF::FederationManager.add(self, predicate, value)\n end",
"def creator=(creator)\n @crea... | [
"0.5499075",
"0.5340245",
"0.52810454",
"0.5190694",
"0.5190694",
"0.50843453",
"0.5066934",
"0.5062746",
"0.5062702",
"0.50044614",
"0.49611464",
"0.48996618",
"0.48730752",
"0.48683342",
"0.48524168",
"0.4849785",
"0.4842948",
"0.47967225",
"0.47967225",
"0.47897446",
"0.47... | 0.6679118 | 0 |
Override this method from core vagrant, here we branch out the provision for windows FIXME: This should be removed when the core vagrant supports communication class for windows guests | def run_provisioner(env)
if env[:machine].config.vm.guest == :windows
case env[:provisioner].class.to_s
when "VagrantPlugins::Shell::Provisioner"
VagrantPlugins::VagrantHyperV::Provisioner::Shell.new(env).provision_for_windows
when "VagrantPlugins::Puppet::Pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provision_winssh(args)\n with_script_file do |path|\n # Upload the script to the machine\n @machine.communicate.tap do |comm|\n env = config.env.map{|k,v| comm.generate_environment_export(k, v)}.join\n upload_path = config.upload_path.to_s\n if File.ext... | [
"0.7146217",
"0.70492584",
"0.6754668",
"0.6731797",
"0.64458185",
"0.6392794",
"0.6363255",
"0.6361694",
"0.632649",
"0.63092256",
"0.6272282",
"0.6267608",
"0.62578017",
"0.62375796",
"0.6216973",
"0.61980397",
"0.6189879",
"0.61584574",
"0.61557585",
"0.6139744",
"0.612985... | 0.7328448 | 0 |
insert, autoallocating the primary key from a sequence | def insert_sequenced(row)
sql = row.type.insert_sql_minus_key
vals = row.field_values_minus_key
#$stderr.puts sql
#$stderr.puts vals.inspect
db.do(sql, *vals)
insert_id = db.select_one(row.type.get_insert_id_sql)[0]
row.send(row.type.primary_key.setter_name, insert_id)
row.reset_changed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primary_key_sequence(table, opts=OPTS)\n quoted_table = quote_schema_table(table)\n Sequel.synchronize{return @primary_key_sequences[quoted_table] if @primary_key_sequences.has_key?(quoted_table)}\n cond = {Sequel[:t][:oid] => regclass_oid(table, opts)}\n value = if pks = _select_se... | [
"0.6798957",
"0.67284274",
"0.6689262",
"0.6686622",
"0.66330767",
"0.66164786",
"0.66038424",
"0.66038424",
"0.6461906",
"0.64407325",
"0.6437145",
"0.64316994",
"0.62496734",
"0.6223949",
"0.6220948",
"0.6183803",
"0.61683446",
"0.6158695",
"0.61476517",
"0.6142947",
"0.613... | 0.70880693 | 0 |
Returns the cost for a particular resource over some duration in seconds. ALL BILLING POLICY SUBCLASSES SHOULD OVERRIDE THIS METHOD | def get_cost_for_duration(resource, duration) ; 1.0 end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cost_item(time_entry)\n if User.current.logged? && (User.current.allowed_to?(:view_rate, time_entry.project) || User.current.admin?)\n return time_entry.cost\n else\n return nil\n end\n end",
"def get_cost_for_duration(rds_server, duration)\n CENTS_PER_GB_PER_MONTH[zone_setting... | [
"0.6435194",
"0.6388575",
"0.63044333",
"0.6247949",
"0.61560947",
"0.61206895",
"0.6092066",
"0.603561",
"0.60191697",
"0.60113394",
"0.59981644",
"0.59981644",
"0.5982747",
"0.5955256",
"0.59534687",
"0.5890761",
"0.5880231",
"0.58663607",
"0.5865109",
"0.5840298",
"0.58402... | 0.84995687 | 0 |
Returns the default billing type for this policy. Override this to set a humanreadable name for the policy. Defaults to the last part of the subclass name. | def billing_type
self.class.name.split('::').last #(defaluts to class name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polymorphic_name\n store_full_class_name ? base_class.name : base_class.name.demodulize\n end",
"def payment_type_display\n self.payment_type.to_s.titleize\n end",
"def default_type_label(type)\n type.name.gsub(/::/, '_').underscore\n end",
"def get_account_payment_type\n ... | [
"0.62362546",
"0.6170936",
"0.603222",
"0.60252243",
"0.6016412",
"0.6016412",
"0.596855",
"0.5942817",
"0.5875563",
"0.5849752",
"0.5811886",
"0.57751286",
"0.57346225",
"0.57091135",
"0.5694887",
"0.56857264",
"0.5669168",
"0.5666361",
"0.5663587",
"0.558719",
"0.5585203",
... | 0.76226145 | 0 |
Writes 'record' into the database if: 1. there's no previous record for this resource + billing type; or 2. the previous such record differs in hourly cost or billing codes; or 3. the records are separated by more than maximum_time_gap Otherwise, `record` is merged with the previous record that matches its resource and... | def write_or_merge_with_existing(new_record, maximum_time_gap)
write_new_record = true
last_record = BillingRecord.most_recent_like(new_record)
# If the previous record for this resource/billing type has the same
# hourly rate and billing codes, just update the previous record
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(record)\n unless exist?(record[0])\n domain = new_domain(record[0])\n zone = new_zone(domain.id)\n for t in @templates\n new_record(t, domain, record)\n end\n\n if(record[4] == \"yes\")\n @mxgoogle.each do |content, ttl_prio|\n new_mx_record(domain, conten... | [
"0.56278914",
"0.5587419",
"0.55569816",
"0.5539045",
"0.54759395",
"0.5458649",
"0.5354007",
"0.5308939",
"0.5194794",
"0.519341",
"0.5172661",
"0.5169908",
"0.5164831",
"0.5113958",
"0.51138276",
"0.5112749",
"0.510494",
"0.510494",
"0.5060039",
"0.50281835",
"0.4986451",
... | 0.759342 | 0 |
Initializes mongo_rack. Pass in options for default override. | def initialize(app, options={})
super
host, port, db_name, cltn_name = parse_server_desc( @default_options[:server] )
@mutex = Mutex.new
@connection = ::Mongo::Connection.new(
host,
port,
:pool_size => @default_options[:pool_size],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_options\n {\n :host => 'localhost',\n :port => Mongo::Connection::DEFAULT_PORT\n }\n end",
"def mongodb=(options = {})\n if options.respond_to?(:keys)\n mongodb.port = options[:port] if options[:port]\n mongodb.host = options[:host] ... | [
"0.6971827",
"0.6885016",
"0.6864397",
"0.68434364",
"0.6764299",
"0.665844",
"0.6635276",
"0.6432224",
"0.641191",
"0.6410892",
"0.63685095",
"0.6346203",
"0.6298248",
"0.62118423",
"0.6206694",
"0.6184704",
"0.6096594",
"0.6056411",
"0.6003625",
"0.5994437",
"0.5955226",
... | 0.72428447 | 0 |
Clean out all expired sessions | def clean_expired!
sessions.remove( { :expire => { '$lt' => Time.now } } )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup\n @sessions.each_value do |session|\n session.close if session.expired?\n end\n rescue => e\n log.error(\"Expired session cleanup failed: #{e}\")\n end",
"def cleanup\n logger.info(\"Cleaning up expired sessions...\", :cleanup, { state: :starting... | [
"0.8176167",
"0.8085375",
"0.7972365",
"0.77706915",
"0.77485996",
"0.77153325",
"0.7592844",
"0.7592844",
"0.75311095",
"0.74809927",
"0.74503034",
"0.74231356",
"0.7334813",
"0.73153824",
"0.72658134",
"0.723724",
"0.7180697",
"0.7180697",
"0.7098137",
"0.70691824",
"0.7062... | 0.8575099 | 0 |
parse server description string into host, port, db, cltn | def parse_server_desc( desc )
tokens = desc.split( "/" )
raise "Invalid server description" unless tokens.size == 3
server_desc = tokens[0].split( ":" )
raise "Invalid host:port description" unless server_desc.size == 2
return server_desc.first, server_desc.last... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_servers\n tuples = config.scan(SERVER_REGEXP)\n hsh = {}\n tuples.map do |(vrf, host, prefer, minpoll, maxpoll, sourcei, key)|\n hsh[host] = {\n vrf: vrf,\n prefer: !prefer.nil?,\n minpoll: minpoll.nil? ? nil : minpoll.to_i,\n maxp... | [
"0.62111753",
"0.5973172",
"0.5915546",
"0.5800562",
"0.5744312",
"0.57415754",
"0.57415754",
"0.57277054",
"0.568331",
"0.5681982",
"0.5641119",
"0.5606183",
"0.5606183",
"0.55802464",
"0.55693823",
"0.55693823",
"0.5562231",
"0.5502871",
"0.5486854",
"0.5383189",
"0.5377956... | 0.76244825 | 0 |
Marshal session object BOZO !! Marshal will not dump valid strings for mongo using yaml instead | def serialize( ses )
YAML.dump( ses )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marshal(session)\n data = [ Marshal.dump(session) ].pack('m').chop\n \"#{data}--#{generate_digest(data)}\"\n end",
"def inspect\n \"#<Mongo::Session:0x#{object_id} session_id=#{session_id} options=#{@options}>\"\n end",
"def marshal(session)\n data = Base64.encode64(Marshal.dump(session... | [
"0.6728865",
"0.6316792",
"0.6307911",
"0.6299874",
"0.62972796",
"0.62523395",
"0.61927164",
"0.6173001",
"0.61103636",
"0.6015591",
"0.6005223",
"0.58515424",
"0.584148",
"0.5840802",
"0.5785582",
"0.57650965",
"0.57336384",
"0.57237434",
"0.57171303",
"0.5692215",
"0.56781... | 0.6432779 | 1 |
merge old, new to current session state | def merge_sessions( sid, old_s, new_s, cur={} )
unless Hash === old_s and Hash === new_s
logger.error 'Bad old or new sessions provided.'
return cur
end
delete = old_s.keys - new_s.keys
logger.info "//@#{sid}: delete #{delete*','}" if not de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_session_variables!; end",
"def restore\n GLOBAL_HASH_TABLE[@session_id]\n end",
"def store_merge_state; end",
"def store_merge_state; end",
"def restore\n return unless @session\n @data = @session.data\n end",
"def update_copy_session\n @user = current_user\n ... | [
"0.6205462",
"0.60833365",
"0.60774887",
"0.60774887",
"0.6018721",
"0.60031736",
"0.59900403",
"0.59900403",
"0.59826654",
"0.5953009",
"0.5855512",
"0.5820702",
"0.58132696",
"0.58038795",
"0.57369757",
"0.57249975",
"0.57124716",
"0.57119817",
"0.57030267",
"0.5684279",
"0... | 0.69177705 | 0 |
Checks if the user wants to exit the calculator. 'Q' to exit | def exit?(ans)
ans.upcase == 'Q'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exit?\n user_input == \"q\" || user_input == \"quit\"\n end",
"def finished?\n input == 'q' || input =='quit'\n end",
"def menu\n puts 'Welcome to the ruby calculator!'\n puts 'Press 1 to calculate or 2 to quit'\n case\n answer = gets.strip\n when '1'\n calculate\n when '2'\n ... | [
"0.764285",
"0.72208023",
"0.709679",
"0.70717436",
"0.68572444",
"0.6807866",
"0.6711127",
"0.6701642",
"0.6690668",
"0.66805744",
"0.6675273",
"0.6673463",
"0.6670867",
"0.6656492",
"0.66519773",
"0.66414565",
"0.6613275",
"0.6612734",
"0.66043913",
"0.65856063",
"0.6581397... | 0.74919397 | 1 |
Used to check the user input. Valid input is either "Q" or a number | def get_valid_input(input_type, options = {})
input = nil
loop do
input = gets.chomp
# binding.pry
if options.has_key?(:result) && input == ""
input = options[:result]
break
else
if input_type == "num"
numeric?(input) || input.upcase == 'Q' ? break : say("Numbers only")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_input(msg)\n puts msg\n print \">> \"\n input = gets.chomp\n if input.downcase == \"q\"\n return input, true\n else\n return input, false\n end\nend",
"def is_valid_input(input)\n if input == \"rock\" || input == \"paper\" || input == \"scissors\" || input == \"lizard\" || input == \"s... | [
"0.67483205",
"0.66702497",
"0.6666446",
"0.6628097",
"0.65997636",
"0.6598698",
"0.65643185",
"0.65577036",
"0.6516444",
"0.6484169",
"0.6446423",
"0.6444627",
"0.638054",
"0.63550824",
"0.6346796",
"0.6342883",
"0.6334482",
"0.6298292",
"0.6283001",
"0.62807816",
"0.6279113... | 0.73210204 | 0 |
Displays the result of the operation performed on the two numbers | def display_result(num1, num2, operator)
# say "num1: #{num1}, num2: #{num2}, operator #{operator}"
case operator
when '1'
result = num1.to_i + num2.to_i
say "#{num1} + #{num2} = #{result}"
when '2'
result = num1.to_i - num2.to_i
say "#{num1} - #{num2} = #{result}"
when '3'
begin
res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_results(num_1, num_2)\n puts \"addition #{num_1 + num_2}\"\n puts \"subtraction #{num_1 - num_2}\"\n puts \"product #{num_1 * num_2}\"\n puts \"remainder #{num_1 % num_2}\"\n puts \"quotient #{num_1 / num_2}\"\n puts \"power #{num_1 ** num_2}\"\n\nend",
"def calculator(a,b)\n puts \"The sub ... | [
"0.72165275",
"0.69052255",
"0.6869239",
"0.6859879",
"0.6838141",
"0.6747097",
"0.6725214",
"0.6724019",
"0.66996586",
"0.66837806",
"0.6667593",
"0.66484004",
"0.66381717",
"0.6631098",
"0.6621911",
"0.6606983",
"0.6598752",
"0.6594458",
"0.65312785",
"0.65121955",
"0.65022... | 0.73220927 | 0 |
DELETE /psychologies/1 DELETE /psychologies/1.xml | def destroy
@psychology = Psychology.find(params[:id])
@psychology.destroy
respond_to do |format|
format.html { redirect_to(psychologies_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n \n @ontology = SYMPH::Ontology.find(params[:id])\n @ontology.disable\n @ontology.destroy\n \n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end",
"def remove_configuration_product\r\n # node = ProductPac... | [
"0.61582494",
"0.6086254",
"0.6056867",
"0.59706193",
"0.5956572",
"0.5942821",
"0.5926905",
"0.5917924",
"0.5891654",
"0.5885887",
"0.58780557",
"0.5869463",
"0.5869463",
"0.58542603",
"0.5851631",
"0.5842676",
"0.5840533",
"0.5837158",
"0.58360296",
"0.58262134",
"0.5807316... | 0.7391541 | 0 |
string The String to be checked letter The String to be checked for. Examples index_of_char("Hello", "o") => "4" Returns the index or nil if not found. | def index_of_char(string, letter)
i = 0
while i < string.length
if string[i] == letter
return i
end
i += 1
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_of_char(string, character)\n i = 0\n position = nil\n while i < string.length\n if string[i] == character\n position = i\n break\n else\n i += 1\n end\n end\n return position\nend",
"def index_of_char(str, char)\n i = 0\n while ... | [
"0.7835206",
"0.76471406",
"0.7409047",
"0.709801",
"0.70619327",
"0.7061357",
"0.70180374",
"0.6688983",
"0.66763335",
"0.66719484",
"0.6631625",
"0.6607552",
"0.6589543",
"0.65614766",
"0.65571266",
"0.6525291",
"0.64588773",
"0.6450701",
"0.6373768",
"0.6306992",
"0.624209... | 0.78389734 | 0 |
check if any of its tasks is not completed | def not_completed?
tasks.any? { |task| task.done != 100 }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tasks_remain?\n\t\ttasks.any?{ |t| t.completed.nil? }\n\tend",
"def incomplete_tasks\n\t\ttasks.select{ |t| !t.completed? }\n\tend",
"def ignore_complete?(task)\n !get_result(task).nil?\n end",
"def empty?; tasks.empty? end",
"def all_complete\n self.tasks.count == self.tasks.done.count\n end",... | [
"0.7589577",
"0.7548989",
"0.75104195",
"0.7493704",
"0.7404067",
"0.7304864",
"0.70360976",
"0.70122945",
"0.6991329",
"0.6991329",
"0.68446267",
"0.6811772",
"0.6742053",
"0.6736515",
"0.6727335",
"0.67162865",
"0.6677665",
"0.66746724",
"0.6668764",
"0.6649169",
"0.6611977... | 0.794058 | 0 |
Select a cookbook to work on. Alert the user if the cookbook owner account has expired. | def select
@cookbook = Cookbook.find params[:id]
user_is_owner = current_user.owns_cookbook(@cookbook)
user_is_contributor = current_user.contributes_to(@cookbook)
# Verify the user is authorized to work on this cookbook.
if @cookbook && (user_is_owner || user_is_contributor)
# User mu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cookbook_selected?\n if !current_cookbook\n redirect_to cookbooks_path, alert: \"You must have selected a Cookbook project to work on first.\"\n end\n end",
"def account_expired?\n if current_user.expired? && current_user.owns_cookbook(current_cookbook)\n redirect_to upgrade_account_path(... | [
"0.6314082",
"0.573691",
"0.5581856",
"0.5515331",
"0.54199946",
"0.5390674",
"0.5250885",
"0.51905346",
"0.51675564",
"0.51355153",
"0.51146585",
"0.51081425",
"0.5051597",
"0.50263315",
"0.4994299",
"0.4979852",
"0.49525097",
"0.49263906",
"0.49219006",
"0.49213073",
"0.491... | 0.7531907 | 0 |
Edit the cookbook title. | def edit_title
@cookbook = current_cookbook
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_title\n @cookbook = current_cookbook\n @cookbook.title = params[:cookbook][:title]\n if @cookbook.save\n redirect_to templates_path, notice: \"Your Cookbook name has been changed!\"\n else\n render :edit_title\n end\n end",
"def ctitle(title)\n self.title = title\n en... | [
"0.80122495",
"0.72350585",
"0.713863",
"0.70878845",
"0.70584404",
"0.7019702",
"0.6919573",
"0.6919573",
"0.6901882",
"0.6879555",
"0.68733776",
"0.68733776",
"0.68733776",
"0.68733776",
"0.68733776",
"0.68733776",
"0.68733776",
"0.68733776",
"0.68733776",
"0.6863989",
"0.6... | 0.8330037 | 0 |
Update the cookbook title | def update_title
@cookbook = current_cookbook
@cookbook.title = params[:cookbook][:title]
if @cookbook.save
redirect_to templates_path, notice: "Your Cookbook name has been changed!"
else
render :edit_title
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_title\n @cookbook = current_cookbook\n end",
"def ctitle(title)\n self.title = title\n end",
"def title=(title)\n @attributes.occi!.core!.title = title\n end",
"def update_window_title(new_title)\n hc_main_view.title = new_title\n end",
"def title=(v)\n if @title != ... | [
"0.77194446",
"0.7060066",
"0.69450605",
"0.6818465",
"0.6657042",
"0.66266453",
"0.6600145",
"0.6594344",
"0.6585583",
"0.65775865",
"0.6567257",
"0.6566344",
"0.6553564",
"0.6546017",
"0.65452695",
"0.65447783",
"0.65447783",
"0.65447783",
"0.65447783",
"0.65447783",
"0.654... | 0.7828986 | 0 |
Edit the cookbook introduction | def edit_introduction
@cookbook = current_cookbook
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_introduction\n @cookbook = current_cookbook\n\n # Process Paperclip attachments\n @cookbook.process_attachments(params)\n\n if params[:cookbook]\n @cookbook.intro_type = params[:cookbook][:intro_type] if params[:cookbook][:intro_type]\n @cookbook.center_introduction = params[:cookb... | [
"0.6936561",
"0.67870855",
"0.6385627",
"0.6292402",
"0.6228709",
"0.6201686",
"0.6119712",
"0.61154443",
"0.6063954",
"0.60586244",
"0.6041879",
"0.6041879",
"0.60394824",
"0.5984697",
"0.59635437",
"0.59521246",
"0.59503376",
"0.58997184",
"0.5824278",
"0.5823441",
"0.58144... | 0.79031426 | 0 |
Update introduction elements Respond with a content type of plain/text to support IE and Opera see: | def update_introduction
@cookbook = current_cookbook
# Process Paperclip attachments
@cookbook.process_attachments(params)
if params[:cookbook]
@cookbook.intro_type = params[:cookbook][:intro_type] if params[:cookbook][:intro_type]
@cookbook.center_introduction = params[:cookbook][:center_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def introduction\r\n\r\n end",
"def content_for_intro(interpret=true)\n if interpret\n render_for_html(body.paragraphs[0])\n else\n body.paragraphs[0]\n end\n end",
"def update\n respond_to do |format|\n if @intro.update(intro_params)\n format.html { redirect_to @intro, notic... | [
"0.6250985",
"0.61511034",
"0.59314656",
"0.5552826",
"0.5540283",
"0.5529689",
"0.55242527",
"0.5460215",
"0.5401076",
"0.5359251",
"0.53455067",
"0.5310336",
"0.53064615",
"0.5302194",
"0.5291925",
"0.52763087",
"0.5234108",
"0.5215682",
"0.52042013",
"0.52030325",
"0.51799... | 0.6728914 | 0 |
Preview the cookbook This can be the current cookbook or a cookbook of another person if an order has been created (guest order) | def preview
order = current_user.orders.find_by_cookbook_id(params[:id])
@cookbook = (order) ? order.cookbook : current_cookbook
preview_path = "#{PDF_PREVIEW_FOLDER}/preview_cookbook-#{@cookbook.id}_#{Time.now.to_i}.pdf"
session[:preview_filename] = preview_path
preview = CookbookPreviewWorker.new(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n @cookbook = current_cookbook\n end",
"def edit_introduction\n @cookbook = current_cookbook\n end",
"def show(cookbook)\n cookbooks[cookbook.cookbook_name] = cookbook.pretty_hash\n end",
"def edit_title\n @cookbook = current_cookbook\n end",
"def show(cookbook)\n path... | [
"0.6933546",
"0.6590305",
"0.6458196",
"0.6370931",
"0.616484",
"0.60808307",
"0.60649455",
"0.6053982",
"0.60436743",
"0.6009953",
"0.59808934",
"0.5940761",
"0.593446",
"0.59180933",
"0.5885206",
"0.58740807",
"0.58616465",
"0.58076125",
"0.5764444",
"0.57035583",
"0.562246... | 0.69126475 | 1 |
Preview the cookbook cover | def preview_cover
preview_path = "#{PDF_PREVIEW_FOLDER}/preview_cover-#{current_cookbook.id}_#{Time.now.to_i}.pdf"
session[:preview_filename] = preview_path
preview = CookbookPreviewWorker.new(
cookbook: current_cookbook,
filename: preview_path
)
preview.cover
render "previews/previ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview\n order = current_user.orders.find_by_cookbook_id(params[:id])\n @cookbook = (order) ? order.cookbook : current_cookbook\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_cookbook-#{@cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPrevie... | [
"0.6626343",
"0.6560433",
"0.6560433",
"0.6156586",
"0.6087413",
"0.59966797",
"0.59966797",
"0.59686",
"0.5883065",
"0.58734447",
"0.5836019",
"0.5792734",
"0.57913464",
"0.57071495",
"0.57039464",
"0.56878126",
"0.5681726",
"0.5663612",
"0.5663612",
"0.56445384",
"0.5624729... | 0.7587635 | 0 |
Preview the title and the table of contents pages | def preview_title_and_toc
preview_path = "#{PDF_PREVIEW_FOLDER}/preview_title_toc-#{current_cookbook.id}_#{Time.now.to_i}.pdf"
session[:preview_filename] = preview_path
preview = CookbookPreviewWorker.new(
cookbook: current_cookbook,
filename: preview_path
)
preview.title_and_toc
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview\n end",
"def preview\n end",
"def preview_page(name, data, format)\n page = @page_class.new(self)\n ext = @page_class.format_to_ext(format.to_sym)\n path = @page_class.cname(name) + '.' + ext\n blob = OpenStruct.new(:name => path, :data => data)\n page.populate(blob, pat... | [
"0.64124614",
"0.64124614",
"0.6228087",
"0.61932886",
"0.61879516",
"0.6138907",
"0.6136847",
"0.61265945",
"0.6119841",
"0.6118165",
"0.60977024",
"0.6089731",
"0.6074166",
"0.6062032",
"0.60570693",
"0.6053675",
"0.6051556",
"0.6033562",
"0.6026164",
"0.6017094",
"0.600442... | 0.76360786 | 0 |
Preview the index page | def preview_index
preview_path = "#{PDF_PREVIEW_FOLDER}/preview_index-#{current_cookbook.id}_#{Time.now.to_i}.pdf"
session[:preview_filename] = preview_path
preview = CookbookPreviewWorker.new(
cookbook: current_cookbook,
filename: preview_path
)
preview.index
render "previews/previ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview_index(urls, path: request.path)\n render(path: __dir__ + \"/index.erb\", locals: { urls: Array(urls), path: path })\n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n render\n end",
"def index; end",
"def index; end",
"def ... | [
"0.7894774",
"0.74425375",
"0.74425375",
"0.74425375",
"0.7379633",
"0.73158634",
"0.73158634",
"0.73158634",
"0.73158634",
"0.73158634",
"0.73158634",
"0.73158634",
"0.73158634",
"0.73158634",
"0.73158634",
"0.73158634",
"0.73158634",
"0.73158634",
"0.73158634",
"0.73158634",
... | 0.77508557 | 1 |
Respond with the number of pages for the current cookbook | def count_page
num_pages = current_cookbook.num_pages
render json: {num_pages: num_pages}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_count; pages.count; end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def getPageCount()\n retur... | [
"0.710333",
"0.69140714",
"0.69140714",
"0.69140714",
"0.69140714",
"0.69040275",
"0.6766329",
"0.6764628",
"0.6753337",
"0.67044806",
"0.6690332",
"0.6689448",
"0.6682994",
"0.66608137",
"0.6655366",
"0.6606979",
"0.65942544",
"0.6583469",
"0.65683705",
"0.6565279",
"0.65496... | 0.87572855 | 0 |
returns a json representation of the specified element argv = commandline arguments, requires an element (e) argument, such as 'interfaces', 'hosts' or 'routes' or 'interfaces/a1' or 'hosts/dell9' | def cmd_get argv
setup argv
e = @hash['element']
response = @api.get(e)
msg JSON.pretty_generate(response)
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parseArgs(argv)\n\n result = { \"all\" => false, \"mongo_host\" => \"localhost\", \"mongo_port\" => 27017, \"tenants\" => [] }\n\n for arg in argv\n if arg == \"--all\"\n result[\"all\"] = true\n elsif arg.include?(\":\")\n host_port = arg.split(':')\n result[\"mongo_host\"] = host_port[... | [
"0.6073539",
"0.6073539",
"0.6073539",
"0.6073539",
"0.6073539",
"0.5711646",
"0.56099266",
"0.5487876",
"0.54710764",
"0.5397917",
"0.5371958",
"0.5348169",
"0.53394496",
"0.53031284",
"0.5281803",
"0.52738583",
"0.5273534",
"0.52599037",
"0.52573115",
"0.52487284",
"0.51750... | 0.62305874 | 0 |
modifies a network element argv = commandline arguments, requires a json configuration (j) and the element (e) to modify, such as 'interfaces', 'hosts' or 'routes' or 'interfaces/a1' or 'hosts/dell9' | def cmd_modify argv
setup argv
json = @hash['json']
e = @hash['element']
response = @api.modify(json, e)
msg response
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @addon_node = args[:addon_node] if args.key?(:addon_node)\n @annotations = args[:annotations] if args.key?(:annotations)\n @anti_affinity_groups = args[:anti_affinity_groups] if args.key?(:anti_affinity_groups)\n @auto_repair_config = args[:auto_repair_conf... | [
"0.5877967",
"0.58464944",
"0.5841025",
"0.5807635",
"0.5739581",
"0.57103986",
"0.5707734",
"0.5687186",
"0.5633782",
"0.5558491",
"0.5511202",
"0.5492197",
"0.54439795",
"0.5435326",
"0.5416061",
"0.5404252",
"0.5400137",
"0.5397197",
"0.53889453",
"0.53607035",
"0.5345757"... | 0.7363384 | 0 |
creates a new network element argv = commandline arguments, requires a json configuration (j) and the element (e) to modify, such as 'interfaces', 'hosts' or 'routes' | def cmd_create argv
setup argv
json = @hash['json']
e = @hash['element']
response = @api.create(json, e)
msg response
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_modify argv\n setup argv\n json = @hash['json']\n e = @hash['element']\n response = @api.modify(json, e)\n msg response\n return response\n end",
"def create_network_equipment(network_uid, network, refapi_path, site_uid = nil)\n network_path = ''\n if site_uid\n network_path = Pat... | [
"0.57113636",
"0.5529602",
"0.53176737",
"0.5289449",
"0.52048165",
"0.5111053",
"0.50640666",
"0.5063005",
"0.50531757",
"0.5027478",
"0.49777773",
"0.4975934",
"0.4961408",
"0.49605873",
"0.49578798",
"0.49498597",
"0.49348983",
"0.49090227",
"0.48975217",
"0.488974",
"0.48... | 0.63507545 | 0 |
deletes an existing network element argv = commandline arguments, requires a json configuration (j) and the element (e) to modify, such as 'interfaces', 'hosts' or 'routes' or 'interfaces/a1' or 'hosts/dell9' | def cmd_delete argv
setup argv
e = @hash['element']
response = @api.delete(e)
msg response
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_modify argv\n setup argv\n json = @hash['json']\n e = @hash['element']\n response = @api.modify(json, e)\n msg response\n return response\n end",
"def update!(**args)\n @network = args[:network] if args.key?(:network)\n end",
"def update!(**args)\n @network =... | [
"0.6460949",
"0.5475716",
"0.54739",
"0.54632664",
"0.5437425",
"0.5421944",
"0.53205013",
"0.5300579",
"0.5272561",
"0.52284783",
"0.5146894",
"0.50955284",
"0.5074325",
"0.50561506",
"0.5038087",
"0.50370777",
"0.5027454",
"0.5010529",
"0.49872196",
"0.49847698",
"0.4973937... | 0.63628566 | 1 |
clears existing network configuration hosts argv = commandline arguments | def cmd_clear_hosts argv
setup argv
response = @api.clear_hosts
msg JSON.pretty_generate(response)
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_unused_host_only_networks\n end",
"def clear_host!\n @host_key_files = []\n @known_host_identities = nil\n self\n end",
"def reset!\n @hosts = nil\n end",
"def delete_unused_host_only_networks\n networks = []\n execute(\"list\", \"... | [
"0.6695341",
"0.6572044",
"0.6545548",
"0.6206237",
"0.617071",
"0.5949854",
"0.5934213",
"0.5871286",
"0.58433074",
"0.57184565",
"0.5705588",
"0.5698112",
"0.5680054",
"0.5645454",
"0.56192917",
"0.5600557",
"0.55954653",
"0.5586551",
"0.5586551",
"0.55767447",
"0.5560001",... | 0.73461294 | 0 |
resolves network configuration hosts argv = commandline arguments, requires the name (n) of the host to resolve (determines its ip address and adds it to the network configuration) | def cmd_resolve_hosts argv
setup argv
name = @hash['name']
response = @api.resolve_hosts(name)
msg response
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_hosts (args)\n\n discoveryrc = File.expand_path(\"~/.discoveryrc\")\n aliasmap = {}\n if File.readable?(discoveryrc)\n File.readlines(discoveryrc).each {|line| line.scan(/(\\w+)\\s*=\\s*(.*)/) {|k,v| aliasmap[k]=v}}\n end\n\n if args.size == 0 || args[0] =~ /^-/\n @hosts = aliasm... | [
"0.6984021",
"0.60479033",
"0.59377795",
"0.5851572",
"0.5738252",
"0.5738252",
"0.5715469",
"0.5711686",
"0.56538963",
"0.5591599",
"0.55742544",
"0.5562225",
"0.5532942",
"0.5500179",
"0.5493819",
"0.5484015",
"0.5450859",
"0.5385188",
"0.5376823",
"0.53705746",
"0.5348531"... | 0.7583121 | 0 |
clears existing network interfaces argv = commandline arguments, require the names of the interfaces to clear (i name) | def cmd_clear_interface argv
setup argv
interface = @hash['interfaces']
response = @api.clear_interface(interface)
msg response
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CleanUp\n\tallGroups.exec(\"killall ITGRecv >/dev/null 2>&1;\")\n\tallGroups.exec(\"killall ITGManager >/dev/null 2>&1; killall ITGSend >/dev/null 2>&1;\") \n\t#set the interfaces down\n @nodes.each do |node|\n\t\tif node.GetType()==\"R\"\n\t\t node.GetInterfaces().each do |ifn|\n\t\t # se... | [
"0.62533665",
"0.59918845",
"0.5898995",
"0.5898995",
"0.5898995",
"0.58098364",
"0.5726285",
"0.5708749",
"0.5697775",
"0.56189936",
"0.5596491",
"0.5579363",
"0.55717564",
"0.54868674",
"0.5479407",
"0.5453402",
"0.54292",
"0.5410123",
"0.5400418",
"0.53941184",
"0.5381248"... | 0.7769497 | 0 |
clears existing network routes argv = commandline arguments | def cmd_clear_routes argv
setup argv
response = @api.clear_routes
msg response
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset!\n ATTRIBUTES.each {|attr| send(\"#{attr.to_s}=\", nil)}\n routes.clear\n end",
"def reset\n @routes.clear\n end",
"def flush_routes\n _init\n\n # Remove each of the individual routes so the comms don't think they're\n # still routing after a flush.\n self.routes.each... | [
"0.6123719",
"0.60387725",
"0.60188967",
"0.6004334",
"0.593301",
"0.5913294",
"0.58890086",
"0.5653833",
"0.55848956",
"0.55750537",
"0.55709225",
"0.5569863",
"0.5560173",
"0.5555922",
"0.55414546",
"0.5516868",
"0.54875404",
"0.5485673",
"0.54714286",
"0.5470428",
"0.54601... | 0.74620134 | 0 |
saves the network configuration to a file argv = commandline arguments, requires the element (e element, such as 'interfaces', or e all) to save, and a file name (f) to save the settings to | def cmd_save argv
setup argv
e = @hash['elements']
filepath = @hash['filepath'] || "config.json"
response = @api.save(e, filepath)
msg response
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_config()\nafile = File.open(\"cp3nodes.conf\", \"w\")\nafile.puts \"1 127.0.0.1 25500 25501 25502\\n\"\nafile.puts \"2 127.0.0.1 25503 25504 25505\\n\"\nafile.puts \"3 127.0.0.1 25506 25507 25508\\n\"\nafile.close\nend",
"def save(fn)\n begin\n File.open(fn,\"w\") do |file|\n output = ... | [
"0.623356",
"0.6000239",
"0.5849585",
"0.58137697",
"0.57539123",
"0.5667529",
"0.5590036",
"0.5588363",
"0.5563063",
"0.5497579",
"0.54847336",
"0.5457971",
"0.54107577",
"0.53860587",
"0.5378316",
"0.5337453",
"0.5304921",
"0.5254505",
"0.5216638",
"0.52010626",
"0.5181774"... | 0.66596174 | 0 |
Converts the range to an equivalent exclusive range (one where exclude_end? is true) Only works for ranges with discrete steps between values (i.e. integers) | def exclusive
if exclude_end?
self
else
Range.new(self.begin, self.end + 1, true)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_range\n min .. max\n end",
"def split_range(range)\n start, finish = range.begin, range.end\n start += length if start < 0\n finish += length if finish < 0\n \n [start, finish - start - (range.exclude_end? ? 1 : 0)]\n end",
"def to_range\n Range.new(self.start, sel... | [
"0.67048925",
"0.66411984",
"0.661552",
"0.65872425",
"0.638718",
"0.6381692",
"0.63625807",
"0.63625807",
"0.6331616",
"0.6318954",
"0.6271104",
"0.62284017",
"0.6194463",
"0.61927426",
"0.6190236",
"0.6157565",
"0.6144774",
"0.6083266",
"0.60557",
"0.60477036",
"0.60390145"... | 0.73609537 | 0 |
Returns whether the range is empty A range is empty if end < begin or if begin == end and exclude_end? is true. | def empty?
if exclude_end?
self.end <= self.begin
else
self.end < self.begin
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?\n\t interval.first == interval.last && interval.exclude_end?\n end",
"def exclude_end?\n @ranges.size == 1 ? @ranges[0].exclude_end? : nil\n end",
"def exclude_begin?\n @ranges.size == 1 ? @ranges[0].exclude_begin? : nil\n end",
"def empty?\n return false if @upper_bou... | [
"0.77110314",
"0.75511134",
"0.73856896",
"0.6896937",
"0.68835026",
"0.6743136",
"0.6574668",
"0.6466301",
"0.6450598",
"0.64366853",
"0.63932437",
"0.6367697",
"0.63334817",
"0.6279109",
"0.62450194",
"0.6210988",
"0.6195007",
"0.6142625",
"0.6123797",
"0.61012787",
"0.6028... | 0.8152051 | 0 |
GET /steps/new GET /steps/new.json | def new
@step = Step.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @step }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n @step = Step.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end",
"def new\n @step_type = StepType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step_type }\n ... | [
"0.8326137",
"0.7754607",
"0.77181315",
"0.77040356",
"0.76325387",
"0.75851744",
"0.7393559",
"0.73890674",
"0.7377804",
"0.73325866",
"0.73225975",
"0.7298311",
"0.7256544",
"0.7219394",
"0.7219394",
"0.7219394",
"0.72105545",
"0.71799856",
"0.7178456",
"0.7143546",
"0.7133... | 0.82181114 | 1 |
Creates a Zipcode Territory if one does not already exist. A zipcode territory is the first 2 digits of the zipcode for the firm. It then assigns the organization to the territory It then checks all the fields, if any are blank, it registers as an incomplete profile. | def process_before_save
zipcode = organization_zipcode.split('')[0..1].join('') if organization_zipcode.present?
teriitory = Territory.find_by_territory_identifier(zipcode)
unless teriitory
teriitory = Territory.new(territory_identifier: zipcode)
teriitory.save
end
self.territory = terii... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_postal_code\n @postal_code = Faker::Address.zip_code(state_abbreviation: @state)\n @postal_code = '' unless @set_blank == false\n end",
"def hard_code_to_create_country(iso_name, iso, iso3, name, numcode, states_required, zipcode_required)\n @country = Spree::Country.create(iso_nam... | [
"0.5473488",
"0.52503294",
"0.5184183",
"0.5136867",
"0.5084143",
"0.5084143",
"0.50389785",
"0.5036017",
"0.5036017",
"0.5036017",
"0.50329506",
"0.502724",
"0.5026956",
"0.4999854",
"0.4992033",
"0.49822778",
"0.49487337",
"0.4945391",
"0.4931078",
"0.48771018",
"0.48741287... | 0.64824766 | 0 |
If the organization is a customer, it gives us all Chess POs where po_lines have the customer as the organization called on. When a vendor, it shows all PO headers that were made to that vendor | def purchase_orders
case organization_type.type_value
when 'customer'
PoHeader.joins(:po_lines).where('po_lines.organization_id = ?', id).order('created_at desc')
when 'vendor'
PoHeader.where('organization_id = ?', id).order('created_at desc')
else
PoHeader.where('organization_id = ?',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sales_orders\n case organization_type.type_value\n when 'customer'\n SoHeader.where('organization_id = ?', id).order('created_at desc')\n when 'vendor'\n SoHeader.joins(:so_lines).where('so_lines.organization_id = ?', id).order('created_at desc')\n else\n SoHeader.where('organization... | [
"0.61493427",
"0.5473448",
"0.53962165",
"0.5296063",
"0.5255456",
"0.51558846",
"0.5130783",
"0.5066964",
"0.5057077",
"0.5034083",
"0.5027433",
"0.5022828",
"0.50064874",
"0.49958438",
"0.49936822",
"0.49876022",
"0.49786782",
"0.49786782",
"0.49744272",
"0.49582633",
"0.49... | 0.6666557 | 0 |
If the organization is a customer, it gives us all Chess SO to the customer If the organization is a vendor, it shows all SO_lines where the vendor was added as the supplier. TODO: have this backfilled after the lot is chosen. Once a lot is shipped, we know the supplier. By filling this in, we can find all so_line item... | def sales_orders
case organization_type.type_value
when 'customer'
SoHeader.where('organization_id = ?', id).order('created_at desc')
when 'vendor'
SoHeader.joins(:so_lines).where('so_lines.organization_id = ?', id).order('created_at desc')
else
SoHeader.where('organization_id = ?', 0)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customers; (line_items.map(&:customer).flatten.compact.uniq rescue []); end",
"def sales\n sales_this_vendor_made = []\n sales_to_check = FarMar::Sale.all\n sales_to_check.each do |sale_to_check|\n if self.id == sale_to_check.vendor_id\n sales_this_vendor_made << sale_to_check\n ... | [
"0.5410528",
"0.5398075",
"0.5268887",
"0.5240552",
"0.5187056",
"0.5175252",
"0.5175252",
"0.5089801",
"0.5068672",
"0.50150645",
"0.49938476",
"0.4980419",
"0.49351025",
"0.4890124",
"0.4882353",
"0.4875101",
"0.4873243",
"0.4858815",
"0.48545456",
"0.4836993",
"0.48176032"... | 0.5707799 | 0 |
All po line items which have a PO header to them (vendor only) used for listing vendor items | def po_items
# po_items = self.po_headers.joins(:po_lines).select("po_lines.item_id").where("po_headers.organization_id = ?",self.id).order("po_lines.created_at DESC")
po_items = PoLine.includes(:po_header).where('po_headers.organization_id = ?', id).order('po_headers.created_at DESC')
po_items = po_items.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fulfilled_line_items\n return self.order_line_items.where(:status => 'shipped').all\n end",
"def line_items_for_customer(customer_id)\n ret_line_items = []\n my_line_items = delivery_details.find_all_by_customer_id(customer_id)\n my_line_items.each do |my_line_item|\n my_line_item.order... | [
"0.6084435",
"0.5931355",
"0.58267266",
"0.56693834",
"0.5661872",
"0.56595933",
"0.5624584",
"0.5621584",
"0.5589917",
"0.5576402",
"0.5571669",
"0.55144733",
"0.54868376",
"0.5481903",
"0.5469212",
"0.5452932",
"0.54120755",
"0.5409425",
"0.5391925",
"0.53228915",
"0.526590... | 0.6458787 | 0 |
When an address is set as default, a type_category matching the comments in the method contact_type_category is created in the mastertype table. The below method creates the string using the contact_type_category method And then searches for it returning the default address (probably uses the contact id under the attri... | def default_address
type_category = contact_type_category('address')
MasterType.find_by_type_category(type_category)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_address\n type_category = contactable.contact_type_category('address')\n\n MasterType.find_by_type_category_and_type_value(type_category, id)\n end",
"def contact_type_category(type)\n 'default_' + type + '_of_org_' + id.to_s\n end",
"def define_address_type\n if @address_type.nil?\... | [
"0.73766905",
"0.6837767",
"0.5996671",
"0.5986107",
"0.58268756",
"0.5826182",
"0.5783171",
"0.578068",
"0.57455057",
"0.56673944",
"0.56240344",
"0.5600963",
"0.55686855",
"0.55672014",
"0.5553719",
"0.5537314",
"0.54946166",
"0.5483968",
"0.5414645",
"0.5367014",
"0.534175... | 0.75310737 | 0 |
Connects to Azure and translate the toot's content | def translate_toot(toot, token)
toot_content = toot.content.strip_tags
translation_url =
"http://api.microsofttranslator.com/v2/Http.svc/Translate?" +
"text=" + toot_content + "&to=en&from=ja"
begin
response = Curl.get(translation_url) do |response|
response.headers['Authorization'] = "Bearer ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(items)\n return nil if super(items).nil?\n\n url = 'https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to='\n @uri = URI.parse(url + @langs.key(@settings['translation_language']))\n @headers = { 'Ocp-Apim-Subscription-Key' => @settings['api_key'] }\n ['Content-Type', 'Ac... | [
"0.6183417",
"0.616856",
"0.6140199",
"0.60634655",
"0.58402056",
"0.58127576",
"0.56791383",
"0.55997115",
"0.5583961",
"0.5516086",
"0.55159795",
"0.5418572",
"0.5408986",
"0.52271056",
"0.52140695",
"0.518717",
"0.5174988",
"0.5174988",
"0.5174988",
"0.5174988",
"0.5174988... | 0.69592875 | 0 |
GET /client_events GET /client_events.json | def index
@client_events = ClientEvent.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def get_events\n Resources::Event.parse(reques... | [
"0.7801329",
"0.74775034",
"0.7406579",
"0.73452014",
"0.72535944",
"0.71210814",
"0.7117756",
"0.7093984",
"0.7072594",
"0.7023973",
"0.7013762",
"0.69860274",
"0.6932043",
"0.69098604",
"0.6866279",
"0.68397945",
"0.68276334",
"0.6827364",
"0.67713875",
"0.6745214",
"0.6731... | 0.7582464 | 1 |
POST /client_events POST /client_events.json | def create
@client_event = ClientEvent.new(client_event_params)
respond_to do |format|
if @client_event.save
format.html { redirect_to @client_event, notice: 'Client event was successfully created.' }
format.json { render :show, status: :created, location: @client_event }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @event = Event.new(event_params)\n @event.user = current_user\n @event.client = Client.find(params[:event][:client_id])\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show,... | [
"0.7194454",
"0.7095184",
"0.69364196",
"0.6768759",
"0.6691625",
"0.6639225",
"0.66091347",
"0.65675455",
"0.65646034",
"0.6539156",
"0.6537612",
"0.65373",
"0.65210396",
"0.650589",
"0.6489856",
"0.6485164",
"0.6449328",
"0.64478916",
"0.644352",
"0.644352",
"0.64017564",
... | 0.7536565 | 0 |
PATCH/PUT /client_events/1 PATCH/PUT /client_events/1.json | def update
respond_to do |format|
if @client_event.update(client_event_params)
format.html { redirect_to @client_event, notice: 'Client event was successfully updated.' }
format.json { render :show, status: :ok, location: @client_event }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j... | [
"0.71390975",
"0.68285114",
"0.67913556",
"0.6673604",
"0.66540617",
"0.66480815",
"0.6642359",
"0.6626081",
"0.659541",
"0.6568784",
"0.6568784",
"0.65275955",
"0.6510078",
"0.6482932",
"0.6427157",
"0.64257115",
"0.6400649",
"0.63769853",
"0.6369708",
"0.6366965",
"0.636368... | 0.7116103 | 1 |
Returns whether to use WSSE digest. Defaults to +false+. | def digest?
!!@digest
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def digest?\n mechanism == :digest\n end",
"def digest?\n mechanism == :digest\n end",
"def digest?\n type == :digest\n end",
"def digest?\n !!asset_config[\"digest\"]\n end",
"def secure?\n false\n end",
"def digest\n serve_assets == \"local_dynam... | [
"0.6633049",
"0.6550017",
"0.6339106",
"0.6265998",
"0.542191",
"0.53634596",
"0.53450143",
"0.5307047",
"0.52868557",
"0.52820957",
"0.52300596",
"0.52300596",
"0.5218898",
"0.51919043",
"0.51839936",
"0.5159496",
"0.5158406",
"0.51576203",
"0.5148059",
"0.51427096",
"0.5139... | 0.6833854 | 1 |
Returns a random String of 100 characters. | def random_string
(0...100).map { ("a".."z").to_a[rand(26)] }.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_string\n\t# generate a bucket of chars for randomization\n\tbucket = [('a'..'z'),('A'..'Z'),(0..9)].map{|i| i.to_a}.flatten\n\t # pick random chars from the bucket and return a 255 char string\n\treturn (0...255).map{ bucket[rand(bucket.length)] }.join\nend",
"def random_big_string offset = rand(1..5... | [
"0.79790276",
"0.7601809",
"0.75339526",
"0.75045025",
"0.74976283",
"0.7492114",
"0.7491424",
"0.7474522",
"0.7456702",
"0.7442442",
"0.7417522",
"0.74075186",
"0.739285",
"0.73904014",
"0.73853624",
"0.7362929",
"0.7351046",
"0.7320435",
"0.73202103",
"0.7314947",
"0.729174... | 0.80276877 | 1 |
Returns the current target framerate (frames/second). | def target_framerate
if @target_frametime
1000.0 / @target_frametime
else
nil
end
rescue ZeroDivisionError
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def framerate\n\t\t\t\t# below is same as: return @ticks / (lifetime / 1000.0)\n\t\t\t\treturn 1000.0 * @ticks / lifetime()\n\t\t\trescue ZeroDivisionError\n\t\t\t\treturn 0\n\t\t\tend",
"def getFramesPerSecond\n @framesPerSecond\n end",
"def frame_interval\n 1.0/@fps\n end",
"def frame_interval\n ... | [
"0.82842237",
"0.7603003",
"0.75797176",
"0.75797176",
"0.75797176",
"0.7559734",
"0.7525969",
"0.7448878",
"0.7386453",
"0.724796",
"0.71540594",
"0.70360285",
"0.70153373",
"0.6926557",
"0.6914581",
"0.68974066",
"0.68974066",
"0.68310887",
"0.68310887",
"0.6795025",
"0.679... | 0.7960962 | 1 |
Sets the target number of frames per second to +framerate+. | def target_framerate=( framerate )
if framerate
@target_frametime = 1000.0 / framerate
else
@target_frametime = nil
end
rescue ZeroDivisionError
@target_frametime = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frame_rate=(rate)\n @list.each { |c| c.change_frame_rate(@fps, rate) }\n @fps = rate\n end",
"def set_frame_rate(rate)\n @cue_list.frame_rate = rate\n end",
"def fps=(fps)\n validator = EnumAttributeValidator.new('Float', [12, 15, 23.976, 24, 25, 29.97, 30])\n unless validato... | [
"0.6792937",
"0.65795815",
"0.65573776",
"0.65374345",
"0.65290767",
"0.636487",
"0.63075143",
"0.61844426",
"0.5878046",
"0.5878046",
"0.5878046",
"0.5653454",
"0.56234765",
"0.5623449",
"0.5623449",
"0.5623449",
"0.5623449",
"0.5623449",
"0.5623449",
"0.5623449",
"0.5623449... | 0.8092805 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.