Skip to content

Instantly share code, notes, and snippets.

View dangdungcntt's full-sized avatar
🇻🇳
Online

Nguyễn Đăng Dũng dangdungcntt

🇻🇳
Online
View GitHub Profile
@dangdungcntt
dangdungcntt / embedded-file-viewer.md
Created October 17, 2022 14:28 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@dangdungcntt
dangdungcntt / base64URLSafe.php
Created October 27, 2021 03:05
PHP Helper functions for Safe Base64 URL encode
<?php
/*
* Copied from https://github.com/firebase/php-jwt/blob/feb0e820b8436873675fd3aca04f3728eb2185cb/src/JWT.php#L350
*/
function encodeURLSafe($data): string
{
return \str_replace('=', '', \strtr(\base64_encode($data), '+/', '-_'));
}
@dangdungcntt
dangdungcntt / cookie_flags.conf
Created May 6, 2021 05:52 — forked from nginx-gists/cookie_flags.conf
Announcing NGINX Plus R24
@dangdungcntt
dangdungcntt / nginx_proxy_uptimerobot.conf
Last active March 27, 2024 15:21
nginx-config-proxy-uptimerobot
server {
listen 80;
server_name status.nddcoder.com;
location / {
#proxy requests đến Uptimerobot
proxy_pass https://stats.uptimerobot.com/ojM8Acwzq/;
#Gửi server_name khi handshake SSL, nếu off thì sẽ bị lỗi SSL
proxy_ssl_server_name on;
#Set header này thì response trả về từ Uptimerobot không bị nén, từ đó mình có thể replace ở bước dưới
@dangdungcntt
dangdungcntt / Trie.js
Created September 2, 2020 00:13 — forked from tpae/Trie.js
Trie.js - super simple JavaScript implementation
// Trie.js - super simple JS implementation
// https://en.wikipedia.org/wiki/Trie
// -----------------------------------------
// we start with the TrieNode
function TrieNode(key) {
// the "key" value will be the character in sequence
this.key = key;
@dangdungcntt
dangdungcntt / DataProtect.php
Created October 17, 2019 06:09
Simple data protect in php. Javascript version here: https://github.com/dangdungcntt/data-protect
<?php
class DataProtect
{
protected static function substrAndToInt($string, $index = 0, $length = 3)
{
return hexdec(self::unmix(substr($string, $index, $length)));
}
protected static function pad($string, $length = 6, $char = '0')
<!DOCTYPE html>
<html lang="en">
<head>
<title>Tools - generate php class</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
margin: 0;
padding: 0;
@dangdungcntt
dangdungcntt / index-chatchit-js
Last active June 14, 2017 11:35
inde-chatchit.js
'use strict';
var express = require('express');
var session = require('express-session');
var config = require('config');
var bodyParser = require('body-parser');
var app = express();
//body-parser for get data from post form
app.use(bodyParser.urlencoded({ extended: false }));