Function to save the firefox profile to the permanant one
551928
def save_firefox_profile(self, remove_old=False):
        """"""
        self.logger.info("Saving profile from %s to %s" % (self._profile.path, self._profile_path))

        if remove_old:
            if os.path.exists(self._profile_path):
                try:
                    shutil.rmtree(self._profile_path)
                except OSError:
                    pass

            shutil.copytree(os.path.join(self._profile.path), self._profile_path,
                            ignore=shutil.ignore_patterns("parent.lock", "lock", ".parentlock"))
        else:
            for item in os.listdir(self._profile.path):
                if item in ["parent.lock", "lock", ".parentlock"]:
                    continue
                s = os.path.join(self._profile.path, item)
                d = os.path.join(self._profile_path, item)
                if os.path.isdir(s):
                    shutil.copytree(s, d,
                                    ignore=shutil.ignore_patterns("parent.lock", "lock", ".parentlock"))
                else:
                    shutil.copy2(s, d)

        with open(os.path.join(self._profile_path, self._LOCAL_STORAGE_FILE), 'w') as f:
            f.write(dumps(self.get_local_storage()))
1143492
public FirefoxProfile getFirefoxProfile() {
        if (firefoxProfile == null) {
            firefoxProfile = new FirefoxProfile();

            firefoxProfile.setAcceptUntrustedCertificates(true);
            firefoxProfile.setAssumeUntrustedCertificateIssuer(false);

            /* default download folder, set to 2 to use custom download folder */
            firefoxProfile.setPreference("browser.download.folderList", 2);

            /* comma separated list if MIME types to save without asking */
            firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/plain");

            /* do not show download manager */
            firefoxProfile.setPreference("browser.download.manager.showWhenStarting", false);
        }

        return firefoxProfile;
    }
1285309
function toggleProfiler() {
			if (!data.profiler.show) {
				profilerCanvas.style.display = "block";
				profilerCheckBox.checked = true;
			} else {
				profilerCanvas.style.display = "none";
				profilerCheckBox.checked = false;
			}
			data.profiler.show = !data.profiler.show;
		}
1259154
def saveProfileAs( self ):
        
        name, ok = QInputDialog.getText(self, 'Create Profile', 'Name:')
        if ( not name ):
            return
        
        manager = self.parent()
        prof    = manager.viewWidget().saveProfile()
        prof.setName(nativestring(name))
        self.parent().addProfile(prof)
1030811
function saveManifest(manifest, request, host, fn) {
  request
    .post(host + '/manifest')
    .send({manifest: JSON.stringify(manifest)})
    .end(function(err, res) {
      if (err) return fn(err);
      if (res.error) return fn(res.error);
      fn(null, res.headers.location);
    });
}
170758
def edit(parent, profile):
        
        dlg = XViewProfileDialog(parent)
        dlg.setProfile(profile)
        if ( dlg.exec_() ):
            return True
        return False
48438
def profile(name='stats', _stats=stats):
    """"""
    def _profile(function):
        def __profile(*args, **kw):
            start_time = timer()
            start_memory = _get_memory_usage()
            try:
                return function(*args, **kw)
            finally:
                total = timer() - start_time
                kstones = _seconds_to_kpystones(total)
                memory = _get_memory_usage() - start_memory
                _stats[name] = {'time': total,
                                'kstones': kstones,
                                'memory': memory}
        return __profile
    return _profile
1054087
def do_save(self, fp=None):
        
        if fp is None:
            fp = sys.stdout
        data = {
            'settings': self.settings,
            'nodes': self.nodes,
            'backward': self.backward
        }
        json.dump(data, fp, ensure_ascii=False)
1011025
def save(self):
        
        config = self.profiledir + '/config'
        if not isdir(self.profiledir):
            makedirs(self.profiledir)

        cp = SafeConfigParser()

        cp.add_section('ssh')
        cp.set('ssh', 'private_key', self.ssh_private_key)
        cp.set('ssh', 'public_key', self.ssh_public_key)

        with open(config, 'w') as cfile:
            cp.write(cfile)
1244972
def exportProfile(self, profile, filename=None):
        
        if not filename:
            filename = QFileDialog.getSaveFileName(self,
                                                   'Export Profile',
                                                   '',
                                                   'XML Files (*.xml)')
            if type(filename) == tuple:
                filename = nativestring(filename[0])
        
        if not filename:
            return False
        
        profile.save(filename)
        return True
708337
function onUpdateProfile() {
  var displayName = $('#display-name').val();
  var photoURL = $('#photo-url').val();
  activeUser().updateProfile({
    'displayName': displayName,
    'photoURL': photoURL
  }).then(function() {
    refreshUserData();
    alertSuccess('Profile updated!');
  }, onAuthError);
}
330916
def get_profile_dir ():
    """"""
    if os.name == 'nt':
        basedir = unicode(os.environ["APPDATA"], nt_filename_encoding)
        dirpath = os.path.join(basedir, u"Mozilla", u"Firefox", u"Profiles")
    elif os.name == 'posix':
        basedir = unicode(os.environ["HOME"])
        dirpath = os.path.join(basedir, u".mozilla", u"firefox")
    return dirpath
