Skip to content

Instantly share code, notes, and snippets.

View isu3ru's full-sized avatar

Isuru Ranawaka isu3ru

  • Sri Lanka
  • 00:04 (UTC +05:30)
View GitHub Profile
@isu3ru
isu3ru / ubuntu-upgrade-packages.txt
Created April 21, 2018 04:34
How to upgrade packages in Ubuntu 16.04
sudo apt-get update
sudo apt-get upgrade
@isu3ru
isu3ru / view-php-version.txt
Created April 21, 2018 04:35
How to view php version in terminal
php --version
@isu3ru
isu3ru / composer-install-howto.txt
Created April 21, 2018 04:36
How to install composer in ubuntu and mac
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
composer global require "laravel/installer"
@isu3ru
isu3ru / media-query.css
Created August 23, 2018 16:03 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@isu3ru
isu3ru / passgen.js
Created December 6, 2018 17:31
Password generator function in javascript
function generate(size) {
let config = {
numbers: true,
symbols: false
};
// add symbols if needed
// config.symbols = true;
let alphabet_low = "abcdefghijklmnopqrstuvwxyz"
let alphabet_up = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#go to the conf folder
cd /etc/apache2/sites-available
#create the new .conf file
sudo vi myapp.com.conf
#Add the following content to your .conf file
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName myapp.com
<?php
public function getNextDays($day = 'Tue', $count = '+2', $type = 'months') {
// current date
$today = date('Y-m-d');
// add 2 months to date
$twoMonthsLater = date('Y-m-d', strtotime(sprintf('%s %s', $count, $type)));
// set begin date of the range (today or any other date)
$begin = new \DateTime($today);
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ceytechmarker.docx;
import java.util.HashMap;
import java.util.Scanner;
@isu3ru
isu3ru / PasswordGenerate.js
Created November 17, 2020 12:04
Simple function to generate a random text that can be used as a password in most cases
/**
* Generate Password Function
* A simple javascript function to generate a random text that can be used as a password in most cases
* NOTES: Does not contain special characters. Only numbers 0 (zero) to 9 (Nine) and English alphabet letters.
*
* @author Isuru Ranawaka ([email protected])
*/
function generatePassword() {
// Numbers and alphabet characters
const characters = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "[", "]", "^", "_", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];