Creates a codepen from the given demo model by posting to Codepen's API using a hidden form.  The hidden form is necessary to avoid a CORS issue. See http://blog.codepen.io/documentation/api/prefill
194084
function editOnCodepen(demo) {
      var externalScripts = $demoAngularScripts.all();
      externalScripts.push('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.js');
      var data = codepenDataAdapter.translate(demo, externalScripts);
      var form = buildForm(data);
      $document.find('body').append(form);
      form[0].submit();
      form.remove();
    }
39571
function create (controller, args, node, relations) {
    // get model from controller
    var model = controller.model
    // get model data from input
    var data = args[model.name]
    // if meta flag is not set then data is instance data
    var createArgs = args.meta ? _.clone(data) : {data: data}
    // do not accept allow flag
    if (createArgs.allow) {
        httpError(403)
    }
    // add session to args
    createArgs.session = args.session
    // create instance
    return model.createMeta(createArgs)
    // create any relation models
    .then(instance => {
        // if no relations do nothing
        if (!relations) {
            return instance
        }
        // create all relations
        return Promise.all(_.map(_.keys(relations), relation => {
            // get relation through instance
            return instance.createMeta({
                data: relations[relation],
                relation: relation,
            })
        }))
        // resolve with instance
        .then(() => instance)
    })
    // redirect on success
    .then(instance => {
        // if being called in json mode or there is an after function
        // return the created instace
        if (args.json || node.after) {
            return instance
        }
        // otherwise redirect to instance page
        else {
            // use redirect from input or redirect to new instance
            var url = args.redirect || './'+instance.id
            // redirect
            httpRedirect(url)
        }
    })
    // catch errors
    .catch(error => {
        // if error is redirect throw it
        if (error.code === 302) {
            throw error
        }
        // if in json mode or there is no form return 400 error
        if (args.json || !controller.form) {
            httpError(400, undefined, error.data)
        }
        // create new form instance with input and error data
        var form = controller.form.newInstance({
            input: data,
            error: error,
        })
        // javascript for page
        var js = []
        // if form uses ckeditor add js
        if (form.ckeditor) {
            js.push({
                crossorigin: 'anonymous',
                //integrity: 'sha256-TTtB6JD2qVpmE4ydlMyYH52d7OSMq5FQh2f0ECHR0Bw=',
                src: '//cdn.jsdelivr.net/ckeditor/4.3.1/ckeditor.js',
            })
        }
        // return form
        return {
            form: form,
            js: js,
        }
    })
}
1151362
public static String buildFormPostContent(final WebContext context) {
        final String requestedUrl = context.getFullRequestURL();
        final Map<String, String[]> parameters = context.getRequestParameters();
        final StringBuilder buffer = new StringBuilder();
        buffer.append("<html>\n");
        buffer.append("<body>\n");
        buffer.append("<form action=\"" + escapeHtml(requestedUrl) + "\" name=\"f\" method=\"post\">\n");
        if (parameters != null) {
            for (final Map.Entry<String, String[]> entry : parameters.entrySet()) {
                final String[] values = entry.getValue();
                if (values != null && values.length > 0) {
                    buffer.append("<input type='hidden' name=\"" + escapeHtml(entry.getKey()) + "\" value=\"" + values[0] + "\" />\n");
                }
            }
        }
        buffer.append("<input value='POST' type='submit' />\n");
        buffer.append("</form>\n");
        buffer.append("<script type='text/javascript'>document.forms['f'].submit();</script>\n");
        buffer.append("</body>\n");
        buffer.append("</html>\n");
        return buffer.toString();
    }
886278
public static function create()
	{
		switch (func_num_args()) {
			case 0:
				return new CodeGeneratorResponse();
			case 1:
				return new CodeGeneratorResponse(func_get_arg(0));
			case 2:
				return new CodeGeneratorResponse(func_get_arg(0), func_get_arg(1));
			case 3:
				return new CodeGeneratorResponse(func_get_arg(0), func_get_arg(1), func_get_arg(2));
			case 4:
				return new CodeGeneratorResponse(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));
			case 5:
				return new CodeGeneratorResponse(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
			case 6:
				return new CodeGeneratorResponse(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));
			case 7:
				return new CodeGeneratorResponse(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));
			case 8:
				return new CodeGeneratorResponse(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));
			default:
				throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');
		}
	}
