Skip to content

Instantly share code, notes, and snippets.

View erfansahaf's full-sized avatar
🎯
Focusing

Erfan Sahaf erfansahaf

🎯
Focusing
View GitHub Profile
@erfansahaf
erfansahaf / StorageProxy.php
Last active December 11, 2022 14:51
Laravel StorageProxy class
<?php
namespace App\Utils;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Support\Facades\Storage;
class StorageProxy
{
private $disk;
@erfansahaf
erfansahaf / bucket-policies-primer.md
Created November 6, 2022 09:17 — forked from krishnasrinivas/bucket-policies-primer.md
Explanation of bucket polices by example

Bucket Policy

Bucket policy is an access policy available for you to grant anonymous permissions to your Minio resources. Bucket policy uses JSON-based access policy language.

This section presents a few examples of typical use cases for bucket policies. The policies use testbucket strings in the resource value. To test these policies, you need to replace these strings with your bucket name. For more information please read Amazon S3 access policy language

Granting Read-Only Permission to an Anonymous User

The following example policy grants the s3:GetObject permission to any public anonymous users. This permission allows anyone to read the object data under testbucket, which is useful for when you have publicly readable assets. A typical example is a website assets stored in testbucket.

ARG PHP_VERSION=7.4
FROM php:${PHP_VERSION}-fpm
# Add user for application
RUN groupadd -g 1000 www
RUN useradd -u 1000 -ms /bin/bash -g www www
# Install PHP Extensions
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
@erfansahaf
erfansahaf / crossy-road-with-three-js.markdown
Created December 28, 2018 13:58
Crossy Road with three.js

Crossy Road with three.js

An interactive tech demo inspired by Crossy Road using three.js where I put together a scene with an orthographic camera that follows the player, a few simplified 3D objects with some texture, lights and shadows, and a basic game logic that randomly generates a level that you can walk through.

A Pen by Hunor Marton Borbely on CodePen.

License.

@erfansahaf
erfansahaf / database.js
Created March 27, 2016 12:33
Express Database Function
var mysqlPackage = require("mysql");
var mysql = mysqlPackage.createConnection({
host: "localhost",
user: "root",
password: "",
database: "test"
});
mysql.connect(function (err) {
err ? console.log(err) : false;
});
@erfansahaf
erfansahaf / SDate.php
Created December 16, 2015 22:43
a php class for work with Gregorian and Jalali dates
<?php
/* If you use Codeigniter framework, uncomment following ↓ line */
//defined('BASEPATH') OR exit('No direct script access allowed');
/*
* @name Shamsi Date (SDate)
* @author Erfan Sahafnejad <Erfan.Sahaf@gmail.com/>
* @copyright 2015 P30Skill Development Team (http://P30Skill.ir)
* @version 1.0
* @link www.P30Skill.ir