Skip to content

Instantly share code, notes, and snippets.

View achmadfatoni's full-sized avatar
🏠
Working from home

Achmad Fatoni achmadfatoni

🏠
Working from home
View GitHub Profile
@achmadfatoni
achmadfatoni / simple_api_lumen_single_controller
Created August 18, 2017 12:34
simple_api_lumen_single_controller
public function show($id)
{
$post = Post::find($id);
if (! $post) {
return response()->json([
'message' => 'post not found'
]);
}
return $post;
@achmadfatoni
achmadfatoni / simple_api_lumen_delete_route
Created August 18, 2017 12:30
simple_api_lumen_delete_route
$app->delete('/posts/{id}', 'PostController@delete');
@achmadfatoni
achmadfatoni / simple_api_lumen_update_route
Created August 18, 2017 12:17
simple_api_lumen_update_route
$app->put('/posts/{id}', 'PostController@update');
@achmadfatoni
achmadfatoni / simple_api_lumen_single_route
Last active August 18, 2017 12:14
simple_api_lumen_single_route
$app->get('/posts/{id}', 'PostController@show');
@achmadfatoni
achmadfatoni / simple_api_lumen_list_controller
Created August 18, 2017 12:06
simple_api_lumen_list_controller
public function index()
{
return Post::all();
}
@achmadfatoni
achmadfatoni / simple_api_lumen_list_route
Created August 18, 2017 12:02
simple_api_lumen_list_route
$app->get('/posts', 'PostController@index');
@achmadfatoni
achmadfatoni / simple_api_lumen_create_controller
Created August 18, 2017 11:59
simple_api_lumen_create_controller
<?php
namespace App\Http\Controllers;
use App\Models\Post;
use Illuminate\Http\Request;
class PostController extends Controller
{
public function store(Request $request)
@achmadfatoni
achmadfatoni / simple_api_lumen_create
Last active August 18, 2017 12:03
simple_api_lumen_create
$app->post('/posts', 'PostController@store');
@achmadfatoni
achmadfatoni / letsencrypt_2017.md
Created July 12, 2017 17:20 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@achmadfatoni
achmadfatoni / docker-cheat-sheet
Created July 10, 2017 03:19
Docker cheat sheet
`docker images` list all images
`docker rmi image-id` delete docker image