Skip to content

Instantly share code, notes, and snippets.

@omegachien
omegachien / laravel-echo-server-supervisor.conf
Created July 7, 2019 03:27
Laravel Echo Server Supervisor Sample Configuration
[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 March 10, 2019 06:13
DataTable Example - Book Controller - Load Data via Ajax
<?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 March 10, 2019 06:10
DataTable Example - Load Data via Ajax
<!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 -->
<!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 -->
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);
@omegachien
omegachien / gist:04bcf18af6f9f0472865
Created March 25, 2015 08:55
Sample Volley Code
//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) {
#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];