Skip to content

Instantly share code, notes, and snippets.

View iFeras93's full-sized avatar
🎯
Focusing

Feras Mohamed iFeras93

🎯
Focusing
View GitHub Profile
@simonhamp
simonhamp / AppServiceProvider.php
Last active May 4, 2024 04:21
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
@noelboss
noelboss / git-deployment.md
Last active May 2, 2024 15:47
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@zhujunsan
zhujunsan / Using Github Deploy Key.md
Last active April 29, 2024 19:14
Using Github Deploy Key

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process in replace of username/password, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key
@ahmu83
ahmu83 / US_States_and_Cities.json
Created July 20, 2016 16:50
List of US States and Cities in JSON format.
{
"New York": [
"New York",
"Buffalo",
"Rochester",
"Yonkers",
"Syracuse",
"Albany",
"New Rochelle",
"Mount Vernon",
@bennylope
bennylope / ffmpeg-watermark.md
Created April 22, 2016 23:17 — forked from webkader/ffmpeg-watermark.md
FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.

@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@tatocaster
tatocaster / RealPathUtil.java
Last active April 3, 2024 00:27
Real Path Utility class for Android, works for all API
public class RealPathUtil {
public static String getRealPath(Context context, Uri fileUri) {
String realPath;
// SDK < API11
if (Build.VERSION.SDK_INT < 11) {
realPath = RealPathUtil.getRealPathFromURI_BelowAPI11(context, fileUri);
}
// SDK >= 11 && SDK < 19
else if (Build.VERSION.SDK_INT < 19) {
@saranemohan
saranemohan / laravel_deploy.sh
Last active December 7, 2023 05:57
Deploy laravel with ease. using command line, integrate latest update from git remote repository. all necessary steps to be followed for laravel is implemented. a log file is recorded for future reference.
#!/bin/bash
mkdir -p deploy_log
file_name=deploy_log/deploy_$(date "+%Y_%m_%d_%H_%M_%S")
echo 'Deployment Started . . . . .' |& tee $file_name
chown -R www-data:www-data storage/
chmod -R 777 storage/
chown -R www-data:www-data bootstrap/cache/
@ibrunotome
ibrunotome / laravel-ddd-approach.md
Last active August 25, 2023 23:25
A Domain Driven Design (DDD) approach to the Laravel Framework
/app
├── /Application
|  ├── /Exceptions
|  ├── /Middlewares
|  ├── /Providers
|  ├── /Requests
├── /Domain
|  ├── /MyDomainA
| | ├── /Contracts
@muzfr7
muzfr7 / index.html
Last active May 31, 2023 11:37
Restrict user from typing Non-Arabic characters in input fields using Javascript / JQuery
<html>
<head></head>
<body>
<form>
<input id="candidate_firstname" name="firstname" required="required" class="gui-input" dir="rtl" type="text" />
<input id="candidate_lastname" name="lastname" required="required" class="gui-input" dir="rtl" type="text" />
</form>
<script type="text/javascript">
function restrictInputOtherThanArabic($field)