Skip to content

Instantly share code, notes, and snippets.

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

faryar faryar76

🏠
Working from home
View GitHub Profile
@fikrimastor
fikrimastor / app.js
Last active May 30, 2024 07:39
Laravel Vite Compile Tabler Theme Bootstrap 5
import '~tabler/dist/js/tabler.min.js';
import './bootstrap';
import '../sass/app.scss';
@gkhays
gkhays / Download File with Node.md
Created February 27, 2020 17:26
Download a file from a URL using Node.js

Download File from URL

Proof-of-concept to download a file from a URL and save it locally. For example, I may wish to retrieve a JAR file from Nexus.

Uses the http package, which does the basics with raw HTTP protocol support.

Possible update: use request, it is like the Python's requests library. There is a companion package called node-request-progress that tracks download progress. See request-progress on GitHub.

Note: The request package has been deprecated.

@enobufs
enobufs / index.html
Last active April 19, 2022 16:31
MediaTrackSettings.echoCancellation Test
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<style>
html, body{
height: 100%;
width: 100%;
}
#video{
height: 300px;
@eoli3n
eoli3n / encryption.php
Last active May 28, 2024 02:47
Encrypt - Decrypt AES from/to Python PyCryptodome from/to PHP openssl
<?php
// use to generate key : 'openssl rand -hex 32'
function my_encrypt($data, $passphrase) {
$secret_key = hex2bin($passphrase);
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
$encrypted_64 = openssl_encrypt($data, 'aes-256-cbc', $secret_key, 0, $iv);
$iv_64 = base64_encode($iv);
$json = new stdClass();
$json->iv = $iv_64;
@reinink
reinink / AppServiceProvider.php
Last active October 22, 2023 13:06
Multi-page Vue App in Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\Factory as ViewFactory;
class AppServiceProvider extends ServiceProvider
{
@majidalavizadeh
majidalavizadeh / Tabler_on_Laravel.md
Last active July 7, 2024 09:01
Use Tabler on laravel

This is a simple instruction to use Tabler in your next Laravel project.

(Tabler is a beautiful dashboard: https://tabler.io/)

How to install:

  1. first of all run content of gistfile1.txt in your Laravel project.
  2. Copy tabler.js to recourses/js.
  3. Copy tabler.scss to resources/sass.
  4. Replace webpack.mix.js with your current webpack.mix.js
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
class LoginController extends Controller
{
@tanaikech
tanaikech / submit.md
Last active February 11, 2024 06:29
Retrieving Screen Shots of Sites using Google Apps Script

Retrieving Screen Shots of Sites using Google Apps Script

This is a sample script for retrieving screen shots of sites using Google Apps Script. In order to retrieve the screen shot, here, I used PageSpeed API.

When you use this, please copy and paste the following script, and set an URL you want to retrieve a screen shot.

var siteUrl = "### URL you want to retrieve a screen shot. ###";
var url =
  "https://www.googleapis.com/pagespeedonline/v4/runPagespeed?screenshot=true&fields=screenshot&url=" +
 encodeURIComponent(siteUrl);
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active July 22, 2024 09:05
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for...i or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

@FlaShG
FlaShG / CanvasPositioningExtensions.cs
Last active July 12, 2024 20:51
A small Unity helper class to convert viewport, screen or world positions to canvas space.
using UnityEngine;
/// <summary>
/// Small helper class to convert viewport, screen or world positions to canvas space.
/// Only works with screen space canvases.
/// </summary>
/// <example>
/// <code>
/// objectOnCanvasRectTransform.anchoredPosition = specificCanvas.WorldToCanvasPoint(worldspaceTransform.position);
/// </code>