- command + option + J, context: html, result: suround with template
- command + shift + return, context: statement or var declaration, result: add semi colon
- command + return, context: in fragment context, result: run the fragment, convenient when your database is configured to work with the IDE, command + return will execute the sql query
#Performance
- When using
$timeoutif$scopedoes not update set false to the third argument to skip the digest. (see angular doc) - Add
strictDiwhen bootstraping, it should throw an error when a function is not annotated. Annotating is important if you need to minify your code. This feature has been introduced in v1.3.0-beta.6 (see ticket, see performance)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'admin_init', 'register_modal_email_settings' ); | |
| function register_modal_email_settings() | |
| { | |
| if( !get_option( $user->user_nicename . '_plugin_options' ) ){ | |
| register_setting( 'section_email_modal', $user->user_nicename . '_plugin_options', '0' ); | |
| } | |
| add_settings_section( 'section_foo', 'Foo settings', 'foo_desc', 'foo' ); | |
| add_settings_field( 'bar', 'Bar field', 'bar_option', 'foo', 'section_foo' ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var matchers = { | |
| toBePromise: function(util){ | |
| return { | |
| compare: function(actual){ | |
| var result = {} | |
| result.pass = typeof actual === "object" && typeof actual.then === "function"; | |
| if(result.pass){ | |
| result.message = "Expected var not be a Promise"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var numbers = ['a', 'b', 'c']; | |
| for(let i of numbers){ | |
| console.log(i); // a b c | |
| } | |
| var users = [{ | |
| firstname: 'jon', | |
| lastname: 'dem' | |
| }, |
This is an example command for Backtick. A Backtick command consists of some executable JavaScript and a bit of metadata in JSON.
Here are the required steps to create a command:
-
Create a new Gist with a
command.jsandcommand.jsonfile, or simply fork this one. -
Write your JavaScript in
command.js. This will be injected into and executed on the page the user is currently on when they run it. -
Add some metadata to the
command.jsonfile:
- name: The name of the command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function () { | |
| 'use strict'; | |
| // cssbeautify | |
| (function(){"use strict";function a(a,b){function s(a){return" "===a||"\n"===a||" "===a||"\r"===a||"\f"===a}function t(a){return"'"===a||'"'===a}function u(a){return h>="a"&&"z">=h||h>="A"&&"Z">=h||h>="0"&&"9">=h||"-_*.:#".indexOf(a)>=0}function v(){var a;for(a=m;a>0;a-=1)g+=c.indent}function w(){g=r(g),p?g+=" {":(g+="\n",v(),g+="{"),"\n"!==i&&(g+="\n"),m+=1}function x(){var a;m-=1,g=r(g),q&&(a=g.charAt(g.length-1),";"!==a&&"{"!==a&&(g+=";")),g+="\n",v(),g+="}",f.push(g),g=""}var c,f,h,i,j,k,l,m,n,o,r,d=0,e=a.length,g="",p=!0,q=!1;for(c=arguments.length>1?b:{},c.indent===void 0&&(c.indent=" "),"string"==typeof c.openbrace&&(p="end-of-line"===c.openbrace),"boolean"==typeof c.autosemicolon&&(q=c.autosemicolon),r=String.prototype.trimRight?function(a){return a.trimRight()}:function(a){return a.replace(/\s+$/,"")},l={Start:0,AtRule:1,Block:2,Selector:3,Ruleset:4,Property:5,Separator:6,Expression:7,URL:8},m=0,k=l.Start,o=!1,f=[],a=a.replace(/\r\n/g,"\n");e>d;)if |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Main exposing (..) | |
| import Html exposing (..) | |
| -- MODEL | |
| type alias Model = | |
| { key : Int } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # works with a file called VERSION in the current directory, | |
| # the contents of which should be a semantic version number | |
| # such as "1.2.3" | |
| # this script will display the current version, automatically | |
| # suggest a "minor" version update, and ask for input to use | |
| # the suggestion, or a newly entered value. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Confirm exposing (confirm) | |
| import Native.Confirm | |
| import Task exposing (Task) | |
| confirm : String -> Task () () | |
| confirm str = | |
| Native.Confirm.doConfirm str |