Skip to content

Instantly share code, notes, and snippets.

@jassok
jassok / app-routing.module.ts
Created July 10, 2018 14:33
Angular 6 Route Guards
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AppComponent } from './app.component';
import { Angular2TokenService } from 'angular2-token';
import { ZeroGuardService as ZeroGuard } from './shared/guards/can-activate-zero-guard.service';
const routes: Routes = [
{ path: 'contact', loadChildren:'./contact/contact.module#ContactModule', canActivate: [ Angular2TokenService ] },
<?php // Min HTML
function sanitize_output($buffer) {
$search = array(
'/\>[^\S ]+/s', // strip whitespaces after tags, except space
'/[^\S ]+\</s', // strip whitespaces before tags, except space
'/(\s)+/s', // shorten multiple whitespace sequences
'/<!--(.|\s)*?-->/' // Remove HTML comments
);
$replace = array('>', '<', '\\1', '');
$buffer = preg_replace($search, $replace, $buffer);
<script defer src=”//ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js”> </script>
<script defer src=”/app/bundle.js?v=0.0.1”></script>
<script defer src=”/app/home.js?v=0.0.1”></script>
@jassok
jassok / lev-checkbox.sublime-snippet
Created December 3, 2013 17:33
Leverage snippets
<snippet>
<content><![CDATA[
<!-- --------------/ Checkbox /------------ -->
<?php echo \$formHTML['before']; ?>
<label>${1:Active?}</label>
<?php echo \$formHTML['between']; ?>
<input type="checkbox" name="${2:active}" value="1" <?php if (\$mq['${2:active}'] || \$addNew) { echo "checked"; } ?> /><label>This will show up on the site</label>
<?php echo \$formHTML['after']; ?>