Function:
function shorten_text($text, $max_length = 140, $cut_off = '...', $keep_word = false)
{
if(strlen($text) <= $max_length) {
return $text;
}
if(strlen($text) > $max_length) {
Function:
function shorten_text($text, $max_length = 140, $cut_off = '...', $keep_word = false)
{
if(strlen($text) <= $max_length) {
return $text;
}
if(strlen($text) > $max_length) {
/* | |
Exemples : | |
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}"> | |
- Or, request confirmation in the process - | |
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}" data-confirm="Are you sure?"> | |
*/ | |
(function() { | |
/** | |
* Preventing dead-locks, using async-lock by key | |
*/ | |
var AsyncLock = require('async-lock'); | |
var lock = new AsyncLock(); | |
function operation(id) { | |
console.log(id + " calling operation"); | |
lock.acquire(id, function(done) { |
########## Install NGINX ############## | |
# Install software-properties-common package to give us add-apt-repository package | |
sudo apt-get install -y software-properties-common | |
# Install latest nginx version from community maintained ppa | |
sudo add-apt-repository ppa:nginx/stable | |
# Update packages after adding ppa |
root
user (sudo su
).nginx
in /opt/redash
.certs
and certs-data
./opt/redash/nginx/nginx.conf
and place the following in it: (replace example.redashapp.com
with your domain name)
upstream redash {
server redash:5000;
}
import axios, { AxiosResponse } from 'axios'; | |
import { PostType } from '../models/post.interface'; | |
const instance = axios.create({ | |
baseURL: 'http://jsonplaceholder.typicode.com/', | |
timeout: 15000, | |
}); | |
const responseBody = (response: AxiosResponse) => response.data; |