1288115
function (req, res, next) {
    var prifile = req.profile;
    var filter = { or: [{ twitter: profile.user_id }, { email: profile.email }] };

    User.find({ where: filter }, function(err, users) {
      var user = users[0];

      if (user) {
        if (!user.twitter) {
          user.twitter = profile.user_id;
          user.displayName = user.displayName || profile.name;
          user.save(function() {
            req.user = user;
            next();
          });
          return;
        }

        req.user = user;
        next();
        return;
      }

      User.create({
        displayName: profile.name,
        yahoo: profile.user_id,
        email: profile.email,
        password: profile.user_id
      }, function (err, user) {
        req.user = user;
        next();
      });

    });
  }
1142585
def exportProfile(self, filename=''):
        
        if not (filename and isinstance(filename, basestring)):
            filename = QtGui.QFileDialog.getSaveFileName(self,
                                                         'Export Layout as...',
                                                         QtCore.QDir.currentPath(),
                                                         'XView (*.xview)')
            
            if type(filename) == tuple:
                filename = filename[0]
        
        filename = nativestring(filename)
        if not filename:
            return
        
        if not filename.endswith('.xview'):
            filename += '.xview'
        
        profile = self.saveProfile()
        profile.save(filename)
1242357
def save_profile(self, userdata, data):
        
        result = userdata
        error = False

        # Check if updating username.
        if not userdata["username"] and "username" in data:
            if re.match(r"^[-_|~0-9A-Z]{4,}$", data["username"], re.IGNORECASE) is None:
                error = True
                msg = _("Invalid username format.")
            elif self.database.users.find_one({"username": data["username"]}):
                error = True
                msg = _("Username already taken")
            else:
                result = self.database.users.find_one_and_update({"email": userdata["email"]},
                                                                 {"$set": {"username": data["username"]}},
                                                                 return_document=ReturnDocument.AFTER)
                if not result:
                    error = True
                    msg = _("Incorrect email.")
                else:
                    self.user_manager.connect_user(result["username"], result["realname"], result["email"],
                                                   result["language"])
                    msg = _("Profile updated.")
            return result, msg, error

        # Check if updating the password.
        if self.app.allow_registration and len(data["passwd"]) in range(1, 6):
            error = True
            msg = _("Password too short.")
            return result, msg, error
        elif self.app.allow_registration and len(data["passwd"]) > 0 and data["passwd"] != data["passwd2"]:
            error = True
            msg = _("Passwords don't match !")
            return result, msg, error
        elif self.app.allow_registration and len(data["passwd"]) >= 6:
            oldpasswd_hash = hashlib.sha512(data["oldpasswd"].encode("utf-8")).hexdigest()
            passwd_hash = hashlib.sha512(data["passwd"].encode("utf-8")).hexdigest()

            match = {"username": self.user_manager.session_username()}
            if "password" in userdata:
                match["password"] = oldpasswd_hash

            result = self.database.users.find_one_and_update(match,
                                                             {"$set": {"password": passwd_hash}},
                                                             return_document=ReturnDocument.AFTER)
            if not result:
                error = True
                msg = _("Incorrect old password.")
                return result, msg, error

        # Check if updating language
        if data["language"] != userdata["language"]:
            language = data["language"] if data["language"] in self.app.available_languages else "en"
            result = self.database.users.find_one_and_update({"username": self.user_manager.session_username()},
                                                             {"$set": {"language": language}},
                                                             return_document=ReturnDocument.AFTER)
            if not result:
                error = True
                msg = _("Incorrect username.")
                return result, msg, error
            else:
                self.user_manager.set_session_language(language)

        # Checks if updating name
        if len(data["realname"]) > 0:
            result = self.database.users.find_one_and_update({"username": self.user_manager.session_username()},
                                                             {"$set": {"realname": data["realname"]}},
                                                             return_document=ReturnDocument.AFTER)
            if not result:
                error = True
                msg = _("Incorrect username.")
                return result, msg, error
            else:
                self.user_manager.set_session_realname(data["realname"])
        else:
            error = True
            msg = _("Name is too short.")
            return result, msg, error

        msg = _("Profile updated.")
        return result, msg, error
582202
function(id, profileKey) {
    if (!profiles.hasOwnProperty("definitions")) {
        throw ("\"profiles\" dictionary is badly formed, no \"definitions\" key");
    }
    if (!profiles.definitions.hasOwnProperty(profileKey)) {
        if (!profiles.definitions.hasOwnProperty("default")) {
            throw ("\"" + profileKey + "\" is not a registred SLURM profile AND no default profile is defined");
        } else {
            profileKey = "default";
        }
    }
    var string = _preprocessorDump(id, profiles.definitions[profileKey]);
    return string;
}
688787
function createProfile(done) {
            if (self.closed) return done(null);

            temp.mkdir('browser-controller', function(err, dirpath) {
                if (err) return done(err);

                self.userDir = dirpath;

                done(null);
            });
        }