Skip to content

Instantly share code, notes, and snippets.

View mactanxin's full-sized avatar
😆
happy coding

Xin Tan mactanxin

😆
happy coding
  • San Jose
  • 08:11 (UTC +08:00)
View GitHub Profile
0.0 0.0
1.1 1.1
3.5 4.5
2.2 2.2
0.1 1.0
2.1 1.2
3.1 1.3
<snippet>
<content><![CDATA[T($SELECTION)]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>T</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.ts</scope>
<description>add a 'T' to strings should be wrapped by ()</description>
</snippet>
{
"Translate_wrapper": {
"prefix": "T",
"scope": "javascript,typescript",
"body": [
"T(TM_SELECTED_TEXT)"
],
"description": "Add a T wrapper"
},
}
import { ApplicationRef, Component, Injector, OnInit, ViewContainerRef } from '@angular/core';
import { FormGroup, FormArray, Validators, AbstractControl} from '@angular/forms';
import { ActivatedRoute, RouterModule, Router } from '@angular/router';
import { EntityConfigComponent } from '../../../common/entity/entity-config/';
import { GlobalState } from '../../../../global.state';
import { RestService, WebSocketService } from '../../../../services/';
import { FieldConfig } from '../../../common/entity/entity-form/models/field-config.interface';
import * as _ from 'lodash';
import { Subscription } from 'rxjs';
@mactanxin
mactanxin / fieldComponentConfig.sublime-snippet
Created June 15, 2017 18:04
in ng2 * component.ts file, type `fcc` tab, there you go
<snippet>
<content><![CDATA[
{
type: '$1',
name: '$2',
placeholder: '$3',
},
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>fcc</tabTrigger>
@mactanxin
mactanxin / consoleLog.sublime-snippet
Created May 24, 2017 16:43 — forked from anonymous/consoleLog.sublime-snippet
type log, then tab to get a console.log
<snippet>
<content><![CDATA[
console.log($1);
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>log</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.ts</scope>
</snippet>
@mactanxin
mactanxin / restart_bluetooth.sh
Created May 10, 2017 16:55 — forked from nicolasembleton/restart_bluetooth.sh
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@mactanxin
mactanxin / this.js
Last active April 24, 2017 21:06
what's this?
var obj = {
foo: function(){
console.log(this)
}
}
var bar = obj.foo;
//what's the result for the two lines
obj.foo()
@mactanxin
mactanxin / systat.sh
Created September 21, 2016 07:01
hardware stat for FreeNAS
#! /bin/sh
for i in $(sysctl -n kern.disks)
do
DevTemp=`smartctl -a /dev/$i | awk '/Temperature_Celsius/{print $0}' | awk '{print $10 "C"}'`
DevSerNum=`smartctl -a /dev/$i | awk '/Serial Number:/{print $0}' | awk '{print $3}'`
DevName=`smartctl -a /dev/$i | awk '/Device Model:/{print $0}' | awk '{print $3}'`
echo $i $DevTemp $DevSerNum $DevName
done
body { padding-bottom: 40px; padding-top: 55px;}.sidebar-nav-fixed { width:13%;}