code-snippets

Transform and regex in Code Snippets in VSCode - Docs

…衆ロ難τιáo~ 提交于 2021-02-18 18:42:23
问题 I need list of transormations, like downcase, upcase, capitalize. Where is the list of such? Good documentation. 回答1: The official documentation is snippets grammar. It shows the transforms but only provides one example. The built-in transforms are /upcase or /downcase or /capitalize or /pascalcase /pascalcase was added by a commit on October 2, 2018 but hasn't made it into the documentation (as of June, 2019). It works to do this: some-file-name.js => SomeFileName // or another separator

storing code snippets in a database

 ̄綄美尐妖づ 提交于 2021-02-18 17:16:08
问题 I want to make a code snippet database web application. Would the best way to store it in the database be to html encode everything to prevent XSS when displaying the snippets on the web page? Thanks for the help! 回答1: The database has nothing to do with this; you simply need to escape the snippets when they are rendered as HTML. At minimum, you need to encode all & as & and all < characters as < . However, your server-side language already has a built-in HTML encoding function; you should

When creating a VSCode snippet, how can I transform a variable to title-case (like TitleCase)?

江枫思渺然 提交于 2021-02-04 17:49:07
问题 https://code.visualstudio.com/docs/editor/userdefinedsnippets#_placeholdertransform My aim is to automatically set the class name within the context of the snippet being inserted. VSCode does not natively support class or method names, but it does support the file name. My file names closely mimic the class name: foo-bar.ts for class FooBar . Here is my current code snippet wherein I can transform "foo-bar" to "Foo-bar" using the native "capitalize" grammar provided by VSCode. TM_FILENAME

¿How do i redirect to the same page affter login?

好久不见. 提交于 2021-01-29 06:55:47
问题 I am redesigning a page for a company and an event has been created where the user has to log in. Where it says: Register as an affiliate by logging in with your username and password here (in Spanish) But the link that shows the link is hidden with a WordPress snippet with the following script to do the login: add_shortcode( 'inscripcion', 'bp_contenido_inscripcion' ); function bp_contenido_inscripcion( $atts, $content = null ) { if ( is_user_logged_in() && !is_null( $content ) && !is_feed()

¿How do i redirect to the same page affter login?

陌路散爱 提交于 2021-01-29 06:53:38
问题 I am redesigning a page for a company and an event has been created where the user has to log in. Where it says: Register as an affiliate by logging in with your username and password here (in Spanish) But the link that shows the link is hidden with a WordPress snippet with the following script to do the login: add_shortcode( 'inscripcion', 'bp_contenido_inscripcion' ); function bp_contenido_inscripcion( $atts, $content = null ) { if ( is_user_logged_in() && !is_null( $content ) && !is_feed()

VS Code: how to make a python snippet that after string or expression hitting tab will transform it

妖精的绣舞 提交于 2021-01-27 17:35:09
问题 is it possible to make a python snippet that transforms code like i explain in my example? "Hello world".print - hit tab transforms it into print("Hello world") it will be nice if automatically understand is it string or expression so if i make a variable for example "a" and i write ".print" at the end and hit tab it will not add " " or ' ' so in that way it will not convert it in something else. a = 10 a.print - hitting tab transforms it into: print(a) not into: print("a") Progress ( if it

Recording a 'macro'? or a series of actions in Visual Studio Code?

与世无争的帅哥 提交于 2020-12-13 18:59:33
问题 I would need something like this. Once I create a folder within a project. A React Project for example. I could select that folder and run some kind of macro or series of actions that would do this. Provided that the name of the folder is Component for example, when the macro would be played it would do this: Create a file with the name, Component.js that would have some kind of snippet default content. Create a file with the name, Component.styled.js which again would have in it some kind of