Skip to content

Instantly share code, notes, and snippets.

View kuldipem's full-sized avatar
:shipit:
Looking for new challenges

KULDIP PIPALIYA kuldipem

:shipit:
Looking for new challenges
View GitHub Profile
@kuldipem
kuldipem / install.php
Last active August 29, 2015 14:21
To install tables using php from .sql file.
<?php
if($_SERVER['REQUEST_METHOD']=="POST"){
if(empty($_POST["inputHost"]) ||
empty($_POST["inputDb"]) ||
empty($_POST["inputUsr"]) ||
empty($_POST["inputPwd"]) ||
die("<h1>All fields are required.</h1>");
}else{
// Name of the file
$filename = 'shoping.sql';
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@kuldipem
kuldipem / android-os-and-browser-detect
Created August 20, 2014 07:09
Javascript snippet to detect android mobile,browser (Stock browser) and get OS version
var android = {
uAString: function() {
return navigator.userAgent;
},
// Android Mobile
isAndroidMobile: function() {
return android.uAString().indexOf('Android') > -1 && android.uAString().indexOf('Mozilla/5.0') > -1 && android.uAString().indexOf('AppleWebKit') > -1;
},
// Android Browser (not Chrome)
regExAppleWebKit: function() {