Skip to content

Instantly share code, notes, and snippets.

👨‍💻
Trying Really Hard

Praveen Puglia praveenpuglia

👨‍💻
Trying Really Hard
Block or report user

Report or block praveenpuglia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@praveenpuglia
praveenpuglia / $.post_Template.js
Created Mar 19, 2013
just the javascript needed to do an ajax request using jquery.
View $.post_Template.js
$(document).ready(function() {
$("#loadAjax").on("click",function(){
$(".ajax-content").html("Loading...");
$.post("ajaxCustomerIdName.jsp", {
url : "Something"
}, function(data) {
console.log(data);
$(".ajax-content").html(data);
});
View CSS Variables - Thoughts.md

Thanks for replying to me! :)

I really didn't know about the recommendation process back then. It's pretty recent that I came to know about it. I am not sure if any of the suggestion helps at the moment since it's now a recommendation.

I am also sure that the working group must have thought about exhaustive scenarios so I may not even be making a point.

I know $ or @ couldn't be used since they were already getting used in preprocessors and @ specifically, I feel, wouldn't go with the existing syntax of CSS.

I met Chris Lilley few days ago and I came to know that $ could be used but it would create multiple problems.

@praveenpuglia
praveenpuglia / localStorageTest.html
Created Aug 24, 2013
A small demo on localstorage...
View localStorageTest.html
<!DOCTYPE html>
<html>
<head>
<title>Local Storage</title>
</head>
<body>
<form action="">
<textarea name="comment" id="comment" cols="30" rows="10"></textarea>
Draft last saved at : --- <div id="updateTime"></div>
<input type="submit">
@praveenpuglia
praveenpuglia / storageEvent.html
Created Aug 24, 2013
localStorage storage event example
View storageEvent.html
<!DOCTYPE html>
<html>
<head>
<title>Local Storage</title>
</head>
<body>
<form action="">
<input name="comment" id="comment"></input>
<input type="submit">
</form>
View hcf.js
function hcf(n1, n2){
var hcf = (n1 > n2) ? findHcf(n2, n1) : findHcf(n1, n2);
console.log("HCF of ", n1, " & ", n2, " is ", hcf);
}
function findHcf(b, a) {
console.log("Divisor : ", b," Dividend: ", a);
var q, r;
q = Math.floor(a/b);
r = a - b*q;
@praveenpuglia
praveenpuglia / debug.component.ts
Created Mar 23, 2018
Simple Component that dumps prettified data in any template.
View debug.component.ts
import { Component, Input } from '@angular/core';
@Component({
selector: 'dump',
template: `
<pre><code>{{data | json}}</code></pre>
`,
styles: [
`
:host {
@praveenpuglia
praveenpuglia / webpack.config.js
Last active Apr 11, 2018
Simplest webpack 4 configuration to work with vuejs & scss
View webpack.config.js
// Require things!
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
// The configuration starts here!
module.exports = {
// The entry point for webpack to start generating a dependency graph.
entry: { index: './src/index.js' },
@praveenpuglia
praveenpuglia / access-state.ts
Last active Apr 25, 2018
Access state inside an ngrx effect
View access-state.ts
// In the Effect's constructor, inject store.
constructor(private store: Store<AppState>)
...
@Effect()
fetchUserProfile$: Observable<Action> = this.actions$.pipe(
ofType<FetchUserProfile>(UserActionTypes.FETCH_USER_PROFILE),
withLatestFrom(this.store),
mergeMap(([action, appState]) => {
return this.http
.get(
@praveenpuglia
praveenpuglia / no-dispatch.ts
Last active Apr 25, 2018
Do not dispatch an action from an ngrx effect
View no-dispatch.ts
@Effect({ dispatch: false })
logout$: Observable<Action> = this.actions$.pipe(
ofType(UserActionTypes.LOGOUT),
tap(action => {
delete window.localStorage.user;
this.router.navigate(['login']);
})
);
@praveenpuglia
praveenpuglia / cancel-request.ts
Created Apr 25, 2018
Cancel in flight / ongoing network request - ngrx effects
View cancel-request.ts
@Effect()
getTabData$: Observable<Action> = this.actions$.pipe(
ofType<FetchTabData>(TabActions.FETCH_TAB_DATA),
switchMap(action => {
const tabType = action.payload;
return this.http
.get(`${environment.apiUrl}/api/tab/${tabType}`)
.pipe(
map((response: any) => {
return new FetchTabDataSuccess(response.data);
You can’t perform that action at this time.