Skip to content

Instantly share code, notes, and snippets.

View AshikNesin's full-sized avatar

Ashik Nesin AshikNesin

View GitHub Profile
@AshikNesin
AshikNesin / file-upload-check.md
Last active September 28, 2015 08:46
[Javascript] Stop Form submit if file upload field is empty
        if(document.getElementById("file-upload").value == "") {
            alert("You need to attach resume");
            return false;
        }
@AshikNesin
AshikNesin / file-upload-php-check.md
Last active September 28, 2015 09:13
[PHP] Check if user uploaded a file
if (isset($_FILES['file-upload']) && count($_FILES['file-upload']['error']) == 1 && $_FILES['file-upload']['error'][0] > 0)
	{
	// file not selected
	}
elseif (isset($_FILES['file-upload']))
	{ 
	//this is just to check if isset($_FILE). Not required.

	// file selected
@AshikNesin
AshikNesin / github-url.md
Last active February 4, 2024 17:42
Regular Expression to check GitHub Profile URL
/^(https?:\/\/)?(www\.)?github\.com\/[a-zA-Z0-9_]{1,25}$/igm

@AshikNesin
AshikNesin / apache-case-insensitive.md
Last active September 30, 2015 05:39
Make URL case insensitive in apache server

Enable mod-spelling module in apache server

a2enmod speling
service apache2 restart

Create an .htaccess file that includes the following lines:

@AshikNesin
AshikNesin / rails-new-directory.md
Created October 5, 2015 11:17
[Rails] Create Rails App in current directory

rails new .

@AshikNesin
AshikNesin / wp-server-setup.sh
Created October 13, 2015 13:20
WordPress Install in LAMP Server
wget http://wordpress.org/latest.tar.gz && tar xfz latest.tar.gz
mv wordpress/* ./
rmdir ./wordpress/ && rm -f latest.tar.gz
sudo chown -R www-data:www-data .
@AshikNesin
AshikNesin / ubuntu-setup.sh
Created October 23, 2015 07:19
Web Developer setup Ubuntu.sh
echo -e "\n--- Add some repos to update our distro ---\n"
sudo add-apt-repository ppa:atareao/telegram
sudo add-apt-repository ppa:saiarcot895/myppa # apt-fast repo
echo -e "\n--- Updating packages list ---\n"
sudo apt-get update
@AshikNesin
AshikNesin / jquery-scroll.js
Created November 6, 2015 12:08
jQuery Scroll Effect
$.fn.scrollView = function() {
return this.each(function() {
$('html, body').animate({
scrollTop: $(this).offset().top
}, 1000);
});
}
@AshikNesin
AshikNesin / remote-deploy.md
Created November 11, 2015 11:06
[Git] Automatic Deployment using hooks
#!/bin/sh
GIT_PATH="/var/repos/project-name.git" 
PROJECT_PATH="/var/www/project-name"
git --work-tree=$GIT_PATH --git-dir=$PROJECT_PATH checkout -f

Read more about Automatic Deployment using Git Hooks at CodeJets

@AshikNesin
AshikNesin / center-button.jade
Created January 27, 2016 18:15
Center Two Buttons in Div
.m-center(style="text-align: center; position:relative; width: 100%; border-width: 1px 0 0 0;")
button(class="ghost-button active-ghost-button" id="btn-iPhone" onclick="showiPhone();") iPhone
button(class="ghost-button active-ghost-button" id="btn-iPhone" onclick="showWatch();") Watch