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 / 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.
$("#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
@kuldipem
kuldipem / git cheat sheet.sh
Last active November 23, 2017 15:36 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@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() {