Skip to content

Instantly share code, notes, and snippets.

View tarekmonjur's full-sized avatar

Tarek Monjur tarekmonjur

View GitHub Profile
FROM php:7.2-apache
WORKDIR /app
COPY . /app
ENV APACHE_DOCUMENT_ROOT /app
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
@tarekmonjur
tarekmonjur / slug.js
Created February 11, 2018 20:10 — forked from bentruyman/slug.js
JavaScript Slug Generator
// Generates a URL-friendly "slug" from a provided string.
// For example: "This Is Great!!!" transforms into "this-is-great"
function generateSlug (value) {
// 1) convert to lowercase
// 2) remove dashes and pluses
// 3) replace spaces with dashes
// 4) remove everything but alphanumeric characters and dashes
return value.toLowerCase().replace(/-+/g, '').replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
};
@tarekmonjur
tarekmonjur / input file text "no file select text" remove
Last active October 22, 2017 19:30
in html input file option remove the text "no file select"
------------- html ----------------
<div><input type='file' title="Choose a video please" id="aa" onchange="pressed()"><label id="fileLabel">Choose file</label></div>
----------- css ------------------
input[type=file]{
width:90px;
color:transparent;
}
---------------- javascript -------------
@tarekmonjur
tarekmonjur / composerbasic
Created August 16, 2017 07:51
the basic format of composer package
{
"name": "tarek/lcsv",
"description": "data read write into csv",
"type": "library",
"require": {
"php": "5.6.*",
"phpunit/phpunit": "^5.1"
},
"license": "MIT",
"authors": [
@tarekmonjur
tarekmonjur / mongodb.sh
Created July 30, 2017 10:57
install mongodb and php client
#!/bin/bash
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update
sudo apt-get install mongodb-org
@tarekmonjur
tarekmonjur / redis.sh
Created July 30, 2017 10:56
install redis and redis php client
#!/bin/bash
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install tcl8.5
cd /tmp
@tarekmonjur
tarekmonjur / phalconphp_php7_ubuntu_16_04.sh
Last active July 30, 2017 10:56
ubuntu environment setup for phalcon php with lamp
#!/bin/bash
# PhalconPhp with PHP7 installation on ubuntu:16.04
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install apache2
# -*- mode: ruby -*-
# vi: set ft=ruby :
#sudo nmcli connection reload && sudo systemctl restart network.service
Vagrant.configure("2") do |config|
config.vm.define :alpha do |alpha|
alpha.vm.box = "ubuntu/trusty64"
alpha.vm.network 'public_network', ip: '192.168.2.40'
alpha.ssh.forward_agent = true
Route::get('/test',function(){
$tests = DB::table('test')->whereRaw("not code REGEXP '^A-[0-9]|^D-[0-9]'")->get();
// dd($tests);
foreach($tests as $test){
if(preg_match("/^a[0-9]|^A[0-9]/", $test->code)){
$code = preg_replace("/[^0-9]/", 'A-',$test->code);
$codes[] = ['id'=>$test->id,'code'=> $code];
}
if(preg_match("/^D[0-9]|^d[0-9]/", $test->code)){
@tarekmonjur
tarekmonjur / convertNumber.js
Last active May 28, 2017 06:28
Number to amount words
function convertNumberToWords(amount) {
var words = new Array();
words[0] = '';
words[1] = 'One';
words[2] = 'Two';
words[3] = 'Three';
words[4] = 'Four';
words[5] = 'Five';
words[6] = 'Six';
words[7] = 'Seven';