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
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 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';
@kuldipem
kuldipem / util-functions
Last active August 29, 2015 14:22
get unique values within range
<?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;

#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

find . -type f -iname '*.pdf'
<?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 July 21, 2015 14:44
Want to impress your girlfriend/boyfriend by your coding skill ?
/*
* 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 November 27, 2015 19:56
Generated by SassMeister.com.
// ----
// 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 April 5, 2016 09:20 — forked from peteboere/jquery.alterclass.js
jQuery alterClass plugin: Remove element classes with wildcard matching. Optionally add classes.
/**
* 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
*
*/
@kuldipem
kuldipem / .htaccess
Created July 12, 2016 06:50 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/