This file contains 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
import {Component} from 'angular2/core'; | |
import {NgFor} from 'angular2/common'; | |
import {Http} from 'angular2/http'; | |
import template from './clients.html'; | |
import {CanActivate, OnActivate, ROUTER_DIRECTIVES, RouteConfig} from 'angular2/router'; | |
import {Service} from './clientResource'; | |
import {Client} from '../classes/Client' | |
This file contains 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
import {Component, View, Input, Output, EventEmitter} from 'angular2/core'; | |
import {NgFor, NgClass, NgIf} from 'angular2/common'; | |
import {ROUTER_DIRECTIVES} from 'angular2/router'; | |
import template from './editable.html'; | |
import styles from './editable.css'; | |
import * as alerts from 'Utils/alerts' | |
const headers = { | |
'Authorization': (()=>getJWT())(), | |
'Accept': 'application/json, text/plain, */*', |
This file contains 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
// angular 1 | |
import template from './navbar.html'; | |
import './navbar.styl'; | |
let Component = { | |
restrict: 'E', | |
bindings: {}, | |
template, | |
controller: Home |
This file contains 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
import queryString from "query-string"; | |
let _route = "api/v2.0/"; | |
const headers = { | |
'Accept': 'application/json', | |
'Content-Type': 'application/json', | |
}; | |
const verbs = { |
This file contains 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
// in Sublime Text, Preferences -> Browse Packages, find HTML-CSS-JS Prettify/scripts/node_modules/js-beautify/js/lib/beautify.js | |
// find the last line of the 'beautify' function, and place the next lines just before 'return sweet_code'; | |
// https://gist.github.com/loopmode/d091bce3b76efaf15d63 | |
// es7 decorators | |
sweet_code = sweet_code.replace(/@\n/g, '@'); | |
sweet_code = sweet_code.replace(/\)@\s/g, ')\n@'); | |
sweet_code = sweet_code.replace(/ @ /g, ' @'); | |
sweet_code = sweet_code.replace(/@\s/g, '\n@'); | |
// destructuring/spread: imports |
This file contains 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
const privateFoo = Symbol("foo"); | |
function Public() { | |
this[privateFoo] = "bar"; | |
} | |
Public.prototype.method = function () { | |
// Do stuff with `this[privateFoo]`... | |
}; |
This file contains 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 parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
This file contains 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
<ul> | |
<li ng-repeat="item in items | orderObjectBy:'color':true">{{ item.color }}</li> | |
</ul> |
This file contains 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 OAuth2 = require('OAuth').OAuth2; | |
var https = require('https'); | |
var oauth2 = new OAuth2(KEY, SECRET, 'https://api.twitter.com/', null, 'oauth2/token', null); | |
oauth2.getOAuthAccessToken('', { | |
'grant_type': 'client_credentials' | |
}, function (e, access_token) { | |
console.log(access_token); //string that we can use to authenticate request | |
var options = { |
This file contains 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
{ | |
"match": "(?<!\\.)\\b(.forEach|.then)(?!\\s*:)\\b", | |
"name": "entity.name.function.js" | |
}, | |
// matches .then & .forEach | |
{ | |
"match": "(?<=\\).)(t(he(n)))\\b", | |
"name": "entity.name.function.js" |
NewerOlder