query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Preview this email at
def problematicOrder order = Order.last user = User.find(Contract.find(order.contract_id).buyer_id) MagicMailer.problematicOrder(order, user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end", "def preview_email\r...
[ "0.71475905", "0.71186084", "0.70552814", "0.6985626", "0.6848472", "0.6848472", "0.6832406", "0.6663229", "0.64324814", "0.631654", "0.6304366", "0.6181875", "0.6167911", "0.61338973", "0.61305445", "0.6115152", "0.61100966", "0.61100966", "0.60882556", "0.60132533", "0.5982...
0.0
-1
Preview this email at
def orderCompleted order = Order.last user = User.find(Contract.find(order.contract_id).buyer_id) MagicMailer.orderCompleted(order, user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end", "def preview_email\r...
[ "0.71475905", "0.71186084", "0.70552814", "0.6985626", "0.6848472", "0.6848472", "0.6832406", "0.6663229", "0.64324814", "0.631654", "0.6304366", "0.6181875", "0.6167911", "0.61338973", "0.61305445", "0.6115152", "0.61100966", "0.61100966", "0.60882556", "0.60132533", "0.5982...
0.0
-1
Preview this email at
def orderCanceled order = Order.last user = User.find(Contract.find(order.contract_id).buyer_id) MagicMailer.orderCanceled(order, user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end", "def preview_email\r...
[ "0.71475905", "0.71186084", "0.70552814", "0.6985626", "0.6848472", "0.6848472", "0.6832406", "0.6663229", "0.64324814", "0.631654", "0.6304366", "0.6181875", "0.6167911", "0.61338973", "0.61305445", "0.6115152", "0.61100966", "0.61100966", "0.60882556", "0.60132533", "0.5982...
0.0
-1
Preview this email at
def newMessage message = Message.last MagicMailer.newMessage(message) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end", "def preview_email\r...
[ "0.71475905", "0.71186084", "0.70552814", "0.6985626", "0.6848472", "0.6848472", "0.6832406", "0.6663229", "0.64324814", "0.631654", "0.6304366", "0.6181875", "0.6167911", "0.61338973", "0.61305445", "0.6115152", "0.61100966", "0.61100966", "0.60882556", "0.60132533", "0.5982...
0.0
-1
Creates a PNG::Canvas object and renders the barcode on it
def to_canvas(opts={}) with_options opts do canvas = PNG::Canvas.new(full_width, full_height, PNG::Color::White) if barcode.two_dimensional? x, y = margin, margin booleans.reverse_each do |line| line.each do |bar| if bar x.upto(x+(xdim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @bar_code = BarCode.new(bar_code_params)\n gen = Barby::Code128B.new(@bar_code.text)\n send_data gen.to_png(:height => 50), :type => \"image/png\", :disposition => \"inline\"\n\n @bar_code.save\n\n\n\n end", "def barcode_generator\n require 'barby'\n require 'barby/barcode/code_12...
[ "0.7193378", "0.7051142", "0.67097145", "0.6655958", "0.65059394", "0.6408441", "0.63442457", "0.6281082", "0.6265766", "0.617756", "0.61163557", "0.60534936", "0.60143995", "0.6014004", "0.59740275", "0.59526116", "0.5940944", "0.59176826", "0.59162885", "0.5898437", "0.5889...
0.7855306
0
Renders the barcode to a PNG image
def to_png(*a) PNG.new(to_canvas(*a)).to_blob end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @bar_code = BarCode.new(bar_code_params)\n gen = Barby::Code128B.new(@bar_code.text)\n send_data gen.to_png(:height => 50), :type => \"image/png\", :disposition => \"inline\"\n\n @bar_code.save\n\n\n\n end", "def barcode_generator\n require 'barby'\n require 'barby/barcode/code_12...
[ "0.7398456", "0.6911261", "0.6746271", "0.6735713", "0.6656176", "0.6654646", "0.66376746", "0.6606729", "0.6580305", "0.65150654", "0.6451081", "0.6450164", "0.6447204", "0.63848066", "0.6334149", "0.6334149", "0.63330495", "0.6282735", "0.6231991", "0.6193653", "0.6190267",...
0.0
-1
return true if this rule matches the given user and objects
def match(user, objects) AUTHORIZATION_LOGGER.debug('trying '+self.inspect) matching = @roles.include?(:all) # checking for right role (no need to check them if already matching) matching = !@roles.find { |role| !user.nil? && role == user.role }.nil? if !matching if @cond.nil? ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_conforms?(user)\n @rule.call(user)\n end", "def matched?(other_user)\n matched.include?(other_user)\n end", "def match_object?(values)\n values.each do |key, value|\n case key.to_sym\n when :id\n object_id = @object_instance.send(key)\n unless object_id == value.to_i...
[ "0.66893846", "0.65588444", "0.6371746", "0.62304926", "0.61967695", "0.6187322", "0.6177511", "0.6166199", "0.6142705", "0.60632056", "0.59538084", "0.59413344", "0.5936268", "0.5897293", "0.58756447", "0.58729446", "0.58578223", "0.58570796", "0.58419096", "0.58403987", "0....
0.79406035
0
string representation for this rule
def inspect str = "rule(#{self.object_id}): allow roles [" + @roles.join(',') + "]" str += " (only under condition object_id will be retrieved using '#{@object_id}')" if @cond str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n rule.inspect\n end", "def to_s\n rule\n end", "def to_s\n 'rule: ' + @symbol.to_s\n end", "def to_s\n rule_name.to_s\n end", "def to_s\n '!' + rule.embed\n end", "def to_s\n '!' + rule.embed\n end", "def to_s\n label.to_s + ':' + rule.embe...
[ "0.8926401", "0.87307453", "0.84758574", "0.8393378", "0.80868894", "0.80868894", "0.80296135", "0.7921412", "0.7882838", "0.77760494", "0.77459466", "0.77459466", "0.7696213", "0.76481956", "0.74830693", "0.73255324", "0.7244904", "0.71224475", "0.69880176", "0.6984731", "0....
0.65372586
36
Initializes a new sphere with the given parameters.
def initialize(center: Point3.origin, radius: 1.0, color: Color.new(rand, rand, rand)) fail ArgumentError, "Not a valid radius (#{r} for 0+)" if radius < 0 @c = center @r = radius @color = color # Cache: @r2 = @r * @r @c2 = @c.dot(@c) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_sphere\n @sphere = Sphere.find(params[:id])\n end", "def sphere_params\n params.require(:sphere).permit(:name)\n end", "def create\n @sphere = Sphere.new(sphere_params)\n\n respond_to do |format|\n if @sphere.save\n format.html { redirect_to @sphere, notice: 'Sphere wa...
[ "0.70452446", "0.6675876", "0.6354954", "0.6205555", "0.61789185", "0.6045514", "0.6002223", "0.59738284", "0.5912837", "0.5861564", "0.57849854", "0.576807", "0.57405126", "0.5728578", "0.56600106", "0.56567293", "0.564585", "0.56000787", "0.5581676", "0.558092", "0.5576434"...
0.49596074
91
rubocop:disable all Returns true if there is an intersection between the ray and the sphere.
def intersection?(ray) a = ray.d.dot(ray.d) b = 2.0 * ray.d.dot(ray.o.sub(@c)) c = @c2 - 2.0 * @c.dot(ray.o) - @r2 d2 = b**2 - 4 * a * c return false unless d2 > 0 t0 = (-b - Math.sqrt(d2)) / (2 * a) t1 = (-b + Math.sqrt(d2)) / (2 * a) t0, t1 = t1, t0 if t0 > t1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getIntersection?( rayOrigin, rayDirection, lastHit )\n\n @index.getIntersection?( rayOrigin, rayDirection, lastHit )\n\n end", "def in_sphere?(coords, radius)\n coords.reduce(0) { |s, c| s + c*c } <= radius**2\nend", "def intersect(ray)\n t = nil\n q = @centre - ray.start\n ...
[ "0.685111", "0.67580533", "0.6432754", "0.64217806", "0.6394007", "0.6198568", "0.61976695", "0.6098905", "0.59627265", "0.596092", "0.59093076", "0.59009254", "0.5898658", "0.57042533", "0.5694537", "0.5639599", "0.5622327", "0.55273616", "0.55237", "0.5522675", "0.5508711",...
0.7363861
0
Finds the intersection between the ray and the sphere.
def intersection(ray) a = ray.d.dot(ray.d) b = 2.0 * ray.d.dot(ray.o.sub(@c)) c = @c2 - 2.0 * @c.dot(ray.o) - @r2 d2 = b**2 - 4 * a * c return nil unless d2 > 0 t0 = (-b - Math.sqrt(d2)) / (2 * a) t1 = (-b + Math.sqrt(d2)) / (2 * a) t0, t1 = t1, t0 if t0 > t1 ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersect(ray)\n cos_theta = normal.dot(ray.direction)\n return nil if cos_theta == 0.0\n t = -(normal.dot(ray.origin) + distance) / cos_theta;\n\n return nil if t <= 0.0\n\n ray_dir = ray.direction.copy_s\n intersection_position = ray_dir.scale(t)\n .add(ray...
[ "0.70597696", "0.6938641", "0.668408", "0.63098985", "0.6293752", "0.62503207", "0.61901325", "0.61766565", "0.6067326", "0.602548", "0.5982219", "0.5975892", "0.5898731", "0.57762307", "0.5767932", "0.5627231", "0.5582709", "0.5549221", "0.54806715", "0.5462244", "0.5445872"...
0.7148629
0
Search your domain in google
def google(q,domain,lang) load("http://www.google.com/search?ie=UTF-8&hl=#{lang}&q=#{q}") clicked = false depth = 0 while true return self if click_by_href(domain) if(lang == "ru") next_string = ">Следующая<" else next_string = ">Next<" end return nil unless click_by_html(next_string) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def google_search(query, sitelink)\n s = Google::Search::Web.new\n s.query = \"#{query}\" + \" site:#{sitelink}\"\n s.get_response\n end", "def google(m, query)\n m.reply(search(query))\n end", "def search_google\n options = Selenium::WebDriver::Chrome::Options.new(args: ['-headless'...
[ "0.70843863", "0.6574019", "0.65697557", "0.65691197", "0.6385924", "0.63304085", "0.6284871", "0.6256472", "0.623097", "0.6180489", "0.61646485", "0.6159419", "0.6140222", "0.613063", "0.6127764", "0.61164874", "0.60609466", "0.6043285", "0.602851", "0.60104805", "0.5982629"...
0.65696245
3
before_filter do |check| check.packageEnabled?(current_site) end
def new @returner = FootballReturner.new(gameschedule_id: params[:gameschedule_id]) @gameschedule = @sport.teams.find(@athlete.team_id).gameschedules.find(params[:gameschedule_id].to_s) if params[:livestats] == "Play by Play" @live = "Play by Play" elsif params[:livestats] == "Totals" @live = "Totals" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_production; end", "def site_enable?\n self[:type] == \"CompanyZ\" && !self.layout.architecture_type.nil?\n end", "def require_site\n self.site\n end", "def has_local_feeds(site)\n File.directory?(\n site.config['releases_dir']\n )\nend", "def check_for_installed_software_only\n ...
[ "0.6122457", "0.61101216", "0.60290116", "0.5969461", "0.5932506", "0.58754045", "0.58471113", "0.5764519", "0.5671721", "0.5667105", "0.56511456", "0.5650487", "0.56495625", "0.5628494", "0.5626545", "0.5626545", "0.5625008", "0.5616378", "0.5590451", "0.5580903", "0.5579884...
0.0
-1
GET /admins GET /admins.json
def index @admins = Admin.all respond_to do |format| format.html # index.html.erb format.json { render json: @admins } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @admins = Admin.all\n\n render json: @admins\n end", "def list_admins\n service_response = ManagerManagement::Team::ListAdmins.new(params).perform\n return render_api_response(service_response)\n end", "def index\n @admins = Admin.accessible_by(current_ability, :index).limit(20)\n ...
[ "0.7761844", "0.7712036", "0.7199103", "0.7149029", "0.7069557", "0.7069557", "0.7069557", "0.7069557", "0.7069557", "0.7069557", "0.70543325", "0.6948629", "0.6920505", "0.69155556", "0.69155556", "0.6878634", "0.68146175", "0.68125564", "0.6804559", "0.6793928", "0.6780752"...
0.7579265
2
GET /admins/1 GET /admins/1.json
def show @admin = current_admin @business = @admin.business @agents = @business.agents @phrases = @business.phrases messages_array = Message.for_business(@business.id) @messages_array = messages_array messages_text_block = String.new messages_array.each { |msg| if msg.messa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @admins = Admin.all\n\n render json: @admins\n end", "def index\n @admins = Admin.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admins }\n end\n end", "def show\n @admin = Admin.find(params[:id])\n @admins = Admin.all\n ...
[ "0.761763", "0.7512067", "0.73583347", "0.72151417", "0.71779555", "0.7131405", "0.7097003", "0.70002615", "0.69801223", "0.6948253", "0.6931872", "0.6928846", "0.6925793", "0.6925793", "0.6925793", "0.6925793", "0.6925793", "0.6925793", "0.69047076", "0.6818901", "0.6818901"...
0.0
-1
GET /admins/new GET /admins/new.json
def new @admin = Admin.new respond_to do |format| format.html # new.html.erb format.json { render json: @admin } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @useradmin = Useradmin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @useradmin }\n end\n end", "def new\n @admin_user = AdminUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @adm...
[ "0.7513104", "0.7493244", "0.7492934", "0.74752104", "0.7452168", "0.74161166", "0.74106324", "0.7397921", "0.72627264", "0.7216025", "0.7216025", "0.7174477", "0.7146609", "0.7144637", "0.70705235", "0.70705235", "0.70705235", "0.70551074", "0.7051933", "0.7013561", "0.70106...
0.7880072
0
POST /admins POST /admins.json
def create @admin = Admin.new(params[:admin]) respond_to do |format| if @admin.save format.html { redirect_to @admin, notice: 'Admin was successfully created.' } format.json { render json: @admin, status: :created, location: @admin } else format.html { render action: "new" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @admins = Admin.new(admin_params)\n respond_to do |format|\n if @admins.save\n format.html { redirect_to admins_path, notice: 'Admin was successfully created.' }\n format.json { render :show, status: :created, location: @admins }\n else\n format.html { render :new ...
[ "0.7454773", "0.69678295", "0.67923826", "0.6781991", "0.6707045", "0.6700572", "0.6593709", "0.6593709", "0.6593709", "0.6559186", "0.65517133", "0.65514106", "0.65464634", "0.6540915", "0.6475669", "0.6473945", "0.6382088", "0.6371819", "0.63396454", "0.6334135", "0.6285025...
0.6592987
9
PUT /admins/1 PUT /admins/1.json
def update @admin = Admin.find(params[:id]) respond_to do |format| if @admin.update_attributes(params[:admin]) format.html { redirect_to @admin, notice: 'Admin was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @admin = Admin.find(params[:id])\n\n if @admin.update(admin_params)\n head :no_content\n else\n render json: @admin.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @admins = args[:admins] if args.key?(:admins)\n end", "def update!(*...
[ "0.6811527", "0.6774032", "0.6774032", "0.6774032", "0.6774032", "0.6774032", "0.6774032", "0.6574197", "0.65726507", "0.6534183", "0.65205836", "0.65103036", "0.6400569", "0.63943946", "0.6354826", "0.63420236", "0.63373375", "0.63321114", "0.63321114", "0.63310194", "0.6318...
0.6639353
7
DELETE /admins/1 DELETE /admins/1.json
def destroy @admin = Admin.find(params[:id]) @admin.destroy respond_to do |format| format.html { redirect_to admins_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @admin = Admin.find(params[:id])\n @admin.destroy\n\n render json: {:ok => true}\n end", "def destroy\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin.destroy\...
[ "0.7603285", "0.75819767", "0.75662726", "0.7500361", "0.73948157", "0.73413825", "0.72465706", "0.72465706", "0.72427416", "0.72092986", "0.72092986", "0.7208234", "0.7208234", "0.7204566", "0.71992934", "0.7189573", "0.7188596", "0.7188596", "0.7188596", "0.7188596", "0.718...
0.7571683
2
update the new action to handle the :author_id parameter if author_id is captured through a nested route, we keep track of it and assign the post to that author
def new # ensure that a new post is created for a valid author if params[:author_id] && !Author.exists?(params[:author_id]) redirect_to authors_path, alert: "Author not found." else @post = Post.new(author_id: params[:author_id]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_author_id\n if self.author_id.blank?\n self.author_id = self.user_id\n end\n end", "def set_author_id\n if self.author_id.blank?\n self.author_id = self.user_id\n end\n end", "def set_author\r\n @author = Author.find(params[:id])\r\n end", "def set_author\n @author ...
[ "0.6911467", "0.6911467", "0.6736511", "0.673415", "0.673415", "0.673415", "0.6733654", "0.6733654", "0.6733654", "0.6733654", "0.6733654", "0.6733654", "0.6733654", "0.6733654", "0.6733654", "0.6733654", "0.6733654", "0.6733654", "0.6733654", "0.6644921", "0.6644921", "0.6...
0.6679281
19
accept :author_id as a parameter for a post
def post_params params.require(:post).permit(:title, :description, :author_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_params\n params.require(:post).permit(:content, :author_id)\n end", "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self \n end", "def...
[ "0.72539926", "0.71344817", "0.71344817", "0.71344817", "0.70867145", "0.6980034", "0.68666524", "0.6793137", "0.6793137", "0.6793137", "0.6786197", "0.6786197", "0.67628926", "0.67520905", "0.6734761", "0.6734761", "0.6734761", "0.6734761", "0.6734761", "0.6734761", "0.67347...
0.70675606
5
TODO: Figure out how to control when logs are flushed
def call(env) dup._call(env) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autoflush_log; end", "def autoflush_log; end", "def flush\n @log.flush if @log.respond_to?(:flush)\n end", "def autoflush_log=(_arg0); end", "def autoflush_log=(_arg0); end", "def reopen_logs; end", "def flush\n @logger.flush if @logger.respond_to?(:flush)\n end", "def tra...
[ "0.8351524", "0.8351524", "0.77643186", "0.7581041", "0.7581041", "0.7422312", "0.7415468", "0.7399449", "0.7253007", "0.7242045", "0.7142921", "0.7114491", "0.7042054", "0.6994495", "0.6959297", "0.68673545", "0.68658984", "0.6836748", "0.67792815", "0.67792815", "0.67792815...
0.0
-1
Visualization of tree structure Required method parent.children name
def tree(object, locals = {}) locals = { depth: [], }.merge(locals) if locals[:depth].size > @options[:drop] if object == object.parent.children.last prefix_char = @options[:edge_char] else prefix_char = @options[:connect_char] end else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def show_tree\n\tend", "def _children...
[ "0.74038273", "0.74038273", "0.74038273", "0.74038273", "0.74038273", "0.74038273", "0.74038273", "0.74038273", "0.74038273", "0.74038273", "0.74038273", "0.74038273", "0.7182207", "0.70276207", "0.6958208", "0.6958208", "0.6958208", "0.6958208", "0.69068897", "0.69008845", "...
0.0
-1
Replace with real successful acknowledgement code
def test_acknowledgement end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_status_response( txn, status_code, message )\n\t\tself.log.info \"Non-OK response: %d (%s)\" % [ status_code, message ]\n\n\t\ttxn.status = status_code\n\n\t\t# Some status codes allow explanatory text to be returned; some forbid it.\n\t\tunless BODILESS_HTTP_RESPONSE_CODES.include?( status_code )\n\t\...
[ "0.6586824", "0.65589076", "0.64850795", "0.64850795", "0.6473702", "0.6424179", "0.6379759", "0.6358759", "0.6347187", "0.63096136", "0.62933904", "0.6200912", "0.61907935", "0.61759096", "0.61759096", "0.61759096", "0.61759096", "0.61759096", "0.61759096", "0.6174765", "0.6...
0.0
-1
Converts the board to characters, then highlights. Don't use this on the taken pieces.
def characters_array # That's a terrible name. convert_to_chars highlight_squares self.rows end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render\n system(\"clear\")\n board.each_with_index do |row,i1|\n complete_row = []\n row.each_with_index do |col,i2|\n pos = [i1, i2]\n # debugger\n if pos == cursor.cursor_pos\n complete_row << board[i1][i2].sym...
[ "0.6442748", "0.63848376", "0.6346253", "0.6233721", "0.61887974", "0.6175569", "0.6171959", "0.61654925", "0.6115894", "0.60836613", "0.6078176", "0.60695535", "0.6047149", "0.59990734", "0.59799856", "0.59772956", "0.59512454", "0.5941504", "0.59304416", "0.59303164", "0.59...
0.62116134
4
=========== = Actions = =========== [get it opened] Opens the current branch [sample usage] Open the current branch: git it opened
def open(args, options) _closest_branch = closest_branch if _closest_branch branch_name = clean_branch_name_for( _closest_branch ) link = @url_generator.branch_url( branch_name ) launch link else fail "Could not find closest remote branch for sha: #{@git_object...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute\n current = GitHub::PullRequest.current\n\n if current\n cli.say \"Opening Pull Request #{current.number}\"\n cli.open current.pull_request.html_url\n end\n end", "def gh_open(path)\n url = url_base + path.chomp\n # use open if on OSX\n if RUBY_PLATFORM....
[ "0.6769143", "0.63816196", "0.6119964", "0.61030537", "0.6101781", "0.6066099", "0.5930136", "0.59100527", "0.5885227", "0.58589137", "0.58589137", "0.58337283", "0.5812825", "0.57977825", "0.57977825", "0.57673323", "0.5716868", "0.5694144", "0.5660929", "0.5649872", "0.5641...
0.6825881
0
[get it compared] Compares the current branch to another branch (default: master) [sample usage] Compare the current branch to master branch git it compared Compare the current branch to release branch git it compared to=release
def compare(args, options) _closest_branch = closest_branch if _closest_branch branch_name = clean_branch_name_for( _closest_branch ) link = @url_generator.compare_branches_url( branch_name, options[:to] || "master" ) launch link else fail "Could not find close...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_branches(join_request)\n working_repo = ::GitFunctionality::Repo.new.get_working_repo(join_request.curricula)\n master_commit = working_repo.branches['master'].gcommit\n user = User.find_by_id(join_request.creator_id)\n request_commit = working_repo.branches[user.username].gcommit\n...
[ "0.6918127", "0.66679597", "0.6642018", "0.6642018", "0.6642018", "0.6642018", "0.6642018", "0.6642018", "0.65322334", "0.64691144", "0.6446071", "0.6446071", "0.64392275", "0.64087784", "0.6375369", "0.62883824", "0.6287465", "0.62533087", "0.62463945", "0.6222496", "0.62021...
0.69543904
0
[get it pulled] Issues a pull request of the current branch into another branch (default: master) [sample usage] Issue a pull request of the current branch into master branch git it pulled Issue a pull request of the current branch into release branch git it pulled to=release
def pull(args, options) _closest_branch = closest_branch if _closest_branch branch_name = clean_branch_name_for( _closest_branch ) link = @url_generator.pull_request_url( branch_name, options[:to] || "master" ) launch link else fail "Could not find closest remo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull_request(_input)\n puts 'TODO: Implement Git.pull_request'\n # TODO: Validate input\n # input[:issue].to_s\n # input[:base_branch].to_s\n end", "def merge_pull_request\n git.merge pull_request.branch\n end", "def execute\n if (!self.pull_request_id)\n curr...
[ "0.73030084", "0.7282489", "0.6994541", "0.6914182", "0.68869656", "0.6862302", "0.6796561", "0.6782782", "0.6773958", "0.669833", "0.6631829", "0.66203445", "0.6597153", "0.6531957", "0.6521096", "0.6509224", "0.6503635", "0.6493972", "0.640399", "0.6372111", "0.6366533", ...
0.7052942
2
[get it opened] Opens the current branch [sample usage] Open the current branch: git it opened
def test(args, options) _closest_branch = closest_branch if _closest_branch branch_name = clean_branch_name_for( _closest_branch ) link = @url_generator.test_url( branch_name ) launch link else fail "Could not find closest remote branch for sha: #{@git_object.o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(args, options)\n _closest_branch = closest_branch\n\n if _closest_branch\n branch_name = clean_branch_name_for( _closest_branch )\n link = @url_generator.branch_url( branch_name )\n\n launch link\n else\n fail \"Could not find closest remote branch for sha...
[ "0.6875191", "0.65296334", "0.6444673", "0.6400566", "0.61507076", "0.605065", "0.5989461", "0.5911283", "0.59005654", "0.59005654", "0.58642775", "0.58636326", "0.5833042", "0.5832006", "0.5830777", "0.58241695", "0.58011204", "0.5789055", "0.57720345", "0.57596356", "0.5758...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def media_params params.require(:media).permit(:url, :description, :media_type_id, :climb_ids, :pull_quote, :ascent_ids => []) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Leverage ID param to dynamically route to tomestone rewards by name
def show index render :index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_name # :nologin: :norobots:\n redirect_to_next_object(:next, Name, params[:id].to_s)\n end", "def new\n if id = params[:id]\n case\n when ITEM_ID.match(id)\n # with a item htid go direct to item page\n redirect_to item_path(params[:id].downcase) \n when match = C...
[ "0.5923264", "0.58124435", "0.5800306", "0.5800306", "0.5800306", "0.57778627", "0.5763973", "0.5697071", "0.5675575", "0.56347775", "0.55937296", "0.5569558", "0.5563856", "0.5524726", "0.5521145", "0.55031055", "0.55031055", "0.54861414", "0.54622096", "0.5452358", "0.54388...
0.0
-1
Link to kata: Description: Write a function, calculateTip(amount, rating) which calculates how much you need to tip based on the total amount of the bill and the service. You need to consider the following ratings: Terrible: tip 0% Poor: tip 5% Good: tip 10% Great: tip 15% Excellent: tip 20% The rating is case insensit...
def calculate_tip(amount, rating) rating = rating.downcase case when rating == "terrible" return 0 when rating == "poor" return (amount * 0.05).ceil when rating == "good" return (amount * 0.10).ceil when rating == "great" return (amount * 0.15).ceil when rating == "excell...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_tip(amount, rating)\n return (amount * 0.00).ceil if rating.downcase == \"terrible\"\n return (amount * 0.05).ceil if rating.downcase == \"poor\"\n return (amount * 0.10).ceil if rating.downcase == \"good\"\n return (amount * 0.15).ceil if rating.downcase == \"great\"\n return (amount * 0.20).ce...
[ "0.8628307", "0.8480247", "0.80868334", "0.7091555", "0.70537484", "0.6968319", "0.68602", "0.68400127", "0.67008746", "0.6689531", "0.6635966", "0.65557325", "0.6544074", "0.6359348", "0.6331798", "0.63207394", "0.63135386", "0.629834", "0.6226045", "0.61368823", "0.61349", ...
0.8377574
2
GET /venues GET /venues.json
def index if params[:since] since_datetime = Time.parse(params[:since]) puts since_datetime @venues = Venue.for_venue_owner(@venue_owner).for_region(params[:region_id]).order(:name).where(["updated_at >= ?", since_datetime]) else @venues = Venue.for_venue_owner(@venue_owner).for_region(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def venues(options = {})\n self.class.require_latitude_and_longitude(options)\n\n response = self.class.get(\"/venues.json\", :query => options, :basic_auth => @auth)[\"venues\"]\n response && response.flatten\n end", "def index\n @venues = current_user.venues\n end", "def index\n @venues = Ve...
[ "0.78412294", "0.75436866", "0.7476105", "0.7476105", "0.74669623", "0.7434513", "0.72530305", "0.7251006", "0.7022262", "0.6940428", "0.6893959", "0.6862872", "0.6828712", "0.68162227", "0.67744845", "0.6768917", "0.6753593", "0.6683326", "0.66703904", "0.6664218", "0.665448...
0.0
-1
GET /venues/1 GET /venues/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def venue(id)\n get(\"venues/#{id}\").venue\n end", "def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end", "def index\n @venues = Venue.all\n\n respond_to do |format|\n format.htm...
[ "0.7449304", "0.73193645", "0.73193645", "0.73043764", "0.7182905", "0.71425945", "0.7130275", "0.7121087", "0.7088336", "0.6955109", "0.6936839", "0.6914768", "0.685223", "0.6788254", "0.6668979", "0.65482074", "0.652874", "0.65267044", "0.6518154", "0.6516677", "0.64659345"...
0.0
-1
POST /venues POST /venues.json
def create @venue = Venue.new(venue_params) respond_to do |format| if @venue.save format.html { redirect_to @venue, notice: 'Venue was successfully created.' } format.json { render :show, status: :created, location: @venue } else format.html { render :new } format.js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n #create venues trought users controller\n end", "def create\n @venue = Venue.new(venue_params)\n\n if @venue.save\n render json: @venue, status: :created, location: @venue\n else\n render json: {errors: @venue.errors}, status: :unprocessable_entity\n end\n end", "def my_...
[ "0.6653711", "0.6587449", "0.6581765", "0.6262751", "0.6237925", "0.62359476", "0.6219155", "0.62095016", "0.61525834", "0.6103657", "0.60696125", "0.60696125", "0.60626173", "0.602209", "0.60196996", "0.6015609", "0.60067767", "0.59807426", "0.597207", "0.59136313", "0.59136...
0.62362003
6
PATCH/PUT /venues/1 PATCH/PUT /venues/1.json
def update respond_to do |format| if @venue.update(venue_params) format.html { redirect_to @venue, notice: 'Venue was successfully updated.' } format.json { render :show, status: :ok, location: @venue } else format.html { render :edit } format.json { render json: @venue.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n #update venues trought users controller\n\n @user = User.find_by(authentication_token: request.headers['Authorization'])\n\n if @user.is_venue?\n @user.venue.update(venue_params)\n if @user.venue.update(venue_params)\n render json: {status: :ok}\n else\n render js...
[ "0.6646456", "0.66221374", "0.6590962", "0.6590962", "0.65301615", "0.64871794", "0.64458025", "0.63705456", "0.6369423", "0.6366396", "0.63653404", "0.6299341", "0.62608314", "0.62335193", "0.62335193", "0.6160211", "0.61462367", "0.6124453", "0.606821", "0.603357", "0.60292...
0.6330397
13
DELETE /venues/1 DELETE /venues/1.json
def destroy @venue.destroy respond_to do |format| format.html { redirect_to venues_url, notice: 'Venue was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :ok }\n end\n end", "def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.ht...
[ "0.7553671", "0.7531355", "0.7507718", "0.7507718", "0.7507718", "0.7507718", "0.74199617", "0.73949975", "0.7332596", "0.72691673", "0.7267232", "0.7267232", "0.7267232", "0.7267232", "0.7213395", "0.71450377", "0.7079433", "0.69543564", "0.6945274", "0.68781865", "0.6878186...
0.7181069
19
Use callbacks to share common setup or constraints between actions.
def set_venue @venue = Venue.find_by_slug(params[:id]) @venue = Venue.find_by_id(params[:id]) if @venue.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def venue_params params.require(:venue).permit(:name, :address, :postcode, :latitude, :longitude, :web, :telephone, :email) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Returns the value of the Boustrophedon transform at T(k,n) where k = n >= 0.
def boustrophedon_at(k,n) raise ArgumentError.new "k must be < size" unless k < size raise ArgumentError.new "n must be < size" unless n < size return 0 if n < 0 || k < n @b_cache ||= [] @b_cache[k] ||= [] @b_cache[k][n] ||= if k==0 self[k] else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def t(k)\n k = k.to_f\n output = 0.0\n if k < @M\n output = 1/(k*@M)\n elsif k == @M\n r = @N/@M\n output = Math.log(r/DELTA)/@M\n else\n output = 0.0\n end\n return output\n end", "def t__X_(n, x); tdist(n, x) - 0.5; end", "def t___x(n, x); 1.0 - tdist(n, x); end", ...
[ "0.59728307", "0.58408785", "0.566746", "0.5549522", "0.54966545", "0.5488223", "0.54392165", "0.53867465", "0.5348908", "0.5338778", "0.526277", "0.52572966", "0.5213658", "0.5205433", "0.5203251", "0.51996815", "0.5182946", "0.5164059", "0.5140188", "0.512599", "0.5111846",...
0.616617
0
GET /suggestions/1 GET /suggestions/1.xml
def show @suggestion = Suggestion.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @suggestion } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @suggestions }\n end\n end", "def suggest\n @suggestions = suggestions_service.suggestions\n render 'suggest', layout: false\n end", "def suggestions\n ...
[ "0.7553297", "0.7144203", "0.71285766", "0.6941189", "0.6941189", "0.693712", "0.6857705", "0.68221486", "0.6788413", "0.6778633", "0.66602933", "0.6595476", "0.65646446", "0.65008265", "0.6438979", "0.6435696", "0.6371694", "0.6371694", "0.63397133", "0.63192743", "0.6268438...
0.7061579
4
GET /suggestions/new GET /suggestions/new.xml
def new @suggestion = Suggestion.new @dictionaries = Dictionary.all if params[:word_id] @word = Word.find_by_id(params[:word_id]) render 'translation' else @dictionary = Dictionary.find_by_id(params[:dictionary]) if params[:dictionary] @suggested = params[:searched] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @suggestion = Suggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suggestion }\n end\n end", "def new\n @suggestion = Suggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml...
[ "0.7590738", "0.7590738", "0.7409226", "0.7093055", "0.69066685", "0.68022335", "0.6796086", "0.6731613", "0.65994656", "0.6499481", "0.6406031", "0.6334994", "0.6334994", "0.6320495", "0.6320495", "0.6287964", "0.62587523", "0.62423", "0.6242147", "0.6236995", "0.6209235", ...
0.6269521
16
POST /suggestions POST /suggestions.xml
def create @suggestion = Suggestion.new(params[:suggestion]) @suggestion.user_id = current_user.id if @suggestion.dictionary_id @word = Word.find_by_word_and_dictionary_id(@suggestion.word_name, @suggestion.dictionary_id) @suggestion.word_id = @word.id if @word else @word = Word.find_b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suggest\n @suggestions = suggestions_service.suggestions\n render 'suggest', layout: false\n end", "def create\n @suggestion = Suggestion.new(params[:suggestion])\n flash[:notice] = 'Thank you for your feedback. ' if @suggestion.save\n respond_with(@suggestion, location: root_url)\n end", ...
[ "0.6557656", "0.64672405", "0.6448183", "0.6271219", "0.625443", "0.6231277", "0.62098944", "0.62098944", "0.6194239", "0.6168289", "0.6161539", "0.6150443", "0.61111915", "0.6106134", "0.6090675", "0.6090675", "0.60769266", "0.6065154", "0.6041451", "0.604027", "0.6011301", ...
0.5840194
29
PUT /suggestions/1 PUT /suggestions/1.xml
def update @suggestion = Suggestion.find(params[:id]) @suggestion.user_id = current_user.id respond_to do |format| if @suggestion.update_attributes(params[:suggestion]) flash[:notice] = 'Suggestion was successfully updated.' format.html { redirect_to(@suggestion) } format....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n if @suggestion.update_attributes(params[:suggestion])\n flash[:notice] = 'Suggestion was successfully updated.'\n format.html { redirect_to(@suggestion) }\n format.xml { head :ok }\n else\n ...
[ "0.6773569", "0.6771939", "0.653856", "0.65382487", "0.6537015", "0.64965683", "0.6384418", "0.6320078", "0.6287329", "0.62863487", "0.60917526", "0.6036104", "0.6023647", "0.5991771", "0.5991771", "0.5991771", "0.5991771", "0.5991771", "0.5991771", "0.5991771", "0.59917706",...
0.6424673
6
DELETE /suggestions/1 DELETE /suggestions/1.xml
def destroy @suggestion = Suggestion.find(params[:id]) @suggestion.destroy respond_to do |format| format.html { redirect_to(suggestions_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @suggestion = Suggestion.find(params[:id])\n @suggestion.destroy\n\n respond_to do |format|\n format.html { redirect_to(root_url) }\n format.xml { head :ok }\n end\n end", "def delete suggestion_id, options={}, headers={}\n @connection.delete \"suggestions/#{suggest...
[ "0.7405714", "0.7169876", "0.70230764", "0.6995898", "0.6955164", "0.68823546", "0.6681194", "0.6680525", "0.6621518", "0.65740585", "0.6355286", "0.6349873", "0.63149226", "0.6289216", "0.6241009", "0.6227154", "0.61586094", "0.6153178", "0.6044649", "0.60348105", "0.6033743...
0.74749637
0
toggle btn name based on target
def set_btn_name !(@target =~ /invoice/i).nil? ? 'Next' : 'Save' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle_click_on_button(name, tag, container, state = true)\n attr = SELECTOR_MAPPING[container][name][tag][STATE][state] || (state ? 'fa-caret-down' : 'fa-caret-right')\n click_on_button(name, tag, container) if (!wait_visibility(name, tag, container)[:class].include? attr)\n end", "def toggle_c...
[ "0.613827", "0.6110076", "0.6035398", "0.6035398", "0.60235244", "0.59158677", "0.584309", "0.5755281", "0.5720987", "0.564898", "0.56058", "0.5530084", "0.54582334", "0.5456077", "0.54402", "0.54194313", "0.537429", "0.5342071", "0.5340344", "0.5317707", "0.5299056", "0.52...
0.71474445
0
start_work sets up directory, downloads files, runs the command, and then reuploads new files
def start_work #first lets make sure the workitem is valid for this function unless WorkItemHelper.validate_workitem(workitem) raise ArgumentError, "Invalid workitem. Check parameters." end # now we start processing. DaemonKit.logger.info "Starting work..." @swr.send("busy", workit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n logger.debug(\"WORK HORSE PROCESS JOB STARTED.\")\n downloadRemotefiles\n unzipFiles\n #parsePhotoRequestReponseXMl\n #updateProducts\n zipXMLFiles\n uploadZipFiles\n logger.debug(\"JOB FINISHED.\")\n end", "def run\n logger.debug('WORK HORSE PROCESS JOB ...
[ "0.6960123", "0.69025904", "0.65591896", "0.63370395", "0.6101155", "0.61008877", "0.60462147", "0.59727746", "0.5954395", "0.5917803", "0.5870339", "0.5866154", "0.58544", "0.5842172", "0.58349806", "0.58281595", "0.5827462", "0.57936007", "0.5792427", "0.5766116", "0.571385...
0.68325776
2
Deletes the specified notification.
def call(id) client.delete("/api/rest/v1/notifications/#{id}.json") true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_notification(principal_uri, notification)\n end", "def destroy\n if @notification.destroy\n send_success_json(@notification.id, {:msg => \"deleted\"})\n else\n send_error_json(@notification.id, \"delete_error\", 400)\n end\n end", "def destroy\n authorize(Notification...
[ "0.7894258", "0.7802342", "0.7555091", "0.75383395", "0.74759144", "0.7429831", "0.7413679", "0.7337603", "0.73210835", "0.723592", "0.72264814", "0.71999896", "0.7191935", "0.71847045", "0.7175974", "0.71213466", "0.7106344", "0.702128", "0.7017707", "0.6975413", "0.6975413"...
0.60724765
67
def change change_table :users, bulk: true do |t| t.index :first_name, algorithm: :inplace t.index :last_name, algorithm: :inplace t.index :email_address, algorithm: :inplace t.index :address_zip, algorithm: :inplace end end def up add_index :users, :first_name add_index :users, :last_name add_index :users, :email_addr...
def down # raise ActiveRecord::IrreversibleMigration remove_index :users, :first_name remove_index :users, :last_name remove_index :users, :email_address remove_index :users, :address_zip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change\n \tenable_extension 'btree_gin'\n \tadd_index :users,[:first_name, :last_name, :email], using: :gin, algorithm: :concurrently\n end", "def up\n unique_index_sql = <<~SQL\n CREATE UNIQUE INDEX IF NOT EXISTS #{INDEX_TYPE_NAME_MAP[:unique]}\n ON transactions\n (user_id, transaction_...
[ "0.7301624", "0.6451002", "0.5931909", "0.59278834", "0.5752528", "0.5684972", "0.56666636", "0.5639949", "0.55973965", "0.5572823", "0.55187035", "0.54775244", "0.54544425", "0.541932", "0.5394822", "0.5394442", "0.5378121", "0.53464395", "0.5343064", "0.53089744", "0.529586...
0.63941944
2
Initialize method, taking 3 parameters, each parameter initialized to becomes value of instance variable
def initialize(state_of_origin, population_density, population) @state = state_of_origin @population = population @population_density = population_density end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(p1,p2,p3)\r\n \r\n @p1 = p1\r\n @p2 = p2\r\n @p3 = p3\r\n \r\n end", "def initialize(p1, p2, p3)\n @p1 = p1\n @p2 = p2\n @p3 = p3\n end", "def initialize(one, two, three)\n @one = one \n @two = two \n @three = three\n end", "def initialize(a,b,c)\n @a, @b...
[ "0.8009168", "0.7886306", "0.7876996", "0.78518707", "0.781215", "0.7764346", "0.7741125", "0.7721846", "0.7720393", "0.7684539", "0.76789254", "0.7588529", "0.75269026", "0.75245625", "0.75245625", "0.75245625", "0.75245625", "0.75245625", "0.7502944", "0.74666554", "0.74648...
0.0
-1
run the two methods notated below
def virus_effects predicted_deaths speed_of_spread end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calls; end", "def calls; end", "def run() end", "def runs; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def methods() end", "def run\n end", "def run\n end", "def run\n...
[ "0.682457", "0.682457", "0.6797625", "0.6761354", "0.6753438", "0.6753438", "0.6753438", "0.6753438", "0.6753438", "0.6753438", "0.6753438", "0.6753438", "0.6753438", "0.66816515", "0.6516007", "0.6509621", "0.6509621", "0.6490526", "0.6490526", "0.6488466", "0.6480974", "0...
0.0
-1
takes a range of population densities and returns the number of deaths based on that range
def predicted_deaths case @population_density when 0...50 then i = 0.05 when 50...100 then i = 0.1 when 100...150 then i = 0.2 when 150...200 then i = 0.3 else i = 0.4 end number_of_deaths = (@population * i).floor print "#{@state} will lose #{number_of_deaths} peo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predicted_deaths\n # predicted deaths is solely based on population density\n case population_range\n when \"low\"\n number_of_deaths = (@population * 0.05).floor\n when \"low_med\"\n number_of_deaths = (@population * 0.1).floor\n when \"med\"\n number_of_deaths = (@po...
[ "0.73990035", "0.73877853", "0.7307815", "0.7300392", "0.72740614", "0.7237852", "0.72137576", "0.72082406", "0.72012347", "0.72003573", "0.7170313", "0.71685857", "0.71664214", "0.7166196", "0.71533793", "0.70978653", "0.709089", "0.7083414", "0.7070127", "0.7064429", "0.705...
0.72305655
6
takes population density range and state and adds speed based on that range
def speed_of_spread #in months # We are still perfecting our formula here. The speed is also affected # by additional factors we haven't added into this functionality. case @population_density when 0...50 then speed = 2.5 when 50...100 then speed = 2 when 100...150 then speed = 1.5 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n \n\n if @population_density >= 200\n @speed += 0.5\n elsif @population_density >= 150\n ...
[ "0.80134726", "0.7886385", "0.7818574", "0.77941", "0.7569448", "0.7569448", "0.7569448", "0.7569448", "0.7555453", "0.7442437", "0.74402267", "0.74308425", "0.74261427", "0.74221677", "0.74165523", "0.74052155", "0.74052155", "0.74052155", "0.74052155", "0.74010247", "0.7401...
0.0
-1
Default method, subclasses must override this
def run super domain_name = _get_entity_name # first check... if this is a wildcard domain, we cannot continue, # results will be generally untrustworthy. # todo... in the future, make a list and we can check against it wildcards = gather_wildcard_ips(domain_name) unless wildcards.empty? ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overrides; end", "def custom; end", "def custom; end", "def default; end", "def default; end", "def private; end", "def special\n override\n end", "def defaults\n super\n end", "def implementation; end", "def implementation; end", "def default\n end", "def defaults; end", ...
[ "0.7415348", "0.73554313", "0.73554313", "0.6991004", "0.6991004", "0.69613177", "0.69572926", "0.6824949", "0.6801543", "0.6801543", "0.67361915", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0...
0.0
-1
end run search zetalytics for a specific domain name
def search_zetalytics_by_domain(api_key, domain) _log "Searching zetalytics by domain: #{domain}" begin # Initialize Zetalytics API with api key zetalytics = Zetalytics::Api.new(api_key) # search zetalytics by hostname for related data #result_hostname = zetalytics.search_by_hostname do...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n super\n\n domain_name = _get_entity_name\n\n # first check... if this is a wildcard domain, we cannot continue,\n # results will be generally untrustworthy.\n # todo... in the future, make a list and we can check against it\n wildcards = gather_wildcard_ips(domain_name)\n unless wild...
[ "0.67251414", "0.65278983", "0.6329839", "0.625652", "0.6221658", "0.62145305", "0.61535484", "0.61343575", "0.609769", "0.59679043", "0.59476703", "0.59209484", "0.5889793", "0.584732", "0.5842578", "0.5805144", "0.5772833", "0.573399", "0.57197064", "0.57003325", "0.5696674...
0.7996471
0
POST /sync_users Allows user sync (update/delete) through a posted file (or string) ==== Params :do If set to 'reset', forces the UserSyncJob to stop :mode Currently forced to 'sync'. May be allowed in the future :user_data The CSV file (or raw csv string) to be used for sync. In 'sync' mode, any user that is in the sy...
def sync_users respond_to do |format| # MM2: Only xml is currently supported format.json { render :text => "Not supported." } format.html { render :text => "Not supported." } format.xml { # MM2: This is mostly based on (and refactored from) AdminController#upload_users ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync_files\n User.sync_files!(@context)\n end", "def sync_datas_process\n SyncDatas.sync(self)\n # user = self\n end", "def userfiles_sync_multiple_post(multi_userfile_mod_req, opts = {})\n userfiles_sync_multiple_post_with_http_info(multi_userfile_mod_req, opts)\n nil\n end", ...
[ "0.5335087", "0.52014154", "0.51820636", "0.48625025", "0.48377097", "0.48007888", "0.47764507", "0.45541444", "0.4552557", "0.45207536", "0.44902223", "0.4468207", "0.44550964", "0.4391159", "0.4379167", "0.4373788", "0.43273267", "0.4327031", "0.42949843", "0.4292167", "0.4...
0.619388
0
GET /sync_users_status Returns the full xml of the last UserSyncJob that was started This job may be queued, running, or even completed
def sync_users_status respond_to do |format| # MM2: Only xml is currently supported format.json { render :text => "Not supported." } format.html { render :text => "Not supported." } format.xml { @job = UserSyncJob.instance render :xml => @job } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_status\n @connection.get(\"/\").body\n end", "def sync_users\n respond_to do |format|\n # MM2: Only xml is currently supported\n format.json { render :text => \"Not supported.\" }\n format.html { render :text => \"Not supported.\" }\n format.xml { \n # MM2...
[ "0.61039746", "0.607224", "0.5990882", "0.59360576", "0.5876766", "0.584868", "0.5808158", "0.5723492", "0.572139", "0.5677164", "0.5651266", "0.5644551", "0.5639992", "0.56037086", "0.55847216", "0.55847216", "0.55459386", "0.55403847", "0.5538088", "0.5536996", "0.5533461",...
0.72175634
0
MM2: Ugly way to render xml without using views This solution is the result of having problems with trying to use layouts/text AND set the status
def render_xml(text, options={}) render({:text => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n#{text}"}.merge(options)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_xml\n end", "def render_xml_output(status)\n builder do |xml|\n xml.instruct!\n xml.response do\n xml.status status\n end\n end\nend", "def xml\n\t\theaders[\"Content-Type\"] = \"text/xml; charset=utf-8\"\n\t\trender :layout => false\n\tend", "def xml; end", "def xml?; end", ...
[ "0.7870724", "0.72578424", "0.7155911", "0.69934946", "0.6973523", "0.6973523", "0.69326246", "0.6890656", "0.6826695", "0.66891503", "0.66652936", "0.6627309", "0.6545263", "0.65063214", "0.64806545", "0.64151603", "0.6379376", "0.6375219", "0.6371421", "0.62855893", "0.6272...
0.71280104
3
keep in sync with boxen/service.rb
def available_services Dir["/Library/LaunchDaemons/dev.*.plist"].map { |f| f[/dev\.(.*)\.plist/, 1] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service; end", "def bi_service\n end", "def services\n\n end", "def services\n end", "def service_name; end", "def services\n\tend", "def service_request(service); end", "def start\n $provider.for($service[:domain].to_sym, $service[:name].to_sym).status= \"Started\" \n end", "def ser...
[ "0.7534425", "0.7110144", "0.67112017", "0.66508704", "0.64767164", "0.6376929", "0.63287604", "0.62110215", "0.6182163", "0.6182163", "0.6160029", "0.6155719", "0.6129406", "0.6110086", "0.60670763", "0.60252476", "0.5944487", "0.5935127", "0.5894835", "0.5892378", "0.587320...
0.0
-1
GET /monthly_summaries GET /monthly_summaries.json
def index @monthly_summaries = MonthlySummary.all.order(:begin_at) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @monthly_reports = MonthlyReport.all\n end", "def index\n # TODO: paginate?\n @monthly_stats = @profile.monthly_stats.order :date\n end", "def index\n @monthly_interests = MonthlyInterest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render...
[ "0.7225586", "0.71206254", "0.69908625", "0.69307035", "0.6911633", "0.68898004", "0.6879404", "0.68524176", "0.67906094", "0.67326266", "0.66408074", "0.6547724", "0.64806634", "0.6472435", "0.64531314", "0.64016056", "0.6398132", "0.63975483", "0.6385248", "0.6359179", "0.6...
0.75022876
0
GET /monthly_summaries/1 GET /monthly_summaries/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @monthly_summaries = MonthlySummary.all.order(:begin_at)\n end", "def index\n @monthly_reports = MonthlyReport.all\n end", "def index\n @monthly_interests = MonthlyInterest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @monthly_in...
[ "0.7402811", "0.7106735", "0.70292866", "0.70191914", "0.70103335", "0.6981931", "0.6791294", "0.678498", "0.67325336", "0.66826624", "0.66485596", "0.6630235", "0.66107863", "0.6594813", "0.6590986", "0.6590756", "0.65150255", "0.63972175", "0.6365678", "0.63376147", "0.6315...
0.0
-1
POST /monthly_summaries POST /monthly_summaries.json
def create @monthly_summary = MonthlySummary.new(monthly_summary_params) respond_to do |format| if @monthly_summary.save format.html { redirect_to @monthly_summary, notice: 'Monthly summary was successfully created.' } format.json { render :show, status: :created, location: @monthly_summa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_monthly_summary\n @monthly_summary = MonthlySummary.find(params[:id])\n end", "def monthly_summary_params\n params.require(:monthly_summary).permit(:year, :month, :begin_at, :end_at, :carryover_amount, :this_month_amount, :amount, :customer_id)\n end", "def index\n @monthly_summaries...
[ "0.68291265", "0.67745185", "0.6609766", "0.65513796", "0.6492592", "0.6454291", "0.6380792", "0.6274217", "0.6245117", "0.6234111", "0.61736214", "0.61163294", "0.6092015", "0.6087819", "0.6067925", "0.60383594", "0.5965132", "0.59494495", "0.59483397", "0.5945056", "0.59387...
0.7365545
0
PATCH/PUT /monthly_summaries/1 PATCH/PUT /monthly_summaries/1.json
def update respond_to do |format| if @monthly_summary.update(monthly_summary_params) format.html { redirect_to @monthly_summary, notice: 'Monthly summary was successfully updated.' } format.json { render :show, status: :ok, location: @monthly_summary } else format.html { render :...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_monthly_summary\n @monthly_summary = MonthlySummary.find(params[:id])\n end", "def update\n @monthly_interest = MonthlyInterest.find(params[:id])\n\n respond_to do |format|\n if @monthly_interest.update_attributes(params[:monthly_interest])\n format.html { redirect_to @monthly_i...
[ "0.65951073", "0.6459012", "0.643116", "0.63169557", "0.62401795", "0.61870515", "0.6111647", "0.60317284", "0.60222304", "0.60038924", "0.59910965", "0.59733343", "0.5964121", "0.59256476", "0.5912482", "0.5896528", "0.5877877", "0.5870965", "0.5836433", "0.583521", "0.58180...
0.73509866
0
DELETE /monthly_summaries/1 DELETE /monthly_summaries/1.json
def destroy @monthly_summary.destroy respond_to do |format| format.html { redirect_to monthly_summaries_url, notice: 'Monthly summary was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @summary.destroy\n respond_to do |format|\n format.html { redirect_to summaries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @annual_summary_report.destroy\n respond_to do |format|\n format.html { redirect_to annual_summary_reports_url}\n ...
[ "0.6840864", "0.6803551", "0.67841107", "0.6737038", "0.6733372", "0.6681194", "0.66434455", "0.66284513", "0.6605731", "0.65732735", "0.65702796", "0.65619427", "0.656128", "0.6474457", "0.6474457", "0.6448831", "0.642384", "0.63892466", "0.6382811", "0.63720965", "0.633607"...
0.76769066
0
Use callbacks to share common setup or constraints between actions.
def set_monthly_summary @monthly_summary = MonthlySummary.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def monthly_summary_params params.require(:monthly_summary).permit(:year, :month, :begin_at, :end_at, :carryover_amount, :this_month_amount, :amount, :customer_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Creates an instance with the specified logger and locale cache destination
def initialize(cache_dir, logger = nil) @cache_dir = cache_dir @logger = logger || Logger.new(STDOUT) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(log, cache)\n @log, @cache = log, cache\n end", "def initialize(cache_dir, logger = nil)\n @cache_dir = cache_dir\n @default_repository_root = default_repository_root\n @logger = logger || LibertyBuildpack::Diagnostics::LoggerFactory.create_logger('.')\n end", "def initialize(logge...
[ "0.62610596", "0.60315365", "0.5974862", "0.5955329", "0.58612806", "0.5770508", "0.5754291", "0.5744528", "0.57269484", "0.5721341", "0.5713809", "0.56684494", "0.56409794", "0.56297517", "0.5619544", "0.5618508", "0.5571198", "0.5566926", "0.5561839", "0.5480245", "0.546018...
0.6484134
0
Downloads remote resources into the cache directory
def download_cache(configs) if configs.empty? @logger.warn 'No cache to download.' return end FileUtils.mkdir_p(@cache_dir) configs.each do |config| # Download index.yml first. index_uri = index_path(config) download(index_uri) # Parse index.yml to see what files it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(url, cache_dir, filename)\n run_script \"curl -L --create-dirs -o #{cache_dir[:guest_path]}/#{filename} #{url}\" unless File.exist?(\"#{cache_dir[:host_path]}/#{filename}\")\n end", "def download_sources(url)\n filename = \"v#{version}.tar.gz\"\n cached_sources = File.join(SOURCES_CACH...
[ "0.7329154", "0.72612196", "0.68933946", "0.677009", "0.6757542", "0.67436934", "0.67044806", "0.6665734", "0.66317415", "0.65917575", "0.6546727", "0.6541983", "0.64616257", "0.64043665", "0.63979614", "0.6386574", "0.6379265", "0.6364166", "0.63474894", "0.63396156", "0.629...
0.607535
37
Obtains the path for a repository
def index_path(config) uri = config[REPOSITORY_ROOT] uri = uri[0..-2] while uri.end_with? '/' "#{uri}#{INDEX_PATH}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repo_path\n @path\n end", "def repo_path\n @repo_path ||= Pathname.new(Dir.pwd).descend { |p| break p if (p + '.git').directory? }\n end", "def repo_path\n @config.get_value('GIT_REPO_ROOT')\n end", "def getRepositoryPath\n return @REPOSITORYPATHORSELECT\n end", "def r...
[ "0.837998", "0.7886503", "0.7869439", "0.78109556", "0.7761442", "0.7704031", "0.7695779", "0.76942974", "0.75504553", "0.75323045", "0.7521116", "0.74891376", "0.7433088", "0.7381923", "0.7369811", "0.73657966", "0.73484945", "0.7290885", "0.7248249", "0.71879286", "0.716983...
0.0
-1
Downloads remote location into a file in the cache directory
def download(uri) target = File.join(@cache_dir, filename(uri)) @logger.debug "Downloading file to #{target}" rich_uri = URI(uri) Net::HTTP.start(rich_uri.host, rich_uri.port, use_ssl: rich_uri.scheme == 'https') do |http| request = Net::HTTP::Get.new(rich_uri.request_uri) http.request reque...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download\n \n @tmpfile = fetch_remote(location)\n \n @fetched_at = Time.new\n \n return @tmpfile\n \n end", "def download(url, cache_dir, filename)\n run_script \"curl -L --create-dirs -o #{cache_dir[:guest_path]}/#{filename} #{url}\" unless File.exi...
[ "0.7925257", "0.79246306", "0.78708845", "0.76107025", "0.7591144", "0.7590959", "0.7435432", "0.74247444", "0.719546", "0.7178665", "0.7057215", "0.7054335", "0.7031685", "0.6964856", "0.69465816", "0.6911617", "0.69049174", "0.68832964", "0.6865992", "0.6848153", "0.6832693...
0.686014
19
Converts URI into a filename used in cache.
def filename(uri) "#{URI.escape(uri, '/')}.cached" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filename(uri)\n \"#{URI.encode_www_form_component(uri)}.cached\"\n end", "def cache_filename_for_uri( path )\n uid = Digest::MD5.hexdigest( \"#{@uid}:#{path}\" )\n # NOTE: this path needs to exist with r/w permissions for webserver\n @cache_dir.join( uid )\n end", "def cache_filename(...
[ "0.8634507", "0.8125702", "0.71939254", "0.71203023", "0.6983062", "0.690447", "0.6873182", "0.6873182", "0.6866086", "0.67993134", "0.677721", "0.67551535", "0.661496", "0.65842485", "0.6563873", "0.65380603", "0.6483922", "0.6461669", "0.64439934", "0.6281489", "0.6279531",...
0.8534648
1
Returns array of config maps containing references to the root index.yml of file sets to be included in the cache.
def collect_configs(config_files = nil, cached_hosts = ['public.dhe.ibm.com']) config_files = Dir[File.expand_path(File.join('..', '..', 'config', '*.yml'), __FILE__)] if config_files.nil? configs = [] config_files.each do |file| @logger.debug "Checking #{file}" begin config = YAML.load_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cache_path_names\n if File.exists?(CachedAssetPackager::Config.send(\"#{self.asset_type}_cache_path_config\"))\n @cache_path_names = YAML::load(File.read(CachedAssetPackager::Config.send(\"#{self.asset_type}_cache_path_config\")))\n else\n @cache_path_names = {}\n each_file_s...
[ "0.657819", "0.6549201", "0.63508654", "0.62673515", "0.62197053", "0.61948746", "0.6186599", "0.6186599", "0.61336607", "0.6063832", "0.6007751", "0.5953132", "0.59521997", "0.59510386", "0.59299177", "0.5894255", "0.58538014", "0.5808538", "0.58062136", "0.57903314", "0.578...
0.57419837
28
Use callbacks to share common setup or constraints between actions.
def set_listing @listing = Listing.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def listing_params params.require(:listing).permit(:title, :specie_id, :user_id, :description, :price_cents, :image, :remove_image) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /cashflows GET /cashflows.json
def index @cashflows = Cashflow.all.paginate(page: params[:page], :per_page => 5).order("created_at DESC") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n #@cashflows = Cashflow.all\n @cashflows = Cashflow.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cashflows }\n end\n end", "def show\n @cashflow = Cashflow.find(params[:id])\n\n re...
[ "0.71252537", "0.675406", "0.64954376", "0.63571596", "0.6204603", "0.61842847", "0.61253685", "0.6111754", "0.60733175", "0.60670865", "0.6036214", "0.5943166", "0.5903871", "0.584953", "0.5829745", "0.57986045", "0.5771947", "0.57563525", "0.57509375", "0.57509375", "0.5750...
0.65844434
2
GET /cashflows/1 GET /cashflows/1.json
def show # define month and year @year= @cashflow.accounting_date.year @month= @cashflow.accounting_date.month @cashflow.year=@year @cashflow.month = @month # get widrawals and lodgement where the month and the year is the same as the and year of the current cashflow @cash_injection = Wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @cashflow = Cashflow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cashflow }\n end\n end", "def index\n #@cashflows = Cashflow.all\n @cashflows = Cashflow.paginate(:page => params[:page], :per_page => 10)\n\n resp...
[ "0.71762156", "0.7022097", "0.63496137", "0.63239324", "0.6239887", "0.6152453", "0.61414874", "0.6131096", "0.6120315", "0.607858", "0.6069493", "0.602298", "0.60053575", "0.599918", "0.5989414", "0.5957911", "0.5925934", "0.59202594", "0.58952993", "0.5863629", "0.5858026",...
0.0
-1
POST /cashflows POST /cashflows.json
def create @cashflow = Cashflow.new(cashflow_params) respond_to do |format| if @cashflow.save format.html { redirect_to @cashflow, notice: 'Cashflow was successfully created.' } format.json { render :show, status: :created, location: @cashflow } else format.html { render :ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @cash_flow ||= @monthly_budget.cash_flows.build(\n category_id: @category.id\n )\n\n @cash_flow.planned = cash_flow_params[:planned]\n\n if @cash_flow.save\n render json: @cash_flow, status: :created\n else\n render json: @cash_flow.errors, status: :unprocessable_entity\n...
[ "0.6992872", "0.65148187", "0.6334216", "0.6288035", "0.6175363", "0.61136883", "0.5998285", "0.594467", "0.59054524", "0.5871496", "0.58543736", "0.5845217", "0.5826634", "0.58173066", "0.5815713", "0.5808597", "0.5803721", "0.5788008", "0.57728523", "0.57608485", "0.5758498...
0.6750345
1
PATCH/PUT /cashflows/1 PATCH/PUT /cashflows/1.json
def update respond_to do |format| if @cashflow.update(cashflow_params) format.html { redirect_to @cashflow, notice: 'Cashflow was successfully updated.' } format.json { render :show, status: :ok, location: @cashflow } else format.html { render :edit } format.json { render...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @cash_flow.update(cash_flow_params)\n format.html { redirect_to @cash_flow, notice: 'CashFlow was successfully updated.' }\n format.json { render :show, status: :ok, location: @cash_flow }\n else\n format.html { render :edit }\n form...
[ "0.6694383", "0.6538148", "0.6441578", "0.6366192", "0.63397276", "0.6326356", "0.6256274", "0.6249967", "0.6234229", "0.61726946", "0.61558145", "0.6137131", "0.61223745", "0.61223745", "0.61223745", "0.61223745", "0.61223745", "0.61223745", "0.61223745", "0.61223745", "0.61...
0.66773194
1
DELETE /cashflows/1 DELETE /cashflows/1.json
def destroy @cashflow.destroy respond_to do |format| format.html { redirect_to cashflows_url, notice: 'Cashflow was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @cashflow = Cashflow.find(params[:id])\n @cashflow.destroy\n\n respond_to do |format|\n format.html { redirect_to cashflows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cashbox.destroy\n respond_to do |format|\n format.html { redirect_to c...
[ "0.7829282", "0.71030176", "0.702509", "0.6973973", "0.6923903", "0.6912307", "0.6906548", "0.689498", "0.6845272", "0.68350136", "0.6832273", "0.68246907", "0.68115103", "0.67882764", "0.6744411", "0.67346615", "0.67219937", "0.6712835", "0.669217", "0.6684625", "0.667393", ...
0.7447272
1
Use callbacks to share common setup or constraints between actions.
def set_cashflow @cashflow = Cashflow.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def cashflow_params params.require(:cashflow).permit(:month, :year, :accounting_date, :name,:user_id, inflows_attributes:[ :id,:rationale,:follow_up,:bankaccount_id,:date_posted,:bank_record_date,:monthtitle_id,:yeartitle_id,:inflowtype_id, :person_id,:owner, :amount, :details, :flow_type, :user_id,:month,:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Fitness Method rank the value of an sgenome
def calcFitness(sgenome) calcWeightAndValue(sgenome) if (@sum_weight > @max_weight) # penalize overweight solutions @sum_value - (@penalty * (@sum_weight - @max_weight)) else @sum_value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitness\n if @fitness == 0.0\n @fitness = @fitness_alg.rank(self)\n end\n @fitness\n end", "def rank; end", "def rank; end", "def calc_rank\n return (self.score * 20001) + self.speaks;\n end", "def fitness individual\r\n (5 - individual).abs\r\n end", "def fitne...
[ "0.7343404", "0.69655263", "0.69655263", "0.6909074", "0.6907756", "0.68489254", "0.6823072", "0.67975867", "0.6761851", "0.6698698", "0.6643569", "0.6624934", "0.65959716", "0.65738475", "0.65715283", "0.65715283", "0.65441346", "0.65004224", "0.6471474", "0.6426682", "0.641...
0.64687395
19
Accumulate weight and value if option is selected. arg is an sgenome
def calcWeightAndValue(possible_solution) @sum_weight=0 @sum_value=0 (0...@optionSize).each do |idx| if possible_solution.m_Data[idx] @sum_weight += @itemWeight[idx].to_f @sum_value += @itemValue[idx].to_f end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight\n options.reduce(0) { |memo, option| option.weight > 0 ? memo + option.weight : memo }\n end", "def weight_adjustment \n options.inject(0.0){|m,x| m + (x.weight_adjustment || 0.0)} \n end", "def update_weight(target, ouput, weight)\n @eta * (target - output) * weight\n end", "def a...
[ "0.7234126", "0.60445285", "0.6018501", "0.59202164", "0.5677401", "0.55830663", "0.5561159", "0.55415833", "0.55415833", "0.5535761", "0.5474372", "0.5456249", "0.5434717", "0.54301435", "0.5405276", "0.5404969", "0.5395661", "0.5384884", "0.5357942", "0.5350173", "0.534042"...
0.62011415
1
evaluate sgenome for win/lose
def isWinner(possible_solution, maxc, minben) (0...@optionSize).each do |idx| calcWeightAndValue(possible_solution) if (@sum_weight <= maxc && @sum_value >= minben ) return true end end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evalSolution(pop, maxcost, minben)\r\n\r\n results=false \r\n # scan culture for solution\r\n (0...pop.get_population_size).each do |sgenomidx|\r\n\r\n if ( @opts.isWinner(pop.get_sgenome(sgenomidx),maxcost,minben) ) \r\n # we have a winner!\r\n @winner = pop.get_s...
[ "0.6146223", "0.5677307", "0.53674096", "0.53644484", "0.535772", "0.5356167", "0.5269504", "0.52528316", "0.5167481", "0.5138972", "0.5130261", "0.50987154", "0.509148", "0.50913465", "0.5073351", "0.50655174", "0.50547624", "0.50452393", "0.50443417", "0.50338465", "0.50315...
0.0
-1
if all of the items total to less than minben, no success possible
def isImpossible(minben) sum_value = @itemValue.inject(0){|sum,item| sum+item} if (sum_value < minben) true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_spend_met?\n !(user.try(:wholesaler?) && item_total.to_f < MINIMUM_ITEM_TOTAL)\n end", "def validate_over_1000_vendor_sells\n total_trokaAki = Interaction.by_month.joins(:user =>:roles).where(:user_id => self.user_id, :roles => { :name => \"vendor\"}).group(\"interactions.user_id\").count\n ...
[ "0.70731765", "0.65188104", "0.65151566", "0.64196223", "0.63140947", "0.6288765", "0.6276568", "0.62448645", "0.62389153", "0.6230794", "0.6151838", "0.6138632", "0.60984945", "0.60913706", "0.6089164", "0.60782355", "0.6027701", "0.59957993", "0.5919825", "0.59087294", "0.5...
0.72015095
0
Load the input file, parse, store. result is boolean
def readCSVFile(csvfilename='') @title = "Fryes Bag-o-Value" @costTitle = "volume" @beneTitle = "value" @cutname = "total volume" @cutop = "<" #@cutval = 500 @cutval = 1000 csvitemID=['cellphone1','cellphone2','cpu1','cpu2','ram 1', 'ram 2', 'ram 3'] csvitemValue=[1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load\n input(@infile)\n true\n end", "def parse_input(input_file); end", "def parse_input(input_file); end", "def parse_input (input_file)\nend", "def parse\n return false unless filecheck\n doc = REXML::Document.new(open(file))\n @result_set = []\n doc.el...
[ "0.78171074", "0.6583075", "0.6583075", "0.63743407", "0.63018626", "0.61588365", "0.60514665", "0.6029227", "0.6022254", "0.5774839", "0.5749185", "0.5731057", "0.5722842", "0.5696361", "0.5691814", "0.56902343", "0.5661614", "0.56551784", "0.5596403", "0.55567306", "0.55540...
0.0
-1
returns the cookie value as a json string
def cookie_value @screen_data.to_json end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookie_value\n \"#{@name}=#{Scanner.quote(@value.to_s)}\"\n end", "def cookie\n { :value => Crypt.encrypt(cookie_value), :expires => 1.year.from_now }\n end", "def cookie_value; end", "def cookie_hash\n\t\t\t{ 'Cookie' => @cookies.to_s }\n\t\tend", "def sso_cookie_content\n return ni...
[ "0.74394816", "0.73294944", "0.7229129", "0.6930871", "0.67759365", "0.66944593", "0.6601882", "0.65813065", "0.6549322", "0.6515236", "0.6515236", "0.65058374", "0.64996535", "0.64673805", "0.63557845", "0.6330041", "0.6302104", "0.6269149", "0.6264964", "0.6244088", "0.6236...
0.8088296
0
returns the encrypted cookie to set as a hash (containing :value and :expires properties)
def cookie { :value => Crypt.encrypt(cookie_value), :expires => 1.year.from_now } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookie_hash\n\t\t\t{ 'Cookie' => @cookies.to_s }\n\t\tend", "def encode_to_cookie h, cookie\n cookie[@name] = encode h\n end", "def hashcookie\n cookies[daw_cookie_name] && Digest::SHA1.hexdigest(cookies[daw_cookie_name])\n end", "def encode_set_cookie h, secure\n secure = @secure unless...
[ "0.69250935", "0.67136365", "0.65898335", "0.6283946", "0.6242148", "0.6237597", "0.61476105", "0.6098139", "0.6087416", "0.6072124", "0.6038313", "0.6014355", "0.6004521", "0.5971849", "0.5971849", "0.59601426", "0.59245086", "0.5885961", "0.58776283", "0.5875443", "0.583119...
0.78918505
0
returns the configuration given a current screen resolution, or nil if not found
def screen_config(width, height) @screen_data.each do |c| if (c['w'] == width && c['h'] == height) return get_config(c) end end nil # none end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_screen_config\n screens = @form.get_form_config.select do |screen|\n screen['screen'] == @name\n end\n\n unless screens.size == 1\n raise \"Invalid results when looking for screen '#{ @name }'\"\n end\n\n screens[0]\n end", "def find_ppi(width, height)\n sc = ...
[ "0.7210157", "0.70644975", "0.68461335", "0.64417505", "0.61266303", "0.5999742", "0.5926443", "0.58072984", "0.569847", "0.5677006", "0.5603606", "0.55518335", "0.5541752", "0.5512172", "0.5461007", "0.54063815", "0.5351177", "0.5336174", "0.53325486", "0.53232574", "0.52808...
0.7910907
0
returns the first screen configuration in the cookie. Only use this where we never expect more than 1 screen config to be stored: for mobile devices
def first_config @screen_data.first ? get_config(@screen_data.first) : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_screen_config\n screens = @form.get_form_config.select do |screen|\n screen['screen'] == @name\n end\n\n unless screens.size == 1\n raise \"Invalid results when looking for screen '#{ @name }'\"\n end\n\n screens[0]\n end", "def first_screen\n # print \"frst: ...
[ "0.7357173", "0.6208163", "0.6081065", "0.56990474", "0.55558884", "0.55383486", "0.5416733", "0.54031754", "0.5221338", "0.5175369", "0.51577353", "0.51137", "0.49410242", "0.49406987", "0.49382532", "0.49196205", "0.4913162", "0.49043292", "0.4903211", "0.49023235", "0.4885...
0.78806716
0
like screen_config, except returns only the :ppi property, or nil if no config found for current screen resolution
def find_ppi(width, height) sc = screen_config(width, height) return sc ? sc[:ppi] : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def screen_config(width, height)\n @screen_data.each do |c|\n if (c['w'] == width && c['h'] == height)\n return get_config(c)\n end\n end\n nil # none\n end", "def screen_resolution\n @values.fetch('ai.device.screenResolution') { \n @values['ai.device.screenResolut...
[ "0.70479214", "0.66072196", "0.64040005", "0.6199103", "0.6183414", "0.5877314", "0.583998", "0.5682866", "0.56169045", "0.54957443", "0.54774827", "0.5378726", "0.53673947", "0.5353008", "0.5335741", "0.5243126", "0.52084285", "0.5207338", "0.5205946", "0.51814806", "0.51735...
0.83519274
0
delete all existing screen configs
def clear @screen_data = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_all\n @configuration = nil\n end", "def delete_all\n @configuration = nil\n end", "def delete_all_configurations\n super\n end", "def delete_all_configurations\n super\n end", "def clear(config)\n Array(config).each do |setting|\n delete_settin...
[ "0.68476415", "0.68476415", "0.674731", "0.674731", "0.6650048", "0.6555919", "0.6341681", "0.6184598", "0.6106087", "0.60363364", "0.6010376", "0.5998723", "0.5989495", "0.59783024", "0.59770125", "0.5964223", "0.595959", "0.5952265", "0.59462297", "0.5903364", "0.5884514", ...
0.6164347
8
updates a current screen config or saves a new screen config for specified screen resolution and optional additional parameters. Returns the cookie
def save_screen_config(width, height, params = {}) cfg = nil @screen_data.each do |d| if (d['w'] == width && d['h'] == height) cfg = d break; end end if !cfg # add it as a new config cfg = { 'w' => width, 'h' => height } @screen_data << cfg # if there ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @screen_dpi = args[:screen_dpi] if args.key?(:screen_dpi)\n @screen_height_px = args[:screen_height_px] if args.key?(:screen_height_px)\n @screen_shape = args[:screen_shape] if args.key?(:screen_shape)\n @screen_width_px = args[:screen_width_px] if args.key...
[ "0.61368424", "0.6077149", "0.5819206", "0.57215923", "0.57044864", "0.5412383", "0.5397736", "0.5383726", "0.5227136", "0.5227136", "0.52246225", "0.51873386", "0.5092935", "0.4845689", "0.4821915", "0.47856", "0.4767369", "0.47307563", "0.4730675", "0.47155693", "0.4709193"...
0.74900806
0
Launch School 101109 Small Problems Exercises (2nd time through)
def swapcase(str) swap_chars = str.chars.map do |char| if char =~ /[a-z]/ char.upcase elsif char =~ /[A-Z]/ char.downcase else char end end swap_chars.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exercise_119 (number)\n end", "def problem_8\nend", "def problem_14\nend", "def first_puzzle a\n # write down your solution to puzzle 1 here\nend", "def fifth_puzzle\n sample = fourth_puzzle.sort!.each { |x| p x }\n p \"Min is \" + sample[0].to_s\n p \"Max is \" + sample[-1].to_s\nend", ...
[ "0.6700225", "0.65547174", "0.6294686", "0.6203187", "0.60866207", "0.60679454", "0.59764117", "0.596225", "0.5927187", "0.59122294", "0.5903203", "0.58823025", "0.5856598", "0.58500075", "0.58420205", "0.5828243", "0.58202064", "0.58182603", "0.5811073", "0.57901967", "0.577...
0.0
-1
index details which image to pick if multiple images
def select_image_given_image_urls(image_urls, width, index = 0) if image_urls.nil? or image_urls == "" return "/assets/Image_Missing.png" end y = image_urls.to_s.split(";") if index < y.length y = y[index] elsif y.length > 0 y = y[0] else return "" end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_image\n query = find_or_create_query(:Image, by: params[:by])\n show_selected_images(query, id: params[:id].to_s, always_index: true)\n end", "def index_image # :nologin: :norobots:\n query = find_or_create_query(:Image, :by => params[:by])\n show_selected_images(query, :id => params[:id]....
[ "0.77500826", "0.7647737", "0.7435466", "0.7164672", "0.6905969", "0.68964654", "0.68084407", "0.6759807", "0.67338675", "0.67232245", "0.67166644", "0.671359", "0.6640938", "0.66159534", "0.6608878", "0.65871364", "0.65811235", "0.6570857", "0.6557216", "0.6553648", "0.65515...
0.0
-1
for pill nav bar to set active or disabled
def nav_link(link_text, link_path) class_name = current_page?(link_path) ? 'active' : '' content_tag(:li, :class => class_name) do link_to link_text, link_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_nav\n @active = \"user\"\n end", "def navbar_active\n # reset in controller for active navbar menu item\n @navbar_active = :shopping_cart\n end", "def set_nav_actived(name = \"home\")\n @nav_actived = name\n end", "def navbar_active\n # reset in controller for active navbar men...
[ "0.73740834", "0.7123182", "0.70913976", "0.69739753", "0.6950216", "0.6943095", "0.68182504", "0.65406567", "0.6457849", "0.64572036", "0.64488673", "0.64234394", "0.64234394", "0.63525057", "0.63477856", "0.632545", "0.6210637", "0.61734796", "0.61734796", "0.61734796", "0....
0.0
-1
flash_display for ajax / jquery
def flash_display response = "" flash.each do |name, msg| case name when :notice then "info" when :error then "error" when :success then "success" when :alert then "warning" end response = response + "<div class='alert alert-#{name}'><a class='close' data-dismi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flash(evt = nil)\n @notice = evt[:notice] rescue ''\n @alert = evt[:alert] rescue ''\n render :text => update(\"##{dom_id}_flash\"), :layout => 'flash_effect.js.erb',\n :locals => {:flashid => \"#{dom_id}_flash\"}\n end", "def show_flash\n html = ''\n [ :alert, :notice, :info, :warning, ...
[ "0.7412049", "0.7302834", "0.7302834", "0.7038174", "0.7006203", "0.70018345", "0.6920508", "0.69128615", "0.69128615", "0.69034547", "0.6836249", "0.68155944", "0.6765324", "0.67443585", "0.6706224", "0.6645945", "0.6619424", "0.6575582", "0.65550166", "0.6529757", "0.651818...
0.7496243
0
helper method to add the http in front of a user submitted url. need this or rails will try to prepend the domain in front of url
def url_with_protocol(url) /^http/.match(url) ? url : "http://#{url}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepend_http_to_url\n self.url = \"http://#{url}\" unless url.blank? || url.starts_with?('http://') || url.starts_with?('https://')\n end", "def add_http_to_url\n if !self.website_url.blank?\n unless self.website_url[/\\Ahttp:\\/\\//] || self.website_url[/\\Ahttps:\\/\\//]\n self.website_u...
[ "0.80435926", "0.7626302", "0.75165296", "0.7476858", "0.734713", "0.717725", "0.70805526", "0.70649374", "0.701938", "0.7016273", "0.697037", "0.68952435", "0.6887731", "0.6885663", "0.6885663", "0.6875119", "0.68343866", "0.68340725", "0.6812107", "0.6807227", "0.67593324",...
0.68721086
17
helper method to return user uploaded url or foursquare image url
def upload_or_foursquare_image_url_picker (object, self_image_size=:thumb, foursquare_image_width=250, foursquare_image_index=0) case object.class.name when 'Trip' if !object.self_image.blank? use_this_url = object.self_image_url(self_image_size) which_url_msg = "Image Uploaded by ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_url\n if image.present?\n image\n else\n \"http://loremflickr.com/320/240/#{CGI.escape name}\"\n end\n end", "def user_image_url # return the user image\n ((self.user_image.present?)?(self.user_image.url.to_s):nil) || self.photo_url || \"/ass...
[ "0.7393935", "0.7371175", "0.725946", "0.72484404", "0.7244938", "0.7141087", "0.70711493", "0.706828", "0.7064511", "0.70410806", "0.7006638", "0.70006585", "0.69916576", "0.69882345", "0.6984164", "0.6966785", "0.6956413", "0.6952564", "0.6951724", "0.6950761", "0.69470006"...
0.6697964
44
author level badge logic
def author_level(author_x) author_trip_stats = author_x.trip_stats agg_author_usefuls = 0 unless author_trip_stats.blank? author_trip_stats.each { |trip| agg_author_usefuls = agg_author_usefuls + trip.useful } end # case agg_author_usefuls if ( agg_author_usefuls ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badge; end", "def badge_level_up \n\t\tbadge_level_up_aux(\"Commenter\",\"commenter\",\"comments\")\n\tend", "def badges\n end", "def for_badge(badge); end", "def badge_level_up\n\t\tbadge_level_up_aux(\"Creator\",\"creator\",\"recipes\")\n\tend", "def badge_level_up\n\t\tbadge_level_up_aux(\"Birdma...
[ "0.75729465", "0.6983026", "0.69022053", "0.68498576", "0.6805011", "0.6705912", "0.65684247", "0.6542495", "0.6324851", "0.6293431", "0.62711656", "0.6214201", "0.61629647", "0.5971887", "0.59556985", "0.58857083", "0.58755124", "0.5873434", "0.58727854", "0.5833762", "0.582...
0.67955655
5