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 / .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/
@kuldipem
kuldipem / angularjs-interceptor.js
Created July 12, 2016 19:34 — forked from gnomeontherun/angularjs-interceptor.js
Intercept XHR/Ajax requests with AngularJS http interceptors. This allows you to globally intercept and modify requests and responses. You don't need to declare all of the methods, just the ones you need. Some example uses would be logging errors, adding extra headers, or triggering 'loading' screens. This intercepts ALL requests/responses, so y…
// Intercepting HTTP calls with AngularJS.
angular.module('MyApp', [])
.config(function ($provide, $httpProvider) {
// Intercept http calls.
$provide.factory('MyHttpInterceptor', function ($q) {
return {
// On request success
request: function (config) {
// console.log(config); // Contains the data about the request before it is sent.
@kuldipem
kuldipem / app-exit.js
Created July 12, 2016 19:36
Cordova/PhoneGap exit app after twice press back button with toast ( plugin required https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin )
var lastTimeBackPress=0;
var timePeriodToExit=2000;
function onBackKeyDown(e){
e.preventDefault();
e.stopPropagation();
if(new Date().getTime() - lastTimeBackPress < timePeriodToExit){
navigator.app.exitApp();
}else{
window.plugins.toast.showWithOptions(
$("#freePlayerPlayBtn").on('click',function(){
kemMediaPlayer.initMedia(src,$("#freePlayerPlayBtn"),$("#freePlayerVolumeBar"),$("#freePlayerSeekeBar"),$("#freePlayerTotalDurationDisplay"),$("#freePlayerPlayedDurationDisplay"));
});
$("#fullPlayerPlayBtn").on('click',function(){
kemMediaPlayer.initMedia(src,$("#fullPlayerVolumeBar"),$("#fullPlayerVolumeBar"),$("#fullPlayerSeekeBar"),$("#fullPlayerTotalDurationDisplay"),$("#fullPlayerPlayedDurationDisplay"));
});
function tattoo_submit() {
if (isset($_POST["addtattoo"])) {
$title = "Tattoo : ". $_POST["tatooInput"];
$my_post = array(
'post_title' => $title,
'post_status' => 'publish',
'post_author' => 1,
@kuldipem
kuldipem / class_decorator.ts
Created August 5, 2017 08:55 — forked from remojansen/class_decorator.ts
TypeScript Decorators Examples
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
@kuldipem
kuldipem / random.js
Created October 12, 2017 11:24
random number
/**
* Returns a random number between min (inclusive) and max (exclusive)
*/
function getRandomArbitrary(min, max) {
return Math.random() * (max - min) + min;
}
/**
* Returns a random integer between min (inclusive) and max (inclusive)
* Using Math.round() will give you a non-uniform distribution!
import {AfterViewInit, Component, ViewChild} from '@angular/core';
import {FetchJsonService} from './services/fetch-json.service';
import {FormBuilderService} from './services/form-builder.service';
import FieldType from './class/ui/form/field/field-type';
import FormType from './class/ui/form/form-type';
import 'brace/mode/html';
import 'brace/mode/typescript';
import { setTimeout } from 'timers';
import './windowFixed.js';
import {AfterViewInit, Component, ViewChild} from '@angular/core';
import {FetchJsonService} from './services/fetch-json.service';
import {FormBuilderService} from './services/form-builder.service';
import FieldType from './class/ui/form/field/field-type';
import FormType from './class/ui/form/form-type';
import 'brace/mode/html';
import 'brace/mode/typescript';
import { setTimeout } from 'timers';
import './windowFixed.js';
@kuldipem
kuldipem / ubuntu.sh
Created November 23, 2017 14:47
ubuntu helping cmds cheatsheet
gnome-desktop-item-edit ~/Desktop/ --create-new #create new desktop shortcut