Skip to content

Instantly share code, notes, and snippets.

@iksose
iksose / jsbeautifier-es6-hacks
Last active January 28, 2017 15:35 — forked from loopmode/jsbeautifier-es6-hacks
Some (ugly!) hacks to fix es6/es7 formatting problems in jsbeautifier. I use it with the "html/css/js prettify" plugin for Sublime Text
// 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
import queryString from "query-string";
let _route = "api/v2.0/";
const headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
};
const verbs = {
@iksose
iksose / ng1_ng2.js
Last active December 26, 2015 01:00
// angular 1
import template from './navbar.html';
import './navbar.styl';
let Component = {
restrict: 'E',
bindings: {},
template,
controller: Home
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, */*',
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'