Skip to content

Instantly share code, notes, and snippets.

View tnqsoft's full-sized avatar

Tuấn Quỳnh Software tnqsoft

View GitHub Profile
.long-text {
white-space: -moz-pre-wrap; /* Mozilla */
white-space: -hp-pre-wrap; /* HP printers */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: pre-wrap; /* CSS 2.1 */
white-space: pre-line; /* CSS 3 (and 2.1 as well, actually) */
word-wrap: break-word; /* IE */
word-break: break-all;
}
@tnqsoft
tnqsoft / angular2-http-audio.ts
Last active June 14, 2017 07:47
Angular 2 HTTP Audio
import { Response, RequestOptions, Headers, ResponseContentType } from '@angular/http';
import * as FileSaver from 'file-saver';
/**
* Get Audio
*
* @returns {Promise<Blob>}
*/
public getAudio(): Promise<Blob> {
let url = `http://example.com/demo.wav`;
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer, SafeHtml, SafeStyle, SafeScript, SafeUrl, SafeResourceUrl } from '@angular/platform-browser';
/*
* Trust pipe
* Usage:
* value | safe
*/
@Pipe({
name: 'safe'
@tnqsoft
tnqsoft / math-lession-1.php
Created April 27, 2017 22:40
Code snippet with math lession
<?php
/**
* Code snippet with math lession
* @author Nguyen Nhu Tuan <[email protected]>
*/
// 2^3 = 8
echo getExponential(2, 3);
echo '<br/>';
@tnqsoft
tnqsoft / TreeChoiceType-V2.php
Created April 11, 2017 18:27
EntityType Tree Display For Symfony 3 - Version 2
<?php
namespace CommonBundle\Form\Type;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormView;
@tnqsoft
tnqsoft / TreeChoiceType.php
Last active April 11, 2017 18:13
EntityType Tree Display For Symfony 3
<?php
namespace CommonBundle\Form\Type;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormView;