Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Faysal Ahamed devfaysal

🏠
Working from home
View GitHub Profile
View countdown_timer.js
var endDate = new Date("Feb 5, 2021 12:00:00 GMT-0800").getTime();
var timer = setInterval(function() {
let now = new Date().getTime();
let t = endDate - now;
if (t >= 0) {
let days = Math.floor(t / (1000 * 60 * 60 * 24));
View OpenGraphImageController.php
<?php
namespace App\Http\Controllers;
use GDText\Box;
use GDText\Color;
use App\Post;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
View vscode shortcut.txt
Bulk Multiple cursor:
Mark all then Atl + shift + i
@devfaysal
devfaysal / cloudSettings
Last active Sep 7, 2021
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2021-09-07T03:32:21.974Z","extensionVersion":"v3.4.3"}
@devfaysal
devfaysal / composer.json
Last active Dec 14, 2019
Add local composer package
View composer.json
"repositories": [
{
"type": "path",
"url": "../pkg/laravel-admin"
},
{
"type": "vcs",
"url": "git@bitbucket.org:vendor/my-private-repo.git"
}
]
View csv-to-json.php
<?php
/*
* Converts CSV to JSON
* Example uses the csv file of this gist
*/
$feed="https://gist.githubusercontent.com/devfaysal/9143ca22afcbf252d521f5bf2bdc6194/raw/ec46f6c2017325345e7df2483d8829231049bce8/data.csv";
//Read the csv and return as array
$data = array_map('str_getcsv', file($feed));
//Get the first raw as the key
$keys = array_shift($data);
@devfaysal
devfaysal / app.scss
Last active Aug 20, 2019
Up and running Tailwindcss in Laravel app
View app.scss
@import "./node_modules/tailwindcss/base";
@import "./node_modules/tailwindcss/components";
@import "./node_modules/tailwindcss/utilities";
View override-search-title-meta.php
function custom_title($title_parts) {
if ( is_search() ) {
$title_parts['title'] = get_search_query();
}
return $title_parts;
}
add_filter( 'document_title_parts', 'custom_title' );
@devfaysal
devfaysal / image-preview.js
Created Nov 13, 2018
Preview Image while uploading
View image-preview.js
//<input onchange="previewFile('#logo_preview', '#logo')" id="logo" type="file" name="logo">
//<img id="logo_preview" src="">
function previewFile(preview, source) {
var preview = document.querySelector(preview);
var file = document.querySelector(source).files[0];
var reader = new FileReader();
reader.onloadend = function () {
preview.src = reader.result;
@devfaysal
devfaysal / email_scrape.php
Created Sep 10, 2018 — forked from aramk/email_scrape.php
Scrape emails from a given URL in PHP. Using it to invite people to Google+, for now :)
View email_scrape.php
<?php
$url = 'http://computerandu.wordpress.com/2011/06/29/how-to-get-google-invite/';
$emails = scrape_email($url);
echo implode($emails, ' ');
function scrape_email($url) {
if ( !is_string($url) ) {
return '';
}