Skip to content

Instantly share code, notes, and snippets.

<?php
function DateThai($strDate){
$strMonthCut = Array("", "ม.ค.", "ก.ม.", "มี.ค.","ม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
$inputDate = array(
'year' => date("Y",strtotime($strDate))+543,
'month' => date("n",strtotime($strDate)),
'day' => date("j",strtotime($strDate)),
'hour' => date("H",strtotime($strDate)),
'minute' => date("i",strtotime($strDate)),
'seconds' => date("s",strtotime($strDate)),
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 2,
center: {lat: -33.872, lng: 151.252},
});
map.data.loadGeoJson('location_of_the_worlds_petroleum_fields__xtl.json');
map.data.setStyle(function(feature) {
var RESINFO = feature.getProperty('RESINFO');
var color;
var color_line;
if(RESINFO == 'gas'){
color = 'blue';
color_line = 'blue';
}else if(RESINFO == 'oil'){
color = 'red';
color_line = 'red';
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@M4R14
M4R14 / Dockerfile
Last active August 14, 2017 16:11
simple-Dockerfile for create-react-app
# Node.js app Docker file
FROM ubuntu:14.04
FROM node:8
RUN apt-get update && apt-get install apt-transport-https
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install yarn
@M4R14
M4R14 / index.html
Last active August 17, 2017 03:32
Got a YouTube video thumbnail
<div class="clip" >
<a href="https://www.youtube.com/watch?v=GgswDxplkWM"/>
<span class="play-btn" data-toggle="modal" data-target="#exampleModal">
<i class="fa fa-play fa-5x" aria-hidden="true"></i>
</span>
<a/>
</div>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
@M4R14
M4R14 / Puppeteer_simple.js
Last active September 3, 2017 14:05
สร้าง web Bot ด้วย Puppeteer chrome-headless ในการ Add, Del ข้อมูล
const puppeteer = require('puppeteer');
const _login = {
data:{
USERNANE: '**********',
PASSWORD: '**********'
},
elem:{
USERNANE: 'body > div.content > form > div:nth-child(4) > div > input',
PASSWORD: 'body > div.content > form > div:nth-child(5) > div > input',
const puppeteer = require('puppeteer');
async function run() {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://github.com');
await page.screenshot({path: 'screenshots/github.png'});
browser.close();
const puppeteer = require('puppeteer');
const LOGIN = async (page) {
const USER = {
username : "<username>",
password : "<password>"
}
// dom element selectors
const USERNAME_SELECTOR = '#login_field';
const PASSWORD_SELECTOR = '#password';
@M4R14
M4R14 / puppeteer-jest.js
Created September 6, 2017 09:11
puppeteer-jest ง่ายๆ
const puppeteer = require('puppeteer');
const _30s = 1000 * 30;
const _1m = 1000 * 60;
const _5m = _1m * 5;
describe('Open Url: Google, Github.', () => {
var browser, page;
beforeEach(async () => {