Skip to content

Instantly share code, notes, and snippets.

View wwarodom's full-sized avatar

Warodom Werapun wwarodom

View GitHub Profile
<html>
<head>
</head>
<body>
Hello world
</body>
</html>
@wwarodom
wwarodom / lms.php
Last active August 18, 2016 08:22
PHP7 cURL post (Login) to LMS
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
function get($url,$cookieFile, $referer, $params=array()) {
$url = $url.'?'.http_build_query($params, '', '&');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@wwarodom
wwarodom / curlSis.php
Last active August 19, 2016 06:06
sis PSU Phuket (Login)
<?php
require_once("simple_html_dom.php");
ini_set('display_errors', 'On');
error_reporting(E_ALL);
function get($url,$cookieFile, $referer, $params=array()) {
$url = $url.'?'.http_build_query($params, '', '&');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@wwarodom
wwarodom / routes-laravel.php
Created October 1, 2016 08:36
jsonObject in Laravel
Route::get('/jsonArray', function () {
$message = App\Message::all();
return $message;
});
Route::get('/jsonObject',function() {
$cars = [
"id1" => ["brand" => "Volvo", "color" => "red", "number" => 123],
"id2" => ["brand" => "BWM", "color" => "blue", "number" => 453],
"id3" => ["brand" => "Toyota", "color" => "green", "number" => 985]
public class ClientFacade {
private static final String BASE_URL = "http://Server-IP/laravel/www/public/";
private static AsyncHttpClient client = new AsyncHttpClient();
public static void get(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
client.get(getAbsoluteUrl(url), params, responseHandler);
}
@wwarodom
wwarodom / MainActivity.java
Last active October 1, 2016 08:57
Main class to call LoopJ
package com.warodom.httpexample;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.loopj.android.http.*;
public void postMessage(String path) {
RequestParams params = new RequestParams();
params.put("id", "1");
params.put("message","Hello my message final");
params.put("_token","AZzS6jPpsdlWv9nNTByaE3OIj4I1FQg8hrhHXkH8");
ClientFacade.post(path, params, new TextHttpResponseHandler() {
@Override
public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
Log.d("----", "failure: "+ statusCode);
@wwarodom
wwarodom / default.conf
Last active November 26, 2016 17:02
default.conf (Nginx configuration)
$ cat conf.d/default.conf
server {
listen 80;
index index.html index.php;
sendfile off;
root /usr/share/nginx/html;
server_name localhost;
location / {
@wwarodom
wwarodom / default.conf
Created November 26, 2016 16:13
nginx 1.11 configuration for Laravel 5.3
server {
listen 80;
sendfile off;
index index.php index.html;
root /usr/share/nginx/html;
server_name localhost;
location / {
try_files $uri $uri/ /blog/public/index.php$is_args$args;
}
@wwarodom
wwarodom / docker-compose.yml
Created November 26, 2016 18:00
Docker compose (LEMP) for Laravel
version: '2'
services:
### MySQL Container #########################################
mysql:
image: mysql:5.7.4
environment:
- MYSQL_DATABASE=dev
- MYSQL_USER=root
- MYSQL_PASSWORD=password