query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
POST /billed_calls POST /billed_calls.xml | def create
@bill = Bill.find(params[:bill_id])
@billed_call = @bill.billed_calls.new(params[:billed_call])
respond_to do |format|
if @billed_call.save
@bill.billed_taxes.each do |billed_tax|
billed_tax.recalculate
end
#We have to save the flag here, other wise it wou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @bill = Bill.find(params[:bill_id])\n @billed_call = @bill.billed_calls.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billed_call }\n end\n end",
"def create\n call = params[:call]\n call[:vote] = parse_vote(call[:vote])\... | [
"0.62940705",
"0.5657223",
"0.5589793",
"0.55268675",
"0.54933226",
"0.5462193",
"0.54277974",
"0.5424563",
"0.54133",
"0.5379636",
"0.53525776",
"0.53275037",
"0.53236794",
"0.53137827",
"0.5311451",
"0.5306401",
"0.5298603",
"0.524802",
"0.5234254",
"0.5233998",
"0.52254736... | 0.6261468 | 1 |
PUT /billed_calls/1 PUT /billed_calls/1.xml | def update
@bill = Bill.find(params[:bill_id])
@billed_call = @bill.billed_calls.find(params[:id])
respond_to do |format|
if @billed_call.update_attributes(params[:billed_call])
@bill.billed_taxes.each do |billed_tax|
billed_tax.recalculate
end
#We have to save the f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @bill = Bill.find(params[:bill_id])\n @billed_call = @bill.billed_calls.new(params[:billed_call])\n\n respond_to do |format|\n if @billed_call.save\n @bill.billed_taxes.each do |billed_tax|\n billed_tax.recalculate\n end\n #We have to save the flag here, oth... | [
"0.5851925",
"0.5806472",
"0.58036757",
"0.56829566",
"0.56038934",
"0.5597829",
"0.55793273",
"0.5556903",
"0.5556903",
"0.5545687",
"0.54872364",
"0.54861504",
"0.5478029",
"0.54622257",
"0.54414296",
"0.5419646",
"0.5405533",
"0.5405533",
"0.53666836",
"0.53649336",
"0.536... | 0.6185291 | 0 |
The red component of the color. | def red
hsl_to_rgb!
@attrs[:red]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def red\n ((hex_color & RED) >> 16) / MAX_RGB_VALUE * 100\n end",
"def color\n @red ? \"R\" : \"B\"\n end",
"def red\n colorize(31)\n end",
"def color\n return @color\n end",
"def color\n return @color\n end",
"def r\n\t\t\tColor.r(@colo... | [
"0.83491296",
"0.7916037",
"0.7904678",
"0.77765393",
"0.77765393",
"0.7774354",
"0.77382296",
"0.7719121",
"0.7645018",
"0.75198287",
"0.7457229",
"0.74518865",
"0.7406805",
"0.7324033",
"0.727451",
"0.7256813",
"0.72173274",
"0.7202516",
"0.7202516",
"0.71873826",
"0.716756... | 0.80857044 | 1 |
The green component of the color. | def green
hsl_to_rgb!
@attrs[:green]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def green\n ((hex_color & GREEN) >> 8) / MAX_RGB_VALUE * 100\n end",
"def green\n colorize(32)\n end",
"def green\n (rgba & 0x00FF00) >> 8\n end",
"def g(value)\n value.to_s.color(:green)\n end",
"def green(output)\n color(32, output)\n end",
"def green(g1)\n ... | [
"0.8372639",
"0.8127372",
"0.77656674",
"0.7622841",
"0.75727904",
"0.7572473",
"0.75303656",
"0.7443499",
"0.7395235",
"0.7353025",
"0.7167728",
"0.7132418",
"0.7132418",
"0.7047176",
"0.70424175",
"0.70163983",
"0.69092864",
"0.68619424",
"0.68619424",
"0.6848983",
"0.67951... | 0.8194861 | 1 |
The hue component of the color. | def hue
rgb_to_hsl!
@attrs[:hue]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hue(value=nil)\n h, s, l, a = self.to_hsl\n if !value.nil?\n value = new_extended_color(value).to_hsl[0] if value.is_a?(Sketchup::Color)\n h = value%360\n return self.from_hsl([h, s, l, a])\n else\n return h\n end\n end",
"def hue\n @hue ||= begin\n ## note: hsl[0], ... | [
"0.8280137",
"0.8062772",
"0.800939",
"0.7851651",
"0.7595983",
"0.75501627",
"0.7414388",
"0.73150384",
"0.71572435",
"0.7139068",
"0.69545966",
"0.6885068",
"0.6885068",
"0.6868551",
"0.68681514",
"0.68655276",
"0.6832927",
"0.66398895",
"0.66095185",
"0.6609079",
"0.659426... | 0.85453147 | 0 |
The saturation component of the color. | def saturation
rgb_to_hsl!
@attrs[:saturation]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saturation(value=nil)\n h, s, l, a = self.to_hsl\n if !value.nil?\n value = new_extended_color(value).to_hsl[1] if value.is_a?(Sketchup::Color)\n s = [[0, value].max, 100].min\n return self.from_hsl([h, s, l, a])\n else\n return s\n end\n end",
"def saturation(color)\n r... | [
"0.8436556",
"0.83499044",
"0.80934495",
"0.7743143",
"0.7661684",
"0.72050136",
"0.6804573",
"0.6697909",
"0.6566421",
"0.6297777",
"0.62427616",
"0.62427616",
"0.6125671",
"0.6125671",
"0.6115014",
"0.6070744",
"0.6070744",
"0.60696876",
"0.60599625",
"0.60555995",
"0.60341... | 0.8655991 | 0 |
The lightness component of the color. | def lightness
rgb_to_hsl!
@attrs[:lightness]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lightness(red, green, blue)\n min, max = [red, green, blue].minmax\n\n (min + max) / (2.0 * 255)\n end",
"def lightness(newlight=nil)\n if not newlight\n return self.hsla[2]\n else\n hsla = self.hsla\n hsla[2] = newlight\n return Color.hsla( *hsla )\n end\n en... | [
"0.8067056",
"0.78644586",
"0.74257666",
"0.73271036",
"0.70636564",
"0.68688035",
"0.6700902",
"0.65127397",
"0.64912117",
"0.6357632",
"0.6273316",
"0.62580866",
"0.62338203",
"0.6195761",
"0.61564904",
"0.611022",
"0.611022",
"0.6086632",
"0.6082799",
"0.6082799",
"0.60638... | 0.8871386 | 0 |
Returns the red, green, blue, and alpha components of the color. | def rgba
[red, green, blue, alpha].freeze
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rgb_color(red, green, blue, alpha = nil)\n attrs = {:red => red, :green => green, :blue => blue}\n attrs[:alpha] = alpha if alpha\n Color.new(attrs)\n end",
"def rgb_color\n [self.color_red, self.color_green, self.color_blue]\n end",
"def rgb(red, green, blue, alpha = Shoes::Color::OP... | [
"0.73751307",
"0.7332661",
"0.7246389",
"0.7246389",
"0.71691376",
"0.71111304",
"0.7055373",
"0.70537895",
"0.69805264",
"0.69579995",
"0.69579995",
"0.691675",
"0.69074214",
"0.6904434",
"0.68159914",
"0.68100065",
"0.6794595",
"0.6794595",
"0.6784986",
"0.67811334",
"0.677... | 0.7892419 | 0 |
Returns the hue, saturation, and lightness components of the color. | def hsl
[hue, saturation, lightness].freeze
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hue\n rgb_to_hsl!\n @attrs[:hue]\n end",
"def hue\n rgb_to_hsl!\n @attrs[:hue]\n end",
"def hsl\n @hsl ||= begin\n red = @red / 255.0\n green = @green / 255.0\n blue = @blue / 255.0\n\n max = [red, green, blue].max\n min = [red, green,... | [
"0.7738073",
"0.7738073",
"0.73276454",
"0.72295743",
"0.7069693",
"0.7046079",
"0.7046079",
"0.69488233",
"0.6904047",
"0.6904047",
"0.6899254",
"0.6869553",
"0.6860438",
"0.6850497",
"0.68146396",
"0.68146396",
"0.6795177",
"0.6794725",
"0.67946285",
"0.67711943",
"0.674648... | 0.79301 | 0 |
Returns the hue, saturation, lightness, and alpha components of the color. | def hsla
[hue, saturation, lightness, alpha].freeze
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hsl\n [hue, saturation, lightness].freeze\n end",
"def hsl\n [hue, saturation, lightness].freeze\n end",
"def hue\n rgb_to_hsl!\n @attrs[:hue]\n end",
"def hue\n rgb_to_hsl!\n @attrs[:hue]\n end",
"def hsl_color(hue, saturation, lightness, alpha = nil)\n a... | [
"0.7538615",
"0.7538615",
"0.7417928",
"0.7417928",
"0.7099002",
"0.6871494",
"0.6709102",
"0.6617462",
"0.6590894",
"0.6590894",
"0.6586237",
"0.65445596",
"0.654408",
"0.6491048",
"0.6472918",
"0.6472918",
"0.6456734",
"0.64436877",
"0.64436877",
"0.644367",
"0.6422294",
... | 0.76309407 | 0 |
GET /go_slims/1 GET /go_slims/1.json | def show
@go_slim = GoSlim.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @go_slim }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @slams = Slam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slams }\n end\n end",
"def show\n @go_slim_sequence = GoSlimSequence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {... | [
"0.67576003",
"0.6557388",
"0.63709944",
"0.6281348",
"0.62797",
"0.62473243",
"0.6211432",
"0.62081254",
"0.6207599",
"0.6104904",
"0.60764056",
"0.60437346",
"0.60127693",
"0.5999571",
"0.5992707",
"0.59585655",
"0.5957253",
"0.59570897",
"0.59477687",
"0.5941815",
"0.59406... | 0.6831756 | 0 |
GET /go_slims/new GET /go_slims/new.json | def new
@go_slim = GoSlim.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @go_slim }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @slam = Slam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slam }\n end\n end",
"def new\n @sitio = Sitio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio }\n end\n end",
... | [
"0.70850426",
"0.6966373",
"0.6957009",
"0.69549674",
"0.6927745",
"0.69112504",
"0.69032556",
"0.6835772",
"0.68163204",
"0.68046397",
"0.676769",
"0.67390853",
"0.673245",
"0.67291856",
"0.66796833",
"0.6628421",
"0.6625616",
"0.6625616",
"0.6625616",
"0.6625616",
"0.661600... | 0.7133009 | 0 |
POST /go_slims POST /go_slims.json | def create
@go_slim = GoSlim.new(params[:go_slim])
respond_to do |format|
if @go_slim.save
format.html { redirect_to @go_slim, notice: 'Go slim was successfully created.' }
format.json { render json: @go_slim, status: :created, location: @go_slim }
else
format.html { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @go_slim_sequence = GoSlimSequence.new(params[:go_slim_sequence])\n\n respond_to do |format|\n if @go_slim_sequence.save\n format.html { redirect_to @go_slim_sequence, notice: 'Go slim sequence was successfully created.' }\n format.json { render json: @go_slim_sequence, status... | [
"0.58684176",
"0.5860791",
"0.57257974",
"0.57056135",
"0.5667037",
"0.5613504",
"0.5579644",
"0.54938674",
"0.54770577",
"0.5463925",
"0.54408556",
"0.54233325",
"0.5398419",
"0.53913",
"0.5386645",
"0.5374929",
"0.5373639",
"0.53615314",
"0.53456414",
"0.5328926",
"0.531329... | 0.5898987 | 0 |
DELETE /go_slims/1 DELETE /go_slims/1.json | def destroy
@go_slim = GoSlim.find(params[:id])
@go_slim.destroy
respond_to do |format|
format.html { redirect_to go_slims_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @slam = Slam.find(params[:id])\n @slam.destroy\n\n respond_to do |format|\n format.html { redirect_to slams_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @ssd.destroy\n respond_to do |form... | [
"0.70438224",
"0.7028841",
"0.685397",
"0.6831078",
"0.6814079",
"0.6790486",
"0.6723496",
"0.6694704",
"0.6684006",
"0.6682382",
"0.66459954",
"0.6643061",
"0.6641464",
"0.6638676",
"0.6598767",
"0.6583882",
"0.65829426",
"0.6565907",
"0.65616244",
"0.65557945",
"0.6542288",... | 0.7614704 | 0 |
Builds class constant for the relation | def build_class(name, klass_name)
ClassBuilder.new(name: klass_name, parent: Relation).call do |klass|
klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def name
#{name.inspect}
end
def respond_to_missing?(name, _include_private = false)
__relations__.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbol_to_constant_class(symbol, parent_class)\n name = symbol.to_s\n # If the classified version of the symbol is defined, then it has a model and can be made into a constant\n if Object.const_defined?(name.singularize.classify)\n name.singularize.classify.constantize\n else\n ... | [
"0.5829543",
"0.5804451",
"0.5804451",
"0.5750053",
"0.57286114",
"0.5649183",
"0.55908734",
"0.551703",
"0.5480255",
"0.54472023",
"0.54307246",
"0.54266584",
"0.5414393",
"0.53899187",
"0.53844786",
"0.53827995",
"0.53520817",
"0.53264934",
"0.53264934",
"0.53094316",
"0.52... | 0.65809447 | 0 |
Updates note content and return a RedCloth rendering for javascript usage. | def update_content
@note = Note.find(params[:id], :select => "article_id")
respond_to do |format|
if @note.article.update_attribute(:content, params[:newContent])
# Technically html :)
format.text { render :text => RedCloth.new(white_list(@note.article.content),[:filter_styles]).to_html(:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @note.user == current_user && @note.update_attribute(:content, params[:content])\n render :show, status: :ok, location: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @note.update(note_par... | [
"0.66337085",
"0.64091134",
"0.6398989",
"0.62434924",
"0.623707",
"0.62237823",
"0.6219463",
"0.6064624",
"0.6046384",
"0.5938158",
"0.5927089",
"0.59233093",
"0.5919917",
"0.59081566",
"0.58936733",
"0.58407074",
"0.58254534",
"0.57964396",
"0.5789585",
"0.57610005",
"0.576... | 0.74877053 | 0 |
POST /assignments Assign an activity to a guest | def create
@activities = params[:guest][:activity_ids]
assignment = Assignment.new(params[:guest_id], params[:activity_id])
@activities.each do |a|
if a != ""
@assignment = Assignment.create(:guest_id => params[:assignments][:guest_id], :activity_id => a)
# assigned_activity = Assignment.crea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @assignment = @user.assignments.new(params[:assignment])\n\n respond_to do |format|\n if @assignment.save\n flash[:notice] = 'Committee assignment was successfully created'\n format.html { redirect_to user_assignments_path(@user) }\n format.xml { render :xml => @assign... | [
"0.64263415",
"0.64028764",
"0.6373517",
"0.6332908",
"0.61906385",
"0.6120735",
"0.609542",
"0.60816914",
"0.6061031",
"0.6020671",
"0.60138685",
"0.6001559",
"0.5961527",
"0.5952758",
"0.59339184",
"0.59328365",
"0.5927569",
"0.59262353",
"0.5926035",
"0.5906829",
"0.590650... | 0.7685041 | 0 |
Initialize application Git repository to clone from remote If the repository exists, it fetches the latest | def init_repo
@logger.info "repository url: #{@repository[:url]}"
if FileTest.exist?(@repository[:path])
@logger.info "repository path exists: #{@repository[:path]}"
@rgit = Git.open(@repository[:path], :log => @logger)
@logger.info @rgit.fetch
else
@logger.info "repo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_clone\n\n Rugged::Repository.clone_at git_url, root_path.to_s if git_url\n end",
"def clone_repository\n `cd #{client.config.tmp_folder} && git clone #{client.config.repository_url}.git`\n `cd #{client.config.tmp_folder}/#{client.config.repository_name} && git fetch origin #{client.config.r... | [
"0.7457419",
"0.7349897",
"0.7324863",
"0.7130002",
"0.70992595",
"0.69954795",
"0.69930786",
"0.6988574",
"0.6972506",
"0.6962066",
"0.6925723",
"0.69173026",
"0.68803984",
"0.685138",
"0.68434334",
"0.6810703",
"0.67943436",
"0.6769858",
"0.6755616",
"0.67507195",
"0.671319... | 0.78406197 | 0 |
Confirm container application is ready to get request via HTTP the container is not ready, wait and retry to send request TODO: need to set protocol, port and path by the user | def confirm_running(container_id)
ip = get_ip_of_container container_id
port = get_port_of_container container_id
tried_count = 1
begin
@logger.info "Checking application is ready... trying count:#{tried_count}"
req = Net::HTTP.new(ip, port)
res = req.get('/')
un... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_for_startup\n TCPSocket.wait_for_service_with_timeout(:host => http_ip,\n :port => http_port,\n :timeout => 10)\n end",
"def wait_for_sinatra_to_startup!\n 10.times do\n Net::HTTP.get(URI.parse(\"ht... | [
"0.64875317",
"0.6484124",
"0.6307945",
"0.6278556",
"0.62709576",
"0.6189446",
"0.61819845",
"0.614058",
"0.614058",
"0.6088719",
"0.6034873",
"0.5969367",
"0.5919027",
"0.590385",
"0.58951396",
"0.5840225",
"0.581771",
"0.5799872",
"0.5780445",
"0.5774008",
"0.57203287",
... | 0.74457806 | 0 |
Wrap command with pty spawn to get output [command] command to execute | def ptywrap(command)
last_line = ''
PTY.spawn(command) do |r, w, pid|
begin
r.each do |line|
@logger.info line
last_line = line
status = PTY.check pid
unless status.nil?
raise RuntimeError,
"Docker build has no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pty(cmd)\n PTY.spawn cmd do |r,w,pid|\n Signal.trap(\"INT\"){ puts \"{killed}\"; Process.kill(\"INT\",pid) }\n begin\n r.sync\n s = r.read_nonblock(4096)\n $stderr.write(s.gsub(/\\n/,\"\\n| \"))\n rescue IO::WaitReadable\n IO.select([r])\n retry\n rescue Errno::EID => e\n ... | [
"0.736196",
"0.7196701",
"0.6973893",
"0.67085713",
"0.6640329",
"0.6456675",
"0.64435756",
"0.64242756",
"0.6402832",
"0.63898146",
"0.6335189",
"0.6269482",
"0.6179358",
"0.6171053",
"0.61318856",
"0.61318856",
"0.61317813",
"0.6129607",
"0.6107498",
"0.60914075",
"0.606075... | 0.78964055 | 0 |
Build Docker image from Git commit id. Docker image will be built by Dockerfile in Git repository which is pointed by Git commit id. This method returns Docker image id. | def build
@logger.info "Build for #{@git_commit_id} ..."
@logger.info @rgit.checkout(@git_commit_id)
@logger.info 'Start building docker image...'
build_command = "docker build -t '#{@repository[:name]}/#{@git_commit_id}' #{@work_dir}/#{@repository[:name]}"
last_line = ptywrap(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_container_by_commit_id(commit_id, opts={})\n logger = opts[:logger] || Logger.new(STDOUT)\n\n logger.info(\"Getting container id for commit id<#{commit_id}>\")\n \n containers = ::Docker::Container.all.map{|c| c.json}\n\n logger.info(\"Now number of running containers: #{container... | [
"0.6653306",
"0.6406274",
"0.63906723",
"0.6314834",
"0.6283107",
"0.6229461",
"0.62014556",
"0.6154721",
"0.6089111",
"0.58230364",
"0.5780366",
"0.57345515",
"0.5733557",
"0.56741494",
"0.5615819",
"0.56021523",
"0.5551398",
"0.5539892",
"0.54726654",
"0.53846157",
"0.53741... | 0.7927355 | 0 |
Run container with Docker image id [image_id] Docker image id | def run(image_id)
@logger.info 'Start running container...'
container_id = `docker run -P -d #{image_id}`.chomp
is_running = `docker inspect --format='{{.State.Running}}' #{container_id}`
raise RuntimeError, 'Could not start running container.' if is_running.eql? 'false'
contai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_and_run_container(code,test_code,user_id)\n puts \"Building and running docker container\"\n formatted_code = format_code(code,test_code)\n p formatted_code\n command = [\"#{DOCKER_DIR}/build.sh\",%Q[\\\"#{formatted_code}\\\"],user_id].join(\" \").chomp\n %x[#{command}]\n end",
"def run... | [
"0.7008691",
"0.693989",
"0.6853483",
"0.6853483",
"0.6771337",
"0.6771337",
"0.6697281",
"0.66031605",
"0.6580407",
"0.6541176",
"0.652726",
"0.65258765",
"0.6441762",
"0.6434066",
"0.64127666",
"0.63585335",
"0.63427746",
"0.6299002",
"0.6299002",
"0.62965405",
"0.6286077",... | 0.8270572 | 0 |
Write Git commit id and Docker image id to id file. id file is needed for controller to judge to build new image [image_id] Docker image id [id_file] Path to id file | def write_ids(image_id, id_file = @id_file)
@logger.info "Write image id <#{image_id}> and commit id <#{@git_commit_id}> to #{@id_file}"
File.open(id_file, "a") do |file|
file.write("#{@git_commit_id}/#{image_id}\n")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build\n @logger.info \"Build for #{@git_commit_id} ...\"\n\n @logger.info @rgit.checkout(@git_commit_id)\n\n @logger.info 'Start building docker image...'\n build_command = \"docker build -t '#{@repository[:name]}/#{@git_commit_id}' #{@work_dir}/#{@repository[:name]}\"\n last... | [
"0.6377062",
"0.611288",
"0.5941158",
"0.5923259",
"0.587789",
"0.57970655",
"0.56975436",
"0.5577524",
"0.55724216",
"0.54385185",
"0.5421427",
"0.5390562",
"0.5342429",
"0.53324187",
"0.5324788",
"0.5318756",
"0.52901703",
"0.52874297",
"0.52843297",
"0.5266889",
"0.5258187... | 0.7970775 | 0 |
Get ip address of Docker container by docker inspect command [container_id] Docker container id | def get_ip_of_container(container_id)
`docker inspect --format '{{ .NetworkSettings.IPAddress }}' #{container_id}`.chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ip\n # Get its IP that could have changed upon restart\n # cf https://github.com/moby/moby/issues/2801\n # Make sure we refresh its info before querying it, as we could hit a cache of a previous IP.\n _exit_status, stdout, _stderr = @cmd_runner.run_cmd \"#{podman_cmd} contai... | [
"0.7784986",
"0.71673995",
"0.68252873",
"0.6751315",
"0.65911347",
"0.65721387",
"0.6314341",
"0.62619644",
"0.62505364",
"0.6249639",
"0.6241581",
"0.6201629",
"0.61771077",
"0.61601204",
"0.6089012",
"0.6078966",
"0.6065511",
"0.6015899",
"0.59974027",
"0.59881306",
"0.598... | 0.915424 | 0 |
Get port of Docker container by docker inspect command [container_id] Docker container id | def get_port_of_container(container_id)
@logger.info "Getting port id for container <#{container_id}> ..."
port = container_port
@logger.info "port for container #{container_id} is : #{port}"
return port
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def docker_getport(containername)\n %x{docker ps --filter name=#{containername} --format \"{{.Ports}}\" | sed \"s;->.*$;;\" | sed \"s;^.*:;;\" | head -n 1 | tr -d \"\\n\"}\n end",
"def get_host_mapped_port_for_container(environment, container_name, container_port)\n container = get_docker_container(envi... | [
"0.86029726",
"0.7660263",
"0.76239187",
"0.7069486",
"0.7014687",
"0.6786541",
"0.6614646",
"0.6448279",
"0.6431084",
"0.6344047",
"0.6249643",
"0.62246597",
"0.6214972",
"0.6168531",
"0.61461467",
"0.6134575",
"0.6124154",
"0.6120376",
"0.6115532",
"0.6093476",
"0.6064252",... | 0.8228021 | 1 |
Returns an array of the values at the specified indices: hash = HashWithIndifferentAccess.new hash[:a] = "x" hash[:b] = "y" hash.values_at("a", "b") => ["x", "y"] | def values_at(*indices)
indices.collect {|key| self[convert_key(key)]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def values_at(*indices)\n indices.collect {|key| self[key]}\n end",
"def values_at(*keys)\n @hash.values_at(*keys)\n end",
"def values_at(*keys); end",
"def values_at(index, vals)\n vals = vals.map { |v| value_hash[v][index] }\n vals\n end",
"def values_at(index, *slots)\n slots.m... | [
"0.83893543",
"0.77947825",
"0.76601815",
"0.75177866",
"0.72513014",
"0.7217087",
"0.71345526",
"0.69100714",
"0.68908787",
"0.6838883",
"0.6733191",
"0.6597742",
"0.65974796",
"0.65974796",
"0.64184976",
"0.6350996",
"0.62597996",
"0.6219613",
"0.60339963",
"0.60332096",
"0... | 0.80651426 | 1 |
s, t = 'ACGTACGTGACG', 'GTA' | def sseq(s, t)
indices = []
last_idx = 0
t.each_char do |chr|
i = s.index(chr, last_idx+1)
if i
indices.push (last_idx = i + 1)
else
puts "ooops", chr
end
end
indices.join ' '
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_the_difference(s, t)\n s_hash = Hash.new(0)\n t_hash = Hash.new(0)\n first = s.split(\"\")\n last = t.split(\"\")\n first.map { |letter| s_hash[letter] += 1 }\n last.map { |letter| t_hash[letter] += 1 }\n (t_hash.to_a - s_hash.to_a).flatten[0]\nend",
"def find_the_difference(s, t)\n histogram ... | [
"0.66759294",
"0.6362219",
"0.6326774",
"0.6272205",
"0.6253789",
"0.6203656",
"0.61588454",
"0.6088257",
"0.6045999",
"0.6039776",
"0.5993773",
"0.59888023",
"0.5984819",
"0.5982664",
"0.59600663",
"0.59439194",
"0.59087604",
"0.59080774",
"0.59013885",
"0.5873471",
"0.58404... | 0.6455153 | 1 |
private method to find the post and load the voting information | def load_post_and_vote
@post = Post.find(params[:post_id])
@vote = @post.votes.where(user_id: current_user.id).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_post\n @post = Post.includes(:comments,:likes).find(params[:id])\n end",
"def find_post\n @post = Post.find(params[:post_id])\n end",
"def set_post\n @post = Post.where('posts.id = ?', params[:id]).eager_load(:user, :pcomments).first\n rescue ActiveRecord::RecordNotFound\n... | [
"0.64767283",
"0.6424089",
"0.6388071",
"0.63578933",
"0.6342196",
"0.63178384",
"0.6304458",
"0.6296562",
"0.62625027",
"0.6256001",
"0.6240899",
"0.62281376",
"0.6193746",
"0.617923",
"0.6146865",
"0.61438435",
"0.6093868",
"0.60894185",
"0.6081449",
"0.60703206",
"0.603022... | 0.7984021 | 0 |
First checks if the vote made by the user is authorized, then updates it with the new_value | def update_vote!(new_value)
if @vote
authorize @vote, :update?
@vote.update_attribute(:value, new_value)
else
@vote = current_user.votes.build(value: new_value, post: @post)
authorize @vote, :create?
@vote.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_or_create_vote(value, user)\n vote = self.votes.find_by user: user\n if vote\n if vote.value == 0\n vote.value = value\n else\n vote.value = vote.value == value ? value : 0\n end\n vote.save\n else\n ... | [
"0.7361047",
"0.7261053",
"0.72402745",
"0.70670927",
"0.7028213",
"0.70167",
"0.6919364",
"0.6850691",
"0.6800981",
"0.6762766",
"0.67109734",
"0.66297245",
"0.6581476",
"0.65656775",
"0.6522431",
"0.65146166",
"0.64847445",
"0.64707655",
"0.64707655",
"0.646178",
"0.6450553... | 0.83857846 | 0 |
GET /federations GET /federations.json GET /federations.xml | def index
@federations = Federation.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @farmer = Farmer.find(params[:id])\n\t\t@dispensals = @farmer.dispensals.all.paginate(:page => params[:page], :order => 'updated_at DESC', :per_page => 5)\n\t\t@donations = @farmer.donations.all.paginate(:page => params[:page], :order => 'updated_at DESC', :per_page => 5)\n respond_to do |format|\... | [
"0.6195959",
"0.6047225",
"0.59778905",
"0.5923986",
"0.58800256",
"0.58258945",
"0.58172333",
"0.5710038",
"0.56266564",
"0.56083465",
"0.5608136",
"0.55862266",
"0.5545631",
"0.5522821",
"0.5522563",
"0.55154264",
"0.5507847",
"0.549588",
"0.5492571",
"0.547731",
"0.547382"... | 0.7105065 | 0 |
POST /federations POST /federations.json POST /federations.xml | def create
@federation = Federation.new(federation_params)
respond_to do |format|
if @federation.save
format.html { redirect_to @federation, notice: 'Federation was successfully created.' }
format.json { render :show, status: :created, location: @federation }
format.xml { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @guest_educator = GuestEducator.new(guest_educator_params)\n\n respond_to do |format|\n if @guest_educator.save\n format.html { redirect_to @guest_educator, notice: 'Guest educator was successfully created.' }\n format.json { render :show, status: :created, location: @guest_ed... | [
"0.56543964",
"0.5615655",
"0.55721194",
"0.55522174",
"0.5540121",
"0.54873866",
"0.54795015",
"0.54752266",
"0.54540896",
"0.54157656",
"0.5390188",
"0.53773147",
"0.5353419",
"0.5350657",
"0.5320114",
"0.5319713",
"0.5317525",
"0.53153306",
"0.53145665",
"0.5309938",
"0.53... | 0.6171765 | 0 |
true if the model param are different for non_tamperable_parasmeters | def tampering?(non_tamperable_parameters, previous_version, model_params, obj_class)
prev_obj = obj_class.constantize.new(previous_version)
tampering = false
non_tamperable_parameters.each do |p|
if prev_obj.send(p.to_sym) != model_params.send(p.to_sym)
tampering = true
end
end
tampering
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_other_update_params?\n !@name && !@author && !@rank && @deprecated.nil? &&\n !@synonymize_with && !@clear_synonyms && !@correct_spelling\n end",
"def diff?(model = self.class.find(id))\n self.class.diffable_attributes.each do |attribute|\n return true if send(attribute) != model.sen... | [
"0.5933441",
"0.5794628",
"0.5634598",
"0.56213796",
"0.5493544",
"0.5463938",
"0.543972",
"0.543972",
"0.5381501",
"0.53362155",
"0.5304493",
"0.528997",
"0.52872884",
"0.5281348",
"0.52777046",
"0.52679026",
"0.52402115",
"0.52168685",
"0.5195043",
"0.5180716",
"0.5179815",... | 0.7388022 | 0 |
DELETE /questions/1 DELETE /questions/1.xml | def destroy
@question = Question.find(params[:id])
@question.destroy
respond_to do |format|
format.html { redirect_to(questions_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n\t@question = Question.find(params[:id])\n\t@question.destroy\n\n\trespond_to do |format|\n\t format.html { redirect_to(questions_url) }\n\t format.xml { head :ok }\n\tend\n end",
"def destroy\n\t@question = Question.find(params[:id])\n\t@question.destroy\n\n\trespond_to do |format|\n\t format.h... | [
"0.71775687",
"0.71775687",
"0.71757257",
"0.71757257",
"0.71757257",
"0.71757257",
"0.71757257",
"0.71757257",
"0.71757257",
"0.71384025",
"0.711533",
"0.7095699",
"0.7081119",
"0.7030921",
"0.6947629",
"0.692958",
"0.68841225",
"0.68730474",
"0.6815187",
"0.6784592",
"0.675... | 0.7202787 | 0 |
returns RPsiElement in current editor with given psi_file | def get_rpsielement_at(editor, psi_file)
get_element_at editor, psi_file, RPsiElement
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_selected_elements(editor, file)\n selection_model = editor.selection_model\n if selection_model.has_selection\n element1 = file.find_element_at(selection_model.selection_start)\n element2 = file.find_element_at(selection_model.selection_end-1)\n else\n caret_model = edit... | [
"0.5535591",
"0.54566324",
"0.53962296",
"0.5385035",
"0.53398114",
"0.52723163",
"0.5128815",
"0.5092213",
"0.50837564",
"0.5060657",
"0.50360423",
"0.50298536",
"0.50083435",
"0.4975374",
"0.49327818",
"0.49222708",
"0.48971474",
"0.48890674",
"0.4888758",
"0.48882607",
"0.... | 0.84857213 | 0 |
Return selected elements ignoring whitespaces and comments | def get_selected_elements(editor, file)
selection_model = editor.selection_model
if selection_model.has_selection
element1 = file.find_element_at(selection_model.selection_start)
element2 = file.find_element_at(selection_model.selection_end-1)
else
caret_model = editor.caret_mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selectElements\n ([expression] + elements).compact if select\n end",
"def matching_text_element_lines(regex, exclude_nested = T.unsafe(nil)); end",
"def elements\n find_by_tag('*')\n end",
"def parse\n #use regex to split\n arr = @html_string.scan(TAGS_AND_TEXT).flatten\n\n #remove n... | [
"0.6210022",
"0.58517313",
"0.5565862",
"0.55259997",
"0.54629827",
"0.5435496",
"0.54254985",
"0.53636235",
"0.5344552",
"0.5333439",
"0.5331526",
"0.5306506",
"0.529468",
"0.5282292",
"0.52352023",
"0.5232169",
"0.523166",
"0.52005607",
"0.5154191",
"0.5126437",
"0.51172346... | 0.61591756 | 1 |
inserts new statements in container after element element anchor element new_elements new generated elements list | def insert_elements element, new_elements
inserted_elements = []
container = PsiTreeUtil.getParentOfType element, RContainer.java_class
comp_statement = container.compound_statement
# looking for the following statement
statements = comp_statement.getStatements
@next_statement = ni... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autogenerate_elements\n to_auto_generate_elements = self.layout_description[\"autogenerate\"]\n unless (to_auto_generate_elements.blank?)\n to_auto_generate_elements.each do |element|\n element = Element.create_from_scratch({'page_id' => self.id, 'name' => element})\n element.move_to_b... | [
"0.6234471",
"0.601659",
"0.59889114",
"0.5949047",
"0.59127617",
"0.5877925",
"0.57722616",
"0.56793237",
"0.56793237",
"0.5660096",
"0.5631512",
"0.55951554",
"0.5561014",
"0.5549036",
"0.55482334",
"0.54904824",
"0.54770947",
"0.54738677",
"0.5459749",
"0.54564816",
"0.545... | 0.76448524 | 0 |
pass a name and the usual OML options here to configure oml4r | def initialize *args
opts = Hash === args.last ? args.pop : {}
name = args.empty? ? 'oml4r' : args.shift
super(name, opts)
begin
OML4R::init(nil, opts)
rescue OML4R::MissingArgumentException => mex
$stderr.puts mex
exit
end
@inject_failed = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modeler_description\n return \"Loads and Set the a default construction library from an osm file. \"\n end",
"def osmxml (ios)\n ios.write(\"<osm version=\\\"0.6\\\" >\\n\")\n @properties.each { |x| \n x.osmxml(ios) \n }\n ios.write(\"</osm>\\n\")\n end",
"def ro_2\n # create an o... | [
"0.6001344",
"0.53794736",
"0.5340712",
"0.5299599",
"0.5289921",
"0.5240559",
"0.5225986",
"0.5180893",
"0.5138762",
"0.51132864",
"0.5110948",
"0.5097618",
"0.5095012",
"0.5083936",
"0.5075661",
"0.5069738",
"0.5049878",
"0.5040321",
"0.5040321",
"0.5040321",
"0.5040321",
... | 0.5627155 | 1 |
Supprimer l'image de profil | def delete_profile_picture
if (current_user.id == params[:id].to_i)
current_user.avatar = nil
current_user.save
redirect_to current_user, notice: "Image de profil supprimée"
else
redirect_to current_user, error: "Vous ne pouvez pas supprimer l'avatar d'un autre utilisateur"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_image\n \t@person = Person.find(params[:id])\n \t@person.image = nil\n \t@person.save!\n \tredirect_to @person\n end",
"def remove_avatar\n @dotcom.avatar.purge if dotcom_params[:remove_avatar] == '1'\n end",
"def removeImage\n @groof = Greenroof.find(params[:id])\n if not (@groof... | [
"0.7769595",
"0.7582881",
"0.73733026",
"0.73571426",
"0.7339447",
"0.7283624",
"0.7280243",
"0.7254129",
"0.7196387",
"0.7180124",
"0.7072264",
"0.70439434",
"0.70310766",
"0.70310766",
"0.70009995",
"0.6981595",
"0.6976333",
"0.6949354",
"0.69291514",
"0.6921955",
"0.691492... | 0.80849326 | 0 |
GET /caballoxcarerras/1 GET /caballoxcarerras/1.json | def show
@caballoxcarerra = Caballoxcarerra.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @caballoxcarerra }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @caballo = Caballo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caballo }\n end\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def index\n @compte_bancaires = CompteBancaire.all\n\n... | [
"0.6873095",
"0.67415804",
"0.64237106",
"0.64032435",
"0.63715243",
"0.63689035",
"0.63651574",
"0.6319525",
"0.6302595",
"0.62541103",
"0.62519145",
"0.6237283",
"0.6233953",
"0.62315613",
"0.62185043",
"0.62151766",
"0.6208679",
"0.62054914",
"0.6193475",
"0.61851376",
"0.... | 0.68802714 | 0 |
POST /caballoxcarerras POST /caballoxcarerras.json | def create
@caballoxcarerra = Caballoxcarerra.new(params[:caballoxcarerra])
respond_to do |format|
if @caballoxcarerra.save
format.html { redirect_to @caballoxcarerra, notice: 'Caballoxcarerra was successfully created.' }
format.json { render json: @caballoxcarerra, status: :created, loca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @caballo = Caballo.new(params[:caballo])\n\n respond_to do |format|\n if @caballo.save\n format.html { redirect_to @caballo, notice: 'Caballo was successfully created.' }\n format.json { render json: @caballo, status: :created, location: @caballo }\n else\n format.... | [
"0.6318443",
"0.5962037",
"0.59425855",
"0.5932438",
"0.590545",
"0.58508265",
"0.58472663",
"0.5841705",
"0.58138657",
"0.5801257",
"0.5792526",
"0.57879394",
"0.5774496",
"0.57571083",
"0.57530165",
"0.574812",
"0.57310706",
"0.57254386",
"0.5722427",
"0.5719928",
"0.571313... | 0.6756675 | 0 |
PUT /caballoxcarerras/1 PUT /caballoxcarerras/1.json | def update
@caballoxcarerra = Caballoxcarerra.find(params[:id])
respond_to do |format|
if @caballoxcarerra.update_attributes(params[:caballoxcarerra])
format.html { redirect_to @caballoxcarerra, notice: 'Caballoxcarerra was successfully updated.' }
format.json { head :no_content }
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putFactura(oc)\n\n facturax= JSON.parse(HTTP.headers(:\"Content-Type\" => \"application/json\").put(\"http://\"+ $url +\"/facturas/\", :json => {:oc => oc}).to_s, :symbolize_names => true)\n return facturax\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\",... | [
"0.60992515",
"0.60828716",
"0.5974689",
"0.5945983",
"0.5911393",
"0.5901438",
"0.5877391",
"0.58653927",
"0.5836907",
"0.5801162",
"0.5764815",
"0.5744953",
"0.5739045",
"0.57044584",
"0.5691066",
"0.5688008",
"0.5671898",
"0.5671898",
"0.5671898",
"0.5647245",
"0.5644649",... | 0.6194825 | 0 |
Create a geometric series pattern of +length+ values, being +start+ the starting value and +step+ the multiplication factor. | def geom(start=0, grow=1, length=inf)
Pattern.new(size: length) do |y|
i = start
loop_n(length) do
y << i
i *= grow
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sequence(length, step)\n Array.new(length) { |idx| (idx + 1) * step }\nend",
"def random_series(length)\n start_of_length = rand(0..10-length)\n #sets random start position for the length of ship\n #uses range (0..10-length) to ensure that no coordinates will\n #find a nil positi... | [
"0.6625753",
"0.61635387",
"0.6011691",
"0.60076207",
"0.5940493",
"0.5865717",
"0.5856019",
"0.5823256",
"0.58167523",
"0.58088493",
"0.5764521",
"0.5753663",
"0.5747983",
"0.57436514",
"0.57355547",
"0.56561655",
"0.56431544",
"0.55644643",
"0.5516417",
"0.54847556",
"0.545... | 0.67473984 | 0 |
Choose items from the +list+ randomly, +repeats+ number of times +list+ can be a finite enumerable or Pattern. | def rand(list, repeats=1)
Pattern.new(list, size: repeats) do |y|
ls = list.to_a
loop_n(repeats) { y << ls.sample }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xrand(list, repeats=1)\n Pattern.new(list, size: repeats) do |y|\n ls = list.to_a\n xs = nil\n loop_n(repeats) do |i|\n xs = ls.shuffle if i % ls.size == 0\n y << xs[i % ls.size]\n end\n end\n end",
"def shuf(list, repeats=1)\n ... | [
"0.7393126",
"0.6998796",
"0.6608281",
"0.64041597",
"0.6386061",
"0.63790965",
"0.63653725",
"0.63339",
"0.6258034",
"0.6168578",
"0.60658854",
"0.6025466",
"0.5944295",
"0.57736117",
"0.5751003",
"0.5744483",
"0.5586759",
"0.55342865",
"0.55187845",
"0.55034906",
"0.5497644... | 0.8143028 | 0 |
Choose randomly, but only allow repeating the same item after yielding all items from the list. +list+ can be a finite enumerable or Pattern. | def xrand(list, repeats=1)
Pattern.new(list, size: repeats) do |y|
ls = list.to_a
xs = nil
loop_n(repeats) do |i|
xs = ls.shuffle if i % ls.size == 0
y << xs[i % ls.size]
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand(list, repeats=1)\n Pattern.new(list, size: repeats) do |y|\n ls = list.to_a\n loop_n(repeats) { y << ls.sample }\n end\n end",
"def shuf(list, repeats=1)\n Pattern.new(list, size: list.size * repeats) do |y|\n xs = list.to_a.shuffle\n loop_n(... | [
"0.7437481",
"0.67112994",
"0.65431947",
"0.6479747",
"0.6329134",
"0.6189399",
"0.60619116",
"0.6034272",
"0.5934325",
"0.576598",
"0.5691199",
"0.56906205",
"0.5678167",
"0.5635618",
"0.5569695",
"0.5537787",
"0.5535191",
"0.5533294",
"0.5532029",
"0.5529558",
"0.54770136",... | 0.6920671 | 1 |
Shuffle the list in random order, and use the same random order +repeats+ times +list+ can be a finite enumerable or Pattern. | def shuf(list, repeats=1)
Pattern.new(list, size: list.size * repeats) do |y|
xs = list.to_a.shuffle
loop_n(repeats) do |i|
xs.each { |x| y << x }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand(list, repeats=1)\n Pattern.new(list, size: repeats) do |y|\n ls = list.to_a\n loop_n(repeats) { y << ls.sample }\n end\n end",
"def xrand(list, repeats=1)\n Pattern.new(list, size: repeats) do |y|\n ls = list.to_a\n xs = nil\n loop_n... | [
"0.79282933",
"0.7733514",
"0.7697167",
"0.6774428",
"0.62265927",
"0.60585034",
"0.60329896",
"0.60191673",
"0.6008844",
"0.5918732",
"0.5912449",
"0.5808951",
"0.5788808",
"0.5761797",
"0.5757557",
"0.5756841",
"0.5734652",
"0.5722745",
"0.57005006",
"0.5689634",
"0.5674748... | 0.7769014 | 1 |
GET /timelogs GET /timelogs.json | def index
@timelogs = Timelog.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end",
"def show\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_log }\n end\n end",
"def index\n @logs = Log\n .orde... | [
"0.73726743",
"0.7073896",
"0.69582266",
"0.6815986",
"0.6813291",
"0.6765001",
"0.66307884",
"0.65876347",
"0.6537963",
"0.6478967",
"0.64256865",
"0.6385153",
"0.6384347",
"0.63786566",
"0.63542604",
"0.63420284",
"0.6318975",
"0.6317318",
"0.629582",
"0.6251748",
"0.625132... | 0.7310598 | 1 |
POST /timelogs POST /timelogs.json | def create
@timelog = Timelog.new(timelog_params)
respond_to do |format|
if @timelog.save
format.html { redirect_to @timelog, notice: 'Timelog was successfully created.' }
format.json { render :show, status: :created, location: @timelog }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @time_log = TimeLog.new(params[:time_log])\n \n puts \"Creating a new time_log\"\n\n respond_to do |format|\n if @time_log.save\n format.html { redirect_to @time_log, notice: 'Time log was successfully created.' }\n format.json { render json: @time_log, status: :created,... | [
"0.7023421",
"0.6592163",
"0.64650595",
"0.634991",
"0.63455045",
"0.62506634",
"0.61999583",
"0.61820954",
"0.6086651",
"0.6042511",
"0.59536463",
"0.59306264",
"0.5923641",
"0.5893624",
"0.58915913",
"0.5871561",
"0.58654696",
"0.58654696",
"0.58654696",
"0.5838579",
"0.583... | 0.6935787 | 1 |
PATCH/PUT /timelogs/1 PATCH/PUT /timelogs/1.json | def update
respond_to do |format|
if @timelog.update(timelog_params)
format.html { redirect_to @timelog, notice: 'Timelog was successfully updated.' }
format.json { render :show, status: :ok, location: @timelog }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n if @time_log.update_attributes(params[:time_log])\n format.html { redirect_to @time_log, notice: 'Time log was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render actio... | [
"0.6938381",
"0.6436876",
"0.6121391",
"0.6099015",
"0.60900754",
"0.6056761",
"0.6040298",
"0.6040298",
"0.5999841",
"0.5982368",
"0.59713626",
"0.5971211",
"0.5964434",
"0.5959338",
"0.5953547",
"0.59450555",
"0.5943569",
"0.592223",
"0.5909404",
"0.5908379",
"0.5899392",
... | 0.6799888 | 1 |
DELETE /timelogs/1 DELETE /timelogs/1.json | def destroy
@timelog.destroy
respond_to do |format|
format.html { redirect_to timelogs_url, notice: 'Timelog was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @time_log = TimeLog.find(params[:id])\n @time_log.destroy\n\n respond_to do |format|\n format.html { redirect_to time_logs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @log_load_time.destroy\n respond_to do |format|\n format.html { redirect_to log_... | [
"0.75932974",
"0.6981856",
"0.69251",
"0.68272036",
"0.6827134",
"0.6826911",
"0.6811898",
"0.67980355",
"0.6788349",
"0.6788349",
"0.67514145",
"0.674705",
"0.6746204",
"0.6718524",
"0.6713604",
"0.67045647",
"0.6690718",
"0.6670177",
"0.6633918",
"0.6627126",
"0.6611565",
... | 0.73390925 | 1 |
GET /vocabs/new GET /vocabs/new.xml | def new
@vocab = Vocab.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @vocab }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @voc = Voc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @voc }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @vocabtype... | [
"0.7205477",
"0.6870795",
"0.68170506",
"0.6459143",
"0.6422557",
"0.64147925",
"0.639831",
"0.63969773",
"0.63346833",
"0.62948924",
"0.6288333",
"0.6286623",
"0.62817866",
"0.6281421",
"0.62568724",
"0.6242399",
"0.6234912",
"0.6229311",
"0.6212404",
"0.619492",
"0.6187409"... | 0.7075525 | 1 |
POST /vocabs POST /vocabs.xml | def create
@vocab = Vocab.new(params[:vocab])
respond_to do |format|
if @vocab.save
format.html { redirect_to(@vocab, :notice => 'Vocab was successfully created.') }
format.xml { render :xml => @vocab, :status => :created, :location => @vocab }
else
format.html { render :ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @vocabs = Vocab.all\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def create_tv_document(vault_id, api_key, schema = {})\n schemaToJsonString = schema.to_json\n schemaToBase64 = Base64.enc... | [
"0.59768724",
"0.56390685",
"0.5589236",
"0.554242",
"0.5515976",
"0.5508201",
"0.53174794",
"0.53073716",
"0.51834935",
"0.5176287",
"0.5162765",
"0.51276416",
"0.5069808",
"0.5051716",
"0.5049468",
"0.5022001",
"0.4989941",
"0.49885255",
"0.4975003",
"0.49597034",
"0.493988... | 0.5768108 | 1 |
DELETE /vocabs/1 DELETE /vocabs/1.xml | def destroy
@vocab = Vocab.find(params[:id])
@vocab.destroy
respond_to do |format|
format.html { redirect_to(vocabs_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @voc = Voc.find(params[:id])\n @voc.destroy\n\n respond_to do |format|\n format.html { redirect_to vocs_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destro... | [
"0.7135757",
"0.6625649",
"0.6546858",
"0.6508123",
"0.65077686",
"0.6447286",
"0.64054155",
"0.63633335",
"0.6357543",
"0.63456863",
"0.63456863",
"0.6330532",
"0.6329075",
"0.6312402",
"0.63054615",
"0.6296517",
"0.62899715",
"0.62629",
"0.625019",
"0.62489575",
"0.6239563"... | 0.7146931 | 0 |
Evaluates the fitness of a chromosome for the knapsack problem | def evaluate_chromosome(chromosome)
@num_evaluations += 1
chromosome.fitness = @knapsack_func.call chromosome, @values, @weights, @max_weight
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fitness\n return @fitness if @fitness\n\n consumption_per_cluster = {}\n @data.each_with_index do |v, i|\n consumption_per_cluster[v] ||= 0\n # puts @prosumers[i].id, @real_consumption\n consumption_per_cluster[v] += (@real_consumption[@prosumers[i].id] || 0)\n ... | [
"0.7115325",
"0.7004482",
"0.68959135",
"0.68527335",
"0.67934406",
"0.66817355",
"0.66817355",
"0.6662765",
"0.66269284",
"0.6491956",
"0.64049995",
"0.63997257",
"0.6353592",
"0.63453203",
"0.63451684",
"0.63141376",
"0.6248547",
"0.6214732",
"0.62117344",
"0.61944336",
"0.... | 0.86387455 | 1 |
Mutates the chromosomes in mating pool | def mutate_matingpool
(0...@mating_pool.size).each do |i|
j = rand 0...@num_genes
chromosome = @mating_pool[i].clone
gene = chromosome[j]
gene = gene.zero? ? 1 : 0
chromosome[j] = gene
@new_generation << chromosome
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mutate_individuals\n m = @chromosomes.size\n (0...m).each do |x|\n r = rand(0.0..1.0)\n next if r > @mut_rate\n\n new_chrom = mutate @chromosomes[x].clone\n evaluate_chromosome new_chrom\n @chromosomes << new_chrom\n end\n end",
"def mutate(chromosome)\n gene_pos = (0...... | [
"0.75502497",
"0.70016086",
"0.6958401",
"0.6566544",
"0.64149225",
"0.6375963",
"0.63740724",
"0.63740724",
"0.62563986",
"0.61983883",
"0.6191474",
"0.6073511",
"0.5991838",
"0.5988826",
"0.5988826",
"0.5868213",
"0.58568865",
"0.57702166",
"0.567231",
"0.5649968",
"0.55785... | 0.7639051 | 0 |
Insert the new chromosomes into the population | def insert_new_generation
(0...@new_generation.size).each do |i|
evaluate_chromosome @new_generation[i]
j = rand 0...@chromosomes.size
@chromosomes.delete_at j
@chromosomes << @new_generation[i]
end
@mating_pool.clear
@new_generation.clear
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add chromosome\n\t\t@arrayChromosomes << chromosome\n\tend",
"def init_chromosomes(pop_size, macro_cromosomes)\n (0...pop_size).each do |j|\n chromo = Chromosome.new\n each do |gene|\n chromo << macro_cromosomes[j][gene]\n end\n @chromosomes << chromo\n end\n @best_chromos... | [
"0.6708868",
"0.6652439",
"0.62758857",
"0.6096428",
"0.5929037",
"0.5780149",
"0.5764817",
"0.5677918",
"0.56172997",
"0.56000036",
"0.55607235",
"0.5552239",
"0.55368334",
"0.5497501",
"0.5460478",
"0.5446601",
"0.5431011",
"0.5335405",
"0.5321213",
"0.5292759",
"0.52521706... | 0.7159294 | 0 |
Render a collection of facet fields | def render_facet_partials fields = facet_field_names, options = {}
safe_join(facets_from_request(fields).map do |display_facet|
render_facet_limit(display_facet, options)
end.compact, "\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_facet_field(*) super end",
"def facet_field_names\n Blacklight.config[:facet][:field_names]\n end",
"def facet_description\n %{ in facet \"#{@field}\"}\n end",
"def facet\n @facet = blacklight_config.facet_fields[params[:id]]\n raise ActionController::RoutingError, 'Not Found' unless @f... | [
"0.7120474",
"0.6898771",
"0.68141806",
"0.6805483",
"0.67574304",
"0.65837395",
"0.6571544",
"0.65704364",
"0.6522319",
"0.65007424",
"0.64987487",
"0.63871676",
"0.6352271",
"0.634417",
"0.63263524",
"0.62522674",
"0.62400496",
"0.6218928",
"0.62139195",
"0.6173563",
"0.615... | 0.7069384 | 1 |
used in the catalog/_facets partial and elsewhere Renders a single section for facet limit with a specified solr field used for faceting. Can be overridden for custom display on a perfacet basis. | def render_facet_limit(display_facet, options = {})
return if not should_render_facet?(display_facet)
options = options.dup
options[:partial] ||= facet_partial_name(display_facet)
options[:layout] ||= "facet_layout" unless options.has_key?(:layout)
options[:locals] ||= {}
options[:locals][:solr_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facet_partial_name(display_facet = nil)\n if advanced_query&.filters&.keys&.include?(display_facet.name)\n 'blacklight_advanced_search/facet_limit'\n else\n super\n end\n end",
"def facet_limit_content\n browse_config = BlacklightFacetBrowse::ConfigInfo.new(blacklight_config, params[... | [
"0.75319517",
"0.7411719",
"0.72236836",
"0.72187984",
"0.72086275",
"0.71757025",
"0.717266",
"0.716315",
"0.70510095",
"0.6914364",
"0.69043404",
"0.68338716",
"0.68260664",
"0.67723316",
"0.6691852",
"0.66669905",
"0.66643906",
"0.6649322",
"0.65980977",
"0.65767425",
"0.6... | 0.7695665 | 0 |
if the facet is 'active', don't collapse if the facet is configured to collapse (the default), collapse if the facet is configured not to collapse, don't collapse | def should_collapse_facet? facet_field
!facet_field_in_params?(facet_field.field) && facet_field.collapse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def should_collapse?\n true\n end",
"def collapsing?\n @effect_type == :collapse\n end",
"def filter_group_div(search, facets, key)\n classes = 'filter collapse'\n values = facets[key]\n if values.blank? || search.send(values.first.field).present?\n classes += ' show'\n end\n conten... | [
"0.5916017",
"0.577509",
"0.57064456",
"0.52796644",
"0.5208292",
"0.5181392",
"0.51693624",
"0.51678884",
"0.5112843",
"0.5061723",
"0.48047403",
"0.4765849",
"0.47312254",
"0.46999016",
"0.4676497",
"0.4666131",
"0.46469474",
"0.46307597",
"0.4627881",
"0.46222404",
"0.4617... | 0.7778308 | 0 |
the name of the partial to use to render a facet field. Can be overridden for custom display on a perfacet basis. | def facet_partial_name(display_facet = nil)
config = facet_configuration_for_field(display_facet.name)
name = config.try(:partial)
name ||= "facet_pivot" if config.pivot
name ||= "facet_limit"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advanced_search_facet_partial_name(display_facet)\n facet_configuration_for_field(display_facet.name).try(:partial) || \"catalog/facet_limit\"\n end",
"def advanced_search_facet_partial_name(display_facet)\n facet_configuration_for_field(display_facet.name).try(:partial) ||\n 'catalog/fac... | [
"0.781309",
"0.7808061",
"0.7571281",
"0.70201045",
"0.6922453",
"0.67138255",
"0.6536312",
"0.645648",
"0.64108264",
"0.63434017",
"0.63183767",
"0.63034713",
"0.6251379",
"0.6234311",
"0.62078863",
"0.6124752",
"0.61228424",
"0.6080235",
"0.6080235",
"0.6060706",
"0.6042738... | 0.8487721 | 0 |
facet param helpers > Standard display of a facet value in a list. Used in both _facets sidebar partial and catalog/facet expanded list. Will output facet value name as a link to add that to your restrictions, with count in parens. first arg item is a facet value item from rsolrext. options consist of: :suppress_link =... | def render_facet_value(facet_solr_field, item, options ={})
scope = options.delete(:route_set) || self
path = scope.url_for(add_facet_params_and_redirect(facet_solr_field, item).merge(only_path: true))
content_tag(:span, :class => "facet-label") do
link_to_unless(options[:suppress_link], facet_dis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_facet_value(facet_field, item, options = {})\n facet_config = facet_configuration_for_field(facet_field)\n path = path_for_facet(facet_field, item)\n if options[:suppress_link]\n content_tag(:span, facet_display_value(facet_field, item), class: 'facet-label') +\n render_facet_count(... | [
"0.7465469",
"0.724564",
"0.71817887",
"0.6936122",
"0.69254816",
"0.66142833",
"0.66138643",
"0.63743275",
"0.63065904",
"0.6246644",
"0.6242055",
"0.6233803",
"0.6232174",
"0.6220401",
"0.62031484",
"0.6196481",
"0.61561364",
"0.6038562",
"0.60293543",
"0.6004332",
"0.60031... | 0.78114754 | 0 |
Renders a count value for facet limits. Can be overridden locally to change style. And can be called by plugins to get consistent display. option :class takes an array of classes to add to count span. | def render_facet_count(num, options = {})
classes = (options[:classes] || []) << "facet-count"
content_tag("span", t('blacklight.search.facets.count', :number => num), :class => classes)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_facet_count(num)\n content_tag(\"span\", t('blacklight.search.facets.count', :number => num), :class => \"badge\") \n end",
"def render_facet_count(num, options = {})\n content_tag(:span, t('blacklight.search.facets.count', number: number_with_delimiter(num)))\n end",
"def count\n { val... | [
"0.7277544",
"0.7219388",
"0.5847923",
"0.58337456",
"0.58337456",
"0.58337456",
"0.58337456",
"0.58337456",
"0.58337456",
"0.57482225",
"0.57482225",
"0.57482225",
"0.57482225",
"0.57482225",
"0.5747489",
"0.5747489",
"0.5747489",
"0.5747489",
"0.5747489",
"0.5747489",
"0.57... | 0.78717864 | 0 |
Used in catalog/facet action, facets.rb view, for a click on a facet value. Add on the facet params to existing search constraints. Remove any paginatorspecific request params, or other request params that should be removed for a 'fresh' display. Change the action to 'index' to send them back to catalog/index with thei... | def add_facet_params_and_redirect(field, item)
new_params = add_facet_params(field, item)
# Delete page, if needed.
new_params.delete(:page)
# Delete any request params from facet-specific action, needed
# to redir to index action properly.
Blacklight::Solr::FacetPaginator.request_keys.value... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_facet_params_and_redirect(field, item)\n new_params = add_facet_params(field, item)\n\n # Delete any request params from facet-specific action, needed\n # to redir to index action properly.\n request_keys = blacklight_config.facet_paginator_class.request_keys\n new_params.except! *... | [
"0.7543344",
"0.7266392",
"0.71268874",
"0.70836556",
"0.6826364",
"0.63537973",
"0.626956",
"0.62656873",
"0.6253408",
"0.62241066",
"0.62236285",
"0.6220417",
"0.62139845",
"0.6196812",
"0.6185584",
"0.6176738",
"0.6155344",
"0.6115457",
"0.60361975",
"0.59883356",
"0.59836... | 0.74737185 | 1 |
true or false, depending on whether the field and value is in params[:f] | def facet_in_params?(field, item)
if item and item.respond_to? :field
field = item.field
end
value = facet_value_for_facet_item(item)
facet_field_in_params?(field) and params[:f][field].include?(value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facet_in_params?(field, value)\n params[:f] and params[:f][field] and params[:f][field].include?(value)\n end",
"def true?(param)\n params[param] == 'on'\n end",
"def true_string?(field)\n field == 'true' || field == true\n end",
"def value?(value) true end",
"def facet_field_in_params?... | [
"0.75339687",
"0.6412714",
"0.64015746",
"0.63371885",
"0.6316254",
"0.63133955",
"0.62888336",
"0.62869513",
"0.62573445",
"0.6148769",
"0.61322033",
"0.6129393",
"0.61263824",
"0.6108834",
"0.60878766",
"0.6087756",
"0.608694",
"0.60623",
"0.60508585",
"0.60198045",
"0.6001... | 0.6470807 | 1 |
GET /swms GET /swms.json | def index
@swms = Swm.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @wms = WmsResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wms }\n end\n end",
"def show\n @swc = Swc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @swc }\n ... | [
"0.68306196",
"0.6727934",
"0.6666062",
"0.66582376",
"0.66351855",
"0.6421187",
"0.63850766",
"0.6320499",
"0.6288333",
"0.62679285",
"0.62573165",
"0.62297046",
"0.62170035",
"0.62159646",
"0.6215255",
"0.62124676",
"0.6161469",
"0.6153026",
"0.614948",
"0.61398816",
"0.613... | 0.7455653 | 0 |
POST /swms POST /swms.json | def create
@swm = Swm.new(swm_params)
respond_to do |format|
if @swm.save
format.html { redirect_to @swm, notice: 'Swm was successfully created.' }
format.json { render :show, status: :created, location: @swm }
else
format.html { render :new }
format.json { render js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @swot = Swot.new(swot_params)\n\n respond_to do |format|\n if @swot.save\n format.html { redirect_to @swot, notice: 'Swot was successfully created.' }\n format.json { render :show, status: :created, location: @swot }\n else\n format.html { render :new }\n fo... | [
"0.6327536",
"0.61164886",
"0.61114085",
"0.60531485",
"0.6039162",
"0.59937876",
"0.59446734",
"0.59335345",
"0.59043264",
"0.58846635",
"0.58678705",
"0.58392733",
"0.5799461",
"0.57974845",
"0.57645106",
"0.576387",
"0.57557553",
"0.574934",
"0.5691495",
"0.5665295",
"0.56... | 0.7552058 | 0 |
PATCH/PUT /swms/1 PATCH/PUT /swms/1.json | def update
respond_to do |format|
if @swm.update(swm_params)
format.html { redirect_to @swm, notice: 'Swm was successfully updated.' }
format.json { render :show, status: :ok, location: @swm }
else
format.html { render :edit }
format.json { render json: @swm.errors, statu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @swot.update(swot_params)\n format.html { redirect_to @swot, notice: 'Swot was successfully updated.' }\n format.json { render :show, status: :ok, location: @swot }\n else\n format.html { render :edit }\n format.json { render json: @... | [
"0.6545483",
"0.65422654",
"0.63835573",
"0.6296627",
"0.6289279",
"0.62850255",
"0.6160707",
"0.60891974",
"0.6083413",
"0.60750896",
"0.60674185",
"0.6026005",
"0.60222507",
"0.60096896",
"0.60055774",
"0.60037106",
"0.59945226",
"0.5990951",
"0.5979109",
"0.59622043",
"0.5... | 0.67645305 | 0 |
DELETE /swms/1 DELETE /swms/1.json | def destroy
@swm.destroy
respond_to do |format|
format.html { redirect_to swms_url, notice: 'Swm was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @swit.destroy\n respond_to do |format|\n format.html { redirect_to swits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url... | [
"0.72164035",
"0.7118506",
"0.71115196",
"0.69948643",
"0.69682616",
"0.6955032",
"0.69134486",
"0.6892953",
"0.6880541",
"0.68415",
"0.68100286",
"0.67969",
"0.67785186",
"0.67688966",
"0.6763038",
"0.6761107",
"0.6758883",
"0.67581385",
"0.6731574",
"0.6731574",
"0.6697689"... | 0.7398149 | 0 |
GET /bug_comments/1 GET /bug_comments/1.json | def show
@bug_comment = BugComment.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @bug_comment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments\n client.get(\"/#{id}/comments\")\n end",
"def bug\n bug = Bug.where(id: params[:bugId])\n render :json => bug.to_json\n end",
"def test_ListBugComments\n\t\tcolName = 'comments'\n\t\tretClass = LeanTesting::BugComment\n\t\tresp = rcol(colName, ['_id', 'text', '_owner_id', 'created_... | [
"0.73293084",
"0.73246545",
"0.71618634",
"0.71053344",
"0.7079374",
"0.70321536",
"0.69211996",
"0.6892707",
"0.68648005",
"0.6836367",
"0.6836367",
"0.6829517",
"0.67326605",
"0.6730982",
"0.6709696",
"0.67096686",
"0.6637634",
"0.6587711",
"0.65641856",
"0.6553427",
"0.653... | 0.7639476 | 0 |
GET /bug_comments/new GET /bug_comments/new.json | def new
@bug_comment = BugComment.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @bug_comment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @bug = Bug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end",
"def new\n @bug = Bug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end",
"def new... | [
"0.7741878",
"0.7741878",
"0.7590423",
"0.75071365",
"0.747693",
"0.74321127",
"0.74179894",
"0.74179894",
"0.74179894",
"0.74179894",
"0.74179894",
"0.74179894",
"0.74179894",
"0.74179894",
"0.74179894",
"0.74179894",
"0.74179894",
"0.74179894",
"0.7377365",
"0.7372561",
"0.... | 0.83357793 | 0 |
POST /bug_comments POST /bug_comments.json | def create
@bug_comment = BugComment.new(params[:bug_comment])
respond_to do |format|
if @bug_comment.save
format.html { redirect_to project_bug_list_bug_post_path(params[:project_id], params[:bug_list_id], params[:bug_post_id]), notice: 'Bug comment was successfully created.' }
format.js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @bug = Bug.new(params[:bug])\n\n respond_to do |format|\n if @bug.save\n format.html { redirect_to @bug, notice: 'Bug was successfully created.' }\n format.json { render json: @bug, status: :created, location: @bug }\n else\n format.html { render action: \"new\" }\... | [
"0.68521065",
"0.68521065",
"0.6757109",
"0.6732868",
"0.67123157",
"0.6676102",
"0.66270256",
"0.6618341",
"0.6515417",
"0.64935964",
"0.6493098",
"0.645337",
"0.64232683",
"0.64228904",
"0.6422504",
"0.64201736",
"0.6416025",
"0.6367726",
"0.6358539",
"0.6346865",
"0.631591... | 0.7440821 | 0 |
PUT /bug_comments/1 PUT /bug_comments/1.json | def update
@bug_comment = BugComment.find(params[:id])
respond_to do |format|
if @bug_comment.update_attributes(params[:bug_comment])
format.html { redirect_to project_bug_list_bug_post_path(params[:project_id], params[:bug_list_id], params[:bug_post_id]), notice: 'Bug comment was successfully up... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_bug(bug_data, bug_task, build_number)\n bug_id = bug_data['id']\n bugproxy = @server.proxy('Bug')\n comments_result = bugproxy.comments({:ids => bug_id})\n #puts comments_result\n comments = comments_result['bugs'][\"#{bug_id}\"]['comments']\n last_comment = comments.last\n\n if la... | [
"0.6903579",
"0.6669344",
"0.6631815",
"0.6620086",
"0.6620086",
"0.6602086",
"0.65929544",
"0.6523104",
"0.6508991",
"0.6498441",
"0.6490905",
"0.6411055",
"0.6410706",
"0.63994026",
"0.63214517",
"0.6285598",
"0.6282371",
"0.6273631",
"0.62533146",
"0.6233127",
"0.6226752",... | 0.70684046 | 0 |
DELETE /bug_comments/1 DELETE /bug_comments/1.json | def destroy
@bug_comment = BugComment.find(params[:id])
@bug_comment.destroy
respond_to do |format|
format.html { redirect_to project_bug_list_bug_post_path(params[:project_id], params[:bug_list_id], params[:bug_post_id]), notice: 'Bug comment was deleted.' }
format.json { head :ok }
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @client_bug.destroy\n respond_to do |format|\n format.html { redirect_to client_bugs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bug = Bug.find(params[:id])\n @bug.destroy\n\n respond_to do |format|\n format.html { redirect_to bugs_url }\... | [
"0.7130589",
"0.7079464",
"0.7079464",
"0.69206566",
"0.6859442",
"0.6834112",
"0.68078357",
"0.67833066",
"0.67779195",
"0.6761538",
"0.6755994",
"0.6749558",
"0.67441714",
"0.6738591",
"0.67318845",
"0.67318845",
"0.67225707",
"0.67193604",
"0.670611",
"0.66941136",
"0.6684... | 0.7298969 | 0 |
We supply an alternative channel template that produces JSON, parse it back and make some basic assertions on the results | def test_overwrite_channel_template
channel_template = File.join(FIXTURES_DIR, 'test_template.json.erb')
channel = JSON.parse(`#{APP_SCRIPT} #{FIXTURE_ITUNES_MP3} --channel-template #{channel_template}`)
assert_equal('All About Everything', channel['channel']['title'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(response, channel)\n return unless channel == \"slack\"\n begin\n JSON.parse(response)\n rescue Exception => e\n warn \"Rendered template is not valid JSON\"\n warn e\n exit 1\n end\n response\n end",
"def message(channel, data)\n\t\t\tmessage = {:channel => chann... | [
"0.6534558",
"0.5554541",
"0.5505385",
"0.54865074",
"0.5458585",
"0.53577924",
"0.5357543",
"0.52691466",
"0.5248611",
"0.5229259",
"0.5227058",
"0.52222663",
"0.52133965",
"0.5156447",
"0.5155439",
"0.5152958",
"0.51413167",
"0.5035337",
"0.49987176",
"0.49987176",
"0.49970... | 0.66296875 | 0 |
discharge?(Energy energy) determines if the capacitor should discharge from given energy If the supplied energy is insufficient to charge the capacitor it will discharge instead | def discharge?(energy)
energy.value < @charge_pull_min
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_charging\n return unless @charging # Rubocop prefers unless here\n @charging = false\n charge_time = Time.new - @last_charge_started\n\n if (@charge + charge_time) >= 100\n @charge = 100\n else\n @charge += charge_time.to_i\n end\n end",
"def charge?\n false\n end",
... | [
"0.58425105",
"0.5829625",
"0.57867074",
"0.5622034",
"0.54161775",
"0.53869593",
"0.5380805",
"0.53004116",
"0.5293725",
"0.5291191",
"0.5215216",
"0.5205467",
"0.5192831",
"0.51886636",
"0.5173412",
"0.5166205",
"0.51445043",
"0.5135364",
"0.51218235",
"0.5115349",
"0.51116... | 0.76605713 | 0 |
Specifies associations to expand in the result. Usage example: account.expand('opportunity_customer_accounts') | def expand(*props)
@query[:expand] = props.join(',')
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_expand(namespace, object, relation, max_depth, opts = {})\n data, _status_code, _headers = get_expand_with_http_info(namespace, object, relation, max_depth, opts)\n data\n end",
"def get_expand_with_http_info(namespace, object, relation, max_depth, opts = {})\n if @api_client.config.deb... | [
"0.6358417",
"0.623677",
"0.5803372",
"0.57773936",
"0.5673523",
"0.5576568",
"0.5538651",
"0.544757",
"0.5267457",
"0.52670187",
"0.52598846",
"0.5227933",
"0.5174248",
"0.51419735",
"0.5110198",
"0.5076177",
"0.50740314",
"0.50640017",
"0.5049304",
"0.50243425",
"0.50199014... | 0.6490332 | 0 |
Specifies properties to order the result by. Usage example: entity.order_by(:Name, :id) | def order_by(*props)
@query[:order_by] = props.join(',')
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_by(property_name)\n query_proxy = OData::Model::QueryProxy.new(self)\n query_proxy.order_by(property_name.to_sym)\n end",
"def get_order_by\n @order_by\n end",
"def order_by(field)\n ensure_valid_parameter('sorting order', field, %w(price age))\n @reques... | [
"0.79452527",
"0.6574977",
"0.6556934",
"0.64796484",
"0.64582866",
"0.6422268",
"0.6387009",
"0.63655484",
"0.63266015",
"0.62856567",
"0.623447",
"0.61986935",
"0.6172897",
"0.61525244",
"0.61286724",
"0.60561204",
"0.60510975",
"0.60374254",
"0.60027474",
"0.594725",
"0.59... | 0.7979034 | 0 |
Specifies properties to select within the result. | def select(*props)
@query[:select] = props.join(',')
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def properties\n PropertySet.new(query.fields)\n end",
"def select(property_name)\n query_proxy = OData::Model::QueryProxy.new(self)\n query_proxy.select(property_name.to_sym)\n end",
"def get_properties\n xml = client.call(\"#{attributes[:url]}/property\").parsed_response... | [
"0.7037523",
"0.6372294",
"0.5966843",
"0.58202016",
"0.5809071",
"0.57916844",
"0.5781576",
"0.5716207",
"0.5715318",
"0.56857157",
"0.55933434",
"0.5578321",
"0.5547509",
"0.55301464",
"0.54964644",
"0.54964644",
"0.54964644",
"0.5496295",
"0.543184",
"0.5427901",
"0.541111... | 0.65223545 | 1 |
Adds expressions to query. For example: AccountId eq 'HS112233' Usage examples: entity.where(entity[:AccountId].eq('ID12345')) entity.where.not(entity[:title].eq('Staff Manager')) Operators: eq, ne, gt, ge, lt, le, and, or, not | def where(*exps)
joined_exps = exps.join(' and ')
return self if joined_exps.empty?
if @query[:filters].nil?
@query[:filters] = joined_exps
else
@query[:filters] += " and #{joined_exps}"
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def and(*exps)\n joined_exps = exps.join(' and ')\n @query[:filters] += \" and #{joined_exps}\"\n self\n end",
"def not(*exps)\n joined_exps = exps.join(' and ')\n\n if @query[:filters].nil?\n @query[:filters] = \"not (#{joined_exps})\"\n else\n @query[:filters] = \... | [
"0.69339955",
"0.6685352",
"0.6166745",
"0.6131219",
"0.6130166",
"0.60400367",
"0.60305995",
"0.59416515",
"0.59129125",
"0.5908985",
"0.58921903",
"0.5864887",
"0.5792198",
"0.5790739",
"0.57528895",
"0.572399",
"0.57158107",
"0.57158107",
"0.5707531",
"0.5695776",
"0.56954... | 0.6930074 | 1 |
Adds the logical operator 'or' to the query and start another chain. Usage example: entity.where(exp).or(exp) entity.where(exp).or.not(exp) | def or(*exps)
joined_exps = exps.join(' and ')
@query[:filters] += " or #{joined_exps}"
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def or(*cond, &block)\n if @opts[:where].nil?\n self\n else\n add_filter(:where, cond, false, :OR, &block)\n end\n end",
"def logical_or\n expr = logical_and\n\n while match?(:or)\n operator = previous\n right = logical_and\n expr = Ringo::Logical.ne... | [
"0.78993905",
"0.7872757",
"0.77842265",
"0.77795374",
"0.77575654",
"0.7741263",
"0.76717913",
"0.7649127",
"0.7562432",
"0.742701",
"0.74042994",
"0.73159015",
"0.7308473",
"0.72583354",
"0.70987034",
"0.70377344",
"0.7009755",
"0.6917593",
"0.6897309",
"0.6892762",
"0.6878... | 0.8045899 | 0 |
Adds the logical operator 'and' to the query. | def and(*exps)
joined_exps = exps.join(' and ')
@query[:filters] += " and #{joined_exps}"
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def and_expr\n expr = equality()\n\n while match(:and)\n operator = previous()\n right = equality()\n expr = Expr::Logical.new expr, operator, right\n end\n\n expr\n end",
"def and(query = nil, *args)\n merge_query(query, :and, *args) do |left, right|\n NSC... | [
"0.8134892",
"0.80127376",
"0.7988323",
"0.79466295",
"0.7616331",
"0.7546433",
"0.7541469",
"0.7511747",
"0.7439362",
"0.7391894",
"0.73369825",
"0.7307591",
"0.7287726",
"0.72846097",
"0.7172448",
"0.7110813",
"0.7085392",
"0.70625675",
"0.7040835",
"0.7037895",
"0.70329815... | 0.81234175 | 1 |
Adds the logical operator 'not' to the query. This should be only used after 'and' or 'or' operators. Usage example: entity.where(exp).and.not(exp) This operator wraps the expressions before it & after it in parentheses. => (expressions) and not (expressions) | def not(*exps)
joined_exps = exps.join(' and ')
if @query[:filters].nil?
@query[:filters] = "not (#{joined_exps})"
else
@query[:filters] = "(#{@query[:filters]}) and not (#{joined_exps})"
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_logical_not_expression\n next_token # = skip NOT operator\n negated_expression = case peek_token\n when :not; parse_logical_not_expression\n when :lparen; parse_expression_sequence\n else parse_comparison\n end\n\n raise ScopedSearch::QueryNotSupported, \"No operand... | [
"0.7901466",
"0.7597914",
"0.73130447",
"0.71479553",
"0.71349484",
"0.69743174",
"0.6865852",
"0.68529075",
"0.67658275",
"0.676059",
"0.6722274",
"0.66262555",
"0.6611376",
"0.6592655",
"0.656709",
"0.6559222",
"0.6542023",
"0.64313924",
"0.64149976",
"0.6410206",
"0.640713... | 0.79329574 | 0 |
'Not Equal to' expression | def ne(val)
expression(:ne, val)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neq(v)\n NotEqual.new(v)\n end",
"def neq(val)\n Rule.new error: [:eq, val], predicate: -> { _1 != val }\n end",
"def not( arg ); { $not => arg } end",
"def compose_not_eq_node(node, value)\n validate_node_or_attribute(node)\n validate_basic_class(node, value)\n node... | [
"0.7427771",
"0.73921627",
"0.726881",
"0.71392304",
"0.709977",
"0.70953625",
"0.70405126",
"0.69993526",
"0.6977087",
"0.6932159",
"0.6891313",
"0.6819818",
"0.6806423",
"0.6745948",
"0.6732703",
"0.6706866",
"0.6684437",
"0.66711414",
"0.66660064",
"0.6614125",
"0.6587215"... | 0.7628501 | 0 |
Builds the expression as a string statement. Note: Single qoutes must be around the value if it's a String or Symbol Example: "Attribute eq 'value'" | def expression(operator, val)
val = (val.is_a?(String) || val.is_a?(Symbol)) ? "'#{val}'" : val
"#{@attr} #{operator} #{val}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n operator_string + \" \" + @expression.to_s\n end",
"def to_s\n template = indirect? ? \"[%s]\" : \"%s\"\n return template % expr_to_s\n end",
"def sql_string\n StringExpression.new(self.op, *self.args)\n end",
"def to_s\n @expression.to_s\n end",
"def expr_... | [
"0.7107881",
"0.6944477",
"0.68101734",
"0.68017095",
"0.6736574",
"0.65716076",
"0.64896035",
"0.64821786",
"0.6330809",
"0.6321559",
"0.6301578",
"0.6261628",
"0.62302476",
"0.62197834",
"0.6157794",
"0.61261564",
"0.61257243",
"0.60876477",
"0.60786057",
"0.6074981",
"0.60... | 0.71151686 | 0 |
Takes two hashes and merges them but has special handling for where the keys are the same. It will merge the values using the same method | def merge_values(h1, h2)
out = {}
(h1.keys + h2.keys).uniq.each do |key|
# If the key is present in both hashes
if h1.key?(key) && h2.key?(key)
out[key] = merge_values(h1[key], h2[key])
elsif h1.key?(key)
out[key] = h1[key]
else
out[key] = h2[key]
end
end
out
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(hash_1, hash_2)\n merged = {}\n hash_1.each { |key, val| merged[key] = val }\n hash_2.each { |key, val| merged[key] = val }\n merged \nend",
"def merge(other_hash); end",
"def merge(hash_1, hash_2)\n new_hash = Hash.new()\n\n hash_1.each {|key, value| new_hash[key] = value}\n\n hash_2.ea... | [
"0.86155486",
"0.8518556",
"0.84364635",
"0.8388181",
"0.82505685",
"0.8201184",
"0.8160832",
"0.8132664",
"0.8087247",
"0.80774677",
"0.8062809",
"0.8022652",
"0.80021596",
"0.79768807",
"0.7955795",
"0.7914494",
"0.78919286",
"0.78919286",
"0.78919286",
"0.7825196",
"0.7808... | 0.8631762 | 0 |
Checks the visibility of a user | def check_visibility
raise Helpedia::ItemNotVisible unless @user.visible_for?(current_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visible?(user=User.current)\n true\n end",
"def viewable?(user=:false)\n (user != :false && is_visible_to_id <= user.user_level.position) || (user == :false && is_visible_to == UserLevel.find_by_name(\"Anonymous\"))\n end",
"def check_visibility\n if @check_visibility_of.respond_to?(:restricted)... | [
"0.76382065",
"0.74569374",
"0.7444551",
"0.7418695",
"0.74130285",
"0.73541003",
"0.73028266",
"0.73006326",
"0.7250934",
"0.7248891",
"0.71260196",
"0.7080851",
"0.7052237",
"0.70232177",
"0.6993443",
"0.6982246",
"0.6948969",
"0.6899554",
"0.6893033",
"0.6830029",
"0.68292... | 0.788039 | 0 |
returns true if the any of the closure's states are included in the set of accept_states | def accept_state_of(closure)
closure.each do |set|
if @accept_states.include?(set)
return @accept_states[set] # change this to "true" if reverting to crappy system
end
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_state?(state)\n @accept.include? state\n end",
"def accepts?(countries)\n return false if done?\n\n @possibles.any? do |ops_modifiers, count|\n all_ops_modifiers_qualify?(countries, ops_modifiers, count)\n end\n end",
"def is_accept_state?(state)\n @accept.include? state.... | [
"0.7464042",
"0.7000052",
"0.6974908",
"0.64885783",
"0.6440938",
"0.6373483",
"0.58169836",
"0.57765716",
"0.5727266",
"0.56781983",
"0.5658219",
"0.5654258",
"0.56140506",
"0.5609479",
"0.55522496",
"0.55454373",
"0.55306786",
"0.55023855",
"0.55005413",
"0.549914",
"0.5492... | 0.81454295 | 0 |
This horrific kluge ports the ruby dump_tables to Javascript. Sorta. Smelly code, but output passes JSLint and is the path of least resistance. TODO: Write something that generates the tables as ruby objects, then refactor these table dumping functions, using array.to_s | def js_tables(name = 'ScannerModule', indent_width = 2)
expand_regex_edges
replacements = {
' # E' => '// E', # Action table's label
' # ' => '// ', # table-leading comments
'# ' => ' // ', # row-trailing descriptions
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dumpLuaTable(data)\n\t\t\t\tif data.is_a?(Array) then\n\t\t\t\t\tstr = \"{\"\n\t\t\t\t\tdata.each do |v|\n\t\t\t\t\t\tstr = (str + dumpLuaTable(v) + \",\")\n\t\t\t\t\tend\n\t\t\t\t\tstr = (str + \"}\")\n\t\t\t\t\treturn str\n\t\t\t\telsif data.is_a?(Hash) then\n\t\t\t\t\tstr = \"{\"\n\t\t\t\t\tdata.each do |k,... | [
"0.6290226",
"0.60953385",
"0.60811573",
"0.6007321",
"0.5973466",
"0.59534174",
"0.5882223",
"0.5824239",
"0.579099",
"0.57674044",
"0.5744161",
"0.5738041",
"0.5715203",
"0.5709374",
"0.569604",
"0.56960005",
"0.5657959",
"0.56341803",
"0.5605203",
"0.5604517",
"0.55589944"... | 0.67840314 | 0 |
Dumps either a state table, an action table, or a lookup table This function is kind of halfrefactored with dump_module and needs cleaning like the wizard needs food. | def dump_table(type = :state, indent_width = 2, indent_level = 2)
# edge_labels = friendly_edge_labels << " Other" # I suspect this line is ruining the code.
edge_labels = get_edge_labels << " Other"
node_names = get_node_names
s = "#{ind(indent_level)}@#{type}_table = " +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump( out = Dumper.new )\n out.dump \"table #{out_name}\" do\n for column in columns\n column.dump( out )\n end\n for index in indexes\n index.dump( out )\n end\n for foreign_key in foreign_keys\n foreign_key.dump( out )\n ... | [
"0.64965963",
"0.62526715",
"0.62514544",
"0.6195146",
"0.61466557",
"0.59946245",
"0.59121525",
"0.58168757",
"0.5805605",
"0.5761295",
"0.5744744",
"0.5727795",
"0.57085055",
"0.5696255",
"0.5665576",
"0.5654355",
"0.56464064",
"0.55648005",
"0.5543738",
"0.55153036",
"0.55... | 0.6870732 | 0 |
Method for set the limit for the media upload | def set_media_upload_limit
# Creating the limitation for the question tags
media_upload_limit = setting.build_media_upload(media_upload_limit: params[:media_upload_limit])
# creating the question tags limit
if media_upload_limit.save
# response to the JSON
render json: { success: true,message: "Media Uplo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_limit\n @limit = 250\n end",
"def limit(_limit)\n @limit = _limit\n self\n end",
"def set_media_tag\n\t\t# Creating the limitation for the media attachment tags\n\t\tmedia_tag_limit = setting.build_media_tag(media_tag_limit: params[:media_tag_limit])\n\t\t# creating the media tags ... | [
"0.7588853",
"0.7318981",
"0.7093644",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"0.6979451",
"... | 0.83225447 | 0 |
Method for creating ther media tag for setting the limit | def set_media_tag
# Creating the limitation for the media attachment tags
media_tag_limit = setting.build_media_tag(media_tag_limit: params[:media_tag_limit])
# creating the media tags limit
if media_tag_limit.save
# response to the JSON
render json: { success: true,message: "Media Tag limit Successfully ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_media_upload_limit\n\t\t# Creating the limitation for the question tags\n\t\tmedia_upload_limit = setting.build_media_upload(media_upload_limit: params[:media_upload_limit])\n\t\t# creating the question tags limit\n\t\tif media_upload_limit.save\n\t\t# response to the JSON\n\t\t render json: { success: tr... | [
"0.7416455",
"0.6167619",
"0.6167619",
"0.6167619",
"0.6167619",
"0.6167619",
"0.6167619",
"0.6167619",
"0.6167619",
"0.61363256",
"0.6090348",
"0.60171604",
"0.5990471",
"0.5985069",
"0.5953337",
"0.5948502",
"0.5908056",
"0.5885753",
"0.5833524",
"0.5820989",
"0.5813597",
... | 0.7850028 | 0 |
Method for creating ther question tag for setting the limit | def set_scn_tag
# Creating the limitation for the question tags
scn_tag_limit = setting.build_scn_tag(scn_tag_limit: params[:scn_tag_limit])
# creating the question tags limit
if scn_tag_limit.save
# response to the JSON
render json: { success: true,message: "Scn Tag limit Successfully Updated.",response:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_media_upload_limit\n\t\t# Creating the limitation for the question tags\n\t\tmedia_upload_limit = setting.build_media_upload(media_upload_limit: params[:media_upload_limit])\n\t\t# creating the question tags limit\n\t\tif media_upload_limit.save\n\t\t# response to the JSON\n\t\t render json: { success: tr... | [
"0.62005025",
"0.61470336",
"0.611906",
"0.59093106",
"0.58628106",
"0.58203053",
"0.57612437",
"0.57612437",
"0.57612437",
"0.57612437",
"0.57612437",
"0.57612437",
"0.57612437",
"0.57612437",
"0.57612437",
"0.57612437",
"0.57612437",
"0.57612437",
"0.57612437",
"0.57612437",
... | 0.6832606 | 0 |
Method for setting the app color according to the select value | def set_app_color
# update the color values with params of color
if setting.update(type_app_color: params[:color])
# response to the JSON
render json: { success: true,message: "Color Successfully Updated.",response: {color: setting.type_app_color.as_json }},:status=>200
else
render :json=> { succe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_color\n selected ? :red : color\n end",
"def set_Color(value)\n set_input(\"Color\", value)\n end",
"def set_appcolour\n @appcolour = Appcolour.find(params[:id])\n end",
"def set_selected(selected)\n default_color = Gtk::Widget.default_style.bg(Gtk::STATE_NORMA... | [
"0.66719776",
"0.6543036",
"0.61804354",
"0.6011349",
"0.59665984",
"0.5841716",
"0.5840884",
"0.5835197",
"0.56949013",
"0.5688239",
"0.558795",
"0.5536907",
"0.55233085",
"0.5514309",
"0.55097044",
"0.550758",
"0.548388",
"0.54690504",
"0.54405385",
"0.5420422",
"0.5408984"... | 0.6904611 | 0 |
Method for user send feedback to the admin | def user_send_feedback
# send feed back to the admin
if UserMailer.feedback(current_user,params[:feedback_text]).deliver_now
# response to the JSON
render json: { success: true, message: "Feedback has sent successfully" },:status=> 200
else
render :json=> { success: false, message: "problem w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feedback\n end",
"def feedback\n NotebookMailer.feedback\n end",
"def feedback\n SystemMailer.user_feedback(current_user, params[:type], params[:message]).deliver!\n return_message(200, :ok)\n end",
"def feedback\n NewsletterMailer.feedback\n end",
"def send_feedback\n feedback = Fee... | [
"0.79391485",
"0.7480279",
"0.7474903",
"0.7296805",
"0.70195305",
"0.69904435",
"0.6975736",
"0.69685215",
"0.68131644",
"0.6750124",
"0.66752476",
"0.6656807",
"0.6641385",
"0.6543384",
"0.6529823",
"0.6480047",
"0.643323",
"0.64155775",
"0.6382736",
"0.6369318",
"0.6368679... | 0.77074534 | 1 |
Method for user send report to the admin | def user_send_report
# send report issue to the admin
if UserMailer.report_issue(current_user,params[:report_text]).deliver_now
# response to the JSON
render json: { success: true, message: "Report has sent successfully" },:status=> 200
else
render :json=> { success: false, message: "problem ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send()\n SQLQuery.new.add('reports', ['accused', 'accuser', 'reason'], [@accused, @accuser, @reason]).send\n end",
"def set_report\n @report = Report.all.find(params[:id])\n if !(current_user.admin? || current_user?(@report.user))\n flash[:alert] = \"올바르지 않은 권한입니다.\"\n redir... | [
"0.70653665",
"0.69281304",
"0.6913787",
"0.6870878",
"0.6743671",
"0.66896176",
"0.66700363",
"0.6658007",
"0.6581758",
"0.65136915",
"0.6512982",
"0.65017873",
"0.65017873",
"0.65017873",
"0.65017873",
"0.65017873",
"0.6478126",
"0.64375037",
"0.6429598",
"0.64221",
"0.6414... | 0.74365914 | 0 |
set to 'true' to have Chrome use a fixed profile directory | def reuse_chrome_profile?
enabled?(ENV['CHROME_REUSE_PROFILE'], default: false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customized_firefox_profile_standard_options(profile)\n # folderList set to 2 means to use the custom download directory\n profile['browser.download.folderList'] = 2\n profile['browser.helperApps.alwaysAsk.force'] = profile['browser.download.manager.showWhenStarting'] = false\n # @see https://www.sitepoint.... | [
"0.59462464",
"0.5935729",
"0.5865077",
"0.5777043",
"0.5748423",
"0.5700025",
"0.5609084",
"0.5583235",
"0.5560239",
"0.5489459",
"0.54395986",
"0.5401114",
"0.5397751",
"0.539648",
"0.53763723",
"0.53584427",
"0.5344949",
"0.5344949",
"0.5308479",
"0.5302297",
"0.52449495",... | 0.679657 | 1 |
Returns true if there is an environment variable that indicates that the feature is supported in the environment under test. All features are supported by default. | def can_test?(feature)
raise ArgumentError, %Q(Unknown feature "#{feature}") unless SUPPORTED_FEATURES.include? feature
enabled?(ENV[SUPPORTED_FEATURES[feature]], default: true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feature_enabled?(feature)\n experimental = features_requested\n feature = feature.to_s\n\n return global_enabled? || experimental.include?(feature)\n end",
"def support?\n Support.new(ENV, verbose: verbose).support?\n end",
"def supports?(feature)\n features.i... | [
"0.7554557",
"0.7385508",
"0.73193115",
"0.70710063",
"0.7061828",
"0.70497173",
"0.6927621",
"0.6898377",
"0.6873732",
"0.68713164",
"0.6850409",
"0.67874026",
"0.67698276",
"0.6743468",
"0.6741324",
"0.6739676",
"0.6739009",
"0.6705724",
"0.66706985",
"0.6660266",
"0.664615... | 0.814117 | 1 |
client is an instantiated redis client (i.e Redis::Client.new(...)) | def initialize(client)
raise "Please specify a Redis client" unless client
@client = client
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client\n @redis\n end",
"def client\n Exchange::GemLoader.new('redis').try_load unless defined?(::Redis)\n @client ||= ::Redis.new(:host => config.host, :port => config.port)\n end",
"def client\n @client ||= Client.new\n end",
"def client\n set_connection unless @cl... | [
"0.8050641",
"0.78392154",
"0.7061341",
"0.6978363",
"0.69125795",
"0.6821891",
"0.6821891",
"0.679437",
"0.679437",
"0.679437",
"0.679437",
"0.67148304",
"0.6666346",
"0.664946",
"0.664852",
"0.66349137",
"0.6617828",
"0.6617017",
"0.6617017",
"0.6617017",
"0.6617017",
"0.... | 0.81682396 | 0 |
Creates and assigns the activation token and digest. | def create_activation_digest
# Create the token and digest.
self.activation_token = User.new_token
self.activation_digest = User.digest(activation_token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_activation_digest\n self.activation_token = Golfer.new_token\n self.activation_digest = Golfer.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = Gamer.new_token\n self.activation_digest = Gamer.digest(activation_token)\n end",
"def create_a... | [
"0.8615071",
"0.86041135",
"0.8602518",
"0.85908353",
"0.85622764",
"0.85622764",
"0.85622764",
"0.85622764",
"0.85622764",
"0.85622764",
"0.85622764",
"0.8561228",
"0.8561228",
"0.8561228",
"0.8561228",
"0.8561228",
"0.8561228",
"0.8561228",
"0.8561228",
"0.8558069",
"0.8557... | 0.862457 | 0 |
Return the default cluster.txt data Returns: Array of cluster.txt lines Raise: if the file is not found | def cluster_txt
File.readlines(File.join(repo_dir, 'cluster.txt'))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_ordinations_files\n clustering_files.to_a\n end",
"def read_cluster_config\n defs_file = open(\"cluster_defs.json\")\n defs_json = defs_file.read\n clust_cfg = JSON.parse(defs_json)\n defs_file.close\n return clust_cfg\nend",
"def read_cluster_config\n if ENV['VAGRANT_CWD'] then\n f... | [
"0.6317886",
"0.6244321",
"0.6156655",
"0.59823334",
"0.5834577",
"0.5809235",
"0.57162225",
"0.56770056",
"0.56614786",
"0.5566427",
"0.5542208",
"0.55204177",
"0.5517529",
"0.54996145",
"0.54769075",
"0.5425632",
"0.5382598",
"0.53801066",
"0.53663695",
"0.53305864",
"0.532... | 0.773479 | 0 |
GET /now_assigns GET /now_assigns.json | def index
@now_assigns = NowAssign.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assigns\n @assigns ||= { }\n end",
"def show\n @assigned = Assigned.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assigned }\n end\n end",
"def view_assigns; end",
"def view_assigns; end",
"def assigns\n @assigns ||= { ... | [
"0.64914757",
"0.6359423",
"0.62745947",
"0.62745947",
"0.6205867",
"0.6205867",
"0.6205867",
"0.6205867",
"0.608272",
"0.57855844",
"0.5675229",
"0.5579887",
"0.5567855",
"0.55628216",
"0.54913956",
"0.542287",
"0.54125726",
"0.54125214",
"0.5400071",
"0.53913486",
"0.537361... | 0.79532343 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.