Skip to content

Instantly share code, notes, and snippets.

@shahednur
shahednur / movie-streaming-apps-activity.txt
Created September 3, 2023 15:43
Prompt: in a movie streaming flutter android app, which kind of activity a user can do, give that list of activity.
Prompt: what is the process of creating that movie streaming app's models using this activity list?
Creating models for a movie streaming app involves defining the data structures and relationships between different entities within the app. Based on the list of activities you provided, here's a step-by-step process for creating models for a movie streaming app:
1. **Identify Entities:**
Start by identifying the main entities (objects or data structures) that will be central to your app. In this case, key entities might include:
- User
- Movie/TV Show
- User Profile
- Review
@shahednur
shahednur / User.php
Created August 22, 2022 05:26
Laravel Eloquent Model Accessor to get Client/User IP Address
public function getClientIps()
{
$clientIps = array();
$ip = $this->server->get('REMOTE_ADDR');
if (!$this->isFromTrustedProxy()) {
return array($ip);
}
if (self::$trustedHeaders[self::HEADER_FORWARDED] && $this->headers->has(self::$trustedHeaders[self::HEADER_FORWARDED])) {
$forwardedHeader = $this->headers->get(self::$trustedHeaders[self::HEADER_FORWARDED]);
preg_match_all('{(for)=("?\[?)([a-z0-9\.:_\-/]*)}', $forwardedHeader, $matches);
@shahednur
shahednur / react-authentication-folder-structure.md
Created February 3, 2022 17:40 — forked from mksglu/react-authentication-folder-structure.md
React JS Authenatication Folder Structure

React JS Authenatication + REST API

Used Packages

  • React JS
  • Redux Thunk
  • Redux Form
  • Redux Logger
@shahednur
shahednur / tailwind.config.js
Last active February 19, 2022 21:00
tailwind.config.js
module.exports = {
prefix: '',
important: false,
separator: ':',
theme: {
screens: {
sm: '640px',
md: '768px',
lg: '1024px',
xl: '1280px',
@shahednur
shahednur / Response.php
Created December 10, 2021 13:37 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
in database:
$table->enum('fruit', ['apple', 'banana', 'cantalope']);
in controller's construct:
public function __construct()
{
DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
}
how to use this Enum in cotroller:
@shahednur
shahednur / laravel.js
Created February 9, 2019 05:58 — forked from JeffreyWay/laravel.js
Want to send a DELETE request when outside of a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. (Requires jQuery, but doesn't have to.) To use, import script, and create a link with the `data-method="DELETE"` attribute.
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
(function() {
@shahednur
shahednur / Nice Route Collections:
Created February 9, 2019 04:18
Laravel Route Group Collections
=========================
======Basic Route========
=========================
Route::get($uri, $callback);
Route::post($uri, $callback);
Route::put($uri, $callback);
Route::patch($uri, $callback);
Route::delete($uri, $callback);
Route::options($uri, $callback);
Route::match(['get', 'post'], '/',function (){});
function getVideoUrl($link){
$data = explode('.mp4', $link);
$decode = urldecode($data[0]);
$linkDownload = array();
$v1080p = $decode.'_hd.mp4';
$v720p = $decode.'_dvd.mp4';
$v360p = $decode.'_fmt1.ogv';
$linkDownload['1080p'] = $v1080p;
$linkDownload['720p'] = $v720p;
$linkDownload['360p'] = $v360p;
@shahednur
shahednur / This version is for image and youtube
Last active December 22, 2018 21:36 — forked from jasny/linkify.php
PHP function to turn all URLs in clickable links
Allow display images and youtube video:
CSS class for links .htmllink and images .htmlimg
public function linkify($showimg = 1, $value, $protocols = array('http', 'mail', 'https'), array $attributes = array('target' => '_blank'))
{
// Link attributes
$attr = '';
foreach ($attributes as $key => $val) {
$attr = ' ' . $key . '="' . htmlentities($val) . '"';
}