Skip to content

Instantly share code, notes, and snippets.

@omegachien
omegachien / laravel-echo-server-supervisor.conf
Created Jul 7, 2019
Laravel Echo Server Supervisor Sample Configuration
View laravel-echo-server-supervisor.conf
[program:staging-echo-server]
process_name=%(program_name)s_%(process_num)02d
directory=/var/www/laravel-project-path
command=laravel-echo-server start
autostart=true
autorestart=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/log/supervisor/laravel-project-staging.log
@omegachien
omegachien / BookController.php
Created Mar 10, 2019
DataTable Example - Book Controller - Load Data via Ajax
View BookController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Yajra\DataTables\DataTables;
class BookController extends Controller
{
public function index()
@omegachien
omegachien / datatable.ajax.blade.php
Created Mar 10, 2019
DataTable Example - Load Data via Ajax
View datatable.ajax.blade.php
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="{{ mix('css/app.css') }}" rel="stylesheet">
<title>DataTable Sample</title>
<!-- Fonts -->
View datatable.blade.php
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="{{ mix('css/app.css') }}" rel="stylesheet">
<title>DataTable Sample</title>
<!-- Fonts -->
View gist:1ed90db2d442cc38c5d5
HashMap<String, String> params = new HashMap<String, String>();
float price = 15.0f;
int userId = 1;
String url = "greenroom.com.my/api/v1/price/update";
//Construct signature and POST param
params.put("price", price);
params.put("user_id", userId);
Log.d("URL", url);
View gist:04bcf18af6f9f0472865
//Remember to put the line below into your build.gradle's dependencies
//compile 'com.mcxiaoke.volley:library:1.0.15'
private void refreshWeather() {
RequestQueue queue = Volley.newRequestQueue(getActivity());
String url = "http://api.openweathermap.org/data/2.5/forecast/daily?q=94043&mode=json&units=metric&cnt=7";
JsonObjectRequest req = new JsonObjectRequest(url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
View iOS Generate Token
#include <CommonCrypto/CommonDigest.h>
#include <CommonCrypto/CommonHMAC.h>
+(NSString*)generateSignature:(NSString*) dataToEncrypt{
NSString *key = UserSecretKey;
NSString *data = dataToEncrypt;
const char *cKey = [key cStringUsingEncoding:NSASCIIStringEncoding];
const char *cData = [data cStringUsingEncoding:NSASCIIStringEncoding];
You can’t perform that action at this time.