Getting the config variables \Config::get(‘app.name’); use Config; … Config::get(‘app.name’); config(‘app.name’); Add new environment settings Method 1 – .env DEFAULT_LANGUAGE=ENG Method 2 – config file ( config.app.php | OR | config.services.php ) return [ ‘default_language’ => env(‘DEFAULT_LANGUAGE’ , ‘ENG’ ); ]; Getting the value // Good $language = […]
Vagrant environment
Working with Virtual environment Starting up Vavgrant ( Need to have setup a VM software like VB ) vagrant init Basics # add a box vagrant box add ubuntu/trusty64 # check existing box vagrant box list # update a box vagrant box update –box box_name # remove a box vagrant […]
OOP Create a tree
<?php function towerBuild( $n ) { $tower = new Tower($n); return $tower->build(); } class Tower { protected $height; protected $tower = []; public function __construct(int $height) { $this->height = $height; } public function build() { for ( $i = 1; $i <= $this->height; $i++ ) { $this->tower[] = $this->addFloor($i); } […]
Custom shortcodes WordPress
First create the shortcode in the backend function custom_avatar_function() { return ‘<img src=”https://blog.sergiobasic.com/wp-content/uploads/2021/04/Asset-1.png” alt=”doti-avatar” width=”96″ height=”96″ class=”left-align” />’; } add_shortcode(‘custom_avatar_function_avatar’, ‘custom_avatar_function_avatar_function’); function custom_avatar_function_rating_function( $atts = array() ) { // set up default parameters extract( shortcode_atts( array( ‘stars’ => ‘5’, ), $atts )); return ‘<img src=”https://blog.sergiobasic.com/wp-content/uploads/2021/04/Asset-1.png” alt=”custom-avatar” width=”96″ height=”96″ class=”left-align” />’; […]
Node JS basics
Reading file fs.readFile(‘notes.log’, function(err, data) { if(err) throw err; console.log(data.toString()); }); Get file lines fs.readFile(‘customlog.log’, function(err, data) { if(err) throw err; var fileLines = data.toString().split(“\n”); console.log(fileLines); }); Write file arr = fs.writeFile(“./note.txt”, “hello”, function(err) { if( err ) throw err; console.log(“hello > 2.js”); }) Create directory fs.mkdir(‘folder1’, function(e) { if(e […]
Java App dev JavaFx + SceneBuilder
Using amazon cornetto SDK Download it from official Amazon link Get JavaFx FX link On Intelij -> New Project -> Java FX Add the javaFx lib folder to the project library as External Library: File -> Project Structure -> Libraries Edit Configurations -> VM Options –module-path C:\java\javafx-sdk-16\lib –add-modules javafx.controls,javafx.fxml Using […]
Json-server & Axios
Example of an express app app.get(‘/’, async (request, response) => { axios.post(‘http://localhost:3001/posts’, { id: 3, title: ‘test2’ }).then(resp => { console.log(resp.data); }).catch(error => { console.log(error); }); // response.send(‘hello’); const getDb = await axios.get(‘http://localhost:3001/posts’); console.log(getDb.data) response.render(‘index’, { custdata: getDb.data } ); console.log(‘active’); }); More info can be found here
Pug – Html preprocessor
Install npm init -y npm install express Create main.js file const { default: axios } = require(‘axios’); const express = require(‘express’); const app = express(); app.set(‘view engine’, ‘pug’); app.get(‘/’, async (request, response) => { // response.send(‘hello’); const getDb = await axios.get(‘http://localhost:3001/posts’); console.log(getDb.data) response.render(‘index’, { custdata: getDb.data } ); console.log(‘active’); }); […]
CSS Positioninig – image backgrounds sprites
Example Image Selecting particular image from a selection .icon-youtube { background-image: url(../../themes/Frontend/Paxton/frontend/_public/src/img/sprite.png); background-position: -72px -209px; width: 24px; height: 17px; } <a href=”#” target=”_blank” title=”YouTube” rel=”noopener”><i class=”icon icon-youtube”></i></a> .icon { display: inline-block; text-indent: 100%; white-space: nowrap; overflow: hidden; }
cPanel Bit
Sections ( click to scrool to required ) sec_sections sec_blog sec_microblog sec_cms sec_forum sec_image sec_wiki sec_networking sec_ads sec_calendar sec_gaming sec_mail sec_analytic sec_management sec_ecommerce sec_erp sec_books sec_support sec_framework sec_education sec_dbtool sec_music sec_video sec_rss sec_filemanage sec_other Blogs WordPress Pubvana Serendipity Dotclear b2evolution Textpattern Nibbleblog HTMLy LifeType Nucleus SitePad Chyrp FlatPress PivotX Leafpub […]