369938
def construct_form_html(hidden_fields, bucket, secure = true, html_options = {}, &block)
      # now build the html for the form
      form_tag(secure == false ? "http://#{bucket}.s3.amazonaws.com" : "https://#{bucket}.s3.amazonaws.com", build_form_options(html_options)) do
        hidden_fields.map do |name, value|
          hidden_field_tag(name, value)
        end.join.html_safe + "
        <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->  
        <div class='row fileupload-buttonbar'>
          <div class='col-lg-7'>
            <span class='btn btn-success fileinput-button'>
              <i class='glyphicon glyphicon-plus'></i>
              <span>Add files...</span>
              ".html_safe +
              file_field_tag(:file, :multiple => true) + "
            </span>
            <button type='submit' class='btn btn-primary start'>
              <i class='glyphicon glyphicon-upload'></i>
              <span>Start upload</span>
            </button>
            <button type='reset' class='btn btn-warning cancel'>
              <i class='glyphicon glyphicon-ban-circle'></i>
              <span>Cancel upload</span>
            </button>
            <button type='button' class='btn btn-danger delete'>
              <i class='glyphicon glyphicon-trash'></i>
              <span>Delete</span>
            </button>
            <input type='checkbox' class='toggle'></input>
            <!-- The loading indicator is shown during file processing -->
	          <span class='fileupload-loading'></span>
          </div>
          <!-- The global progress information -->
          <div class='col-lg-5 fileupload-progress fade'>
            <!-- The global progress bar -->
            <div class='progress progress-striped active' role='progressbar' aria-valuemin='0' aria-valuemax='100'>
              <div class='progress-bar progress-bar-success' style='width: 0%;'></div>
            </div>
            <!-- The extended global progress information -->
            <div class='progress-extended'>&nbsp;</div>
          </div>
        </div>
        <!-- The table listing the files available for upload/download -->
        <table role='presentation' class='table table-striped' id='upload_files'>
          <tbody class='files'></tbody>
        </table>".html_safe + (block ? capture(&block) : '')
      end
    end
432666
def __create_rec(*args, **kwargs):
        '''
        
        '''
        uid = args[0]
        kind = args[1]
        post_data = kwargs['post_data']

        try:
            TabWiki.create(
                uid=uid,
                title=post_data['title'].strip(),
                date=datetime.datetime.now(),
                cnt_html=tools.markdown2html(post_data['cnt_md']),
                time_create=tools.timestamp(),
                user_name=post_data['user_name'],
                cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md']),
                time_update=tools.timestamp(),
                view_count=1,
                kind=kind,  # 1 for wiki,  2 for page
            )
            return True
        except:
            return False
224840
def create(self, sid):
        
        data = values.of({'Sid': sid, })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid'], )
105006
function create(clientModelDoc, callback) {
      var cb = callback || angular.noop;

      return ClientModelDoc.create(clientModelDoc,
        function (clientModelDoc) {
          return cb(clientModelDoc);
        },
        function (err) {
          return cb(err);
        }).$promise;
    }
634108
def create(self, **kwargs):
        

        return super(PostController, self).create(**self._with_markdown(kwargs))
490073
def create_notebook(self, model=None, path=''):
        """"""
        path = path.strip('/')
        if model is None:
            model = {}
        if 'content' not in model:
            metadata = current.new_metadata(name=u'')
            model['content'] = current.new_notebook(metadata=metadata)
        if 'name' not in model:
            model['name'] = self.increment_filename('Untitled', path)

        model['path'] = path
        model['type'] = 'notebook'
        model = self.save_notebook(model, model['name'], model['path'])

        return model
614963
protected ValueModel createValueModel(String formProperty) {
		Assert.notNull(formProperty, "formProperty");
		if (logger.isDebugEnabled()) {
			logger.debug("Creating " + (buffered ? "buffered" : "") + " value model for form property '" + formProperty
                    + "'.");
		}
		return buffered ? new BufferedValueModel(propertyAccessStrategy.getPropertyValueModel(formProperty))
				: propertyAccessStrategy.getPropertyValueModel(formProperty);
	}
