Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Looking for new challenges

KULDIP PIPALIYA kuldipem

:shipit:
Looking for new challenges
View GitHub Profile
@kuldipem
kuldipem / android-os-and-browser-detect
Created Aug 20, 2014
Javascript snippet to detect android mobile,browser (Stock browser) and get OS version
View android-os-and-browser-detect
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() {
View node-and-npm-in-30-seconds.sh
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 / install.php
Last active Aug 29, 2015
To install tables using php from .sql file.
View install.php
<?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';
@kuldipem
kuldipem / util-functions
Last active Aug 29, 2015
get unique values within range
View util-functions
<?php
function getUniqeValueWithinRang($count=10,$min=0,$max=10){
$uniqValuesInRange=[];
for($j=0;$j<$count;$j++){
$ran=rand($min,$max);
while(in_array($ran=rand($min,$max), $uniqValuesInRange));
array_push($uniqValuesInRange, $ran);
}
return $uniqValuesInRange;
View ubuntu-php-development-environment.md

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for a live environment!

I hope it helps you too!

fyi @mheiniger and me started with an installer here: https://github.com/mheiniger/webdev-setup

View DropEntityTableCommand
<?php
namespace Kem\CoreBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@kuldipem
kuldipem / iloveyou.c
Created Jul 21, 2015
Want to impress your girlfriend/boyfriend by your coding skill ?
View iloveyou.c
/*
* File: main.c
* Author: KULDIP PIPALIYA <kuldipem@gmail.com>
*
* Created on 17 July, 2015, 10:17 AM
*/
#include <stdio.h>
#include <stdlib.h>
@kuldipem
kuldipem / SassMeister-input.scss
Created Nov 27, 2015
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// libsass (v3.2.5)
// ----
$colors: #800080, #ff0000, #dc143c, #ff4500, #ff0000,#ffa500,#ff4500,
#ffd700,#ffa500,#9acd32,#ffd700,#008000,#9acd32,#4682b4,#87ceeb,#9370db,
#4682b4,#800080,#9370db;
$max: length($colors);
$dash: 10;
@kuldipem
kuldipem / jquery.alterclass.js
Created Apr 5, 2016 — forked from peteboere/jquery.alterclass.js
jQuery alterClass plugin: Remove element classes with wildcard matching. Optionally add classes.
View jquery.alterclass.js
/**
* jQuery alterClass plugin
*
* Remove element classes with wildcard matching. Optionally add classes:
* $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
*
* Copyright (c) 2011 Pete Boere (the-echoplex.net)
* Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
*
*/