Skip to content

Instantly share code, notes, and snippets.

View abcprintf's full-sized avatar
🎯
Focusing

Mix Abcprintf abcprintf

🎯
Focusing
View GitHub Profile
@abcprintf
abcprintf / gist:f3600c180f586033eb48e7470a74b32a
Created September 24, 2018 15:09
how to convert .docx to .pdf [PHPword]
$rendererLibraryPath = PHPWORD_BASE_DIR . '/vendor/dompdf/dompdf';
\PhpOffice\PhpWord\Settings::setPdfRendererPath($rendererLibraryPath);
\PhpOffice\PhpWord\Settings::setPdfRendererName('DomPDF');
$phpWord = new \PhpOffice\PhpWord\PhpWord();
//Load temp file
$phpWord = \PhpOffice\PhpWord\IOFactory::load('.docx');
//Save it
$('form').submit(function(e) {
e.preventDefault();
var formData = new FormData($(this)[0]); // array[0] !important
$.ajax({
url: '{{ url('/url') }}',
type: 'POST',
data: formData,
success: function(result)
{
// result
@abcprintf
abcprintf / Command Line React-Native.txt
Last active October 17, 2018 07:58
command line react-native open Emulator.exe
#Install Android Studio
- Sdk
#SET Environment Variables
- Path
- Andorid Sdk
- emulator
- platform-tools
<?php
$apiToken = ""; // Your Token
$chat_id = ""; // Your Chat ID
$text = $_GET['text'];
// V1
/*
$params = [
'chat_id' => $chat_id,
@abcprintf
abcprintf / CommandMongoDB.md
Last active June 6, 2019 07:40
Command Mongodb

Command MongoDB

- aggregate
- $unwind
- $match -> where
    - $regex -> like
    - $or -> ||
    - $and -> &&
    - $eq -> =
    - $ne -> !=
    - $nin -> NOT IN
<?php
error_reporting(E_ALL);
// Attachments Form :
// $data = array(
// 'attachments' => array(
// 0 => array(
// 'fallback' => 'Required plain-text summary of the attachment.',
// 'color' => '#36a64f',
// 'pretext' => 'Optional text that appears above the attachment block',
@abcprintf
abcprintf / server.js
Created June 4, 2019 08:13
Listening on HTTP and HTTPS
// Host runing https:
var port = 3000;
var express = require('express');
var fs = require("fs");
var cert = {
key: fs.readFileSync('./cert/x.key'),
cert: fs.readFileSync('./cert/x.cer')
};
var app = express()
, http = require('http').createServer(app)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<form>
<div class="form-group">
@abcprintf
abcprintf / add_year.md
Created October 31, 2019 02:38
moment เพิ่มปี 543 (พ.ศ)
  moment().add(543, 'years').format('L');
@abcprintf
abcprintf / preview.js
Created November 19, 2019 04:45
preview files ก่อน upload
function readURL(input) {
if (input.files.length > 1) {
var htmlPreview = $('#preview-files');
htmlPreview.html("");
$.each(input.files, function(i, v) {
var filename = v.name;
var filetype = v.type;