52903
def create():
    ''''''
    data = {
        'first_name': click.prompt('First name'),
        'last_name': click.prompt('Last name'),
        'email': click.prompt('Email'),
        'password': click.prompt('Password', hide_input=True),
        'password_confirm': click.prompt('Confirm Password', hide_input=True),
    }
    # Until https://github.com/mattupstate/flask-security/issues/672 is fixed
    with current_app.test_request_context():
        form = RegisterForm(MultiDict(data), meta={'csrf': False})
    if form.validate():
        data['password'] = encrypt_password(data['password'])
        del data['password_confirm']
        data['confirmed_at'] = datetime.utcnow()
        user = datastore.create_user(**data)
        success('User(id={u.id} email={u.email}) created'.format(u=user))
        return user
    errors = '\n'.join('\n'.join(e) for e in form.errors.values())
    exit_with_error('Error creating user', errors)
915285
@POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @RequiresPermissions(I18nPermissions.KEY_WRITE)
    public Response createKey(KeyRepresentation keyRepresentation) throws URISyntaxException {
        WebAssertions.assertNotNull(keyRepresentation, THE_KEY_SHOULD_NOT_BE_NULL);
        WebAssertions.assertNotBlank(keyRepresentation.getName(), THE_KEY_SHOULD_CONTAINS_A_NAME);
        WebAssertions.assertNotBlank(keyRepresentation.getDefaultLocale(), THE_KEY_SHOULD_CONTAINS_A_LOCALE);

        assertKeyDoNotAlreadyExists(keyRepresentation);

        Key key = factory.createKey(keyRepresentation.getName());
        key.setComment(keyRepresentation.getComment());
        addDefaultTranslation(keyRepresentation, key);
        keyRepository.add(key);

        return Response.created(new URI(uriInfo.getRequestUri() + "/" + key.getId()))
                .entity(keyFinder.findKeyWithName(key.getId())).build();
    }
664788
function createFactory() {
    return function Stamp(options) {
      var i = Stamp[_compose] || {};
      // Next line was optimized for most JS VMs. Please, be careful here!
      var obj = {__proto__: i[_methods]};

      var inits = i[_initializers], args = slice.apply(arguments);
      var initializer, returnedValue;

      var tmp = i[_deepProperties];
      if (tmp) merge(obj, tmp);
      tmp = i[_properties];
      if (tmp) assign(obj, tmp);
      tmp = i[_propertyDescriptors];
      if (tmp) defineProperties(obj, tmp);

      if (!inits || !inits[_length]) return obj;

      if (options === _undefined) options = {};
      for (i = 0; i < inits[_length];) {
        initializer = inits[i++];
        if (isFunction(initializer)) {
          returnedValue = initializer.call(obj, options,
            {instance: obj, stamp: Stamp, args: args});
          obj = returnedValue === _undefined ? obj : returnedValue;
        }
      }

      return obj;
    };
  }
83580
async def create(self, **kwargs):
        '''
        
        '''
        try:
            # create model
            obj = self._meta.object_class()
            # deserialize data from request body
            self.data.update(kwargs)
            await obj.deserialize(self.data)
            # create document in DB
            await obj.insert(db=self.db)
            # serialize object for response
            return await obj.serialize()
        except Exception as ex:
            logger.exception(ex)
            raise BadRequest(ex)
573782
@RequestMapping(value = "create", method = RequestMethod.GET)
    public Form getCreationForm() {
        return Form.create()
                .with(Form.defaultNameField())
                .with(Text.of("fullName").length(100).label("Full name").help("Display name for the account"))
                .with(Email.of("email").label("Email").length(200).help("Contact email for the account"))
                .with(Password.of("password").label("Password").length(40).help("Password for the account"))
                .with(
                        MultiSelection.of("groups").label("Groups")
                                .items(accountService.getAccountGroupsForSelection(ID.NONE))
                );
    }
614633
def _create_model(model, ident, **params):
    
    with log_errors(pdb=True):
        model = clone(model).set_params(**params)
        return model, {"model_id": ident, "params": params, "partial_fit_calls": 0}