query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
GET /expenses/1 GET /expenses/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def index\n @api_v1_expenses = Api::V1::Expense.all\n ... | [
"0.7852153",
"0.76643664",
"0.7582055",
"0.73080707",
"0.73080707",
"0.73080707",
"0.73080707",
"0.73080707",
"0.7251809",
"0.72369164",
"0.72013515",
"0.71863693",
"0.70798296",
"0.6971261",
"0.69470507",
"0.6900109",
"0.6899645",
"0.6838902",
"0.68240345",
"0.67582136",
"0.... | 0.0 | -1 |
POST /expenses POST /expenses.json | def create
@expense = Expense.new(expense_params)
respond_to do |format|
if @expense.save
format.html { redirect_to @expense, notice: 'Expense was successfully created.' }
format.json { render :show, status: :created, location: @expense }
else
format.html { render :new }
format.json { render json: @expense.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def create\n # Get the variables passed in from params on create\n @expense = Expense.new(expense_param... | [
"0.7261324",
"0.7084191",
"0.70350605",
"0.6900912",
"0.6822504",
"0.67079735",
"0.65698487",
"0.65261096",
"0.6502184",
"0.6492159",
"0.6477112",
"0.6404915",
"0.640302",
"0.6383205",
"0.63663673",
"0.63563615",
"0.6343615",
"0.63217306",
"0.63024414",
"0.6295727",
"0.629067... | 0.6843917 | 4 |
PATCH/PUT /expenses/1 PATCH/PUT /expenses/1.json | def update
respond_to do |format|
if @expense.update(expense_params)
format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }
format.json { render :show, status: :ok, location: @expense }
else
format.html { render :edit }
format.json { render json: @expense.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end",
"def update\n @expense = Expense.find params.fetch(:id)\n\n if @expense.update(expense_params)\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n ... | [
"0.74732983",
"0.7248082",
"0.72346777",
"0.709356",
"0.7013842",
"0.700139",
"0.686158",
"0.686158",
"0.68436813",
"0.67908907",
"0.6763711",
"0.67226046",
"0.6672167",
"0.6638457",
"0.6638457",
"0.66367996",
"0.660783",
"0.659185",
"0.65893495",
"0.65851796",
"0.6558547",
... | 0.67052156 | 14 |
DELETE /expenses/1 DELETE /expenses/1.json | def destroy
@expense.destroy
respond_to do |format|
format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n ... | [
"0.7657695",
"0.7657695",
"0.7635413",
"0.762301",
"0.75940335",
"0.7556879",
"0.7556879",
"0.74879384",
"0.74002934",
"0.7357415",
"0.7357415",
"0.7334415",
"0.7239536",
"0.72328955",
"0.7210207",
"0.71496665",
"0.71335983",
"0.7113668",
"0.71059626",
"0.7101808",
"0.7090992... | 0.72726315 | 15 |
Use callbacks to share common setup or constraints between actions. | def set_expense
@expense = Expense.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def expense_params
params.require(:expense).permit(:date, :description, :amount, :category_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Omniauth setup phase hook, that is used to dynamically set up a omniauth strategy for provider on customer basis | def auth_setup
service = Person::OmniauthService::SetupPhase.new(community: @current_community, params: params, request: request)
service.run
render :plain => "Setup complete.", :status => 404 #This notifies the ominauth to continue
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n case\n when session.delete(:only_dtu)\n request.env['omniauth.strategy'].options[:login_url] = '/login?only=dtu&template=dtu_user'\n when session.delete(:prefer_dtu)\n request.env['omniauth.strategy'].options[:login_url] = '/login?template=dtu_user'\n when session.delete(:public)\... | [
"0.73006517",
"0.7193139",
"0.6808927",
"0.6621159",
"0.65283954",
"0.6527101",
"0.62718433",
"0.6267364",
"0.6242243",
"0.61745125",
"0.6172827",
"0.6151476",
"0.61464876",
"0.61355233",
"0.6134691",
"0.61205226",
"0.6083893",
"0.6047887",
"0.6046003",
"0.59811467",
"0.59738... | 0.7395827 | 0 |
Callback from Omniauth failures | def failure
origin_locale = get_origin_locale(request, available_locales())
I18n.locale = origin_locale if origin_locale
error_message = params[:error_reason] || "login error"
kind = request.env["omniauth.error.strategy"].name.to_s || "Facebook"
flash[:error] = t("devise.omniauth_callbacks.failure",:kind => kind.humanize, :reason => error_message.humanize)
redirect_to search_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fail\n render :text => request.env[\"omniauth.auth\"].to_yaml\n end",
"def on_failure!(response)\n session.authentication.errors.clear!\n session.authentication.errors.add(:openid, 'OpenID verification failed, maybe the provider is down? Or the session timed out')\n nil\n ... | [
"0.72447765",
"0.69695884",
"0.68047315",
"0.6513187",
"0.65073943",
"0.6391501",
"0.6367987",
"0.63227403",
"0.62982416",
"0.62861043",
"0.6266558",
"0.6257491",
"0.62568986",
"0.62526715",
"0.62526095",
"0.6170803",
"0.61645913",
"0.61423445",
"0.6131171",
"0.61293465",
"0.... | 0.7093228 | 1 |
run callback if timedout | def check_run(year, yeartick, yearlen)
if !@ticklimit
@callback.call
else
if year > @minyear or (year == @minyear and yeartick >= @minyeartick)
@minyear = year
@minyeartick = yeartick + @ticklimit
if @minyeartick > yearlen
@minyear += 1
@minyeartick -= yearlen
end
@callback.call
end
end
rescue
puts_err "onupdate cb #$!", $!.backtrace
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeout!; end",
"def on_timeout(options = {})\n timeout = options[:timeout] || 0.5\n\n sleep timeout\n\n yield\n end",
"def timeout_after(time); end",
"def timeout; end",
"def timeout; end",
"def timeout; end",
"def start_timed_out\n end",
"def timedout?(last_access); end",
"def on_t... | [
"0.70447934",
"0.6986087",
"0.69137585",
"0.68287736",
"0.68287736",
"0.68287736",
"0.680392",
"0.67015237",
"0.6655743",
"0.6555242",
"0.6509908",
"0.64775056",
"0.6459655",
"0.64354587",
"0.6414269",
"0.63517815",
"0.63355803",
"0.63016963",
"0.6269472",
"0.6263596",
"0.624... | 0.0 | -1 |
delete the callback for onupdate ; use the value returned by onupdate_register | def onupdate_unregister(b)
@onupdate_list.delete b
if @onupdate_list.empty?
DFHack.onupdate_active = false
DFHack.onupdate_minyear = DFHack.onupdate_minyeartick = 0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_update; end",
"def after_update; end",
"def after_update; end",
"def after_update_callback\n puts('----------after_updateをコール----------')\n end",
"def after_update\n end",
"def after_update\n end",
"def on_update(&update_callback)\n @update_callbacks << update_callback\n end",
"d... | [
"0.8190901",
"0.76737213",
"0.76737213",
"0.7635677",
"0.7524111",
"0.7524111",
"0.73023075",
"0.7276052",
"0.72458506",
"0.71878207",
"0.7135902",
"0.6955954",
"0.69158435",
"0.68502814",
"0.6599085",
"0.65932757",
"0.65648407",
"0.6551384",
"0.65483665",
"0.6541374",
"0.653... | 0.69774365 | 11 |
same as onupdate_register, but remove the callback once it returns true | def onupdate_register_once(*a)
handle = onupdate_register(*a) {
onupdate_unregister(handle) if yield
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_update_callback cb\n\t\t\t@update_callbacks.delete cb\n\t\tend",
"def on_update(&update_callback)\n @update_callbacks << update_callback\n end",
"def add_update_callback &cb\n\t\t\t@update_callbacks << cb\n\t\t\tcb\n\t\tend",
"def after_update_callback\n puts('----------after_updateをコール... | [
"0.6971363",
"0.68902653",
"0.6884721",
"0.68627286",
"0.67858887",
"0.6746627",
"0.6698707",
"0.65706336",
"0.65681237",
"0.65681237",
"0.6491961",
"0.6491961",
"0.6468902",
"0.64397025",
"0.6425761",
"0.6392026",
"0.6154841",
"0.6114577",
"0.6048724",
"0.602921",
"0.6010057... | 0.6853553 | 5 |
this method is called by dfhack every 'onupdate' if onupdate_active is true | def onupdate
@onupdate_list ||= []
ticks_per_year = TICKS_PER_YEAR
ticks_per_year *= 72 if gametype == :ADVENTURE_MAIN or gametype == :ADVENTURE_ARENA
@onupdate_list.each { |o|
o.check_run(cur_year, cur_year_tick, ticks_per_year)
}
if onext = @onupdate_list.sort.first
DFHack.onupdate_minyear = onext.minyear
DFHack.onupdate_minyeartick = onext.minyeartick
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_update; end",
"def update() end",
"def after_update; end",
"def after_update; end",
"def update\n run_callbacks :update do\n true\n end\n end",
"def after_update\n end",
"def after_update\n end",
"def after_update\n true\n end",
"def update ; end",
"def af... | [
"0.7552531",
"0.71937674",
"0.71727675",
"0.71727675",
"0.70702696",
"0.69972545",
"0.69972545",
"0.69237024",
"0.68888617",
"0.6878756",
"0.679569",
"0.6773571",
"0.67702633",
"0.67127323",
"0.67127323",
"0.67127323",
"0.67127323",
"0.67127323",
"0.67127323",
"0.67127323",
"... | 0.6301687 | 52 |
delete the callback for onstatechange ; use the value returned by onstatechange_register | def onstatechange_unregister(b)
@onstatechange_list.delete b
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onstatechange(newstate)\n @onstatechange_list ||= []\n @onstatechange_list.each { |cb| cb.call(newstate) }\n end",
"def onstatechange(newstate)\n @onstatechange_list ||= []\n @onstatechange_list.each { |cb| cb.call(newstate) }\n end",
"def onstatech... | [
"0.71614426",
"0.71614426",
"0.6394786",
"0.6394786",
"0.6378013",
"0.61333764",
"0.61212856",
"0.61084485",
"0.60863596",
"0.6000661",
"0.5999841",
"0.5953311",
"0.5854173",
"0.58467174",
"0.58413976",
"0.57923764",
"0.5788757",
"0.5772229",
"0.5754699",
"0.57387626",
"0.573... | 0.7015332 | 3 |
same as onstatechange_register, but autounregisters if the block returns true | def onstatechange_register_once
handle = onstatechange_register { |st|
onstatechange_unregister(handle) if yield(st)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_state(state, &block)\n end",
"def on_actuator_state(&block)\n\t\t\t@on_actuator_state = block\n\t\tend",
"def register_state_handler(state, &block)\n register(state_key(state), &block)\n end",
"def register_state_handler(state, &block)\n register(\"state_#{state}\", &block)\n end",
... | [
"0.66989094",
"0.6476662",
"0.62296855",
"0.619848",
"0.60056406",
"0.5990404",
"0.59616053",
"0.59616053",
"0.5945412",
"0.5945412",
"0.59400636",
"0.59400636",
"0.5933006",
"0.59223443",
"0.58912086",
"0.586281",
"0.58574593",
"0.5852536",
"0.5852536",
"0.5852188",
"0.57215... | 0.79283726 | 1 |
this method is called by dfhack every 'onstatechange' | def onstatechange(newstate)
@onstatechange_list ||= []
@onstatechange_list.each { |cb| cb.call(newstate) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def on_data_changed; end",
"def state\n end",
"def fire_state_changed\n @sce = ChangeEvent.new(self) if @sce.nil?\n fire_handler :STATE_... | [
"0.6405733",
"0.6405733",
"0.6405733",
"0.6405733",
"0.6405733",
"0.6405733",
"0.6405733",
"0.6405733",
"0.621362",
"0.6182524",
"0.61487603",
"0.60473204",
"0.59840256",
"0.59840256",
"0.59840256",
"0.59454995",
"0.5939994",
"0.5933506",
"0.58022386",
"0.57971865",
"0.574544... | 0.5854729 | 19 |
return true if the argument is under the cursor | def at_cursor?(obj)
same_pos?(obj, cursor)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def needs_cursor?\n\t\ttrue\n\tend",
"def needs_cursor?\n\t\ttrue\n\tend",
"def cursor_left?\r\n @item_window.index % 2 == 0\r\n end",
"def needs_cursor?; end",
"def needs_cursor?\r\n \ttrue\r\n \t end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def n... | [
"0.6748322",
"0.6748322",
"0.67130995",
"0.66899663",
"0.6686582",
"0.66680133",
"0.66680133",
"0.66680133",
"0.66680133",
"0.66680133",
"0.66680133",
"0.66680133",
"0.6663039",
"0.6663039",
"0.6663039",
"0.6663039",
"0.6663039",
"0.6663039",
"0.6663039",
"0.66532105",
"0.664... | 0.7357218 | 1 |
returns true if both arguments are at the same x/y/z | def same_pos?(pos1, pos2)
pos1 = pos1.pos if pos1.respond_to?(:pos)
pos2 = pos2.pos if pos2.respond_to?(:pos)
pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Point3dEqual(arg0, arg1)\n ret = _invoke(1610743875, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def ==(c) \n (@x == c.x) && (@y == c.y)\n end",
"def == point\t\n\t\t@x == point.x && @y == point.y\t\n\tend",
"def isEqual(p)\n ... | [
"0.69228035",
"0.67688966",
"0.6671872",
"0.66445565",
"0.6627033",
"0.66072893",
"0.66033715",
"0.65441424",
"0.6525725",
"0.65117407",
"0.650433",
"0.641483",
"0.63972193",
"0.6378879",
"0.6365862",
"0.6334743",
"0.6315819",
"0.6298482",
"0.6279416",
"0.6261196",
"0.6256398... | 0.70263106 | 1 |
try to match a userspecified name to one from the raws uses caseswitching and substring matching eg match_rawname('coal', ['COAL_BITUMINOUS', 'BAUXITE']) => 'COAL_BITUMINOUS' | def match_rawname(name, rawlist)
rawlist.each { |r| return r if name == r }
rawlist.each { |r| return r if name.downcase == r.downcase }
may = rawlist.find_all { |r| r.downcase.index(name.downcase) }
may.first if may.length == 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_name?(gotten_name, requested_name)\n gotten_name.text.strip.downcase == requested_name.downcase\n end",
"def proper_name(name)\n return name if name =~ /[[:upper:]]/\n\n name.gsub(/\\b[[:alpha:]]+/) { |w| w =~ PARTICLE_REGEX ? w : w.capitalize }\n end",
"def origName(name)\n\t\tretur... | [
"0.7314645",
"0.6519375",
"0.64724416",
"0.6466073",
"0.6461452",
"0.64281964",
"0.64281315",
"0.64148",
"0.6413963",
"0.6401176",
"0.63648754",
"0.63614166",
"0.6334101",
"0.63312757",
"0.6298522",
"0.6288812",
"0.6278815",
"0.6278449",
"0.6250826",
"0.6248937",
"0.6245844",... | 0.7954118 | 1 |
global alias so we can write 'df.world.units.all[0]' | def df
DFHack
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def systemOfUnits \n \"systemOfUnits\" \n end",
"def unit\n return @units[@index]\n end",
"def unit\n return @units[@index]\n end",
"def get_units(dimension)\n nil\n end",
"def units\n attribute('yweather:units')\n end",
"def units\n @units = SQF.units @this\n ... | [
"0.6253005",
"0.6218855",
"0.6218855",
"0.617125",
"0.60599464",
"0.6035692",
"0.6006734",
"0.59391373",
"0.5906701",
"0.5829076",
"0.5816485",
"0.5725521",
"0.5705413",
"0.5693525",
"0.55649716",
"0.55614126",
"0.55238646",
"0.5523828",
"0.5517844",
"0.5488671",
"0.544142",
... | 0.0 | -1 |
Returns true if the version is in the range of this VersionRange object. Uses OSGi versioning rules to determine if the version is in range. | def in_range(version)
return in_range(version.min) && (version.max_infinite ? true : in_range(version.max)) if version.is_a?(VersionRange)
result = min_inclusive ? min <= version : min < version
if (!max_infinite)
result &= max_inclusive ? max >= version : max > version
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match?(version)\n return false if version < lower_bound\n return include_lower_bound? if version == lower_bound\n return true if upper_bound.nil?\n return false if version > upper_bound\n return include_upper_bound? if version == upper_bound\n true\n end",
"def in_range?\n return self.r... | [
"0.6728251",
"0.6130454",
"0.6048944",
"0.60476685",
"0.60186523",
"0.6000444",
"0.59901667",
"0.59349054",
"0.5924388",
"0.5917354",
"0.5915489",
"0.5898391",
"0.5898391",
"0.5890496",
"0.5881358",
"0.58742887",
"0.5874032",
"0.5818609",
"0.57542723",
"0.5750041",
"0.569864"... | 0.7289303 | 0 |
returns these dates in EPOCH TIME | def now
tzt.to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def epoch_from_date(date)\n\tdate.to_time.to_i\nend",
"def epoch_time\n return time + epoch\n end",
"def epoch_now()\n Time.now.to_i\n end",
"def last_epoch_time; end",
"def epochday\n @line1[20...32].to_f\n end",
"def parse_date(number)\n EPOCH + number\n end",
... | [
"0.6863598",
"0.67042524",
"0.6690243",
"0.64514947",
"0.638965",
"0.6343367",
"0.6325309",
"0.6278664",
"0.62366605",
"0.6153587",
"0.61094064",
"0.6105131",
"0.60223585",
"0.5977445",
"0.5949432",
"0.5912672",
"0.587298",
"0.5781985",
"0.57798475",
"0.57548463",
"0.5728489"... | 0.0 | -1 |
Below code is used in manager portal page for assignning and unassigning the skill to secretaries | def eligible_secretaries
comm = Communication.find(params[:commID].to_i, :include => [:receiver => [:service_provider_employee_mappings => [:skills, :service_provider]]])
providers = []
comm.receiver.service_provider_employee_mappings.each do|p|
p.skills.each do|s|
if s.skill_type_id == params[:skillID].to_i
providers << p.service_provider
break
end
end
end
@eligible_secretaries = providers
render :partial => "eligible_secretaries"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_skill\n @skill = policy_scope(Skill).find(params[:id])\n authorize(@skill)\n end",
"def set_learnable_skill\n @learnable_skill = LearnableSkill.find(params[:id])\n end",
"def setup_change_skill\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n skill = $data... | [
"0.6360636",
"0.6320044",
"0.6278272",
"0.612025",
"0.6069391",
"0.59727085",
"0.5959961",
"0.5959599",
"0.58318317",
"0.58237493",
"0.5820707",
"0.5808836",
"0.5804556",
"0.57919794",
"0.5791363",
"0.57837635",
"0.5779786",
"0.57516694",
"0.57420963",
"0.5737335",
"0.5730548... | 0.0 | -1 |
Below code is before_filter only for ['new','create','named_views_secretarys_task'] | def get_service_session
@sp_session = current_service_session
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_filter; end",
"def run_filters\n set_user\n authorize\n end",
"def index\n @task_filter = if params.has_key? :task_filter\n TaskFilter.new(params[:task_filter])\n else\n TaskFilter.new\n end\n\n @task_deletion =... | [
"0.6676479",
"0.5921187",
"0.588122",
"0.5863533",
"0.5811481",
"0.5804265",
"0.57233775",
"0.5614183",
"0.56137395",
"0.55888265",
"0.55788594",
"0.5575768",
"0.55272156",
"0.54966336",
"0.54893523",
"0.5485913",
"0.54840595",
"0.54778594",
"0.54534185",
"0.54460675",
"0.542... | 0.0 | -1 |
Below code execute on clcik of add button while creating session notes entry. | def add_new_record
@com_notes_entry= Communication.new
@index = params[:index].to_i
matter_contact_records
render :partial => 'communications/field',:locals=>{:emp_id=>params[:emp_id]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_notes\n end",
"def click_create_new_note\n logger.debug 'Clicking the New Note button'\n wait_for_update_and_click new_note_button_element\n end",
"def custom_action\n :new_note\n end",
"def click_save_new_note\n logger.debug 'Clicking the new note Save button'\n wait_for... | [
"0.6531403",
"0.6243501",
"0.61153203",
"0.5926735",
"0.5835627",
"0.57856447",
"0.5701386",
"0.5697841",
"0.56111133",
"0.55980676",
"0.55967903",
"0.5582339",
"0.5575413",
"0.5545498",
"0.55367446",
"0.55336636",
"0.5522595",
"0.5509467",
"0.5508807",
"0.5508807",
"0.550880... | 0.0 | -1 |
Below code is before_filter only for ['add_new_record','new'] | def matter_contact_records
get_comp_id = get_company_id
@contacts = Contact.get_contact_records(current_company,get_comp_id)
@matters = Matter.get_matter_records(get_comp_id, get_employee_user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\t\tpre_new\n\tend",
"def before_create_save(record); end",
"def before_create()\n end",
"def before_create\n @added = true\n super\n end",
"def before_filter; end",
"def new_record?; end",
"def new_record?; end",
"def after_create_save(record); end",
"def aa_add_new\n ... | [
"0.71086025",
"0.68594503",
"0.68331736",
"0.68326193",
"0.6678914",
"0.64111745",
"0.64111745",
"0.6319246",
"0.62625295",
"0.62143826",
"0.6094404",
"0.6061116",
"0.6055378",
"0.6052322",
"0.60434544",
"0.60434544",
"0.60434544",
"0.60434544",
"0.59550214",
"0.59178275",
"0... | 0.0 | -1 |
Below code create new notes. | def new
# Below code is use to create 4 array object of Communication
@com_notes_entries= Array.new(4){Communication.new}
assignmentuser_id = @sp_session.assignment.nil? ? @sp_session.user.id : @sp_session.assignment.user.id
lawfirm_user = User.find assignmentuser_id
matter_contact_records
@salutations = CompanyLookup.get_salutations(lawfirm_user)
@employee = User.find(assignmentuser_id).employee
@designations = Designation.get_companys_designation(lawfirm_user.company.id)
params[:to_date]=(Date.today+1.week).to_s
@outstanding_tasks = UserTask.get_outstanding_tasks(assignmentuser_id,is_secretary_or_team_manager?,params[:to_date])
@task_completed = UserTask.get_task_completed_to_secretary(assignmentuser_id,is_secretary_or_team_manager?)
@my_instructions = Communication.get_my_instructions( lawfirm_user.company.id,assignmentuser_id)
respond_to do |format|
format.html
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_notes\n end",
"def create_new_note\n note_type = params[:note_type][:note_type_id]\n new_note = keytech_note_handler.create(note_type, params[:element_key])\n new_note.subject = params[:subject]\n new_note.text = params[:body]\n response = keytech_note_handler.save(new_note)\n if re... | [
"0.88576674",
"0.7713706",
"0.7570108",
"0.75609124",
"0.7538372",
"0.74609864",
"0.7432908",
"0.7386994",
"0.7371634",
"0.7366263",
"0.73415357",
"0.73298675",
"0.7264616",
"0.7159805",
"0.71367335",
"0.7074874",
"0.7068432",
"0.7058423",
"0.7050091",
"0.7047972",
"0.7030824... | 0.0 | -1 |
Below code save new notes. | def create
begin
UserTask.transaction do
# Below code is use to append created_by_user_id,performed_by,:user_id,assigned_to to the @com_notes_entries array object.
com_notes_entries = params[:com_notes_entries].values.collect { |com_notes_entries| Communication.new(com_notes_entries.merge!(:created_by_user_id =>current_user.id,:assigned_to_user_id=>current_user.id,:assigned_by_employee_user_id =>get_employee_user_id,:company_id=>get_company_id))}
# below code is use to count the number of notes saved.
cnt=0
# Below mention transaction block basically revert Task entry and even revert the Communication "status: field to update.
# Added by Ajay Arsud Date:09 Sept 2010
com_notes_entries.each do |com_notes_entries|
unless com_notes_entries.description.blank?
com_notes_entries.note_priority = com_notes_entries.note_priority == 0? 1 : 2
cnt =cnt+1 if com_notes_entries.save!
if com_notes_entries.is_actionable.eql?(false)
task = UserTask.new(:name=>com_notes_entries.description,:created_by_user_id=>@current_user.id,:tasktype=>6,:note_id=>com_notes_entries.id,:assigned_by_employee_user_id=>com_notes_entries.assigned_by_employee_user_id,:assigned_to_user_id=>@current_user.id,:status=>'complete',:completed_at =>Time.now,:completed_by_user_id => @current_user.id,:priority=>com_notes_entries.note_priority.to_i == 1? 1 : 2)
com_notes_entries.update_attributes(:status =>'complete')
task.save
end
end
end
cnt >= 1? (cnt>1?flash[:notice] = "#{cnt} #{t(:text_notes_were)} successfully assigned." : flash[:notice] = "#{cnt} #{t(:text_note_was)} successfully assigned.") : (flash[:error]="Error while assigning the notes. Please enter all details.")
redirect_to :action => 'new'
end
rescue
redirect_to :action => 'new'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_note(note)\n self.notes = notes.present? ? \"\\n\\n#{note}\" : note\n save\n end",
"def create_notes\n end",
"def save\n if @id\n # run an UPDATE query if it is in the database\n DB[:conn].execute(\"UPDATE notes SET text='#{@text}', is_complete='#{@is_complete}' WHERE id=#{@id}\")\... | [
"0.7558285",
"0.7546625",
"0.73355824",
"0.71755743",
"0.7157353",
"0.7055497",
"0.70492655",
"0.7048036",
"0.69547063",
"0.69547063",
"0.691969",
"0.691969",
"0.691969",
"0.691969",
"0.686743",
"0.6848943",
"0.68312025",
"0.6755147",
"0.672135",
"0.6639261",
"0.66220534",
... | 0.0 | -1 |
Below code is used to show the task detials to edit. | def edit_task
authorize!(:edit_task,current_user)unless current_user.role?(:secretary)
data=params
@task = UserTask.find(data[:id])
@asset = @task.note_id if @task
@com_notes_entries = Communication.find(@asset, :include => [:receiver => :service_provider_employee_mappings]) #@com_notes_entries.receiver.service_provider_employee_mappings
@matters = Matter.team_matters(@com_notes_entries.assigned_by_employee_user_id, @com_notes_entries.company_id) #FIXME: Is the company id right?
lawyer_details(@com_notes_entries)
@contacts = Contact.all(:conditions => ["company_id = ?", @com_notes_entries.company_id], :order => 'first_name')
@skill_list = Physical::Liviaservices::SkillType.all
if data[:previous] =~ /(\d+)\z/
@previous = UserTask.tracked_by(@current_user).find($1)
end
render :layout=> false
rescue ActiveRecord::RecordNotFound
@previous ||= $1.to_i
respond_to_not_found(:js) unless @task
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @notes = @task.task_notes\n @tasks = @task.sub_tasks\n end",
"def edit\n # @task = Task.find(params[:id])\n set_task\n end",
"def edit\n @task = Task.find(params[:id])\n end",
"def edit\n # raise\n @task = Task.find(params[:id])\n # @task =\n end",
"def show\n @ta... | [
"0.69226146",
"0.66530114",
"0.6592081",
"0.6468582",
"0.64632106",
"0.64189357",
"0.64073735",
"0.6284563",
"0.6252969",
"0.6248483",
"0.6228838",
"0.62094325",
"0.6201855",
"0.61999726",
"0.61897767",
"0.61722016",
"0.61302334",
"0.61302334",
"0.61302334",
"0.61293143",
"0.... | 0.60218304 | 25 |
Below code is used to update the task. | def update_task
authorize!(:update_task,current_user)unless current_user.role?(:secretary)
data=params
@note_priority =(data[:com_notes_entries][:note_priority] == 0 ||data[:com_notes_entries][:note_priority].eql?('0'))? 1 : 2
@task = UserTask.find(data[:id].to_i)
@com_notes_entries = Communication.find(data[:task][:note_id].to_i)
if data[:commit].eql?("Save & Exit")
respond_to do |format|
# Below mention transaction block basically revert Task entry and even revert the Communication to update.
# Added by Ajay Arsud Date:09 Sept 2010
UserTask.transaction do
if @task.update_attributes(data[:task].merge!(:assigned_to_user_id => @current_user.id))
@com_notes_entries.update_attributes(data[:com_notes_entries].merge!(:note_priority=>@note_priority))
flash[:notice] = "#{t(:text_task)} " "#{t(:flash_was_successful)} " "#{t(:text_saved)}"
format.html {redirect_to physical_liviaservices_livia_secretaries_url}
else
flash[:error] = t(:flash_task_error)
format.html {redirect_to physical_liviaservices_livia_secretaries_url}
end
end
end
elsif data[:commit].eql?("Assign To")
# Below mention transaction block basically revert Task entry and even revert the Communication to update.
# Added by Ajay Arsud Date:09 Sept 2010
UserTask.transaction do
@task.update_attributes(data[:task])
@task.update_attributes(:priority => @note_priority,:assigned_to_user_id => data[:task][:assigned_to_user_id])
respond_to do |format|
if @task.save
data[:com_notes_entries][:note_priority] = @note_priority
@com_notes_entries.update_attributes(data[:com_notes_entries])
flash[:notice] = "#{t(:text_task)} " "#{t(:flash_was_successful)} " "#{t(:text_assigned)}"
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
else
flash[:error] = t(:flash_task_type)
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
end
end
end
elsif data[:commit].eql?("Complete Task")
# Below mention transaction block basically revert Task entry and even revert the Communication to update.
# Added by Ajay Arsud Date:09 Sept 2010
UserTask.transaction do
@task.update_attributes(data[:task].merge!(:status => 'complete',:completed_at =>Time.now,:completed_by_user_id => @current_user.id,:assigned_to_user_id => @current_user.id))
respond_to do |format|
if @task.save
if data[:com_notes_entries][:note_priority] == 0 ||data[:com_notes_entries][:note_priority].eql?('0')
@note_priority = 1
else
@note_priority = 2
end
@com_notes_entries.update_attributes(data[:com_notes_entries].merge!(:note_priority=>@note_priority))
flash[:notice] = "#{t(:text_task)} " "#{t(:flash_was_successful)} " "#{t(:text_completed)}"
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
else
flash[:error] = t(:flash_task_type)
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update \n\t logger.debug \"Params --------------------------------------- #{params}\"\n\n\t logger.debug \"task params --------------------------------------#{task_params}\"\n\t format_task_attributes(task_params)\n\t \n\t logger.debug \"-------------------------------------------------------------\"\n\t ... | [
"0.83295304",
"0.80790067",
"0.7988207",
"0.77650857",
"0.7725884",
"0.7685884",
"0.763715",
"0.7635538",
"0.7635098",
"0.7621154",
"0.7618731",
"0.75391346",
"0.75151587",
"0.75008655",
"0.74234",
"0.7389905",
"0.73669827",
"0.73576945",
"0.7344472",
"0.73399514",
"0.7337498... | 0.0 | -1 |
Below code is used to covert notes to task. | def update
data=params
employee = Employee.find(params[:id])
if update_lawyer_preferences(employee)
flash[:notice] = "Lawyer preferences updated successfully"
redirect_to :back
return true
else
flash[:error] = "<ul>" + employee.errors.full_messages.collect {|e| "<li>" + e + "</li>"}.join(" ") + "</ul>"
redirect_to :back
return false
end
@com_notes_entries = Communication.find(data["id"].to_i)
@note_priority = (data[:com_notes_entries][:note_priority] == 0 ||data[:com_notes_entries][:note_priority].eql?('0'))? 1 : 2
notes = data[:com_notes_entries][:description] if data[:com_notes_entries][:description]
# Below code is common in "Complete Task" and "Assign To" logic.
if data[:commit].eql?("Complete Task") || data[:commit].eql?("Assign To")
notes_type = data[:task][:tasktype] unless data[:task][:tasktype].blank?
task_details = {}
task_details.merge!(data[:task])
task_details.merge!(:name=>notes,:tasktype =>notes_type,:priority=>@note_priority)
end
if data[:commit].eql?("Save & Exit")
respond_to do |format|
if @com_notes_entries.update_attributes(:description=>notes,:more_action =>data[:com_notes_entries][:more_action], :matter_id =>data[:com_notes_entries][:matter_id], :contact_id=>data[:com_notes_entries][:contact_id],:note_priority=>@note_priority.to_i)
flash[:notice] = "#{t(:text_task)} " "#{t(:flash_was_successful)} " "#{t(:text_saved)}"
format.html {redirect_to physical_liviaservices_livia_secretaries_url}
else
format.html { render :action => "show" }
end
end
elsif data[:commit].eql?("Complete Task")
task_details.merge!(data[:task])
task_details.merge!(:assigned_to_user_id =>@current_user.id,:status=>'complete',:completed_at=>Time.now,:completed_by_user_id=>@current_user.id)
@task= UserTask.new(task_details)
respond_to do |format|
# Below mention transaction block basically revert Task entry and even revert the Communication to update.
# Added by Ajay Arsud Date:09 Sept 2010
UserTask.transaction do
if @task.save
@com_notes_entries = Communication.find(data["id"].to_i)
@task.update_attributes(:company_id=>@com_notes_entries.company_id)
@com_notes_entries.update_attributes(:status => 'complete')
flash[:notice] = "#{t(:text_task)} " "#{t(:flash_was_successful)} " "#{t(:text_completed)}"
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
else
flash[:error] = t(:flash_task_type)
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
end
end
end
elsif data[:commit].eql?("Assign To")
task_details.merge!(:assigned_to_user_id =>data[:task][:assigned_to_user_id])
@task = UserTask.new(task_details)
respond_to do |format|
# Below mention transaction block basically revert Task entry and even revert the Communication to update.
# Added by Ajay Arsud Date:09 Sept 2010
Communication.transaction do
if @task.save
@com_notes_entries = Communication.find(data["id"].to_i)
@task.update_attributes(:company_id=>@com_notes_entries.company_id)
@com_notes_entries.update_attributes(:status => 'complete')
flash[:notice] = "#{t(:text_task)} " "#{t(:flash_was_successful)} " "#{t(:text_assigned)}"
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
else
flash[:error] = t(:flash_task_type)
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def description\n \"This task simply attaches a note entity to the current entity.\"\nend",
"def create\n note_id = task_params[\"note_id\"]\n new_task_params = task_params\n new_task_params.delete(\"note_id\")\n @task = Task.new(new_task_params)\n if task_params[\"color\"].nil?\n @task.colo... | [
"0.6265846",
"0.6215131",
"0.60967374",
"0.6085407",
"0.6057565",
"0.596471",
"0.5945023",
"0.5945023",
"0.58952194",
"0.5885392",
"0.5874794",
"0.58742714",
"0.58129007",
"0.57929397",
"0.5774158",
"0.5745813",
"0.5685189",
"0.5685189",
"0.5683511",
"0.5661293",
"0.56471914"... | 0.0 | -1 |
Below code is used to show the details of the notes before converting it to task. | def show
data=params
#Below code is to find details for the notes.
@com_notes_entries = Communication.find(data[:com_id].to_i) #@com_notes_entries.receiver.service_provider_employee_mappings
@matters = Matter.team_matters(@com_notes_entries.assigned_by_employee_user_id, @com_notes_entries.company_id) #FIXME: Is the company id right?
lawyer_details(@com_notes_entries)
company_id = CompanyLookup.find_by_lvalue_and_company_id("Rejected", @com_notes_entries.company_id).id
@contacts = Contact.all(:conditions => ["company_id = ? AND status_type != ?", company_id, @com_notes_entries.company_id], :order => 'first_name')
@task = UserTask.new
@skill_list = Physical::Liviaservices::SkillType.all
if data[:related]
model, id = data[:related].split("_")
instance_variable_set("@asset", model.classify.constantize.find(id))
end
render :layout => false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notes\n @notes\n end",
"def notes_show_formatted\n Observation.show_formatted(notes)\n end",
"def notes; end",
"def notes; end",
"def notes; end",
"def show\n @notes = @task.task_notes\n @tasks = @task.sub_tasks\n end",
"def notes\n run(helm('get', 'notes', name))\n ... | [
"0.7144478",
"0.7135806",
"0.69757557",
"0.69757557",
"0.69757557",
"0.69607174",
"0.6893777",
"0.682769",
"0.6802575",
"0.6799512",
"0.6798337",
"0.67829776",
"0.6738023",
"0.6717798",
"0.6717798",
"0.6717798",
"0.6717798",
"0.6679622",
"0.66640913",
"0.6637172",
"0.66075385... | 0.0 | -1 |
Below code is used when clicked on the "Secretarys Task" in left side bar on communication page. | def named_views_secretarys_task
@task_assigned = UserTask.all(:conditions => ["assigned_to_user_id = ? AND (status is null OR status != 'complete')", @sp_session.assignment.user.id], :order => "created_at DESC")
@task_completed = UserTask.all(:conditions => ["completed_by_user_id = ? AND status like ? AND completed_at >= ?", @sp_session.assignment.user.id, "complete", 1.week.ago], :order => "created_at DESC")
render :partial => 'named_views_secretarys_task'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_matter_task(activity)\n name = activity[:activity_name]\n link = link_to_remote(truncate(h(activity[:activity_name]), :length => 15), :url => edit_activity_calendars_path(:id=> activity[:activity_id],:height=>350,:width=>680, :home=> true), :class=>\"thickbox vtip\", :method=>:post)\n new_tooltip... | [
"0.5853781",
"0.58313626",
"0.5820317",
"0.56921417",
"0.5687608",
"0.56618243",
"0.5656846",
"0.55965",
"0.5572417",
"0.55124485",
"0.5489414",
"0.54826856",
"0.54826856",
"0.54826856",
"0.54677594",
"0.54600036",
"0.5452335",
"0.5445387",
"0.5427383",
"0.53597677",
"0.53597... | 0.54226375 | 19 |
Below code is used in show and edit_task to get lawyer details. | def lawyer_details(notes)
@allowed_ids=[]
lawyer = Employee.find_by_user_id(notes.assigned_by_employee_user_id, :include => [:company => :employees])
lawyer.company.employees.each do |employee|
@allowed_ids << employee.user_id
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_lawyer\n end",
"def find_lawyer\n @lawyer = Lawyer.find(params[:id])\n end",
"def display_resource(buyer)\n buyer.full_name\n end",
"def show_lawyer_list\n authorize!(:show_lawyer_list,current_user) unless current_user.role?:secretary\n #session[:verified_secretary_id1] = params[:serv... | [
"0.7035812",
"0.6722092",
"0.650128",
"0.6281326",
"0.6265311",
"0.6115404",
"0.60529023",
"0.60156167",
"0.5943066",
"0.5914389",
"0.58577037",
"0.5847701",
"0.5845466",
"0.5815475",
"0.5815475",
"0.58088773",
"0.5803934",
"0.58010787",
"0.5788795",
"0.576335",
"0.5759148",
... | 0.69658023 | 1 |
added for search matter and contact for autocomplete | def get_matter_details
get_comp_id = get_company_id
@matters = Matter.search_results(get_company_id, get_employee_user_id, params["q"], true, nil, 'my_all').uniq
@contacts = Contact.search_communication_contact(params[:q],current_company,get_comp_id)
respond_to do |format|
if params[:from] == "matters"
format.js { render :partial=> 'comm_matter_auto_complete', :object => @matters,:locals=>{:from=>"matters"} }
format.html { render :partial=> 'comm_matter_auto_complete',:object => @matters,:locals=>{:from=>"matters"} }
else
format.js { render :partial=> 'comm_matter_auto_complete', :object => @contacts,:locals=>{:from=>"contacts"}}
format.html { render :partial=> 'comm_matter_auto_complete', :object => @contacts,:locals=>{:from=>"contacts"}}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autocomplete; end",
"def contact_autocomplete(type, options)\n set_search_path\n Contact.where(\"type = :type AND matchcode ILIKE :term\", :type => type, :term => \"%#{options[:term]}%\").limit(20).map {|c| {:id => c.id, :label => c.to_s}}\n end",
"def autocomplete\r\n# return '' unless sessi... | [
"0.73838806",
"0.7332649",
"0.68955564",
"0.6794047",
"0.67873037",
"0.675239",
"0.67342377",
"0.66615826",
"0.6620139",
"0.6597149",
"0.6590058",
"0.65092415",
"0.6495667",
"0.64929533",
"0.6490873",
"0.6479817",
"0.6459309",
"0.6451394",
"0.64343727",
"0.6433693",
"0.642784... | 0.61608994 | 56 |
for searchng matter and contact in communication index page by imagedrop | def get_matter_info
get_comp_id = get_company_id
@contacts = Contact.get_contact_records(current_company,get_comp_id)
@matters = Matter.get_matter_records(get_comp_id, get_employee_user_id)
render :update do |page|
if params[:comm_cnt_id].present?
page.replace_html "contact_drop_#{params[:comm_cnt_id]}_span", :partial=>"verify_matter", :locals => { :contacts => @contacts,:com_id=>params[:comm_cnt_id],:from=>"contacts" }
else
page.replace_html "comm_mtr_#{params[:com_id]}_span", :partial=>"verify_matter", :locals => { :matters => @matters,:com_id=>params[:com_id],:from=>"matters" }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advanced_search # :nologin: :norobots:\n begin\n query = find_query(:Image)\n show_selected_images(query)\n rescue => err\n flash_error(err.to_s) if !err.blank?\n redirect_to(:controller => 'observer', :action => 'advanced_search')\n end\n end",
"def index\n if params.key?(:s... | [
"0.6049769",
"0.58802927",
"0.5831796",
"0.57925856",
"0.5761551",
"0.5739531",
"0.5704575",
"0.5685991",
"0.5670842",
"0.56465226",
"0.56358856",
"0.56270206",
"0.55961597",
"0.55772674",
"0.5566132",
"0.5565407",
"0.5550157",
"0.553893",
"0.5517671",
"0.5512236",
"0.5504696... | 0.53051233 | 59 |
Retrieves a specific enquiry. | def enquiries_get(id, opts = {})
data, _status_code, _headers = enquiries_get_with_http_info(id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inquiry(inquiry, options = {})\n get(\"inquiries/#{inquiry}\", options).pop\n end",
"def show\n @enquiry = Enquiry.new\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(... | [
"0.7656498",
"0.7073781",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.6613011",
"0.61701363",
"0.5994193",
"0.5910172",
"0.5828734",
"0.5828734",
"0.5730599",
"0.56073195",
"0.5590675",
"0.5580071",
"0.5531131",
"0.5516563",
"0.551... | 0.5456451 | 26 |
Retrieves a specific enquiry. | def enquiries_get_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_get ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling EnquiriesApi.enquiries_get"
end
# resource path
local_var_path = '/v1/enquiries/{id}'.sub('{' + 'id' + '}', id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'text/html', 'application/xml', 'text/xml'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'DomainPublicAdapterWebApiModelsV1EnquiriesEnquiryReport')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: EnquiriesApi#enquiries_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inquiry(inquiry, options = {})\n get(\"inquiries/#{inquiry}\", options).pop\n end",
"def show\n @enquiry = Enquiry.new\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(... | [
"0.7656498",
"0.7073781",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.6613011",
"0.61701363",
"0.5994193",
"0.5910172",
"0.5828734",
"0.5828734",
"0.5730599",
"0.56073195",
"0.5590675",
"0.5580071",
"0.5531131",
"0.5516563",
"0.551... | 0.50877565 | 56 |
Sends an enquiry for listing, agency, etc... (based on the enquiry type and referenceid). Recipients and template will be automatically selected. | def enquiries_post(enquiry, opts = {})
data, _status_code, _headers = enquiries_post_with_http_info(enquiry, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enquiry(enquiry)\n @enquiry = enquiry\n\n mail :to => Rails.configuration.enq_to_address, :subject => \"B&B availability request for Bull Farm Oast\", :bcc => Rails.configuration.enq_bcc_address, :reply_to => enquiry.email \n end",
"def inquiry(inquiry)\n @inquiry = inquiry\n @greeting = \"咨询\"\... | [
"0.6753966",
"0.671804",
"0.6641258",
"0.66005546",
"0.65287817",
"0.65119916",
"0.6456055",
"0.63947916",
"0.62793857",
"0.62793857",
"0.62793857",
"0.62793857",
"0.62793857",
"0.62793857",
"0.62793857",
"0.6167682",
"0.61347187",
"0.6133035",
"0.61269325",
"0.6119145",
"0.6... | 0.5529786 | 73 |
Sends an enquiry for listing, agency, etc... (based on the enquiry type and referenceid). Recipients and template will be automatically selected. | def enquiries_post_with_http_info(enquiry, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_post ...'
end
# verify the required parameter 'enquiry' is set
if @api_client.config.client_side_validation && enquiry.nil?
fail ArgumentError, "Missing the required parameter 'enquiry' when calling EnquiriesApi.enquiries_post"
end
# resource path
local_var_path = '/v1/enquiries'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'text/html', 'application/xml', 'text/xml'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'text/html', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(enquiry)
auth_names = ['oauth2']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'DomainEnquiryServiceV1ModelGroupEnquiryServiceModelsEnquiryResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: EnquiriesApi#enquiries_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enquiry(enquiry)\n @enquiry = enquiry\n\n mail :to => Rails.configuration.enq_to_address, :subject => \"B&B availability request for Bull Farm Oast\", :bcc => Rails.configuration.enq_bcc_address, :reply_to => enquiry.email \n end",
"def inquiry(inquiry)\n @inquiry = inquiry\n @greeting = \"咨询\"\... | [
"0.6754216",
"0.67178786",
"0.6641498",
"0.6600392",
"0.6528532",
"0.6511498",
"0.6455065",
"0.63949484",
"0.62789315",
"0.62789315",
"0.62789315",
"0.62789315",
"0.62789315",
"0.62789315",
"0.62789315",
"0.616759",
"0.6134839",
"0.6131733",
"0.61263883",
"0.6118745",
"0.6087... | 0.0 | -1 |
Searches enquiries based on agents or agencies. | def enquiries_search(opts = {})
data, _status_code, _headers = enquiries_search_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enquiries_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_search ...'\n end\n # resource path\n local_var_path = '/v1/enquiries'\n\n # query parameters\n query_params = {}\n query... | [
"0.62912035",
"0.5943017",
"0.5818383",
"0.5763571",
"0.55510765",
"0.5463672",
"0.5458465",
"0.54349744",
"0.54203886",
"0.53927994",
"0.5341064",
"0.53291506",
"0.53019464",
"0.5286",
"0.52757335",
"0.5264768",
"0.5256553",
"0.5240246",
"0.5238153",
"0.5225142",
"0.51921916... | 0.68223643 | 0 |
Searches enquiries based on agents or agencies. | def enquiries_search_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_search ...'
end
# resource path
local_var_path = '/v1/enquiries'
# query parameters
query_params = {}
query_params[:'agencyId'] = opts[:'agency_id'] if !opts[:'agency_id'].nil?
query_params[:'agentId'] = opts[:'agent_id'] if !opts[:'agent_id'].nil?
query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'text/html', 'application/xml', 'text/xml'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'Array<DomainPublicAdapterWebApiModelsV1EnquiriesEnquiryReport>')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: EnquiriesApi#enquiries_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enquiries_search(opts = {})\n data, _status_code, _headers = enquiries_search_with_http_info(opts)\n data\n end",
"def all_search\n @results ||= []\n feat_keyword ||= {:name_contains => params[:q]}\n reward_keyword ||= {:partner_business_name_contains => params[:q]}\n\n Feat.search(f... | [
"0.68223643",
"0.5943017",
"0.5818383",
"0.5763571",
"0.55510765",
"0.5463672",
"0.5458465",
"0.54349744",
"0.54203886",
"0.53927994",
"0.5341064",
"0.53291506",
"0.53019464",
"0.5286",
"0.52757335",
"0.5264768",
"0.5256553",
"0.5240246",
"0.5238153",
"0.5225142",
"0.51921916... | 0.62912035 | 1 |
route: add_item_cart POST /cart/add_item(.:format) cartsadd_item | def add_item
product_id = params[:product_id].to_s
modify_cart_delta(product_id, +1)
redirect_to :back
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add\n\t\tadd_to_cart(params[:item_obj], params[:qty])\n flash[:notice] = \"Succesfully added to your cart!\"\n\t\tredirect_to :controller => \"items\", :action => \"show\"\n\tend",
"def add_item_to_cart\n product_id = params[:product_id]\n @item = LineItem.create!(product_id: product_id, cart_i... | [
"0.7826361",
"0.77205575",
"0.76614505",
"0.7575464",
"0.7511385",
"0.7424134",
"0.74231166",
"0.7410437",
"0.7384941",
"0.7355176",
"0.7320388",
"0.7294891",
"0.7254877",
"0.7238063",
"0.72168064",
"0.7194003",
"0.7194003",
"0.7194003",
"0.7189589",
"0.7173619",
"0.7166893",... | 0.7200069 | 15 |
route: remove_item_cart POST /cart/remove_item(.:format) cartsremove_item | def remove_item
product_id = params[:product_id].to_s
modify_cart_delta(product_id, -1)
redirect_to :back
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_item\r\n cart_item_id = params[:id].to_i\r\n session[:cart].delete(cart_item_id)\r\n\r\n flash[:info] = 'Item has been removed!'\r\n redirect_to cart_url\r\n end",
"def remove_from_cart\n #see if you can change number of items in cart\n item_id = params[:remove_from_cart][:item_id]\... | [
"0.7956798",
"0.79337883",
"0.7791225",
"0.77619106",
"0.7696895",
"0.7645814",
"0.7348551",
"0.73236763",
"0.72768754",
"0.7234894",
"0.7226352",
"0.722203",
"0.722203",
"0.71857285",
"0.71670955",
"0.7165987",
"0.7148073",
"0.7123608",
"0.71204686",
"0.7099394",
"0.7096567"... | 0.7750645 | 4 |
Finds the latest date of issue WSJ runs MonFri with Front Page, Onipion, and Money & Investing so, on the weekend returns the previous Friday, either 24 or 48 hours ago in yyyymmdd | def pubdate(format="%Y%m%d")
t = Time.now
case t.strftime("%A")
when 'Saturday'
(t-(48*60*60)).strftime(format)
when 'Sunday'
(t-(24*60*60)).strftime(format)
else
t.strftime(format)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prev_working_date(date)\n cwday = date.cwday\n days = 0\n while true\n days -= 1\n cwday -= 1\n if cwday == 0\n cwday = 7\n end\n break unless non_working_week_days.include?(cwday) || days < -7\n ... | [
"0.64499897",
"0.64085466",
"0.6347102",
"0.6332013",
"0.62868994",
"0.62403786",
"0.6228187",
"0.6228187",
"0.6174297",
"0.6171379",
"0.6138157",
"0.6114922",
"0.60781854",
"0.6076616",
"0.6047179",
"0.6047179",
"0.60168594",
"0.59650683",
"0.59397316",
"0.59099984",
"0.5862... | 0.0 | -1 |
Downloads and scrapes the Today's Paper section of wsj.com | def get_new_articles
# Download the RSS feed and save to self.doc
get_source
# Keep track of which articles are in the feed
articles = []
article_links = (self.doc/'li.mjItemMain').collect do |mjItem|
mjItem.at('a.mjLinkItem')
end
# For each item in the RSS feed
article_links.each_with_index do |link, index|
# Create or update the article in the db
articles << Article.factory(
:category => self.category,
:description => '',
:feed => self,
:url => "http://online.wsj.com#{link.attributes['href']}",
:priority => index
)
end
articles
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download\n @doc = Nokogiri::HTML(open(@url))\n\tend",
"def download\n if platinum_user_and_above?\n urls=SiteUrl.where(\"site is not null\")\n workbook = RubyXL::Workbook.new\n worksheet = workbook.worksheets[0]\n worksheet.sheet_name = 'urls'\n header = [\"Site\",\"Url\",\... | [
"0.65615314",
"0.63855296",
"0.6320158",
"0.62340295",
"0.6208372",
"0.61435944",
"0.60363513",
"0.6026494",
"0.5920664",
"0.5916873",
"0.58959883",
"0.5844194",
"0.57742417",
"0.5763967",
"0.57567656",
"0.5755375",
"0.5755358",
"0.5744359",
"0.573881",
"0.5736781",
"0.573487... | 0.0 | -1 |
This method should return a list of serverfeatures. This is for example 'versioning' and is added to the DAV: header in an OPTIONS response. | def features
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_flags\n res = get_request 'features'\n if res.status == 200\n JSON.parse(res.body, symbolize_names: true)\n else\n @config.logger.error(\"[LDClient] Unexpected status code #{res.status}\")\n {}\n end\n end",
"def all_flags\n res = get_request 'features'\n ... | [
"0.6962645",
"0.6962645",
"0.66653997",
"0.65692395",
"0.63687974",
"0.6288781",
"0.6042794",
"0.6041703",
"0.5943413",
"0.59104997",
"0.58123845",
"0.57798815",
"0.5773977",
"0.5635589",
"0.5611153",
"0.5602541",
"0.55978733",
"0.55978286",
"0.55961347",
"0.5551353",
"0.5518... | 0.54884017 | 21 |
Use this method to tell the server this plugin defines additional HTTP methods. This method is passed a uri. It should only return HTTP methods that are available for the specified uri. | def http_methods(_path)
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def http_methods\n reload if executed_requests['GET'].nil? || executed_requests['GET']['headers'].nil? || executed_requests['GET']['headers'].empty?\n (executed_requests['GET']['headers']['Allow'] || \"GET\").split(/,\\s*/)\n end",
"def parse_http_methods!(req)\n if (method = req.params['_method'... | [
"0.6038416",
"0.5975979",
"0.58222145",
"0.5746334",
"0.57386875",
"0.57345146",
"0.57337415",
"0.5721152",
"0.57161534",
"0.57161534",
"0.56956637",
"0.56931037",
"0.56319016",
"0.5613789",
"0.5595842",
"0.55587375",
"0.55545336",
"0.55020386",
"0.5484724",
"0.54841757",
"0.... | 0.6450332 | 0 |
Returns a plugin name. Using this name other plugins will be able to access other plugins using \Sabre\DAV\Server::getPlugin | def plugin_name
self.class.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plugin_name\n name.split('::').last.underscore.to_sym\n end",
"def plugin_name\n @plugin_name ||= instance[:name]\n end",
"def plugin_name\n instance[:name]\n end",
"def plugin_name\n @@name || self.class.name\n end",
"def plugin_name\n s = @event.at('@pluginN... | [
"0.83314645",
"0.7881166",
"0.78111",
"0.7722512",
"0.7526759",
"0.74359274",
"0.7414494",
"0.68823963",
"0.6871244",
"0.6769277",
"0.67598736",
"0.6758391",
"0.6627354",
"0.63714135",
"0.6365459",
"0.6333212",
"0.63240296",
"0.6273711",
"0.62600756",
"0.62538457",
"0.6253313... | 0.7157317 | 7 |
Returns a bunch of metadata about the plugin. Providing this information is optional, and is mainly displayed by the Browser plugin. The description key in the returned array may contain html and will not be sanitized. | def plugin_info
{
'name' => plugin_name,
'description' => nil,
'link' => nil
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Generates HTML indexes and debug information for your sabre/dav server',\n 'link' => 'http://sabre.io/dav/browser-plugin/'\n }\n end",
"def plugin_info\n {\n 'n... | [
"0.731031",
"0.6975837",
"0.6779127",
"0.671048",
"0.66537756",
"0.6532279",
"0.6531967",
"0.6520701",
"0.64915174",
"0.63981205",
"0.6397866",
"0.63945514",
"0.63911355",
"0.6344642",
"0.6331503",
"0.6317602",
"0.6305746",
"0.62706506",
"0.62706506",
"0.62682104",
"0.6258005... | 0.7458092 | 0 |
before_action :verify_user_is_area_admin, only: [:new, :create, :edit, :update, :destroy] | def index
if current_user.coach.nil?
@coach = Coach.first
else
@coach = current_user.coach
end
# @coach = current_user.coach
@junior_teams = Team.for_juniors(1000, @coach.organization)
@senior_teams = Team.for_seniors(1000, @coach.organization)
@seniorb_teams = Team.for_seniorb(1000, @coach.organization)
@coaches = Coach.alphabetical.active.all
@organizations = Organization.alphabetical.all
@top_juniors = IndivStanding.for_juniors(10, @coach.organization)
@top_seniors = IndivStanding.for_seniors(10, @coach.organization)
@top_seniorb = IndivStanding.for_seniorb(10, @coach.organization)
@improved_juniors = ResultCalculator.find_most_improved(@coach.organization, Division.find_by_name("juniors"))
@improved_seniors = ResultCalculator.find_most_improved(@coach.organization, Division.find_by_name("seniors"))
@improved_seniorb = ResultCalculator.find_most_improved(@coach.organization, Division.find_by_name("seniorb"))
render template: 'dashboards/coach_dashboard'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_admin\n :authenticate_user!\n have_no_rights('restricted area') unless current_user.isAdmin?\nend",
"def admin_area &block\n capture(&block) if current_user && current_user.admin?\n end",
"def isAdmin\n \n end",
"def admin_area(&block)\n if admin?\n yield\n end\n end",
"def... | [
"0.76303256",
"0.71692306",
"0.68710583",
"0.68340254",
"0.6819351",
"0.6788042",
"0.6788042",
"0.67702895",
"0.66242266",
"0.6584962",
"0.6565099",
"0.6561352",
"0.6524774",
"0.6504416",
"0.64939594",
"0.64934623",
"0.64926994",
"0.64926994",
"0.64817804",
"0.64793813",
"0.6... | 0.0 | -1 |
use in auth_rules(examquestion) return [programme_id] for academician | def lecturers_programme
mypost = Position.find(:first, :conditions => ['staff_id=?',staff_id])
myunit = mypost.unit
postbasics=['Pengkhususan', 'Pos Basik', 'Diploma Lanjutan']
post_prog=Programme.find(:all, :conditions => ['course_type IN(?)', postbasics])
dip_prog=Programme.find(:all, :conditions => ['course_type=?', 'Diploma']).map(&:name)
if dip_prog.include?(myunit)
programmeid=Programme.roots.find(:all, :conditions => ['name=?', myunit]).map(&:id)
else
if myunit=="Pengkhususan" && roles.map(&:authname).include?("programme_manager")
programmeid=post_prog.map(&:id)
elsif postbasics.include?(myunit)
post_prog.map(&:name).each do |pname|
@programmeid=Programme.roots.find(:all, :conditions => ['name=?', pname]) if mypost.tasks_main.include?(pname).pluck(&:id)
end
programmeid=@programmeid
else
programmeid=0 #default val for admin, common_subjects lecturer too
end
end
programmeid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def academic_program\n ::HubEdos::StudentApi::V2::AcademicPolicy::AcademicProgram.new(@data['academicProgram']) if @data['academicProgram']\n end",
"def commonsubject_lecturer_programmeid_list\n unit = Login.current_login.staff.position.unit\n current_lecturer = Login.current_login.staf... | [
"0.6532166",
"0.6142319",
"0.59872055",
"0.56526065",
"0.56071657",
"0.55580777",
"0.5554242",
"0.5437931",
"0.5424791",
"0.54119337",
"0.5396182",
"0.5383893",
"0.53590107",
"0.53560513",
"0.5354479",
"0.5353185",
"0.5343918",
"0.53414756",
"0.5298971",
"0.5289248",
"0.52789... | 0.66381055 | 0 |
use in auth_rules(staff attendance) | def unit_members_thumb
Staff.find(:all, :conditions=> ['id IN?', unit_members]).map(&:thumb_id).compact #[5658]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate_staff_activity\n if not (current_user.role?(\"staff\") || current_user.role?(\"admin\"))\n flash[:notice] = \"对不起,您没有权限访问该网址!\"\n redirect_to root_url\n end\nend",
"def require_staff\n if current_staff.class != Staff\n flash[:notice] = '很抱歉,您没有权限'\n redirect_to root_path\n ... | [
"0.6412877",
"0.6012213",
"0.5993954",
"0.5972326",
"0.5841609",
"0.5827434",
"0.5814818",
"0.5792963",
"0.57737017",
"0.5714488",
"0.5711477",
"0.56935674",
"0.566619",
"0.56576663",
"0.5624784",
"0.56152487",
"0.5601437",
"0.5599299",
"0.5570371",
"0.55095106",
"0.5501692",... | 0.0 | -1 |
Use in Ptdo(for use in auth_rules & Edit pages (approve)) start | def unit_members#(current_unit, current_staff, current_roles)
#Academicians & Mgmt staff : "Teknologi Maklumat", "Perpustakaan", "Kewangan & Akaun", "Sumber Manusia","logistik", "perkhidmatan" ETC.. - by default staff with the same unit in Position will become unit members, whereby Ketua Unit='unit_leader' role & Ketua Program='programme_manager' role.
#Exceptional for - "Kejuruteraan", "Pentadbiran Am", "Perhotelan", "Aset & Stor" (subunit of Pentadbiran), Ketua Unit='unit_leader' with unit in Position="Pentadbiran" Note: whoever within these unit if wrongly assigned as 'unit_leader' will also hv access for all ptdos on these unit staff
current_staff=staff
exist_unit_of_staff_in_position = Position.find(:all, :conditions => ['unit is not null and staff_id is not null']).map(&:staff_id).uniq
if exist_unit_of_staff_in_position.include?(current_staff)
current_unit=staff.position.unit #staff.positions.first.unit
#replace current_unit value if academician also a Unit Leader (23)
#current_roles=User.where(userable_id: userable_id).first.roles.map(&:name) ##"Unit Leader" #userable.roles.map(&:role_id)
current_roles=roles.map(&:name)
current_unit=unit_lead_by_academician if current_roles.include?("Unit Leader") && Programme.roots.map(&:name).include?(current_unit)
if current_unit=="Pentadbiran"
unit_members = Position.find(:all, :conditions => ['unit=? OR unit=? OR unit=? OR unit=?', "Kejuruteraan", "Pentadbiran Am", "Perhotelan", "Aset & Stor"]).map(&:staff_id).uniq-[nil]+Position.find(:all, :conditions => ['unit=?', current_unit]).map(&:staff_id).uniq-[nil]
elsif ["Teknologi Maklumat", "Pusat Sumber", "Kewangan & Akaun", "Sumber Manusia"].include?(current_unit) || Programme.roots.map(&:name).include?(current_unit)
unit_members = Position.find(:all, :conditions => ['unit=?', current_unit]).map(&:staff_id).uniq-[nil]
else #logistik & perkhidmatan inc."Unit Perkhidmatan diswastakan / Logistik" or other UNIT just in case - change of unit name, eg. Perpustakaan renamed as Pusat Sumber
unit_members = Position.find(:all, :conditions => ['unit ILIKE(?)', "%#{current_unit}%"]).map(&:staff_id).uniq-[nil]
end
else
unit_members = []#Position.find(:all, :conditions=>['unit=?', 'Teknologi Maklumat']).map(&:staff_id).uniq-[nil]
end
unit_members #collection of staff_id (member of a unit/dept) - use in model/user.rb (for auth_rules)
#where('staff_id IN(?)', unit_members) ##use in ptdo.rb (controller - index)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_control\n \n end",
"def authorization; end",
"def allow_in_post_mortem; end",
"def admin_logic\n end",
"def pre_authorize_cb=(_arg0); end",
"def pre_authorize_cb; end",
"def policies; end",
"def active_for_authentication? \n \tsuper && approved?\n \t\n\tend",
"def allow_in_pos... | [
"0.6225528",
"0.6057875",
"0.5864551",
"0.58299154",
"0.5822494",
"0.5768441",
"0.5658114",
"0.56534255",
"0.5616913",
"0.55861026",
"0.55698866",
"0.5566668",
"0.55569875",
"0.55569875",
"0.5521171",
"0.55193704",
"0.55150986",
"0.5505747",
"0.5502263",
"0.5471804",
"0.54603... | 0.0 | -1 |
maps a score to 3 rgb values | def scoreToColor(score, minVal, maxVal)
maxColor = 230.0
minColor = 10.0
norm = (((score.to_f - minVal ) / (maxVal - minVal ) ) * (maxColor - minColor)) + minColor
norm = [maxColor, norm].min
return [minColor, norm, norm]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_3f; return [red, green, blue].map {|i| i / 255.0}; end",
"def scores\n {\n 'a' => 1, 'e' => 1, 'i' => 1, 'o' => 1,\n 'u' => 1, 'l' => 1, 'n' => 1, 'r' => 1,\n 's' => 1, 't' => 1, 'd' => 2, 'g' => 2,\n 'b' => 3, 'c' => 3, 'm' => 3, 'p' => 3,\n 'f' => 4, 'h' => 4, 'v' => 4, 'w' => 4,\n 'y... | [
"0.6585143",
"0.64540607",
"0.64525515",
"0.6397052",
"0.6172393",
"0.6146491",
"0.61367965",
"0.61096257",
"0.60897267",
"0.59990287",
"0.5975819",
"0.59694016",
"0.59386694",
"0.5934119",
"0.58882684",
"0.5876459",
"0.5805941",
"0.5764289",
"0.5736834",
"0.5735293",
"0.5707... | 0.69518447 | 0 |
Generate random unique token for the model | def generate_token
self.token = loop do
random_token = SecureRandom.base58(UID_LENGTH)
break random_token unless Session.exists?(token: random_token)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_token\n self.token = UniqueToken.generate\n end",
"def generate_token\n UUIDTools::UUID.random_create.to_s\n end",
"def generate_token\n self.token = SecureRandom.hex if new_record?\n end",
"def generate_token!\n self.token = SecureRandom.hex\n save!\n end",
... | [
"0.8457368",
"0.8455425",
"0.83874255",
"0.8278362",
"0.8253664",
"0.8136916",
"0.80688334",
"0.8067104",
"0.8063123",
"0.80224055",
"0.8009095",
"0.8007525",
"0.7977554",
"0.79563254",
"0.79373723",
"0.79324937",
"0.792361",
"0.79143894",
"0.78944105",
"0.7869692",
"0.786810... | 0.7638131 | 32 |
Set the correct api_host for US/EU | def region(region)
if(region.to_s == 'us')
config['api_host'] = US_API_HOST
elsif(region.to_s == 'eu')
config['api_host'] = EU_API_HOST
else
raise "Region Unknown"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host=(value)\n conf['api']['host'] = value\n end",
"def host\n conf['api']['host']\n end",
"def api_host #:nodoc:\n API_URI\n end",
"def host(host)\n @api.host = host\n end",
"def host\n @host ||= 'api.postmarkapp.com'\n end",
"def host\n @host || \"https://a... | [
"0.7726354",
"0.7395114",
"0.7252886",
"0.7113536",
"0.6820745",
"0.68007284",
"0.67744684",
"0.672256",
"0.6692382",
"0.6591938",
"0.65051657",
"0.64917684",
"0.6483513",
"0.6470143",
"0.64450777",
"0.6434192",
"0.6424697",
"0.64147395",
"0.6388952",
"0.6363906",
"0.6338501"... | 0.67583525 | 8 |
Create the hierarchy of directories based on API namespaces | def __create_directories(key, value)
return if value['documentation']
empty_directory @output.join(key)
create_directory_hierarchy * value.to_a.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_base_dirs\n BASE_DIR.each do |dir|\n FileUtils.mkdir \"#{@project_name}/#{dir}\"\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{dir}\"\n end\n FileUtils.mkdir \"#{@project_name}/app/apis/#{@project_name}\"\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\tapp/apis/#{@project... | [
"0.674889",
"0.66468835",
"0.66454357",
"0.6614416",
"0.6592764",
"0.6554183",
"0.6554183",
"0.644086",
"0.6339784",
"0.6298167",
"0.6298167",
"0.62349814",
"0.6231644",
"0.6224152",
"0.6197502",
"0.6171351",
"0.61546355",
"0.61015356",
"0.60867023",
"0.60748184",
"0.60160327... | 0.64609057 | 7 |
Extract parts from each path | def __endpoint_parts
parts = @spec['url']['paths'].select do |a|
a.keys.include?('parts')
end.map do |path|
path&.[]('parts')
end
(parts.inject(&:merge) || [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parts\n prefix, parts = split_names(@path)\n prefix.empty? ? parts : [prefix] + parts\n end",
"def path_to_parts(path)\n path.\n downcase.\n split('/').\n map { |part| part.empty? ? nil : part.strip }.\n compact\n end",
"def path_comps path\n path.nil? || path.... | [
"0.7646406",
"0.71857566",
"0.6943568",
"0.6903241",
"0.6776759",
"0.6740738",
"0.6617828",
"0.64602107",
"0.63616055",
"0.63610256",
"0.6360628",
"0.6360628",
"0.6358876",
"0.63458794",
"0.6236395",
"0.6206066",
"0.6194004",
"0.61849123",
"0.61780375",
"0.61780375",
"0.61590... | 0.6463575 | 7 |
Find parts that are definitely required and should raise an error if they're not present | def __required_parts
required = []
required << 'body' if (@spec['body'] && @spec['body']['required'])
# Get required variables from paths:
req_variables = __path_variables.inject(:&) # find intersection
required << req_variables unless req_variables.empty?
required.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_required!\n validate_nil_attributes\n\n validate_rubygems_version\n\n validate_required_attributes\n\n validate_name\n\n validate_require_paths\n\n @specification.keep_only_files_and_directories\n\n validate_non_files\n\n validate_self_inclusion_in_files_list\n\n validate_sp... | [
"0.63505703",
"0.626776",
"0.6202635",
"0.61618435",
"0.61610097",
"0.6106957",
"0.60681283",
"0.60567874",
"0.6025397",
"0.5999005",
"0.59525275",
"0.59384006",
"0.5915372",
"0.59115845",
"0.5898733",
"0.5857568",
"0.5852387",
"0.58411586",
"0.58411586",
"0.58411586",
"0.583... | 0.70998764 | 0 |
SetCookie: =[; =]...[; expires=][; domain=][; path=][; secure][; httponly] | def set_cookie options
options ||= {}
@header["Set-Cookie"] = options.collect{|key,value|"#{key}=#{value}"}.join("; ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_cookies(response)\n cookie_str = response.header['set-cookie']\n return if cookie_str.nil?\n\n fields = cookie_str.split(\"; \").inject({}) { |h, field|\n key, value = field.split(\"=\")\n h[key] = value\n\n h\n }\n\n # This is obviously not a generalized cooki... | [
"0.74554664",
"0.7346372",
"0.73437965",
"0.7339657",
"0.722675",
"0.7197083",
"0.7106873",
"0.70891815",
"0.7076132",
"0.70603925",
"0.6939609",
"0.688597",
"0.68459064",
"0.68241686",
"0.68241686",
"0.68169785",
"0.68069786",
"0.6794069",
"0.6794069",
"0.6786588",
"0.675204... | 0.72899604 | 4 |
Ignore any snippets that start with an underscore | def existing_resource_snippets_paths
Dir["#{snippets_path}/*#{template_ext}"].reject { |path| File.basename(path).start_with?('_') }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trim_underscore_prefix(name)\n if config['allow_leading_underscore']\n # Remove if there is a single leading underscore\n name = name.gsub(/^_(?!_)/, '')\n end\n\n name\n end",
"def trim_underscore_prefix(name)\n if config['allow_leading_underscore']\n # Remove if ... | [
"0.6749511",
"0.6742397",
"0.6455024",
"0.64129525",
"0.6198442",
"0.60999143",
"0.6082141",
"0.5985735",
"0.59701395",
"0.59653395",
"0.5923278",
"0.5905598",
"0.58992475",
"0.5886599",
"0.58702534",
"0.5805526",
"0.5800479",
"0.5789538",
"0.5768112",
"0.5757646",
"0.5717575... | 0.5105565 | 96 |
requiring a valid session before exposing any resources. | def require_login
return head(:forbidden) unless current_user || current_employee
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_session; end",
"def set_session\n \n end",
"def setup\n @current_session = new_session\n end",
"def session; end",
"def session; end",
"def session; end",
"def session; end",
"def session_begin(cred, mode)\n #This is a stub, used for indexing\n end",
"def setup\n open_... | [
"0.65562886",
"0.65252805",
"0.6371064",
"0.63681054",
"0.63681054",
"0.63681054",
"0.63681054",
"0.6361802",
"0.62991863",
"0.6265073",
"0.62181467",
"0.6163355",
"0.6130341",
"0.6118251",
"0.6110032",
"0.6087858",
"0.60715157",
"0.6035674",
"0.6031612",
"0.6031612",
"0.6031... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def medicine_params
params.require(:medicine).permit(:rx_name, :pill_count, :pill_size, :employee_id, :pet_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Set locales and regions | def set(locales = nil, regions = nil)
@Locales = locales unless locales.nil?
@Regions = regions unless regions.nil?
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(locales = nil, regions = nil, types = nil)\n @Locales = locales unless locales.nil?\n @Regions = regions unless regions.nil?\n @Types = types unless types.nil?\n self\n end",
"def available_locales=(locales); end",
"def set_locale\n end",
"def confi... | [
"0.70689005",
"0.6920386",
"0.68463564",
"0.65672755",
"0.6469948",
"0.6411923",
"0.6411923",
"0.6380237",
"0.63767344",
"0.6287042",
"0.6249324",
"0.62423474",
"0.62423474",
"0.6151886",
"0.61494565",
"0.6144181",
"0.61401325",
"0.6130125",
"0.6124334",
"0.6116401",
"0.61141... | 0.75364214 | 1 |
Check if timezone is valid | def isValid?
if @Valid.nil?
params = []
joins = ''
where = ''
if not @Locales.empty?
joins += ' LEFT JOIN `Locales` AS L ON TN.Locale = L.ID'
where = 'L.Name COLLATE NOCASE IN (' + Array.new(@Locales.count, '?').join(',') + ') AND '
params += @Locales
end
sql = "SELECT 1 FROM `WindowsZoneNames` TN #{joins} WHERE #{where}TN.`NameLowercase` = ? LIMIT 1"
params << @Name.downcase
@Valid = Data::Storage.getStatement(sql).execute(*params).count > 0
end
@Valid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_timezone\n self.timezone = 'America/Los_Angeles' if self.timezone.nil?\n if not TZInfo::Timezone.get(self.timezone)\n errors.add(:timezone,'invalid timezone')\n end\n end",
"def has_timezone?\n md = self.to_s.match(GRAMMAR)\n md && !!md[2]\n end",
"def has_timezone?\n... | [
"0.81070393",
"0.72459674",
"0.72459674",
"0.72459674",
"0.69781744",
"0.6906113",
"0.68039167",
"0.678006",
"0.6725676",
"0.6663425",
"0.6575564",
"0.6505368",
"0.6474721",
"0.63975865",
"0.6331326",
"0.63050133",
"0.6302639",
"0.63013375",
"0.62901264",
"0.6287064",
"0.6269... | 0.0 | -1 |
If child_id is not set, then link_url is used to find/create a Shadow and set the shadow_id | def create_shadow_if_needed
if self.link_url.present?
self.shadow = Shadow.special_find_or_create_by_web_url( self.link_url )
if( self.shadow.errors.empty? )
write_attribute(:shadow_id, self.shadow.id)
return true
else
errors.add_to_base( self.shadow.errors.full_messages.to_sentence )
return false
end
else
errors.add(:link_url, "can't be blank" )
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_permalink\n if parent_id.nil?\n self.permalink = name.to_url if permalink.blank?\n else\n parent_taxon = Taxon.find(parent_id)\n self.permalink = [parent_taxon.permalink, (permalink.blank? ? name.to_url : permalink.split('/').last)].join('/')\n end\n end",
"def upda... | [
"0.5394538",
"0.53615135",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.52043587",
"0.51849407",
"0.51461846",
"0.51452243",
"0.5120769",
"0.51141423",
"0.51141423",
"0.5099782",
"0.509213... | 0.59551823 | 0 |
This method is used to generate the token from UAA server by providing the UAA url and usename and password. | def get_access_token()
if @api_url[4] != "s"
temp = @api_url[10..@api_url.length]
@uaa_target = "https://uaa#{temp}"
else
temp=@api_url[11..@api_url.length]
@uaa_target = "https://uaa#{temp}"
end
Dir.chdir @home_directory
FileUtils.rm_rf(".uaac.yml")
system("uaac target #{@uaa_target} --skip-ssl-validation >> /dev/null")
print "Enter email:".yellow
@uaa_username = gets.chomp
print "Enter password:".yellow
@uaa_password = STDIN.noecho(&:gets).chomp
puts ""
command = system("uaac token get #{@uaa_username} #{@uaa_password}")
if command != true
puts ""
abort("Invalid Credentials.".red)
else
puts "Token generated Successfully.".green
end
Dir.chdir @home_directory
if Dir.glob(".uaac.yml") != '.uaac.yml'
filehandler = File.open('.uaac.yml','r')
for line in filehandler do
if line[6..17]=="access_token"
length_line = line.length
@access_token = line[20..length_line]
end
end
else
abort("Unable to get Token.".red)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_token\n return api_call('request-token',{\"apiKey\"=> @@_api_key });\n end",
"def create_sandbox_user\n body = { \"providerCallbackHost\": @host }\n @url = 'https://ericssonbasicapi2.azure-api.net/v1_0/apiuser'\n response = Faraday.post(@url) do |req|\n req.headers['Content-T... | [
"0.6511591",
"0.6506689",
"0.6370539",
"0.6330441",
"0.6314617",
"0.6314173",
"0.6268256",
"0.6267854",
"0.6247867",
"0.62304616",
"0.62201935",
"0.62063366",
"0.6200999",
"0.6170968",
"0.613957",
"0.6134499",
"0.6124009",
"0.61170065",
"0.6107336",
"0.6098177",
"0.60938376",... | 0.7330301 | 0 |
This method is used to prompt for getting api url and return the api url. | def get_api_url()
print "Enter the API URL(include http:// or https://)::".yellow
@api_url = gets.chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_url\n @api_url ||=\"#{base_url}#{@options['api_url']}\"\n end",
"def api_url\n authentication_credentials_provided? ? \"https://api.gowalla.com\" : \"http://api.gowalla.com\"\n end",
"def api_url\n @api_url || DEFAULT_API_URL\n end",
"def api_url\n @api_url ||= \"... | [
"0.7048653",
"0.6941984",
"0.6929423",
"0.68975925",
"0.68714154",
"0.6847141",
"0.6720983",
"0.6614052",
"0.65354437",
"0.6501432",
"0.64943826",
"0.6483023",
"0.64439386",
"0.6411442",
"0.6397988",
"0.6387811",
"0.6387811",
"0.63397723",
"0.63294625",
"0.63226765",
"0.62843... | 0.81253964 | 0 |
This method is used to login into cloud foundry account using api url, username, password, organization name, space name. | def cf_login()
command = system("cf login -a #{@api_url} -u #{@uaa_username} -p #{@uaa_password} -o #{@organization_name} -s #{@space_name}")
if command == true
puts "Successfully loggned on as #{@uaa_username}".green
else
abort("Invalid credentials".red)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_0\n\n #definde needed header\n headers = {'Authorization' => \"Basic \" + @base_user_string}\n\n #Login\n response = request({:method => \"POST\", :url => @host + \"login\", :headers => headers})\n\n #Get organisation link\n @org_link = parse_content(response.body, '//Org')[... | [
"0.7438451",
"0.72109944",
"0.6575673",
"0.6426859",
"0.6385089",
"0.6383221",
"0.634048",
"0.63353336",
"0.62812245",
"0.62636894",
"0.6215292",
"0.6185221",
"0.6139858",
"0.6134139",
"0.6127644",
"0.61175114",
"0.6103368",
"0.60997164",
"0.60919964",
"0.6089481",
"0.6076203... | 0.6794371 | 2 |
This is the main method for the automation of application deployment in cloud foundry. | def main()
@home_directory="/home/ubuntu"
@curl_path ="/usr/bin"
@curl_command = "curl"
@dummy_directory="/opt/cloudfoundry/dummy"
@project = "redis"
@zip_path = "/opt/cloudfoundry/gitzip/#{@project}"
@project_directory = "/opt/cloudfoundry/project"
@git_url ="https://github.com/pivotal-cf/cf-redis-example-app/archive/master.zip"
get_api_url()
get_access_token()
print "Enter the Organization name:".yellow
@organization_name = gets.chomp
print "Enter the Space name:".yellow
@space_name = gets.chomp
endpoint = Endpoint.new(@curl_command,@curl_path,@api_url,@access_token)
endpoint.main(@organization_name,@space_name)
space_hash = endpoint.space_hash # since it is needed in service class for checking the service in market place for a particular space.
cf_login()
print "Enter the application name:".yellow
@application_name = gets.chomp
application = Application.new(@curl_command,@curl_path,@application_name,@access_token,@api_url,@zip_path,@project_directory,@git_url)
application.delete_orphan_route()
application.check_for_app(@application_name)
service = Service.new(@curl_command,@curl_path,@organization_name,@space_name,@api_url,@access_token,space_hash)
service.main()
@service_instance_name = service.service_instance
bind = Bind.new
bind.binding_service_to_app(@application_name,@service_instance_name)
start_obj = Start.new
start_obj.start(@application_name)
check = Check.new(@api_url,@curl_command,@curl_path,@dummy_directory,@application_name)
check.push_data()
check.get_data()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deploy_application\n deploy(selfdir + \"app\")\n end",
"def deploy_to_cloud(project_config: {}, cloud_config: {}, local_image_name: '')\n puts \"#{__method__.to_s} enter\"\n\n cloud_info = push_container_image_to_cloud(\n cloud_config: cloud_config,\n local_image_name: lo... | [
"0.73133636",
"0.7040861",
"0.6883963",
"0.6820133",
"0.6757936",
"0.6747921",
"0.66988254",
"0.66682243",
"0.6630242",
"0.65734875",
"0.6507835",
"0.6474247",
"0.6417019",
"0.63874507",
"0.6355456",
"0.6350167",
"0.63293135",
"0.6301211",
"0.62736565",
"0.625333",
"0.6252934... | 0.6789987 | 4 |
GET /sysconfigs/1 GET /sysconfigs/1.json | def show
@sysconfig = Sysconfig.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @sysconfig }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sysconfigs = Sysconfig.order(created_at: :desc).page(params[:page])\n end",
"def index\n @sys_configs = @system.sys_configs.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @sys_configs.to_xml }\n end\n end",
"def get_serv_con... | [
"0.7215372",
"0.71492386",
"0.70465827",
"0.6918086",
"0.6900202",
"0.68822014",
"0.6855901",
"0.6722509",
"0.6722509",
"0.6695499",
"0.6690279",
"0.6644363",
"0.6605443",
"0.65996766",
"0.6530625",
"0.6389129",
"0.6339807",
"0.63157856",
"0.625954",
"0.62510806",
"0.61336136... | 0.76873696 | 0 |
GET /sysconfigs/new GET /sysconfigs/new.json | def new
@sysconfig = Sysconfig.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @sysconfig }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @system_config = SystemConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @system_config }\n end\n end",
"def create\n @sysconfig = Sysconfig.new(params[:sysconfig])\n\n respond_to do |format|\n if @sysconfig.save\n f... | [
"0.7235673",
"0.7187315",
"0.7100649",
"0.6810288",
"0.67672145",
"0.6504352",
"0.64832616",
"0.64733607",
"0.63627243",
"0.63515973",
"0.6278042",
"0.61392987",
"0.6070879",
"0.6056347",
"0.60154986",
"0.59992707",
"0.5959088",
"0.59567565",
"0.59228665",
"0.59183276",
"0.59... | 0.80483764 | 0 |
POST /sysconfigs POST /sysconfigs.json | def create
@sysconfig = Sysconfig.new(params[:sysconfig])
respond_to do |format|
if @sysconfig.save
format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }
format.json { render json: @sysconfig, status: :created, location: @sysconfig }
else
format.html { render action: "new" }
format.json { render json: @sysconfig.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @sysconfig = Sysconfig.new(sysconfig_params)\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render :show, status: :created, location: @sysconfig }\n else\n form... | [
"0.74242145",
"0.7006661",
"0.6665303",
"0.651607",
"0.6507566",
"0.6473905",
"0.63871545",
"0.63316214",
"0.6199562",
"0.61874706",
"0.59439105",
"0.58492786",
"0.5767599",
"0.57276773",
"0.5714163",
"0.56336147",
"0.56314445",
"0.5597371",
"0.55625254",
"0.55252385",
"0.552... | 0.74121094 | 1 |
PUT /sysconfigs/1 PUT /sysconfigs/1.json | def update
@sysconfig = Sysconfig.find(params[:id])
respond_to do |format|
if @sysconfig.update_attributes(params[:sysconfig])
format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @sysconfig.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @sysconfig.update(sysconfig_params)\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { render :show, status: :ok, location: @sysconfig }\n else\n format.html { render :edit }\n for... | [
"0.739974",
"0.7163445",
"0.69778836",
"0.67551184",
"0.66523504",
"0.6626705",
"0.6618349",
"0.6481555",
"0.6279338",
"0.62287104",
"0.61434656",
"0.6092519",
"0.60168856",
"0.5936552",
"0.59056824",
"0.5903177",
"0.58864784",
"0.5867259",
"0.5821404",
"0.57741857",
"0.57499... | 0.7398427 | 1 |
DELETE /sysconfigs/1 DELETE /sysconfigs/1.json | def destroy
@sysconfig = Sysconfig.find(params[:id])
@sysconfig.destroy
respond_to do |format|
format.html { redirect_to sysconfigs_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @sys_config = SysConfig.find(params[:id])\n @sys_config.destroy\n\n respond_to do |format|\n format.html { redirect_to user_system_sys_configs_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sysconfig.destroy\n respond_to do |format|\n format.html { ... | [
"0.74785835",
"0.7477476",
"0.73887104",
"0.7311788",
"0.70314854",
"0.68435985",
"0.6732241",
"0.6670511",
"0.663053",
"0.6564886",
"0.6539986",
"0.6514842",
"0.64910066",
"0.64798516",
"0.64489335",
"0.6424096",
"0.6368141",
"0.63643223",
"0.63249904",
"0.63144207",
"0.6311... | 0.77282345 | 0 |
GET /defenses GET /defenses.json | def index
@defenses = Defense.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def index\n @defense_responses = DefenseResponse.all\n ... | [
"0.75221795",
"0.72220296",
"0.6945406",
"0.6941673",
"0.6874378",
"0.6774466",
"0.6745395",
"0.6710029",
"0.6680765",
"0.66717875",
"0.66627014",
"0.66261905",
"0.65643096",
"0.65643096",
"0.65643096",
"0.65643096",
"0.65643096",
"0.65557337",
"0.6550464",
"0.64772576",
"0.6... | 0.780192 | 0 |
GET /defenses/1 GET /defenses/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @defenses = Defense.all\n end",
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def sho... | [
"0.7389979",
"0.7040264",
"0.69019705",
"0.68452525",
"0.68452525",
"0.68452525",
"0.68452525",
"0.68452525",
"0.6722822",
"0.6648022",
"0.66356015",
"0.65578806",
"0.6501001",
"0.6463238",
"0.63468415",
"0.6333051",
"0.63327265",
"0.63276285",
"0.63043064",
"0.6295408",
"0.6... | 0.0 | -1 |
POST /defenses POST /defenses.json | def create
@defense = Defense.new(defense_params)
respond_to do |format|
if @defense.save
format.html { redirect_to @defense, notice: 'Defense was successfully created.' }
format.json { render :show, status: :created, location: @defense }
else
format.html { render :new }
format.json { render json: @defense.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def create\n # Get the variables passed in from params on create\n @expense = Expense.new(expense_param... | [
"0.6828333",
"0.66891485",
"0.6661024",
"0.6627724",
"0.6517853",
"0.64565474",
"0.6436841",
"0.6415493",
"0.638892",
"0.63604337",
"0.6293899",
"0.6290302",
"0.6284612",
"0.61891246",
"0.61451745",
"0.61402446",
"0.60999316",
"0.60911024",
"0.60643226",
"0.6062161",
"0.60494... | 0.7049325 | 0 |
PATCH/PUT /defenses/1 PATCH/PUT /defenses/1.json | def update
respond_to do |format|
if @defense.update(defense_params)
format.html { redirect_to @defense, notice: 'Defense was successfully updated.' }
format.json { render :show, status: :ok, location: @defense }
else
format.html { render :edit }
format.json { render json: @defense.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense }\n else\n format.html { render :e... | [
"0.68470395",
"0.68042976",
"0.66526896",
"0.66416186",
"0.6534707",
"0.6479547",
"0.6440812",
"0.64405686",
"0.6436137",
"0.6436137",
"0.63496983",
"0.6298905",
"0.629658",
"0.6258257",
"0.6257082",
"0.6252634",
"0.62386525",
"0.62386525",
"0.62386525",
"0.622639",
"0.621395... | 0.6282999 | 13 |
DELETE /defenses/1 DELETE /defenses/1.json | def destroy
@defense.destroy
respond_to do |format|
format.html { redirect_to defenses_url, notice: 'Defense was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html { ... | [
"0.73333275",
"0.72282755",
"0.72282755",
"0.72218657",
"0.7204065",
"0.7186804",
"0.7186804",
"0.7099884",
"0.708687",
"0.7040137",
"0.70333296",
"0.69834936",
"0.69607043",
"0.69562864",
"0.6942919",
"0.69345653",
"0.69345653",
"0.69345653",
"0.69345653",
"0.69345653",
"0.6... | 0.70754033 | 9 |
Use callbacks to share common setup or constraints between actions. | def set_defense
@defense = Defense.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def defense_params
params.require(:defense).permit(:description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Evaluates the underlying RPN expression and returns the final result as a number. | def evaluate
stack = Stack.new
tokens.each do |token|
if numeric?(token)
stack.push(token.to_i)
elsif operator?(token)
args = []
SYMBOL_TABLE[token].arity.times do
# This adds the return value of stack.pop to the beginning of the
# args array
args.unshift(stack.pop)
end
# The *args syntax might be unfamiliar. It's called the "splat"
# operator and among other things it lets you turn an array into
# a list of arguments.
stack.push(call_operator(token, *args))
else
raise "omg what is this token even?"
end
end
stack.pop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval\n return @value unless @value.nil?\n \n debug \"\\nfor RPN expression: #{expression}\\nTerm\\tAction\\tStack\"\n stack = []\n expression.split.each do |term|\n if Operators.has_key?(term)\n a, b = stack.pop(2)\n raise ArgumentError, \"not enough operands on the stack\" if b.... | [
"0.7619665",
"0.72076446",
"0.6806979",
"0.6579995",
"0.64633274",
"0.6404994",
"0.6389471",
"0.6376674",
"0.6341396",
"0.6321771",
"0.6275619",
"0.6210364",
"0.62019825",
"0.61891866",
"0.6162061",
"0.61346906",
"0.61062944",
"0.60767424",
"0.604017",
"0.6017986",
"0.6013602... | 0.0 | -1 |
file is currently the same paper, until we support multiple files per paper. | def mainFile
object
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preservation_file\n if parent.try(:image_resource?)\n @file_set.primary_file\n else\n @file_set.preservation_file || @file_set.primary_file\n end\n end",
"def file\n files.first\n end",
"def file\n files.first\n end",
"def file_name\n self.file_file_name... | [
"0.6361272",
"0.6196004",
"0.6196004",
"0.60841274",
"0.6004241",
"0.59893614",
"0.59893614",
"0.59893614",
"0.59893614",
"0.59893614",
"0.59893614",
"0.59848565",
"0.59285104",
"0.5894201",
"0.5853821",
"0.5844086",
"0.5844086",
"0.5822351",
"0.5804296",
"0.5804296",
"0.5804... | 0.0 | -1 |
Implementation must return user object if login successful | def login(login, password)
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_to_login\n User.login(self.name, self.password)\n end",
"def user\n user = User.find_by_email(email)\n return user if user && user.authenticate(password)\n errors.add :user_authentication, 'invalid credentials'\n nil\n end",
"def user\n user = User.find_by_email(email)\n return u... | [
"0.7688267",
"0.7537561",
"0.7523583",
"0.7509861",
"0.7492866",
"0.73512703",
"0.7322902",
"0.73168355",
"0.7303131",
"0.72990716",
"0.72961223",
"0.7293795",
"0.72626203",
"0.72478175",
"0.7225801",
"0.72189283",
"0.7194552",
"0.7193901",
"0.7192522",
"0.7160053",
"0.715120... | 0.0 | -1 |
computes vat for line_items associated with order, and tax rate and now coupon discounts are taken into account in tax calcs | def compute(order)
rate = self.calculable
tax = 0
return 0 unless order.ship_address.nil? || order.ship_address.country.nil? || rate.zone.country_list.include?(order.ship_address.country)
if rate.tax_category.is_default and !Spree::Config[ :show_price_inc_vat]
order.adjustments.each do | adjust |
next if adjust.originator_type == "TaxRate"
add = adjust.amount * rate.amount
puts "Applying default rate to adjustment #{adjust.label} (#{adjust.originator_type} ), sum = #{add}"
tax += add
end
end
order.line_items.each do | line_item|
# do not apply tax_rate if product has no tax_category
next unless line_item.product.tax_category_id?
next unless line_item.product.tax_category == rate.tax_category
next unless line_item.product.tax_category.tax_rates.include? rate
tax += BigDecimal((line_item.price * rate.amount).to_s).round(2, BigDecimal::ROUND_HALF_UP) * line_item.quantity
end
tax
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vat_amount_from_line_item line_item\n amount = line_item.included_tax_total / line_item.quantity\n\n Spree::Money.new(\n BigDecimal.new(amount.to_s).round(2, BigDecimal::ROUND_HALF_UP),\n currency: line_item.currency\n ).cents\n end",
"def line_vat_total\n order... | [
"0.743872",
"0.71842974",
"0.6856751",
"0.67182183",
"0.67161757",
"0.6616587",
"0.6578488",
"0.6574881",
"0.65331477",
"0.6513317",
"0.64921665",
"0.6480711",
"0.6458064",
"0.6418855",
"0.63976496",
"0.6386684",
"0.63805616",
"0.63747054",
"0.6369321",
"0.6357562",
"0.634686... | 0.6339696 | 21 |
Creates a CommandExecutor given a `WinRM::WinRMWebService` object. | def initialize(service, logger = nil)
@service = service
@logger = logger
@command_count = 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def executor\n @executor ||= create_executor\n end",
"def executor\n @executor ||= create_executor\n end",
"def executor(executor)\n @cli_executor.executor = executor\n end",
"def set_remote_execution_service(username = nil, password = nil)\n @user_name = username\n @password = ... | [
"0.5140453",
"0.5140453",
"0.51375043",
"0.49277255",
"0.4920439",
"0.48939925",
"0.46898645",
"0.45556685",
"0.44710284",
"0.44393826",
"0.44165945",
"0.441473",
"0.4411758",
"0.4372179",
"0.43015683",
"0.42805913",
"0.42767406",
"0.42659163",
"0.42645863",
"0.422993",
"0.42... | 0.0 | -1 |
Closes the open remote shell session. This method can be called multiple times, even if there is no open session. | def close
return if shell.nil?
service.close_shell(shell)
@shell = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_ssh_session(session)\n session.close\n session = nil\n true\n end",
"def close\n @registry[:transport][:session].close if @open\n @open = false\n end",
"def close\n return if shell.nil?\n\n service.close_shell(shell)\n remove_finalizer\n @shell = nil\n... | [
"0.71057767",
"0.6981516",
"0.6890663",
"0.6773836",
"0.6758684",
"0.6731146",
"0.6715928",
"0.66963744",
"0.667177",
"0.6646758",
"0.66439974",
"0.65966713",
"0.6543056",
"0.65326804",
"0.6523264",
"0.65212005",
"0.64516383",
"0.6413949",
"0.63993376",
"0.6396554",
"0.638908... | 0.69855636 | 1 |
Opens a remote shell session for reuse. The maxiumum commandpershell threshold is also determined the first time this method is invoked and cached for later invocations. | def open
close
@shell = service.open_shell
@command_count = 0
determine_max_commands unless max_commands
shell
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open\n close\n retryable(service.retry_limit, service.retry_delay) do\n @shell = service.open_shell(codepage: code_page)\n end\n add_finalizer(shell)\n @command_count = 0\n shell\n end",
"def request_shell\n @state = :shell\n @channel.send_req... | [
"0.6251886",
"0.57624686",
"0.5740671",
"0.57309824",
"0.56949246",
"0.567466",
"0.56519455",
"0.56013155",
"0.5541296",
"0.55361515",
"0.5464457",
"0.54332954",
"0.5430686",
"0.54252017",
"0.541093",
"0.5410368",
"0.5410368",
"0.5395123",
"0.538147",
"0.53743464",
"0.5351741... | 0.6636245 | 0 |
Runs a CMD command. | def run_cmd(command, arguments = [], &block)
reset if command_count_exceeded?
ensure_open_shell!
@command_count += 1
result = nil
service.run_command(shell, command, arguments) do |command_id|
result = service.get_command_output(shell, command_id, &block)
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_cmd(cmd)\n\t\tconsole.run_single(cmd)\n\tend",
"def run_cmd(cmd)\n\t\tconsole.run_single(cmd)\n\tend",
"def run(cmd)\n runner.run(cmd, shell, nil)\n end",
"def run_command cmd\n # http://whynotwiki.com/Ruby_/_Process_management#What_happens_to_standard_error_.28stderr.29.3F\n require 'c... | [
"0.79618555",
"0.79618555",
"0.782065",
"0.7676827",
"0.7478485",
"0.73601484",
"0.73601484",
"0.73148143",
"0.72980636",
"0.7225652",
"0.71514225",
"0.71462566",
"0.71405846",
"0.7139157",
"0.7129951",
"0.7126808",
"0.71130794",
"0.7101988",
"0.70852697",
"0.7064583",
"0.705... | 0.0 | -1 |
Run a Powershell script that resides on the local box. | def run_powershell_script(script_file, &block)
# this code looks overly compact in an attempt to limit local
# variable assignments that may contain large strings and
# consequently bloat the Ruby VM
run_cmd(
"powershell",
[
"-encodedCommand",
WinRM::PowershellScript.new(
script_file.is_a?(IO) ? script_file.read : script_file
).encoded
],
&block
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n script_name = shift_argument\n unless script_name\n error(\"Usage: mortar local:run SCRIPT\\nMust specify SCRIPT.\")\n end\n validate_arguments!\n\n # cd into the project root\n project_root = options[:project_root] ||= Dir.getwd\n unless File.directory?(project_root)\n err... | [
"0.6735011",
"0.6436718",
"0.6137456",
"0.6071061",
"0.6032136",
"0.5994519",
"0.59745455",
"0.5949975",
"0.5941233",
"0.5881938",
"0.57871234",
"0.5774158",
"0.57672775",
"0.5710012",
"0.56687105",
"0.56373",
"0.5619653",
"0.56104535",
"0.56058675",
"0.5574116",
"0.55630565"... | 0.59956574 | 5 |
Determines the safe maximum number of commands that can be executed on a remote shell session by interrogating the remote host. | def determine_max_commands
os_version = run_powershell_script(PS1_OS_VERSION).stdout.chomp
@max_commands = os_version < "6.2" ? LEGACY_LIMIT : MODERN_LIMIT
@max_commands -= 2 # to be safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_command_length; end",
"def remote_maximum_packet_size; end",
"def _unix_max_line_length\n # Based on autoconf's arg_max calculator, see\n # http://www.in-ulm.de/~mascheck/various/argmax/autoconf_check.html\n calc_line_max = 'i=0 max= new= str=abcd; \\\n while (test \"X\"`echo \"X$str\" 2>... | [
"0.63175696",
"0.61611533",
"0.57459944",
"0.56649756",
"0.5626086",
"0.55016613",
"0.54920995",
"0.5425902",
"0.5343629",
"0.5341369",
"0.5330872",
"0.5321345",
"0.53138965",
"0.53011936",
"0.528496",
"0.52069306",
"0.52038836",
"0.5191957",
"0.51918805",
"0.51796687",
"0.51... | 0.6916242 | 0 |
Closes the remote shell session and opens a new one. | def reset
debug {
"Resetting WinRM shell (Max command limit is #{max_commands})"
}
open
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_session\n # disable autocorrect (oh-my-zsh)\n shell_write(\"unsetopt correct_all; unsetopt correct\\n\")\n # fixing oh-my-zsh themes\n shell_write(\"PROMPT='$ '\\n\")\n # fixing issues with ZSH syntax highlighting (not very common)\n shell_write(\"unset ZSH_HIGHLIG... | [
"0.6331439",
"0.60656524",
"0.6021583",
"0.60133636",
"0.59945434",
"0.59879714",
"0.5928798",
"0.58771306",
"0.585966",
"0.5833521",
"0.58304054",
"0.57491946",
"0.57074744",
"0.56920445",
"0.5641087",
"0.5603728",
"0.5551568",
"0.55476314",
"0.55278563",
"0.55008787",
"0.54... | 0.5037634 | 64 |
GET /families/1 GET /families/1.json | def show
@family = Family.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @family }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end",
"def show\n @family = Family.find(params[:id])\n \n respond_to do |format|\n format.h... | [
"0.73359054",
"0.724417",
"0.7214146",
"0.7206399",
"0.7093841",
"0.7093841",
"0.7093841",
"0.6945207",
"0.6817828",
"0.67575496",
"0.66471833",
"0.6474473",
"0.6474473",
"0.6456767",
"0.64294004",
"0.6424024",
"0.63775104",
"0.626056",
"0.62563133",
"0.6234184",
"0.6186986",... | 0.7167201 | 4 |
GET /families/new GET /families/new.json | def new
@family = Family.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @family }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { ... | [
"0.71695906",
"0.71695906",
"0.71391577",
"0.7129296",
"0.71064544",
"0.7022028",
"0.68648344",
"0.67930543",
"0.67314255",
"0.6726343",
"0.66926026",
"0.6654322",
"0.66194683",
"0.65615916",
"0.6561281",
"0.6548845",
"0.65236",
"0.65201026",
"0.6514795",
"0.6457378",
"0.6347... | 0.78264546 | 0 |
POST /families POST /families.json | def create
@family = Family.new(params[:family])
if User.find_by_email(session[:user_email]).identity >= 3 #if user is at least manager+
@family.approved_by = User.find_by_email(session[:user_email]).id
@family.display = true
end
respond_to do |format|
if @family.save
format.html { redirect_to session[:redirect_path], notice: 'Family was successfully created.' }
format.json { render json: @family, status: :created, location: @family }
else
flash[:error] = "Sorry, one or more fields were not entered correctly. Please double-check that the information is correct."
format.html { render action: "new" }
format.json { render json: @family.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_jobfamily\n @jobfamily = @company.jobfamilies.create(name: params[:jobfamily][:name])\n respond_to do |format|\n format.json { render json: @jobfamily }\n end\n end",
"def create\n @family = Family.new(family_params)\n addMembers\n respond_to do |format|\n if @family.save\... | [
"0.69394344",
"0.6557405",
"0.6539632",
"0.62348044",
"0.6194535",
"0.6145975",
"0.6061082",
"0.60608697",
"0.6032527",
"0.5941302",
"0.5921364",
"0.5920388",
"0.5912198",
"0.5904324",
"0.58811975",
"0.5864885",
"0.5859784",
"0.5856368",
"0.5819247",
"0.580773",
"0.580773",
... | 0.567173 | 28 |
PUT /families/1 PUT /families/1.json | def update
@family = Family.find(params[:id])
@user = User.find_by_email(session[:user_email])
if @user && @user.identity == 2
@family.approved_by = nil
end
respond_to do |format|
if @family.update_attributes(params[:family])
format.html { redirect_to session[:redirect_path], notice: 'Family was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @family.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],... | [
"0.6697375",
"0.6618747",
"0.6419242",
"0.6303814",
"0.62850624",
"0.62772053",
"0.62772053",
"0.6213107",
"0.62118375",
"0.62118375",
"0.61449337",
"0.6117397",
"0.61047333",
"0.6074112",
"0.6045636",
"0.6035152",
"0.6004471",
"0.59281236",
"0.58985716",
"0.589363",
"0.58132... | 0.58596694 | 20 |
DELETE /families/1 DELETE /families/1.json | def destroy
@family = Family.find(params[:id])
@family.destroy
respond_to do |format|
format.html { redirect_to session[:redirect_path] }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to families_... | [
"0.7311203",
"0.73010886",
"0.713922",
"0.71099216",
"0.70258963",
"0.70226616",
"0.6981185",
"0.69420177",
"0.6745161",
"0.6731434",
"0.6715669",
"0.66346616",
"0.66107696",
"0.6606611",
"0.6606611",
"0.66009855",
"0.66007686",
"0.65877193",
"0.65728956",
"0.65667725",
"0.65... | 0.70011246 | 6 |
List of pending families | def pending
session[:redirect_path] = pending_families_path
if params[:location]
@display_families = User.find_pending_families
@display_families.keep_if { |family| params[:location].include?(Family.get_location_name(family.locationID)) }
else
@display_families = User.find_pending_families
end
respond_to do |format|
format.html
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def families\n @ks[:family].keys\n end",
"def list_families\n http_get(:uri=>\"/plugins/families\", :fields=>x_cookie)\n end",
"def families\n response = @client.get('plugins/families')\n verify response,\n forbidden: 'You do not have permission to view plugin families',\n... | [
"0.6987667",
"0.6929717",
"0.6485551",
"0.6442865",
"0.64385295",
"0.63020223",
"0.63020223",
"0.6285194",
"0.6263535",
"0.6122741",
"0.6097932",
"0.60399747",
"0.59919256",
"0.596978",
"0.59261245",
"0.5921667",
"0.5913941",
"0.588815",
"0.588815",
"0.588815",
"0.5878203",
... | 0.5155817 | 89 |
Shows a specific users info | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\t\t# Find all users with id passed by params.\n\t\t@user = User.find(params[:id])\n\t\tCUSTOM_LOGGER.info(\"Start to find users #{@user.to_yaml}\")\n\tend",
"def info\n\t@user = User.find(params[:id])\n end",
"def show\n @user = User.find_by(username: params[:id])\n render :show\n end",
"d... | [
"0.78503466",
"0.77752644",
"0.7599091",
"0.7594006",
"0.7588339",
"0.7588339",
"0.7588339",
"0.75874245",
"0.75652593",
"0.7551915",
"0.75068307",
"0.74937606",
"0.7493045",
"0.74892145",
"0.74370694",
"0.7416838",
"0.74085784",
"0.73859227",
"0.73837376",
"0.7375159",
"0.73... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.