Here is a list of scopes to use in Sublime Text 2/3 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
/** | |
* Transform HTML `table` element to JS Object. | |
* @param {HTMLTableElement} table | |
* @returns {{ caption: string; rows: Array<{ [key: string]: string }>; }} | |
*/ | |
function table2JSObject(table) { | |
const caption = table.caption ? table.caption.textContent.trim() : ''; | |
const titles = [...table.querySelectorAll('th')].map(th => { | |
const innerHTML = th.innerHTML; | |
# ---------------------------------- | |
# Colors | |
# ---------------------------------- | |
NOCOLOR='\033[0m' | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
ORANGE='\033[0;33m' | |
BLUE='\033[0;34m' | |
PURPLE='\033[0;35m' | |
CYAN='\033[0;36m' |
export interface IPackageJSON extends Object { | |
readonly name: string; | |
readonly version?: string; | |
readonly description?: string; | |
readonly keywords?: string[]; |
/** | |
* 将字符串编译为 DOM 结构 | |
* @deprecated 请注意,不要用该函数,因为 compile('<div></div><p></p>') 会编译成嵌套结构:<p><div></div></p> | |
* @public | |
* @param {String} domString | |
* @return {HTMLElement} | |
* @throws {Error} 如果输入不是合法的 DOM 字符串 | |
* | |
* @example | |
* compile('<div><p><a><em></em></a></p></div>') |
(function () { | |
'use strict'; | |
angular | |
.module('q.race', []) | |
.config(function ($provide) { | |
$provide.decorator('$q', function ($delegate) { | |
$delegate.race = promises => $delegate((resolve, reject) => { | |
const bind = promise => { |
<?php | |
trait MethodInvoker { | |
/** | |
* Call protected/private static method of a class. | |
* | |
* @param string $class - class name that we will run method on | |
* @param string $methodName - method name to call | |
* @param array $parameter - parameter to pass into method | |
* | |
* @return mixed - original method's return |
Here is a list of scopes to use in Sublime Text 2/3 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
import angular from 'angular'; | |
import 'angular-spinner'; | |
function loadingInterceptor($q, $injector) { | |
let http; | |
let usSpinnerService; | |
let timeout; | |
return { | |
request(config) { |
/** | |
* `onDisconnected` will be called when network disconneted | |
* The script must be run in the console of `TEST_URL` | |
*/ | |
function detectNetworkAccessibility({ TEST_URL, DETECT_INTERVAL = 30 * 1000, TIMEOUT = 3 * 1000 }, onDisconnected = alert) { | |
const RETRY_INTERVAL = 5 * 1000; | |
console.log(`Detecting network accessibility by fetching ${TEST_URL} at every ${DETECT_INTERVAL / 1000}s`); | |
timeoutableFetch(fetch(TEST_URL), { TIMEOUT }) |