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
Sends a request to the real system and parses the response.
def execute res = Net::HTTP.start(@query.uri.hostname, @query.uri.port) do |http| req = Net::HTTP::Post.new(@query.uri) req['Cookie'] = @session_cookie_provider.current.value req['Content-Type'] = "application/json; charset=utf-8" req.body = build_body(@query.attributes) http.request(req) end # TODO: handle invalid responses @parser.parse(res.body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request\n self.response = prepare_response(http_communication.content)\n end", "def send_request\n @response = _send_request\n end", "def send_and_receive\n url = to_s\n raw_response = HTTPClient.new.get(url).body\n parsed_response = BEncode::Parser.new(StringIO.new(...
[ "0.72805285", "0.6891959", "0.67669374", "0.66990614", "0.66230047", "0.65468645", "0.64692205", "0.6465099", "0.6447844", "0.64199317", "0.63973683", "0.6389739", "0.63668174", "0.6339353", "0.6302415", "0.6302074", "0.62899953", "0.6279908", "0.6275161", "0.62478906", "0.62...
0.58445156
76
Translate the query attributes into JSON which will be the request body.
def build_body(attributes) "{" + attributes.map { |k, v| %Q("#{k}":"#{v}") }.join(",") + "}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_query\n {\n json: query\n }\n end", "def to_query\n {\n json: query\n }\n end", "def request_body\n MAPPING.keys.inject({}) do |mem, e|\n next mem unless value = send(e)\n mem.merge!(e.to_s => value.to_json)\n end\n end", "def to_json_...
[ "0.7024072", "0.7024072", "0.6774197", "0.6549591", "0.64813006", "0.64813006", "0.6382476", "0.6324486", "0.6324486", "0.6324486", "0.6324486", "0.63009924", "0.63009924", "0.63009924", "0.62627", "0.6211094", "0.6123735", "0.61029613", "0.61029613", "0.6085512", "0.60315126...
0.6238711
15
needs obj array for common sites' info
def check_site_index(url) site_match = Site.where("url like ?", "%#{url[/(http)s?:\/\/(?<uri>[\w\d\.]+)/, "uri"]}%") if site_match.size == 0 @new_sites << url return nil end return site_match[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def site_data; end", "def find_for_site(objects, site)\n #TODO *** IS THERE A BETTER WAY TO IMPLEMENT THIS??? ***\n\n site_objects = []\n objects.each do |o|\n site_objects << o if o.root.site == site\n end\n site_objects\n end", "def site_data_hash; end", "def all_site_details\r\n ...
[ "0.6491125", "0.6483659", "0.6358057", "0.6347334", "0.6240457", "0.6229643", "0.6010878", "0.6010878", "0.6010878", "0.6010878", "0.6010878", "0.59800506", "0.59798497", "0.59544885", "0.593387", "0.5931338", "0.5893128", "0.58589244", "0.5834489", "0.5743611", "0.5731053", ...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_account @account = Account.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def account_params params.require(:account).permit( :name, :name_addon, :comments, :zip, :city, :street, :streetno, :country, :gender, :firstname, :lastname, :tel1, :tel2, :fax, :email, :homepage, :logo, :payment_adapter_id, :email_billing_address, :accountstatus_id, :terms_link, :vat_number, :invoice_no_start, :subdomain, :token, :show_header_image, :eventheader, :css_code, :js_code, :invoice_from_small, :invoice_from, :invoice_footer, :tax_id, :invoicelogo, :domain, :active, :event_contact, :vat_included, :terms_link_text, :terms_required, :tracking_code, :robots_txt, :landingpagecode, :websiteintegration_done ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Wrap radian values within the range of radians (0..PI2).
def rad2rad(rad) remt(rad, PI2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertToRadians(val)\n return val * PIx / 180\n end", "def convertToRadians(val)\n return val * PIx / 180\n end", "def radian_angle\n @angle * Math::PI / 180.0\n end", "def deg2rad\n self * (Math::PI/180)\n end", "def to_rad\n self * Math::PI / 180\n end", "def rad\n ...
[ "0.6953246", "0.6953246", "0.6815769", "0.6766003", "0.6696698", "0.66509175", "0.66327876", "0.6569903", "0.6527652", "0.65061414", "0.64924353", "0.6490792", "0.6490792", "0.6477993", "0.64658415", "0.6238123", "0.6202522", "0.6165221", "0.6112726", "0.61095715", "0.6093234...
0.7234385
0
Wrap degree values within the range of degrees (0..360).
def deg2deg(deg) remt(deg, 360) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_input(any_value_float)\n n, degrees_remaining = any_value_float.divmod(360)\n if degrees_remaining >= 0\n degrees_remaining\n elsif\n degrees_remaining < 0\n degrees_remaining + 360\n end\nend", "def to_degrees\n self / Math::PI.fdiv(180)\n end", "def convertToRadians(val)\n retu...
[ "0.6945152", "0.6742482", "0.66013396", "0.66013396", "0.6529405", "0.64295584", "0.64018226", "0.63640374", "0.6332521", "0.6311381", "0.6309162", "0.6308506", "0.6295077", "0.6292524", "0.62815785", "0.62740016", "0.62667745", "0.6248314", "0.6239638", "0.6234815", "0.62345...
0.6304269
12
Wrap gradian values within the range of gradians (0..400).
def grad2grad(grad) remt(grad, 400) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradians\n self * Math::PI / 200.0\n end", "def rotatel(grados)\n if grados < 0\n self.rotater(grados.abs)\n else\n suma = @grados + grados\n if suma >= 360\n @grados = suma%360\n else\n \t@grados = suma\n end\...
[ "0.6540935", "0.5727147", "0.5693421", "0.5657908", "0.5636403", "0.5510285", "0.5510285", "0.54959726", "0.54530513", "0.5409899", "0.5320145", "0.5311159", "0.5297222", "0.52702713", "0.5236066", "0.5236066", "0.5222034", "0.51743394", "0.517289", "0.5129564", "0.5127471", ...
0.0
-1
Convert degrees to radians. The value will be constrained to the range of radians (0..PI2) unless +wrap+ is false.
def deg2rad(deg, wrap = true) rad = DR * deg rad = rad2rad(rad) if wrap rad end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deg2rad\n self * (Math::PI/180)\n end", "def to_radians\n self * Math::PI.fdiv(180)\n end", "def to_radians(mod = false)\n if mod\n (self * Math::PI / 180) % Math::PI\n else\n self * Math::PI / 180\n end\n end", "def convertToRadians(val)\n return val * PIx / 180\n end"...
[ "0.7576695", "0.7395715", "0.73709154", "0.7349314", "0.7349314", "0.7203287", "0.719633", "0.719465", "0.7165236", "0.7150701", "0.71401596", "0.71332365", "0.71118855", "0.7072822", "0.7061366", "0.70542914", "0.70142925", "0.6967052", "0.6935201", "0.693189", "0.689596", ...
0.7287801
5
Convert degrees to gradians. The value will be constrained to the range of gradians (0..400) unless +wrap+ is false.
def deg2grad(deg, wrap = true) grad = DG * deg grad = grad2grad(grad) if wrap grad end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradians\n self * Math::PI / 200.0\n end", "def rad2deg(rad, wrap = true)\r\n deg = RD * rad\r\n deg = deg2deg(deg) if wrap\r\n deg\r\n end", "def grad2deg(grad, wrap = true)\r\n deg = GD * grad\r\n deg = deg2deg(deg) if wrap\r\n deg\r\n end", "def deg2rad(deg, wrap = true)\r\n ...
[ "0.73029226", "0.7072027", "0.67608964", "0.67155737", "0.646686", "0.6386754", "0.6371415", "0.6362079", "0.636093", "0.636093", "0.63474095", "0.62757957", "0.6242054", "0.6208834", "0.6195484", "0.6188463", "0.60282165", "0.6019756", "0.60156184", "0.6010245", "0.6010245",...
0.6249695
12
Convert radians to degrees. The value will be constrained to the range of degrees (0..360) unless +wrap+ is false.
def rad2deg(rad, wrap = true) deg = RD * rad deg = deg2deg(deg) if wrap deg end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_degrees\n self / Math::PI.fdiv(180)\n end", "def rad2deg\n self * (180/Math::PI)\n end", "def to_degrees(radians)\n (radians * 180.0) / Math::PI\n end", "def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\...
[ "0.76899284", "0.7605061", "0.75259733", "0.72717494", "0.7251495", "0.7251495", "0.7251217", "0.7251217", "0.7247722", "0.72218823", "0.71925634", "0.7177028", "0.71727175", "0.713889", "0.70933133", "0.70279014", "0.69896126", "0.6981577", "0.6953764", "0.69443667", "0.6919...
0.7602901
2
Convert radians to gradians. The value will be constrained to the range of gradians (0..400) unless +wrap+ is false.
def rad2grad(rad, wrap = true) grad = RG * rad grad = grad2grad(grad) if wrap grad end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradians\n self * Math::PI / 200.0\n end", "def rad2deg(rad, wrap = true)\r\n deg = RD * rad\r\n deg = deg2deg(deg) if wrap\r\n deg\r\n end", "def deg2rad(deg, wrap = true)\r\n rad = DR * deg\r\n rad = rad2rad(rad) if wrap\r\n rad\r\n end", "def grad2rad(grad, wrap = true)\r\n ...
[ "0.7073034", "0.70421636", "0.6824547", "0.64663494", "0.6431927", "0.64079547", "0.64008015", "0.63994616", "0.63994616", "0.6393482", "0.6390405", "0.6390405", "0.6361153", "0.63513964", "0.6316169", "0.6296792", "0.6270821", "0.62258536", "0.60983217", "0.6079405", "0.6073...
0.6467056
3
Convert gradians to degrees. The value will be constrained to the range of degrees (0..360) unless +wrap+ is false.
def grad2deg(grad, wrap = true) deg = GD * grad deg = deg2deg(deg) if wrap deg end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rad2deg(rad, wrap = true)\r\n deg = RD * rad\r\n deg = deg2deg(deg) if wrap\r\n deg\r\n end", "def to_degrees\n self / Math::PI.fdiv(180)\n end", "def deg2deg(deg)\r\n remt(deg, 360)\r\n end", "def rad2deg\n self * (180/Math::PI)\n end", "def to_degrees(mod = false)\n retur...
[ "0.76339155", "0.73241544", "0.7201475", "0.71910363", "0.7004376", "0.690793", "0.690279", "0.68894476", "0.6857332", "0.6843334", "0.6799143", "0.6799143", "0.6792775", "0.67685515", "0.67414606", "0.66974723", "0.6681639", "0.66383487", "0.6576273", "0.65413886", "0.650036...
0.72924536
2
Convert gradians to radians. The value will be constrained to the range of radians (0..PI2) unless +wrap+ is false.
def grad2rad(grad, wrap = true) rad = GR * grad rad = rad2rad(rad) if wrap rad end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deg2rad(deg, wrap = true)\r\n rad = DR * deg\r\n rad = rad2rad(rad) if wrap\r\n rad\r\n end", "def deg2rad\n self * (Math::PI/180)\n end", "def deg2rad(deg)\n deg*Math::PI/180\n end", "def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend", "def deg_to_rad(deg)\n return (...
[ "0.747109", "0.7298806", "0.7097056", "0.7032088", "0.7017716", "0.701321", "0.69410855", "0.69315857", "0.6927721", "0.6927721", "0.69037366", "0.6903086", "0.6892582", "0.6851327", "0.6843788", "0.6834461", "0.682497", "0.6794163", "0.6772143", "0.6745342", "0.67073125", ...
0.6662441
23
TODO print koji url (both on success & failure)
def scratch_build begin distgit_pkg.build rescue => e puts "Warning: scratch build failed: #{e}".bold.red end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kisalli_url\n return KISALLI_URL\n end", "def url\n end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url...
[ "0.5899059", "0.5867022", "0.58260036", "0.58260036", "0.58260036", "0.58260036", "0.58260036", "0.58260036", "0.58260036", "0.58260036", "0.58260036", "0.58260036", "0.58260036", "0.58260036", "0.58260036", "0.58260036", "0.58260036", "0.58260036", "0.58260036", "0.58260036", ...
0.0
-1
== Instance Methods ===================================================== Slug generation rule
def url I18n.t('common.ad_url', locale: I18n.default_locale, model_brand_name: brand&.name, model_name: model&.name, city_region_name: region&.name, city_name: city&.name, id: id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_slug\n self.slug = self.name.parameterize\n end", "def generate_slug\n self.slug = self.title[0..47].parameterize\n end", "def generate_slug\n self.slug = self.title[0..47].parameterize\n end", "def generate_slug\n self.slug = name.parameterize if name.present?\n end", "def gen...
[ "0.7824403", "0.7812275", "0.7812275", "0.75820357", "0.7498259", "0.7494246", "0.7478583", "0.7469181", "0.7410889", "0.7410889", "0.7379168", "0.7374327", "0.7343948", "0.73370665", "0.73142856", "0.7234278", "0.72251606", "0.72225446", "0.718371", "0.7182452", "0.71308434"...
0.0
-1
GET /subcategories/1 GET /subcategories/1.json
def show @subcategory = Subcategory.find(params[:id]) @message = Message.new @posts = @subcategory.posts.where(:published => true).where("published_at <= ?", Time.now).paginate(:page => params[:page], :per_page => 6) respond_to do |format| format.html # show.html.erb format.json { render json: @subcategory } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def index\n @subcategories = @category.subcategories\n end", "def subcategories_json\n {id: id, name: name, depth: depth}\n end", "d...
[ "0.85748774", "0.77882415", "0.77775973", "0.77775973", "0.7774985", "0.7752968", "0.7698596", "0.7470836", "0.74105114", "0.7390872", "0.7381812", "0.73512584", "0.73512584", "0.73456556", "0.7316344", "0.7220665", "0.7134633", "0.70723563", "0.7029457", "0.7004672", "0.7002...
0.6155346
68
GET /subcategories/new GET /subcategories/new.json
def new @subcategory = Subcategory.new @categories = Category.all respond_to do |format| format.html # new.html.erb format.json { render json: @subcategory } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @home_categories_sub = Home::Categories::Sub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @home_categories_sub }\n end\n end", "def new\n @sub_category = SubCategory.new\n end", "def new\n @super_category = SuperCategory.new\n\n ...
[ "0.77681744", "0.7476486", "0.73068905", "0.72809464", "0.7226173", "0.7132106", "0.7126193", "0.7076101", "0.7069384", "0.7066397", "0.70567524", "0.7034097", "0.7014026", "0.699683", "0.69571924", "0.69488525", "0.6935046", "0.6904319", "0.6892189", "0.6821989", "0.68099767...
0.77856463
0
POST /subcategories POST /subcategories.json
def create @subcategory = Subcategory.new(params[:subcategory]) respond_to do |format| if @subcategory.save format.html { redirect_to @subcategory, notice: 'Subcategory was successfully created.' } format.json { render json: @subcategory, status: :created, location: @subcategory } else format.html { render action: "new" } format.json { render json: @subcategory.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def create_sub\n @sub_category = SubCategory.new(sub_category_params)\n @category = Category.find(@sub_category.CategoryId)\n @sub_cate...
[ "0.7588882", "0.73007095", "0.7248703", "0.7181887", "0.7181887", "0.7007688", "0.6992044", "0.6889236", "0.6737247", "0.669113", "0.6690759", "0.66476345", "0.664047", "0.6606002", "0.6572054", "0.65421176", "0.65349185", "0.6501213", "0.6496519", "0.64940494", "0.64682436",...
0.6661781
11
PUT /subcategories/1 PUT /subcategories/1.json
def update @subcategory = Subcategory.find(params[:id]) respond_to do |format| if @subcategory.update_attributes(params[:subcategory]) format.html { redirect_to @subcategory, notice: 'Subcategory was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @subcategory.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_sub_category\n @sub_category = SubCategory.find(params[:id])\n end", "def set_sub_category\n @sub_category = SubCategory.find(params[:id])\n end", "def set_sub_sub_category\n @sub_sub_category = SubSubCategory.find(params[:id])\n end", "def update\n @home_categories_sub = H...
[ "0.70400244", "0.7039272", "0.69710296", "0.69369704", "0.6910998", "0.69069964", "0.6871698", "0.68535143", "0.6766925", "0.6701056", "0.6671873", "0.65947896", "0.65787756", "0.65787756", "0.65451056", "0.65451056", "0.65451056", "0.65451056", "0.6529481", "0.6524203", "0.6...
0.67026544
9
DELETE /subcategories/1 DELETE /subcategories/1.json
def destroy @subcategory = Subcategory.find(params[:id]) @subcategory.destroy respond_to do |format| format.html { redirect_to subcategories_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @subcategory = @category.subcategories.find(params[:id])\n @subcategory.destroy\n\n respond_to do |format|\n format.html { redirect_to(kadmin_category_subcategories_url(@category)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @home_categories_sub = Home::Categ...
[ "0.76238775", "0.75684327", "0.75140494", "0.7448943", "0.7448943", "0.7316239", "0.72644025", "0.72470343", "0.72470343", "0.7221435", "0.7197644", "0.70930177", "0.70675975", "0.7066929", "0.6986819", "0.6960526", "0.69342744", "0.6883598", "0.686438", "0.68614846", "0.6844...
0.76223236
1
Assumes other types are atoms.
def visit_other_type value = compiler.compile_as_atom(node) compile_value_match(value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def same_types?(other)\n types == other.types\n end", "def types(types); end", "def nonregular_type; end", "def inverse_type; end", "def associate_atom!(arg)\n if arg.is_a?(Rubabel::Atom)\n @ob.add_atom(arg.ob)\n arg\n else\n (num, is_aromatic) = \n ...
[ "0.574325", "0.55618376", "0.55400985", "0.5535219", "0.54859924", "0.53762937", "0.5372919", "0.53087515", "0.5302607", "0.52023757", "0.5200052", "0.51641655", "0.5148312", "0.5144402", "0.513201", "0.5093813", "0.50787336", "0.5073342", "0.50626296", "0.5061695", "0.506169...
0.66313756
0
Recursively crawl all new photos, sorted by created_at desc, for a user
def crawl(username, last_scraped_id, max_id = nil, items = []) # Construct url for the current page of photos url = "https://instagram.com/#{ username }/media/" url += "?&max_id=#{ max_id }" if max_id # Make network call and parse json uri = URI.parse(url) response = Net::HTTP.get_response(uri) json = JSON.parse(response.body) rescue nil # Raise error if there is any raise url if json['status'] != 'ok' # Short circuit if we have already reached the last scraped photo last_scraped_id_index = json['items'].map { |item| item['id'] }.index(last_scraped_id) if last_scraped_id_index items.concat(json['items'][0...last_scraped_id_index]) puts "crawled #{ items.size } items, reached last scraped photo, done" return items end # Append photos from this page to the recursive collection items = items.concat(json['items']) # Recursively crawl the next page; otherwise, we've crawled everything if json['more_available'] puts "crawled #{ items.size } items, more available (max_id = #{ json['items'][-1]['id'] })" crawl(username, last_scraped_id, json['items'][-1]['id'], items) else puts "crawled #{ items.size } items, reached the end, done" end # Return all the photos crawled items end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recent_images(count = 20, page = 1)\n latest_photo = self.photos.limit(1).first\n min_id = if latest_photo\n latest_photo.uid\n else\n nil\n end\n\n params = {count: count, access_token: self.access_token}\n params[:min_id] = min_id if min_id\n\n response = Star::Requester.get \"...
[ "0.59856606", "0.5901742", "0.57447433", "0.5550974", "0.5508283", "0.5497291", "0.5490228", "0.5489036", "0.54766643", "0.54294044", "0.54006547", "0.53774196", "0.5306476", "0.52998614", "0.52883446", "0.5287063", "0.5278055", "0.5278055", "0.5278055", "0.5278055", "0.52780...
0.6428627
0
Save photo with exif time and comment in year/month subfolder
def save(item) url = item['images']['standard_resolution']['url'] created_at = Time.at(item['created_time'].to_i) folder_name = "#{ USERNAME }/#{ created_at.strftime("%Y/%m") }" file_path = "#{ folder_name }/#{ item['id'] }.jpg" # Organize photos into year and month folders `mkdir -p #{ folder_name }` # Check if 1080 resolution is available (not exposed in their api) url_1080 = url.gsub('s640x640', 's1080xs1080') url = url_1080 if `curl -s -I #{ url_1080 }` =~ /200 OK/ # Download photo `curl -s -o #{ file_path } #{ url }` # Set exif time `./jhead-3.00 -mkexif -ts#{ created_at.strftime('%Y:%m:%d-%T') } #{ file_path }` # Set exif comment to include location and caption location = item['location']['name'] if item['location'] && item['location']['name'] caption = item['caption']['text'] if item['caption'] && item['caption']['text'] comment = [location, caption].compact.join(' | ') .gsub(/\n/, ' ') .gsub(/\s+/, ' ') .gsub(/"/, "'") `./jhead-3.00 -cl "#{ comment }" #{ file_path }` puts "saved #{ item['id'] }" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_meta_data\n img = ::MiniMagick::Image.open(file.file)\n\n model.format = img.type\n model.height = img.height\n model.width = img.width\n\n if img.exif.present?\n exif_date = img.exif[\"DateTimeOriginal\"].split(\" \")\n exif_date.first.gsub!(\":\", \"-\")\n\n model.t...
[ "0.6240719", "0.6178876", "0.61714154", "0.60399944", "0.5901128", "0.583667", "0.5823057", "0.5728076", "0.57130665", "0.57007414", "0.5674609", "0.5667315", "0.5657567", "0.5635428", "0.5623497", "0.56043524", "0.56032866", "0.55806416", "0.55757415", "0.5571986", "0.554262...
0.6765814
0
Below, returns the user object (chef) who is logged in, used with checking who they are
def current_chef #Below, finds the current chef who is logged in from the session hash and their ID. The if statement makes it so this #only occurs if there is a session for a logged in chef. This will automatically hit the DB whether or not the CHef #was already logged in @current_chef ||= Chef.find(session[:chef_id]) if session[:chef_id] #But, the "||=" makes it so if the chef is there #return it right away; If not, then return it using the code following the "=". This is optimization of code. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n\t\t#memorization; stores the value of what is returned into @current_user which will be used later on by the app\n\t\t@current_user ||= Chef.find(session[:chef_id]) if session[:chef_id]\n\tend", "def current_user\n \t#se guarda al usuario actual que esta loggeado por cuestion de eficiencia\n ...
[ "0.7797451", "0.77688247", "0.7706851", "0.7698209", "0.7672074", "0.7672074", "0.76502347", "0.75552815", "0.72131103", "0.70810276", "0.7021209", "0.69942", "0.6976449", "0.69083494", "0.6906317", "0.6872532", "0.68712646", "0.6870357", "0.6865509", "0.68568736", "0.6847641...
0.7118751
9
PATCH/PUT /posts/1 PATCH/PUT /posts/1.json
def update if @event.update(event_params(params)) render json: @event, status: 200 else render :json => @event.errors, :status => 422 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "def update\n respond_with Post.update(params[:id], params[:posts])\n end", "def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n forma...
[ "0.71863747", "0.7041976", "0.67735577", "0.67668164", "0.6669752", "0.6648918", "0.65785664", "0.65562683", "0.65507084", "0.6548935", "0.6534891", "0.65306884", "0.649767", "0.6496564", "0.64679456", "0.64313143", "0.6428435", "0.64265287", "0.64264816", "0.641942", "0.6418...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_event @event = Event.find_by_id(params[:id]) render json: { error: 'Event not found'}, status: 404 if @event.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 event_params(parameters) data = {} data[:user_id] = current_user.id data[:name] = parameters[:name] || "untitle" data[:private_status] = parameters[:private_status] || false data[:distance] = parameters[:distance] || 10 data[:city] = parameters[:city] || "Paris" data[:start_date] = parameters[:start_date] || Date.today data[:end_date] = parameters[:end_date] || Date.tomorrow.at_end_of_day data[:description] = parameters[:description] || "" data 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 a list of valid shells
def get_valid_shells() vaild_shells = %x[ls /usr/bin |grep 'sh$' |awk '{print "/usr/bin/" $1 }'] vaild_shells = vaild_shells.split("\n").join(",") return vaild_shells end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shell_is_valid?(shell_path)\n return false if shell_path.nil? || !File.exist?(shell_path)\n # AIX is the only OS that has the concept of 'approved shells'\n return true unless platform_family?('aix')\n\n begin\n File.open('/etc/security/login.cfg') do |f|\n f.each_line do |l...
[ "0.5819872", "0.57962114", "0.57949007", "0.5752746", "0.57495165", "0.5749092", "0.56281936", "0.5574769", "0.55369955", "0.54647446", "0.54527", "0.5442911", "0.5422999", "0.54207885", "0.54067504", "0.5384999", "0.5371431", "0.53507125", "0.53371716", "0.53270805", "0.5324...
0.84241164
0
Make sure user ID is greater than 100
def check_valid_uid(answer) correct = 1 if answer.match(/[A-z]/) correct = 0 else if Integer(answer) < 100 correct = 0 puts "UID must be greater than 100" end end return correct end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_valid\n @user_id.length >= 7 && (@user_id.include?(\"!\") || @user_id.include?(\"$\"))\n end", "def is_uid?(number)\n number > 0 and number < 1000000000\n end", "def user_one_has_smaller_id\n if user_one_id.to_i > user_two_id.to_i\n self.errors.add(:user_one_id, :user_one_id_larger...
[ "0.6629121", "0.6505727", "0.63007325", "0.6267266", "0.6266096", "0.6112004", "0.6081412", "0.6067024", "0.60440373", "0.60242665", "0.6002156", "0.5999273", "0.59851164", "0.59451216", "0.59191376", "0.5901168", "0.58850014", "0.5832859", "0.5827658", "0.58110285", "0.57174...
0.6054352
8
Make sure user group is greater than 10
def check_valid_gid(answer) correct = 1 if answer.match(/[A-z]/) correct = 0 else if Integer(answer) < 10 correct = 0 puts "GID must be greater than 10" end end return correct end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_max_members_not_exceeded!(group)\n return unless group.present? && group_assignment.present? && group_assignment.max_members.present?\n return unless group.repo_accesses.count >= group_assignment.max_members\n\n report_invitation_failure\n raise NotAuthorized, \"This team has reached its m...
[ "0.7011221", "0.6433858", "0.6243412", "0.61348766", "0.60893315", "0.6059582", "0.5982246", "0.59631276", "0.59358984", "0.59238285", "0.5914701", "0.58954304", "0.5884491", "0.58302915", "0.57543194", "0.5750354", "0.57010317", "0.56990963", "0.5691048", "0.56902045", "0.56...
0.5215977
92
Get the user home directory ZFS dataset name
def get_account_home_zfs_dataset() account_home_zfs_dataset = "/export/home/"+$q_struct["account_login"].value return account_home_zfs_dataset end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset_dir\n Atlas.data_dir.join(DIRECTORY).join(key.to_s)\n end", "def home_dir(name=nil)\n username = (name || self.username)\n if (username == \"root\")\n \"/root\"\n else\n \"/home/#{username}\"\n end\n end", "def get_homedir(user)\n begin\...
[ "0.6288667", "0.62636214", "0.62257373", "0.61166614", "0.61052215", "0.6074077", "0.6066259", "0.6062657", "0.6019573", "0.5961016", "0.5838686", "0.58345556", "0.58296895", "0.5805782", "0.5771301", "0.57679886", "0.5748466", "0.57481706", "0.57395566", "0.5729343", "0.5713...
0.73557895
0
Get the user home directory mount point
def get_account_home_mountpoint() account_home_mountpoint = "/export/home/"+$q_struct["account_login"].value return account_home_mountpoint end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(user=nil)\n File.expand_path(Dir.home(user))\n end", "def get_homedir(user)\n begin\n Etc.getpwnam(\"#{user}\")[\"dir\"].chomp\n # or with dscl\n #homedir = %x(dscl . -read /users/#{user} NFSHomeDirectory).gsub(/NFSHomeDirectory: /,\"\")\n rescue Exception => e\n end \...
[ "0.80753493", "0.79201823", "0.7618964", "0.7616048", "0.7476953", "0.7404973", "0.72425246", "0.7161372", "0.7152372", "0.71323174", "0.70948327", "0.6984014", "0.6966098", "0.69239223", "0.6735856", "0.6679067", "0.6636023", "0.66092926", "0.66092926", "0.6478251", "0.64355...
0.71480364
9
Import AI manifest This is done to change the default manifest so that it doesn't point to the Oracle one amongst other things Check the structs for settings and more information
def import_ai_manifest(output_file,service_name) date_string = get_date_string() arch_list = [] base_name = get_service_base_name(service_name) if !service_name.match(/i386|sparc/) and !client_arch.match(/i386|sparc/) arch_list = ["i386","SPARC"] else if service_name.match(/i386/) arch_list.push("i386") else if service_name.match(/sparc/) arch_list.push("SPARC") end end end arch_list.each do |sys_arch| lc_arch = sys_arch.downcase backup = $work_dir+"/"+base_name+"_"+lc_arch+"_orig_default.xml."+date_string message = "Archiving:\tService configuration for "+base_name+"_"+lc_arch+" to "+backup command = "installadm export -n #{base_name}_#{lc_arch} -m orig_default > #{backup}" output = execute_command(message,command) message = "Validating:\tService configuration "+output_file command = "AIM_MANIFEST=#{output_file} ; export AIM_MANIFEST ; aimanifest validate" output = execute_command(message,command) if output.match(/[A-z|0-9]/) puts "AI manifest file "+output_file+" does not contain a valid XML manifest" puts output else message = "Importing:\t"+output_file+" to service "+service_name+" as manifest named "+$default_manifest_name command = "installadm create-manifest -n #{base_name}_#{lc_arch} -m #{$default_manifest_name} -f #{output_file}" output = execute_command(message,command) message = "Setting:\tDefault manifest for service "+service_name+" to "+$default_manifest_name command = "installadm set-service -o default-manifest=#{$default_manifest_name} #{base_name}_#{lc_arch}" output = execute_command(message,command) end end return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_main_manifest\n parser = Parser::EvaluatingParser.singleton\n parsed_code = Puppet[:code]\n program = if parsed_code != \"\"\n parser.parse_string(parsed_code, 'unknown-source-location')\n else\n file = @environment.manifest\n\n # if the manifest file is a reference to a directo...
[ "0.5891631", "0.5825265", "0.5774922", "0.5766088", "0.5749256", "0.57382643", "0.57264787", "0.57264787", "0.5714315", "0.5704424", "0.567528", "0.5659667", "0.5641902", "0.55908424", "0.5590622", "0.5525378", "0.54883105", "0.5471201", "0.5457668", "0.54568106", "0.5450367"...
0.6670098
0
Import a profile and associate it with a client
def import_ai_client_profile(output_file,client_name,client_mac,service_name) message = "Creating:\tProfile for client "+client_name+" with MAC address "+client_mac command = "installadm create-profile -n #{service_name} -f #{output_file} -p #{client_name} -c mac='#{client_mac}'" execute_command(message,command) return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_profile\n method('import_profile_from_' + self.service_provider).call \n end", "def import_profile_from_google\n # forthcoming\n end", "def import_profile_from_twitter\n self.profile.first_name = @credentials['name']\n self.profile.website = @credentials['url']\n self.profile.fed...
[ "0.6686158", "0.65777224", "0.6558583", "0.63770545", "0.6290275", "0.6182195", "0.6002919", "0.5994839", "0.5923994", "0.58732104", "0.5831568", "0.5821228", "0.57285696", "0.5704855", "0.56842077", "0.56710947", "0.5659271", "0.56392664", "0.5594789", "0.558968", "0.5570458...
0.67267144
0
Code to change timeout and default menu entry in grub
def update_ai_client_grub_cfg(client_mac) copy = [] netboot_mac = client_mac.gsub(/:/,"") netboot_mac = "01"+netboot_mac netboot_mac = netboot_mac.upcase grub_file = $tftp_dir+"/grub.cfg."+netboot_mac if $verbose_mode == 1 puts "Updating:\tGrub config file "+grub_file end if File.exists?(grub_file) text=File.read(grub_file) text.each do |line| if line.match(/set timeout=30/) copy.push("set timeout=5") copy.push("set default=1") else copy.push(line) end end File.open(grub_file,"w") {|file| file.puts copy} print_contents_of_file(grub_file) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_timeout_class=(_arg0); end", "def idle_timeout=(timeout); end", "def set_timeout timeout\r\n command 'setTimeout', timeout\r\n end", "def set_timeout timeout\r\n command 'setTimeout', timeout\r\n end", "def call_menu\n call_idle($game_player.old_character_name, false)\n syn_map_me...
[ "0.62128484", "0.6093513", "0.60570115", "0.60570115", "0.5947145", "0.5887452", "0.5869738", "0.58547676", "0.58547676", "0.58547676", "0.581706", "0.58124995", "0.5801914", "0.5801914", "0.5801914", "0.5801914", "0.5801914", "0.5800611", "0.5799512", "0.5799281", "0.5751535...
0.0
-1
Main code to configure AI client services Called from main code
def configure_ai_client_services(client_arch,publisher_host,publisher_port,service_name) puts puts "You will be presented with a set of questions followed by the default output" puts "If you are happy with the default output simply hit enter" puts service_list = [] # Populate questions for AI manifest populate_ai_manifest_questions(publisher_host,publisher_port) # Process questions process_questions(service_name) # Set name of AI manifest file to create and import if service_name.match(/i386|sparc/) service_list[0] = service_name else service_list[0] = service_name+"_i386" service_list[1] = service_name+"_sparc" end service_list.each do |temp_name| output_file = $work_dir+"/"+temp_name+"_ai_manifest.xml" # Create manifest create_ai_manifest(output_file) # Import AI manifest import_ai_manifest(output_file,temp_name) end return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_ai_client(client_name,client_arch,client_mac,client_ip,client_model,publisher_host,service_name,image_name)\n # Populate questions for AI profile\n if !service_name.match(/i386|sparc/)\n service_name = service_name+\"_\"+client_arch\n end\n check_ai_client_doesnt_exist(client_name,client_mac,s...
[ "0.72714335", "0.6912092", "0.6863109", "0.6701331", "0.6416961", "0.63820946", "0.63623697", "0.6361343", "0.6361207", "0.6329511", "0.6305312", "0.6280536", "0.6276614", "0.62644714", "0.6260502", "0.6240027", "0.6224642", "0.62128264", "0.62078834", "0.6202276", "0.6178188...
0.756818
0
Fix entry for client so it is given a fixed IP rather than one from the range
def update_ai_client_dhcpd_entry(client_name,client_mac,client_ip) copy = [] client_mac = client_mac.gsub(/:/,"") client_mac = client_mac.upcase dhcp_file = "/etc/inet/dhcpd4.conf" backup_file(dhcp_file) text = File.read(dhcp_file) text.each do |line| if line.match(/^host #{client_mac}/) copy.push("host #{client_name} {") copy.push(" fixed-address #{client_ip};") else copy.push(line) end end File.open(dhcp_file,"w") {|file| file.puts copy} print_contents_of_file(dhcp_file) return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_administrative_ip(opts)\n opts = check_params(opts,[:old_ips,:new_ips,:netmasks])\n super(opts)\n end", "def patch_ip\n remote_addrs = request.headers['REMOTE_ADDR'] ? request.headers['REMOTE_ADDR'].split(/[,\\s]+/) : []\n remote_addrs.reject! { |addr| trusted_proxy?(addr) }\n\n ...
[ "0.61135274", "0.60551494", "0.6014203", "0.6014203", "0.5950137", "0.59267", "0.59267", "0.58572143", "0.583353", "0.5830634", "0.58297", "0.5810723", "0.5798227", "0.5792126", "0.57779866", "0.5746094", "0.5746094", "0.5746094", "0.5746094", "0.5746094", "0.5746094", "0.5...
0.6149505
0
Routine to actually add a client
def create_ai_client(client_name,client_arch,client_mac,service_name,client_ip) message = "Creating:\tClient entry for #{client_name} with architecture #{client_arch} and MAC address #{client_mac}" command = "installadm create-client -n #{service_name} -e #{client_mac}" execute_command(message,command) if client_arch.match(/i386/) or client_arch.match(/i386/) update_ai_client_dhcpd_entry(client_name,client_mac,client_ip) update_ai_client_grub_cfg(client_mac) else add_dhcp_client(client_name,client_mac,client_ip,client_arch,service_name) end smf_service = "svc:/network/dhcp/server:ipv4" refresh_smf_service(smf_service) return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(client); end", "def add_client(client) # add client object\n @clients[client.name] = client\n end", "def add_client(client)\n clients.push(client)\n end", "def add_client(client)\n @clients.push(client)\n end", "def add_client(client, clients)\n\tclients << client\nend", "def add_clie...
[ "0.862989", "0.82597727", "0.80877787", "0.789663", "0.7860437", "0.7835091", "0.7639564", "0.7639564", "0.7460085", "0.7336484", "0.72792745", "0.7196476", "0.71463615", "0.7015831", "0.6919419", "0.68616915", "0.6850276", "0.6809092", "0.6777248", "0.6756092", "0.6608496", ...
0.5993353
40
Check AI client doesn't exist
def check_ai_client_doesnt_exist(client_name,client_mac,service_name) client_mac = client_mac.upcase message = "Checking:\tClient "+client_name+" doesn't exist" command = "installadm list -p |grep '#{client_mac}'" output = execute_command(message,command) if output.match(/#{client_name}/) puts "Warning:\tProfile already exists for "+client_name if $yes_to_all == 1 puts "Deleting:\rtClient "+client_name unconfigure_ai_client(client_name,client_mac,service_name) else exit end end return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists?(username)\n perform_request({:action => 'client-checkexists', :username => username})\n statusmsg.match /client exists/i\n end", "def client?() false; end", "def check_client\n unless client\n raise ClientNotSetup\n end\n unless client.connected?\n ...
[ "0.6854493", "0.675522", "0.66202414", "0.6600302", "0.6529338", "0.6522949", "0.65209186", "0.65209186", "0.65047234", "0.65047234", "0.63979125", "0.62849873", "0.6252382", "0.62195253", "0.6126917", "0.6104799", "0.6050291", "0.60258824", "0.60191375", "0.60092443", "0.597...
0.7607382
0
Main code to actually add a client
def configure_ai_client(client_name,client_arch,client_mac,client_ip,client_model,publisher_host,service_name,image_name) # Populate questions for AI profile if !service_name.match(/i386|sparc/) service_name = service_name+"_"+client_arch end check_ai_client_doesnt_exist(client_name,client_mac,service_name) populate_ai_client_profile_questions(client_ip,client_name) process_questions(service_name) if $os_name.match(/Darwin/) tftp_version_dir = $tftp_dir+"/"+service_name check_osx_iso_mount(tftp_version_dir,iso_file) end output_file = $work_dir+"/"+client_name+"_ai_profile.xml" create_ai_client_profile(output_file) puts "Configuring:\tClient "+client_name+" with MAC address "+client_mac import_ai_client_profile(output_file,client_name,client_mac,service_name) create_ai_client(client_name,client_arch,client_mac,service_name,client_ip) if $os_name.match(/SunOS/) and $os_rel.match(/11/) clear_solaris_dhcpd() end return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(client); end", "def add_client(client) # add client object\n @clients[client.name] = client\n end", "def add_client(client)\n clients.push(client)\n end", "def add_client\n name = get_answer_to(\"What is the client\\'s name?\")\n age = get_answer_to(\"What is ...
[ "0.85058093", "0.7655422", "0.75304306", "0.74241287", "0.73790956", "0.7351603", "0.72007877", "0.6878735", "0.68396384", "0.68390197", "0.6803307", "0.67900753", "0.67900753", "0.67700285", "0.67529476", "0.67411613", "0.6720326", "0.6720326", "0.67122716", "0.66789025", "0...
0.0
-1
Add a _node_ to this graph.
def add(node) @nodes << node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_node(node)\n @nodes.add node\n end", "def add_node(node)\n\t\t\tunless has_node?(node)\n\t\t\t\t@nodes[node] = new_node(node)\n\t\t\t\t@order += 1\n\t\t\tend\n\t\t\tself\n\t\tend", "def addNode(node)\r\n\t\tif @nodes.nil?\r\n\t\t\t@nodes = [node]\r\n\t\telse\r\n\t\t\t@nodes << node\r\n\t\tend\r\n\t...
[ "0.85016483", "0.80950636", "0.78463775", "0.7652583", "0.7628048", "0.7626051", "0.7573539", "0.74676144", "0.7456076", "0.73219377", "0.73162895", "0.72741556", "0.71098673", "0.70665175", "0.70499396", "0.7000384", "0.69406354", "0.6923678", "0.6887349", "0.68757004", "0.6...
0.81512153
1
Iterates all nodes and fills the dependency fields of the Node.
def resolve_dependencies @nodes.each do |node| puts "processing #{node}" node.outgoing_dependencies do |dependency| providers = nodes_satisfying(dependency.target) node.add_dependency(dependency, providers) end node.dependencies.values.each { |vals| vals.sort! } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_all_nodes\n debug 'Start processing all nodes'\n each_node do |node|\n process_node node\n end\n end", "def _set_dependency(direction, depth, nodes, edges, base_job)\n return if nodes[base_job[:job_id]][:depth] == depth\n\n base_job[direction].map{|depend_job|\n...
[ "0.6015914", "0.59735113", "0.5952225", "0.5952225", "0.5921819", "0.5891796", "0.5771959", "0.5730006", "0.57297885", "0.5691587", "0.5664516", "0.56575525", "0.562184", "0.55913764", "0.55861866", "0.5583008", "0.5578939", "0.55575943", "0.55432713", "0.5528503", "0.5511085...
0.72427857
0
Find the nodes that satisfy the given _dependency_
def nodes_satisfying(dependency) @nodes.find_all { |n| n.satisfies?(dependency) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_for(dependency)\n # This array gets mutated by Molinillo; it's okay because sort returns a\n # new array.\n graph.versions(dependency.name, dependency.constraint).sort\n end", "def resolve_dependencies\r\n @nodes.each do |node|\r\n puts \"processing #{node}\"\r\n\r\n ...
[ "0.69579864", "0.6447244", "0.6423051", "0.6361501", "0.6249394", "0.6220293", "0.6198164", "0.61927986", "0.6115362", "0.6040003", "0.59675175", "0.59285074", "0.5914839", "0.58311373", "0.5797364", "0.5787019", "0.577071", "0.5762611", "0.5728495", "0.572424", "0.5709231", ...
0.8562812
0
Iterate all nodes in this Graph and call _block_ for each Node
def each_node(&block) @nodes.each { |node| block.call(node) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_node(&block)\n nodes.each_node &block\n end", "def each_node(&block)\n nodes.each_node &block\n end", "def each_node(&block)\n\t\t\tnodes.each(&block)\n\t\tend", "def each_node(&block)\n @nodes.each &block\n end", "def each_node(&block)\n @nodes.each &block\n end", ...
[ "0.79206383", "0.79206383", "0.77741134", "0.7765911", "0.7765911", "0.7683829", "0.7523192", "0.72769547", "0.7163582", "0.7136076", "0.707308", "0.6937505", "0.69251406", "0.68944013", "0.68897057", "0.68585455", "0.6730564", "0.6705396", "0.66411304", "0.66345334", "0.6634...
0.78625154
2
Defaults to create a facebook wall post when creating a post off by default when editing a post
def default_facebook post.new_record? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def force_post\n @type = \"post\"\n @post = \"\"\n end", "def fb_post_to_wall(name = 'Post to wall', options = {})\n options = {\n :method => 'feed',\n :callback => 'function(response) {}'\n }.merge(options)\n\n fb_ui name, options\n end", "def create\n @post = cur...
[ "0.6638744", "0.6561049", "0.6538548", "0.6423986", "0.641622", "0.6335347", "0.63002247", "0.62251526", "0.6138504", "0.61371464", "0.6081114", "0.6060844", "0.60261226", "0.601031", "0.5991369", "0.59898704", "0.5979063", "0.59732807", "0.59665734", "0.5963296", "0.59532416...
0.68940485
0
Returns true when notification acts as facebook notification
def facebook? self.kind == 'facebook' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notification?\n kind == 'notification'\n end", "def friendship_notifications?\n notification_friendship\n end", "def notification?\n false\n end", "def allow_notification?\n true\n end", "def is_there_notification\n current_user.notifications\n end", "def verify_notifi...
[ "0.76242757", "0.7331077", "0.72873276", "0.70874983", "0.6623617", "0.6553116", "0.6507317", "0.6415823", "0.6341176", "0.6338956", "0.6336239", "0.6336239", "0.63355047", "0.631383", "0.630493", "0.6295853", "0.6291534", "0.62862265", "0.62389904", "0.62251633", "0.61764127...
0.6580774
5
Posts a link to the post with the title of the content of the notification as a default message
def perform Kublog.facebook_client.link! :link => @url, :message => @message end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_post_notification(post)\n #author\n reciever = User.find_by_id post.user_id\n setup_email(reciever)\n @subject +=\"Новый пост в вашем сообществе\"\n body[:url] = RAILS_URL + \"posts/show/#{post.id}\"\n body[:post] = post\n end", "def post(title, target, message, color)\n a_message_not...
[ "0.7241348", "0.7010666", "0.67701954", "0.6596769", "0.6577605", "0.64553803", "0.6438353", "0.6339243", "0.6261808", "0.62208307", "0.62032855", "0.61864114", "0.61748654", "0.61392", "0.61285293", "0.60344183", "0.60338616", "0.60218453", "0.5995728", "0.5981768", "0.59267...
0.5647998
46
def determine_role if current_user.student? redirect_to 'students/students' elsif current_user.professor? redirect_to 'professors/professors' else redirect_to :new_user_session_path end end
def configure_permitted_parameters devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(:first_name,:last_name, :date_of_birth, :email, :password, :role) } devise_parameter_sanitizer.permit(:account_update) { |u| u.permit(:first_name,:last_name, :date_of_birth, :email, :password, :role) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def role\n if current_user.has_role?(:guest)\n redirect_to \"/workouts\"\n elsif current_user.has_role?(:instructor)\n redirect_to \"/workouts\"\n end\n end", "def must_be_student\n unless current_user.role.name.eql?('Student')\n flash[:error] = \"Access denied.\"\n redirect_to r...
[ "0.8114749", "0.7863732", "0.7672241", "0.7499675", "0.7372636", "0.72388846", "0.72211623", "0.72013676", "0.71953267", "0.71876335", "0.715267", "0.71438617", "0.71392673", "0.71260357", "0.70435375", "0.703881", "0.7037154", "0.7037154", "0.7015077", "0.701101", "0.7007367...
0.0
-1
this is known as a getter method (it gets a property for us)
def title @title end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def property\n @property\n end", "def getters; end", "def get(property)\n self.send(property.to_sym)\n end", "def get_property(key)\n self.fetch key\n end", "def property(name); end", "def get(object); end", "def getter\r\n @getter ||= Field.getter(@name)\r\n end", "def ge...
[ "0.79818404", "0.79463685", "0.7415089", "0.7362863", "0.7274265", "0.7193934", "0.7152872", "0.71267897", "0.7092404", "0.7092404", "0.7092404", "0.7092404", "0.7092404", "0.7092404", "0.7092404", "0.70906305", "0.7086307", "0.7050356", "0.69779867", "0.69140106", "0.6872843...
0.0
-1
this is a setter method for author
def author=(author) @author = author end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def author=(author) #setter\n @author = author\n end", "def author=(author)\n @author = author.to_s.strip\n end", "def author value = nil\n return @author if value.nil?\n @author = value\n end", "def author=(o)\n self.authors = [o]\n end", "def author=(new_author = nil)\n @info[...
[ "0.87708557", "0.82423025", "0.80576754", "0.802041", "0.79866934", "0.7869423", "0.7869423", "0.78245604", "0.7817964", "0.781437", "0.7780819", "0.7725789", "0.7714685", "0.76443124", "0.76443124", "0.7640307", "0.76262456", "0.7603377", "0.7603377", "0.7603377", "0.7603377...
0.84555805
1
this is a getter method for author
def author @author end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_author()\n @author\n end", "def\n get_author()\n @author\n end", "def get_author()\n return @author\n end", "def author; @author; end", "def author; @author; end", "def author\n @author ||= get_author\n end", "def author\n\t\t@author\n\tend", "def author; end", "def get...
[ "0.9024315", "0.9000491", "0.8960699", "0.8887595", "0.8887595", "0.86475784", "0.86255676", "0.85348624", "0.8528863", "0.84626645", "0.84037435", "0.8330711", "0.8330711", "0.8319108", "0.829184", "0.82609767", "0.82217705", "0.8182256", "0.8174635", "0.8153382", "0.8152478...
0.8937418
3
setter method for page count
def page_count=(num) @page_count = num end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_pages=(value)\n @number_of_pages = value\n end", "def pages= number_of_pages\n \t@pages = number_of_pages\n end", "def page_count(arg)\n @pages = arg\n end", "def pagination=(count)\n settings.pagination = count\n end", "def set_PageCount(value)\n ...
[ "0.831719", "0.8161859", "0.8078838", "0.7882427", "0.7712922", "0.7712922", "0.7712922", "0.7712922", "0.7712922", "0.7712922", "0.7712922", "0.7712922", "0.7712922", "0.7712922", "0.7614065", "0.761169", "0.7606461", "0.7562109", "0.755518", "0.7369315", "0.7243922", "0.7...
0.8962508
0
getter method for page count
def page_count @page_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_count; pages.count; end", "def page_count\n @page_counter\n end", "def page_count\n @pages.count\n end", "def getPageCount()\n return @helper.getPageCount()\n end", "def getPageCount()\n return @helper.getPageCount()\n end", "def getPageCount()\n ...
[ "0.8878196", "0.880116", "0.8791925", "0.861796", "0.861796", "0.861796", "0.861796", "0.8608824", "0.8340322", "0.8179249", "0.8112386", "0.79492605", "0.79112154", "0.7833615", "0.78232116", "0.7801629", "0.77958757", "0.7777161", "0.77424973", "0.7723432", "0.7715834", "...
0.8804308
1
setter method for genre
def genre=(genre) @genre = genre end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genre(value)\n @ole.Genre = value\n nil\n end", "def genre=(genre)\n @genre = genre \n GENRES << genre \n end", "def genre=(genre)\n @genre = genre\n GENRES << genre\n end", "def genre=(genre)\n @genre = genre\n GENRES << genre\n end", "def genre= (genre)\n @genre =...
[ "0.8544388", "0.8512329", "0.846154", "0.846154", "0.8460923", "0.84045565", "0.82716864", "0.8196035", "0.808024", "0.80374265", "0.8025936", "0.8025936", "0.79900783", "0.79354835", "0.79349697", "0.7916542", "0.7916165", "0.7853655", "0.7834237", "0.7834237", "0.77535844",...
0.8735913
0
getter method for genre
def genre @genre end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genre; end", "def genre; end", "def get_genre_name\n self.genre.name\n end", "def genre\n fetch('game.genre')\n end", "def genre\n @ole.Genre\n end", "def genre_name\n \tif self.genre\n \t\tself.genre.name\n \tend\n end", "def genre_name\n self.genre ? self.genre.name...
[ "0.85556585", "0.85556585", "0.8533257", "0.8401553", "0.8344466", "0.81413114", "0.808454", "0.808454", "0.8031368", "0.8003487", "0.8003487", "0.8003487", "0.8003487", "0.8003487", "0.80025023", "0.7987414", "0.7970931", "0.79624534", "0.79619575", "0.7956722", "0.7956093",...
0.8729956
2
:secret => '9054a504e8cfd455107c37ee845ff83d' See ActionController::Base for details Uncomment this to filter the contents of submitted sensitive data parameters from your application log (in this case, all fields with names like "password"). filter_parameter_logging :password Authentication (Shamelessly stealing the bits of restful_authentication that I like.)
def current_person=(person) session[:current_person_id] = (person.nil? || person.is_a?(Symbol)) ? nil : person.id @current_person = person end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_password_confirmation\n log :filter_password_confirmation, \"\"\n replace_in_file 'config/initializers/filter_parameter_logging.rb',\n 'Rails.application.config.filter_parameters += [:password]',\n 'Rails.application.config.filter_parameters += [:password, :password_c...
[ "0.6536366", "0.64010173", "0.62888694", "0.62888694", "0.6233486", "0.6209301", "0.62063396", "0.62058246", "0.61347663", "0.61347663", "0.61347663", "0.6132899", "0.60615647", "0.604748", "0.60466266", "0.6009482", "0.598612", "0.59774417", "0.59702253", "0.596264", "0.5947...
0.0
-1
so we've got our UUID
def to_param uuid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uuid; end", "def uuid; end", "def uuid() = @uuid ||= SecureRandom.uuid", "def suuid; uuid; end", "def generate_uuid\n# self[:uuid] = UUID.sha1_create(UUID_OID_NAMESPACE, Time.now.utc.to_f.to_s).to_s\n end", "def populate_uuid\n self.uuid = SecureRandom.uuid()\n end", "def add_uuid\n self...
[ "0.8039781", "0.8039781", "0.78364563", "0.7517807", "0.74936664", "0.74530685", "0.7446117", "0.7364313", "0.72113657", "0.7183818", "0.7173391", "0.71728456", "0.71672344", "0.71507746", "0.7085465", "0.7052889", "0.7038594", "0.70346147", "0.70275444", "0.70246524", "0.702...
0.7014771
25
GET /az_companies GET /az_companies.xml
def index @tariffs = AzTariff.all @tariffs = @tariffs.collect{|t| [t.name + " " + t.tariff_type.to_s, t.id]} @companies = AzCompany.paginate(:all, :page => params[:page], :order => 'id desc') # @seeds = {AzProject => {}, # AzProjectBlock => {}, # AzStructDataType => {}, # AzDefinition => {}, # AzCommonsAcceptanceCondition => {}, # AzCommonsCommon => {}, # AzCommonsContentCreation => {}, # AzCommonsPurposeExploitation => {}, # AzCommonsPurposeFunctional => {}, # AzCommonsRequirementsHosting => {}, # AzCommonsRequirementsReliability => {}} # # @seeds.each_pair do |cls, cls_seeds_by_id| # cls_seeds = cls.find(:all, :conditions => "seed = 1") # cls_seeds.each do |item| # cls_seeds_by_id[item.id] = item # end # end #puts "((((((((((((((((((((((((((((((((((((((((((((" #puts @seeds.inspect # seed_projects = AzProject.find(:all, :conditions => "seed = 1") # @seed_projects_by_id = {} # seed_projects.each do |project| # @seed_projects_by_id[project.id] = project # end # # seed_blocks = AzProjectBlock.find(:all, :conditions => "seed = 1") # @seed_blocks_by_id = {} # seed_blocks.each do |item| # @seed_blocks_by_id[item.id] = item # end # # seeds = AzStructDataType.find(:all, :conditions => "seed = 1") # @seed_structs_by_id = {} # seeds.each do |seed| # @seed_structs_by_id[seed.id] = seed # end respond_to do |format| format.html # index.html.erb format.xml { render :xml => @az_companies } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render...
[ "0.7295624", "0.7251792", "0.7251792", "0.7251792", "0.7251792", "0.7204521", "0.7061837", "0.70165676", "0.6958202", "0.68519527", "0.6799089", "0.67904603", "0.6786618", "0.67630345", "0.6746376", "0.67299306", "0.67299306", "0.67236567", "0.67073375", "0.67073375", "0.6707...
0.0
-1
GET /az_companies/1 GET /az_companies/1.xml
def show @az_company = AzCompany.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @az_company } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml ...
[ "0.72755134", "0.72755134", "0.72755134", "0.72755134", "0.7260417", "0.7196384", "0.67957807", "0.67609185", "0.67609185", "0.67609185", "0.67551655", "0.6743317", "0.67255616", "0.6689399", "0.6679157", "0.66698366", "0.66403395", "0.6633537", "0.6621255", "0.65375215", "0....
0.7029448
6
GET /az_companies/new GET /az_companies/new.xml
def new @az_company = AzCompany.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @az_company } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @title = \"New Company\"\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n \n respond_to do |format|\n format.html # new.html.erb\n format...
[ "0.77251047", "0.77186424", "0.76395255", "0.76395255", "0.76395255", "0.76395255", "0.76395255", "0.76395255", "0.76395255", "0.74527717", "0.7341118", "0.72496253", "0.7229767", "0.7228511", "0.712104", "0.7078044", "0.70696443", "0.7023055", "0.7019656", "0.7019656", "0.70...
0.7667014
2
POST /az_companies POST /az_companies.xml
def create @az_company = AzCompany.new(params[:az_company]) #admin = AzUser.find_by_login('admin') user = @az_company.ceo #@az_company.ceo = admin ret = @az_company.save if ret if Integer(params[:az_company][:wo_ceo_co_create]) != 1 @az_company.add_employee(user) end if Integer(params[:az_company][:create_default_content_co_create]) == 1 @az_company.create_default_content end end respond_to do |format| if ret flash[:notice] = 'AzCompany was successfully created.' format.html { redirect_to(@az_company) } format.xml { render :xml => @az_company, :status => :created, :location => @az_company } else format.html { render :action => "new" } format.xml { render :xml => @az_company.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully created.' }\n format.json\n end\n end\n end", "def create\n...
[ "0.6541191", "0.64368683", "0.64368683", "0.64368683", "0.6352869", "0.6307827", "0.6258758", "0.6221407", "0.6183473", "0.61738664", "0.61236525", "0.61234736", "0.6122531", "0.61134624", "0.6110332", "0.60984266", "0.60984266", "0.60984266", "0.60984266", "0.60984266", "0.6...
0.5788543
53
PUT /az_companies/1 PUT /az_companies/1.xml
def update @az_company = AzCompany.find(params[:id]) respond_to do |format| if @az_company.update_attributes(params[:az_company]) #TODO Защитить баланс!!! flash[:notice] = 'AzCompany was successfully updated.' format.html { redirect_to(@az_company) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @az_company.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n add_to_log(t('Company updated log') + @company.name,\"companies\",\"update\")\n flash[:notice] = t('Company updated')\n format.html { redirect_to(@company...
[ "0.65778476", "0.65607363", "0.6506505", "0.6481517", "0.64802974", "0.64802974", "0.6474168", "0.6404089", "0.63768154", "0.6338016", "0.62980497", "0.625952", "0.6224043", "0.62104416", "0.62055427", "0.6201715", "0.62002295", "0.62002295", "0.62002295", "0.62002295", "0.62...
0.68111324
0
DELETE /az_companies/1 DELETE /az_companies/1.xml
def destroy @az_company = AzCompany.find(params[:id]) @az_company.destroy respond_to do |format| format.html { redirect_to(:back) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n add_to_log(t('Company dest...
[ "0.7141533", "0.71404773", "0.70738006", "0.70738006", "0.70738006", "0.70738006", "0.70738006", "0.70738006", "0.70738006", "0.7006754", "0.6883018", "0.68473995", "0.68157977", "0.6773656", "0.6746102", "0.6707356", "0.66699064", "0.666435", "0.6582022", "0.65725946", "0.65...
0.64742005
22
do uniquiness for user and post check stackoverflow
def body_count body.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_unique\n puts \"Ensuring uniqueness of user #{self.user_id.to_s} to recipe #{self.recipe_id.to_s}\"\n end", "def unique_helpfulness\n if helpful_user_id\n self.unhelpful_user_ids.delete(helpful_user_id) if self.unhelpful_user_ids\n (self.helpful_user_ids << helpful_user_id...
[ "0.58992165", "0.5855131", "0.5813033", "0.5710916", "0.5681593", "0.5595026", "0.5524522", "0.5511066", "0.548258", "0.5407309", "0.5385483", "0.53841", "0.5381385", "0.5379445", "0.5378501", "0.53363496", "0.53349173", "0.5334094", "0.5274606", "0.52634245", "0.52494043", ...
0.0
-1
Create candidate based on values submitted in the form, except read student_number from the session so that one can only use student number of their own find alliance by invite_code so one can only apply to an alliance they have been invited to
def create @alliance = find_alliance @candidate = Candidate.new(candidate_params).tap do |t| t.student_number = current_haka_user.student_number # sensitive t.electoral_alliance = @alliance # sensitive end if @candidate.save flash.notice = "Ehdokasilmoittautuminen vastaanotettu!" redirect_to registrations_candidate_path(@candidate.student_number) else flash.alert = "Ehdokasilmoittautuminen ei onnistunut, koska lomakkeen tiedoissa oli virheitä." render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @current_student = Student.find_by(id: session[:student_id]) # ADDED THIS BUT NOT DONE\n # Get the two params then add the rest later? Still need to figure out how to get evaluee id\n @evaluation = Evaluation.new(evaluation_params)\n if @evaluation.save\n flash[:success] = ...
[ "0.64590234", "0.61654484", "0.614535", "0.6136116", "0.61335176", "0.61314833", "0.60570854", "0.6000143", "0.5989504", "0.59658486", "0.59360516", "0.5890265", "0.58772236", "0.58388835", "0.5799245", "0.5776037", "0.5753923", "0.5751443", "0.5746353", "0.57443243", "0.5741...
0.67254496
0
Validations Class methods Instance methods
def registered_for?(auction) self.auctions.include? auction end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validation; end", "def validation; end", "def validate; end", "def validate; end", "def validate; end", "def validate; end", "def validate\n end", "def validator; end", "def validate\n fail 'sub class to implement'\n end", "def validate\n \n \n end", "def validate!; end"...
[ "0.80165124", "0.80165124", "0.7986662", "0.7986662", "0.7986662", "0.7986662", "0.79334545", "0.7916654", "0.7890589", "0.7868426", "0.7862408", "0.7862408", "0.7862408", "0.77951056", "0.7756661", "0.7744203", "0.77179474", "0.77179474", "0.77179474", "0.768493", "0.7678486...
0.0
-1
A path that starts with "$/"
def tfs_path case @path[0] when "$" @path when "/" "$#{@path}" else "$/#{@path}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n [[\"$:\"].concat($:)]\n end", "def path\n return @path.sub(/^\\//,'').sub(/^%2F/,'/')\n end", "def uniPath(source)\n source.gsub(/\\\\/, File::SEPARATOR)\nend", "def ensure_leading_slash(path); end", "def check_path_re\n check = (self.path_re == '^/$' || self.path_re.blan...
[ "0.7244455", "0.6652131", "0.6432785", "0.63706034", "0.6354958", "0.6301147", "0.6227543", "0.6167013", "0.6127402", "0.6121415", "0.60815185", "0.60815185", "0.6046422", "0.59973073", "0.5956353", "0.5908589", "0.59001344", "0.5888876", "0.5884247", "0.5875278", "0.5846313"...
0.64000016
3
GET /dias_semanas_vagas GET /dias_semanas_vagas.json
def index @dias_semanas_vagas = DiasSemanasVaga.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end", "def index\n\t\tvendas = Venda.all\n\t\trender json: vendas, status: :ok\n\tend", "def set_dias_se...
[ "0.6893552", "0.6812322", "0.66863376", "0.6650499", "0.6550655", "0.651908", "0.6458409", "0.6431234", "0.64144695", "0.6392315", "0.6377194", "0.63674057", "0.63201797", "0.6308009", "0.6301801", "0.6286835", "0.6260724", "0.6259943", "0.62580764", "0.6254448", "0.6235663",...
0.7136455
0
GET /dias_semanas_vagas/1 GET /dias_semanas_vagas/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end", "def index\n @dias_semanas_vagas = DiasSemanasVaga.all\n end", "def index\n\t\tvendas = Venda....
[ "0.706581", "0.7023298", "0.6879024", "0.6852359", "0.675234", "0.67460126", "0.66891426", "0.66696507", "0.66284716", "0.6594924", "0.65855783", "0.65709", "0.656782", "0.6536483", "0.64910406", "0.64860797", "0.64759254", "0.6446643", "0.64395124", "0.64347833", "0.64283913...
0.0
-1
POST /dias_semanas_vagas POST /dias_semanas_vagas.json
def create @dias_semanas_vaga = DiasSemanasVaga.new(dias_semanas_vaga_params) respond_to do |format| if @dias_semanas_vaga.save format.html { redirect_to @dias_semanas_vaga, notice: 'Dias semanas vaga was successfully created.' } format.json { render :show, status: :created, location: @dias_semanas_vaga } else format.html { render :new } format.json { render json: @dias_semanas_vaga.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dias_semanas_vaga_params\n params.require(:dias_semanas_vaga).permit(:vaga_id, :nome)\n end", "def set_dias_semanas_vaga\n @dias_semanas_vaga = DiasSemanasVaga.find(params[:id])\n end", "def create\n @estadia = Estadia.new(estadia_params)\n\n #Quando cria uma estadia nova, seta a data...
[ "0.6925132", "0.6661401", "0.6468975", "0.6428454", "0.6335077", "0.6296731", "0.62712955", "0.6247704", "0.62389266", "0.6228729", "0.622136", "0.61885095", "0.61823785", "0.61752456", "0.6169215", "0.6143385", "0.6109895", "0.6108259", "0.6101511", "0.6092106", "0.60770816"...
0.72266406
0
PATCH/PUT /dias_semanas_vagas/1 PATCH/PUT /dias_semanas_vagas/1.json
def update respond_to do |format| if @dias_semanas_vaga.update(dias_semanas_vaga_params) format.html { redirect_to @dias_semanas_vaga, notice: 'Dias semanas vaga was successfully updated.' } format.json { render :show, status: :ok, location: @dias_semanas_vaga } else format.html { render :edit } format.json { render json: @dias_semanas_vaga.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n if @safra_verdoso.update_attributes(params[:safra_verdoso])\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n else...
[ "0.66153437", "0.6543044", "0.65250456", "0.64857227", "0.64825845", "0.6473217", "0.64592534", "0.64564013", "0.64545995", "0.6443058", "0.64412403", "0.6410409", "0.6383495", "0.63825125", "0.6381797", "0.6377079", "0.63685054", "0.6365588", "0.6365395", "0.63411474", "0.63...
0.6843405
0
DELETE /dias_semanas_vagas/1 DELETE /dias_semanas_vagas/1.json
def destroy @dias_semanas_vaga.destroy respond_to do |format| format.html { redirect_to dias_semanas_vagas_url, notice: 'Dias semanas vaga was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_conte...
[ "0.7511879", "0.74465823", "0.74072385", "0.7347393", "0.7323572", "0.73208255", "0.72560066", "0.72560066", "0.7247961", "0.72199893", "0.7214749", "0.7214749", "0.7211716", "0.7202828", "0.7198211", "0.7192401", "0.71882516", "0.7184307", "0.7183093", "0.7176548", "0.717193...
0.7559699
0
Use callbacks to share common setup or constraints between actions.
def set_dias_semanas_vaga @dias_semanas_vaga = DiasSemanasVaga.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 dias_semanas_vaga_params params.require(:dias_semanas_vaga).permit(:vaga_id, :nome) 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
Assuming we've already configured Twitter, this returns the client. Pass in the user's access token and secret (or the app's access token and secret).
def twitter_client(access_token, access_token_secret) return Twitter::Client.new( oauth_token: access_token, oauth_token_secret: access_token_secret ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client\n Twitter::Client.new(\n oauth_token: token,\n oauth_token_secret: token_secret\n )\n end", "def client\n Twitter::REST::Client.new(consumer_key: Settings.consumer.key,\n consumer_secret: Settings.consumer.secret,\n access_t...
[ "0.8430334", "0.8227998", "0.8025517", "0.799876", "0.79950756", "0.78997624", "0.7891093", "0.7886527", "0.78714246", "0.7841652", "0.7838062", "0.7823555", "0.78101826", "0.7792803", "0.7774745", "0.7747005", "0.77138025", "0.7698678", "0.7629197", "0.7610034", "0.74376804"...
0.8297907
1
Returns a score for a tweet based on number of favorites and retweets.
def tweet_score(favorite_count, retweet_count) return favorite_count + (retweet_count * 2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_favorite_tweeter\n # Count each fav as 1 point\n scores = Hash[most_faved]\n scores.default = 0\n\n # Count each RT as 1.5 points\n most_retweeted.each { |screen_name, rts| scores[screen_name] += (rts * 1.5) }\n\n winning_screen_name, winning_score = scores.max_by { |_, score| score...
[ "0.7595042", "0.70686877", "0.70164037", "0.6812099", "0.61186284", "0.6028041", "0.6009796", "0.60075307", "0.5969592", "0.5944099", "0.5939561", "0.59046924", "0.58927065", "0.58797085", "0.5871165", "0.58711237", "0.58347285", "0.58300155", "0.5812848", "0.58100665", "0.57...
0.83638316
0
need to create a nonRESTful route show_by_name (tag name) for users above methods are for users only for admins (future) need separate controller that is admin only to create these RESTful actions: create, new, edit, update, destroy below CREATE action added her temporarily until figure out how to create AdminControllerCreateTags
def create @tag = Tag.new( name: params[:name], ) if @tag.save render json: {message: 'Tag created successfully'}, status: :created else render json: {errors: user.errors.full_messages}, status: :bad_request end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n authorize @tag\n end", "def show\n @tagname = params[:id].to_s\n @tags = Tag.name_is(@tagname).descend_by_updated_at.reject {|r| !r.tagable.read_allowed?(current_user) }.paginate(\n :page => params[:page], :per_page => POSTINGS_PER_PAGE)\n @tagables = @tags.map { |t| \n t.taga...
[ "0.642201", "0.63223356", "0.6320692", "0.6116768", "0.6085994", "0.5993188", "0.5988932", "0.5957953", "0.5933179", "0.588931", "0.5809403", "0.58063895", "0.5767483", "0.5742374", "0.57323414", "0.57005775", "0.5690985", "0.5680849", "0.5676095", "0.5668635", "0.5666746", ...
0.52600163
90
lazy init this, to keep the dependency (which goes to parfait and booting) at bay
def dynamic_call @dynamic ||= SlotMachine::DynamicCall.new() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bootstrap_init\n end", "def pre_initialize\n end", "def post_init\n end", "def pre_initialize; end", "def enable_dependency_loading=(_arg0); end", "def enable_dependency_loading=(_arg0); end", "def at_init\n\n\t\tend", "def post_init\n end", "def hook_require!\n hook_inst...
[ "0.68753386", "0.667067", "0.64960563", "0.6451968", "0.6393567", "0.6393567", "0.63365746", "0.6243994", "0.6232642", "0.62250865", "0.61812085", "0.6155357", "0.61441237", "0.6101102", "0.60833097", "0.60833097", "0.60830915", "0.6067601", "0.60588706", "0.6046556", "0.6025...
0.0
-1
A Send breaks down to 2 steps: Setting up the next message, with receiver, arguments, and (importantly) return address a CachedCall , or a SimpleCall, depending on wether the receiver type can be determined A slight complication occurs for methods defined in superclasses. Since we are type, not class, based, these are not part of our type. So we check, and if find, add the source (sol_method) to the class and start compiling the sol for the receiver_type
def to_slot( compiler ) @receiver = SelfExpression.new(compiler.receiver_type) if @receiver.is_a?(SelfExpression) if(@receiver.ct_type) method = @receiver.ct_type.get_method(@name) #puts "Known #{@receiver.ct_type}: method #{method}" method = create_method_from_source(compiler) unless( method ) return simple_call(compiler, method) if method end cached_call(compiler) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_method_from_source(compiler)\n sol_method = @receiver.ct_type.object_class.resolve_method!(@name)\n return nil unless sol_method\n #puts \"#{sol_method.name} , adding to #{@receiver.ct_type.object_class.name}\"\n @receiver.ct_type.object_class.add_instance_method(sol_method)\n s...
[ "0.6150268", "0.60373646", "0.5430735", "0.5430735", "0.542665", "0.53680325", "0.53378093", "0.5243899", "0.52068233", "0.51597863", "0.5123712", "0.5121858", "0.51142055", "0.5105227", "0.50736547", "0.49556154", "0.4936722", "0.4903333", "0.4881186", "0.4876651", "0.487038...
0.55695534
2
If a method is found in the class (not the type) we add it to the class that the receiver type represents, and create a compiler to compile the sol for the specific type (the receiver)
def create_method_from_source(compiler) sol_method = @receiver.ct_type.object_class.resolve_method!(@name) return nil unless sol_method #puts "#{sol_method.name} , adding to #{@receiver.ct_type.object_class.name}" @receiver.ct_type.object_class.add_instance_method(sol_method) sol_method.create_callable_method_for(@receiver.ct_type) new_compiler = sol_method.compiler_for(@receiver.ct_type) compiler.add_method_compiler(new_compiler) new_compiler.callable end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_method_to(cls)\n cls.class_eval do\n def m; 'hello'; end\n end\nend", "def to_slot( compiler )\n @receiver = SelfExpression.new(compiler.receiver_type) if @receiver.is_a?(SelfExpression)\n if(@receiver.ct_type)\n method = @receiver.ct_type.get_method(@name)\n #puts \"Known #{...
[ "0.5989799", "0.5854502", "0.58062696", "0.5740737", "0.5698144", "0.563938", "0.56389934", "0.5592122", "0.5548929", "0.5513346", "0.5507309", "0.54874784", "0.54772127", "0.5470941", "0.5457041", "0.5441674", "0.53949493", "0.5372015", "0.5359234", "0.5357719", "0.53515106"...
0.7385557
0
this breaks cleanly into two parts: check the cached type and if neccessary update call the cached method
def cached_call(compiler) cache_check(compiler) << call_cached_method(compiler) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_cache\n # Does nothing...up to subclasses to implement.\n end", "def update_cache(type, id, data)\n end", "def update_cache(type, id, data)\n end", "def update_cache(type, id, data)\n end", "def cached\n raise NotImplementedError\n end", "def cached?; end", "de...
[ "0.75636667", "0.720644", "0.71866333", "0.71866333", "0.6970629", "0.6817806", "0.67859614", "0.6722857", "0.6562065", "0.6562065", "0.6547747", "0.65441686", "0.65246737", "0.65246737", "0.64903635", "0.6482895", "0.6345699", "0.6345699", "0.63410324", "0.63410324", "0.6341...
0.63321155
28
check that current type is the cached type if not, change and find method for the type (simple_call to resolve_method) conceptually easy in ruby, but we have to compile that "easy" ruby
def cache_check(compiler) ok = SlotMachine::Label.new(self,"send_cache_#{@name}_ok_#{self.object_id}") check = build_condition(ok, compiler) # if cached_type != current_type check << SlotMachine::SlotLoad.new(self,[dynamic_call.cache_entry, :cached_type] , receiver_type_definition(compiler)) check << SlotMachine::ResolveMethod.new(self, @name , dynamic_call.cache_entry ) check << ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_method store, cache, klass, type, name\n methods = store.send(cache)[klass]\n return unless methods\n method = methods.find do |method_name|\n method_name == name\n end\n return unless method\n store.load_method klass, \"#{type}#{method}\"\n end", "def cache_check(compiler)\n ...
[ "0.6650089", "0.6159591", "0.6111468", "0.61091954", "0.6095517", "0.6016752", "0.5998872", "0.59987265", "0.5985429", "0.59041715", "0.5876143", "0.5859184", "0.5795385", "0.57666636", "0.57666636", "0.5759051", "0.5738691", "0.5728209", "0.5711952", "0.568751", "0.563454", ...
0.6207495
1
to call the method (that we know now to be in the cache), we move the method to reg1, do the setup (very similar to static) and call
def call_cached_method(compiler) message_setup(compiler,dynamic_call.cache_entry) << dynamic_call end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_compiled_method_cache; end", "def registers; end", "def singleton_cache; end", "def singleton0_cache; end", "def cached_call(compiler)\n cache_check(compiler) << call_cached_method(compiler)\n end", "def cached_call(compiler)\n cache_check(compiler) << call_cached_method(compiler)\n ...
[ "0.6443929", "0.63113415", "0.6279526", "0.62036085", "0.61949044", "0.61949044", "0.6179267", "0.6179267", "0.6179267", "0.6179267", "0.6179267", "0.6179267", "0.6179267", "0.61306816", "0.61306816", "0.61306816", "0.61306816", "0.60038507", "0.5898686", "0.5898686", "0.5808...
0.5864559
21
filter args matches on == or nil, so [nil,nil,10] matches [:foo, :bar, 10]
def sub event, callback, subject_or_class = nil, args = nil location(event,subject_or_class).push [self,callback,args] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nil_args\n refute check_args(nil)\n end", "def filtered_args(args)\n return args if args.empty?\n json_args = Normalizer.jsonify(args)\n\n case unique_args_method\n when Proc\n filter_by_proc(json_args)\n when Symbol\n filter_by_symbol(json_args)\n else\n ...
[ "0.6190677", "0.608926", "0.58005565", "0.5796899", "0.5635675", "0.55726135", "0.5559295", "0.55289817", "0.55289817", "0.55289817", "0.548494", "0.5473685", "0.5461626", "0.5455262", "0.54331845", "0.542645", "0.54166365", "0.53701633", "0.5370056", "0.53416854", "0.5333187...
0.0
-1
GET /courses GET /courses.json
def index if (params[:query]) @courses = Course.full_course_search(params[:query]).listed.page(params[:page]).per_page(10) else @courses = Course.listed.paginate(:page => params[:page], :per_page => 10).order("created_at desc") end @followers = Course.get_number_people_following_published_courses respond_to do |format| format.html # index.html.erb format.json { render json: @courses } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t@courses = Course.all\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @courses }\n\t\tend\n\tend", "def index\n @courses = Course.all\n render json: @courses, status: :ok\n end", "def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).or...
[ "0.7943173", "0.78570646", "0.7742099", "0.7729055", "0.7729055", "0.76939315", "0.76708746", "0.76526207", "0.752899", "0.74440956", "0.74415404", "0.73988724", "0.7373047", "0.7365082", "0.73555565", "0.7347125", "0.7311683", "0.7271882", "0.7270879", "0.72251445", "0.72230...
0.67933244
87
all hals for a course
def hals @course = Course.find(params[:id]) # don't show any private hals @hals = @course.hals.not_private end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_courses\n all_sections = sections.to_a.concat(sections_as_student).uniq\n\n # In the future we may want to make it so that if assigned a script, but that\n # script has a default course, it shows up as a course here\n all_sections.map(&:course).compact.uniq\n end", "def course_sections\n...
[ "0.6121403", "0.60162044", "0.59913653", "0.5912272", "0.5845143", "0.58192015", "0.575527", "0.5746898", "0.570733", "0.56573534", "0.5629477", "0.5593769", "0.55697596", "0.553533", "0.5521904", "0.55162156", "0.5512516", "0.55075365", "0.5506356", "0.5497862", "0.5497475",...
0.7778515
0
GET /courses/1 GET /courses/1.json
def show @course = Course.find(params[:id]) @tab = params[:tab] || 0 if @course.user != current_user and !@course.published? return redirect_to :root, notice: 'Nothing here' end @hals = @course.hals.not_private @followers = @course.get_course_followers # puts @followers.inspect end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def course\n\t\t@course = Course.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.json\n\t\tend\n\tend", "def index\n @courses = Course.all\n render json: @courses, status: :ok\n end", "def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).order(:name)\n respond_to do...
[ "0.7639248", "0.7600732", "0.7561499", "0.7498261", "0.7492566", "0.7492566", "0.7460362", "0.7459336", "0.7438278", "0.7280991", "0.7248682", "0.7241407", "0.723878", "0.72222453", "0.72222453", "0.72222453", "0.72222453", "0.72222453", "0.72222453", "0.721023", "0.71961445"...
0.0
-1
ajax call for description update
def update_description @course = Course.find(params[:id]) respond_to do |format| if @course.update_attributes(params[:course]) flash[:notice] = "Course updated Successfully" else flash[:error] = "An error occured!" end format.html format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n json_response(@description.update!(description_params))\n end", "def set_expense_entry_description\n data=params\n @tne_invoice_expense_entry = TneInvoiceExpenseEntry.find(data[:id])\n @tne_invoice_expense_entry.update_attribute(:description,data[:value])\n render :text => @...
[ "0.7500717", "0.69409585", "0.68184865", "0.67236394", "0.660691", "0.660691", "0.65856165", "0.655476", "0.65547127", "0.65525883", "0.64650255", "0.63578767", "0.6355749", "0.62480354", "0.62464994", "0.6236368", "0.62320846", "0.6201524", "0.61487", "0.6131886", "0.6118541...
0.7116548
1
ajax call for overview update
def overview_update @course = Course.find(params[:id]) respond_to do |format| if @course.update_attributes(params[:course]) flash[:notice] = "Course updated Successfully" else flash[:error] = "The overview could not be saved" end # format.html format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update \n render partial: theme_presenter.page_template_path('products/accessories/update'), format: [:js]\n end", "def update_show\n\tend", "def update_show\n\tend", "def update\n respond_to do |format|\n if @top5.update(top5_params)\n @status = 'success'\n @action = 'upd...
[ "0.6490332", "0.64690983", "0.64690983", "0.6376657", "0.63683707", "0.63652897", "0.6352432", "0.6285934", "0.62153375", "0.6182528", "0.61316", "0.60662735", "0.60493", "0.60350925", "0.60310173", "0.6018082", "0.6017233", "0.5978509", "0.5971003", "0.5967607", "0.5960085",...
0.6231874
8
owner publishes their course
def publish_course @course = Course.find(params[:id]) if !course_ok?(@course) return redirect_to edit_course_path(@course) end @course.publish respond_to do |format| if @course.save flash[:notice] = "Your course is now published. View it <a href='/courses/#{@course.id}'>here</a>".html_safe format.html { redirect_to @course} else flash[:error] = 'Something went kaboom' format.html { redirect_to :back } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish_course(test_id)\n logger.info 'Publishing the course'\n search_for_course test_id\n WebDriverUtils.wait_for_element_and_click publish_course_button_element\n course_published_button_element.when_visible timeout=WebDriverUtils.page_load_wait\n current_url.sub(\"#{WebDriverUtils.canvas_bas...
[ "0.63158756", "0.6187705", "0.6164663", "0.61614954", "0.6117636", "0.60756296", "0.60573626", "0.6036506", "0.59622186", "0.595489", "0.59427625", "0.5896247", "0.58939797", "0.5881798", "0.5881798", "0.5881798", "0.58550763", "0.5847872", "0.58333623", "0.5816167", "0.57779...
0.70950216
0
used for guiding ppl who want to publish
def course_ok?(course) if course.publishable? true else flash[:error] = "The course doesn't have any activities. Add some before publishing." false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pubid; end", "def publisher\n end", "def publish\n end", "def publish\n end", "def publish\n end", "def extra_pubish_tasks(p)\n \n end", "def register_with_pkyp\n send_to_pkyp(@pub.to_s)\n end", "def ps_publisher(action = :create)\n PubSubModelSync::Config.publishers....
[ "0.72045743", "0.6523501", "0.63973105", "0.63973105", "0.63973105", "0.637927", "0.62698257", "0.6241783", "0.6236573", "0.6236573", "0.623245", "0.623245", "0.6149945", "0.6131282", "0.60959285", "0.6090349", "0.60230315", "0.60101694", "0.60063803", "0.5973923", "0.5966272...
0.0
-1
GET /courses/new GET /courses/new.json
def new @course = Course.new respond_to do |format| format.html format.json { render json: @course } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @course = Course.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course }\n end\n end", "def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @co...
[ "0.81655526", "0.80730015", "0.80730015", "0.80730015", "0.80730015", "0.80730015", "0.80730015", "0.80730015", "0.80730015", "0.80730015", "0.80730015", "0.80047226", "0.7998199", "0.79972154", "0.7957562", "0.7943409", "0.79187226", "0.78030574", "0.77926284", "0.77773756", ...
0.80042166
12
post course info on user's wall on fb
def share_course_on_fb @course = Course.find(params[:id]) graph = Koala::Facebook::API.new(current_user.oauth_token) url = "http://www.melearni.ng/courses/33" #url_for(@course) TODO change for prod puts "url: #{url}" puts @course.post_print graph.put_wall_post(@course.post_print, {:name => "My New course", :link => url}) redirect_to @course, notice: 'posted.' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish_on_fb\n\t \tbegin\n\t\t \tme = FbGraph::User.me(oauth_token)\n\t\t \tme.feed!(\n\t\t \t\t:message => \"\",\n\t\t \t\t:picture => \"indirizzo immagine\",\n\t\t \t\t:link => \"indirizzo applicazione\",\n\t\t \t\t:name => \"\",\n\t\t \t\t:description => \"\"\n\t\t \t)\n\t\trescue Excepti...
[ "0.5876719", "0.5837252", "0.57778025", "0.5709478", "0.56887317", "0.56764305", "0.5670824", "0.5656539", "0.56511766", "0.56110495", "0.55994475", "0.5574982", "0.55698997", "0.5567962", "0.5567002", "0.55416125", "0.55093426", "0.5497761", "0.5477498", "0.5473021", "0.5431...
0.76742625
0
POST /courses POST /courses.json
def create @course = Course.new(params[:course]) @course.user = current_user @tab = 1 respond_to do |format| if @course.save format.html { flash[:notice] = 'Course was successfully created.' render :edit_course} format.json { render json: @course, status: :created, location: @course } else format.html { render action: "new" } format.json { render json: @course.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n # render plain: params[:courses].inspect\n @courses = Courses.new(courses_params)\n\n respond_to do |format|\n if @courses.save\n format.html { redirect_to @courses, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @cour...
[ "0.76898974", "0.73798543", "0.7334656", "0.72327256", "0.72273064", "0.7157716", "0.7128817", "0.71268123", "0.7109645", "0.71044004", "0.71044004", "0.71044004", "0.71044004", "0.71044004", "0.71044004", "0.71044004", "0.7092889", "0.70824045", "0.70697033", "0.7053714", "0...
0.0
-1
DELETE /courses/1 DELETE /courses/1.json
def destroy @course = Course.find(params[:id]) @course.destroy respond_to do |format| format.html { redirect_to my_created_courses_path, notice: 'Course was successfully deleted.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :ok }\n end\n end", "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n ...
[ "0.77230847", "0.77079666", "0.77079666", "0.77079666", "0.77079666", "0.76962376", "0.7696043", "0.7696043", "0.7696043", "0.7696043", "0.7696043", "0.7696043", "0.7696043", "0.7696043", "0.7696043", "0.7696043", "0.7696043", "0.76494783", "0.76408905", "0.7619815", "0.76093...
0.75462914
24
ensure the course is owned by logged in user
def require_owner @course = Course.find_by_id(params[:id]) if (!@course || @course.user != current_user) redirect_to :root, notice: 'Not yours. Pas touche.' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_user_in_course!\n user_from_course_user = CourseUser.find(params[:id]).user\n\n unless current_user && user_from_course_user && current_user.id == user_from_course_user.id\n head 401\n end\n end", "def course_owner\n @course = Course.find(params[:id])\n user = User.find(@course.us...
[ "0.77174574", "0.7545736", "0.7306539", "0.7098415", "0.7098415", "0.66716087", "0.66572714", "0.6533644", "0.65324724", "0.65259594", "0.6496653", "0.6459726", "0.645468", "0.6451935", "0.6436051", "0.6430949", "0.6406641", "0.64002913", "0.6395892", "0.63745695", "0.6373727...
0.769366
1
Return prepared hash of search results data
def prepared_results prepared = [] results = WatirNokogiri::Document.new(html).lis(Selectors::FAST_SEARCH_MODAL[:result][:self]) results.each { |result| prepared[] = { title: title(result), price: price(result) } } prepared end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_data\n {\n title: title,\n tagline: tagline,\n description: description,\n status: status,\n rating: rating,\n categories: categories.map(&:id),\n research_areas: research_areas.map(&:id),\n providers: providers.map(&:id),\n platforms: platforms.map(&:id),...
[ "0.70151603", "0.68086827", "0.67661476", "0.6701607", "0.66702944", "0.6666282", "0.6654631", "0.6614198", "0.6529839", "0.64648926", "0.6443408", "0.64264184", "0.6321458", "0.6320585", "0.6319827", "0.63021535", "0.62899673", "0.62899673", "0.6272677", "0.6270094", "0.6227...
0.650164
9
Switch to iframe context Required because of geckodriver issue: "ERROR: Command execution failure. The error message is: can't access dead object".
def switch_to_frame wait.until { wrapper_element.attribute('class').include?('modal_open') } @browser.switch_to.frame(@browser.find_element(Selectors::FAST_SEARCH_MODAL[:iframe])) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_to_parent_frame\n driver.switch_to.parent_frame\n end", "def switch_frame frame\n $driver.switch_to.frame(frame)\nend", "def change_to_iframe(index)\n @driver.switch_to.frame(index)\n end", "def switch_to_frame(criteria,value)\r\n\t\t\tel = @driver.find_element(criteria.to_sym, value)\t\r...
[ "0.74268776", "0.74226063", "0.699815", "0.6778938", "0.6675889", "0.6587537", "0.63779634", "0.63301426", "0.6217157", "0.6066974", "0.6065657", "0.6063363", "0.5955128", "0.59207207", "0.59207207", "0.5910471", "0.5890017", "0.5882723", "0.5854637", "0.5822504", "0.57959586...
0.65774274
6
Switch back to page context Required because of geckodriver issue: "ERROR: Command execution failure. The error message is: can't access dead object".
def switch_to_default_content @browser.switch_to.default_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_back\n begin\n @driver.back\n\n rescue Exception => e\n @@logger.an_event.error \"browser go back : #{e.message}\"\n raise Errors::Error.new(BROWSER_NOT_GO_BACK, :values => {:browser => name}, :error => e)\n\n else\n\n @@logger.an_event.debug \"browser go back\"\n\...
[ "0.6851896", "0.67672473", "0.6708343", "0.66711223", "0.6403139", "0.63015157", "0.6290223", "0.6211336", "0.6211336", "0.61880887", "0.61666745", "0.61411303", "0.61170197", "0.60907876", "0.6070589", "0.605709", "0.605709", "0.6034572", "0.6019975", "0.59936404", "0.598277...
0.0
-1