Skip to content

Instantly share code, notes, and snippets.

subudeepak /
Last active Jun 24, 2021
Latex - Long Equation in a 2 column environment

What is this

In latex there is a problem with adding long equations to a paper. Suggestions like converting the equation to a figure first are more troublesome than any help. The physics journals have already implemented something called widetext and this is quite useful. That being said, this is a very simple feature. It exists, though guides are not quite useful.

Instructions are below ..

Packages to add

subudeepak /
Last active Aug 29, 2015
The functionality exists but only native implementation seem to be able to use it

The button click in JavaScript

I have always wondered why the button click could be simulated using the event. I mean if only we could ensure that any click event that originates must be a click event because of user interaction, it would make life just a step better right ! So many form submits under malicious circumstances could be avoided. [For the technically informed: Of course there are workarounds that need other mechanisms in place]. A sample code of how this can be done is here

So this week I was working on the HTML5's full screen API. I am not a major audio/visual person so I have not had the pleasure of exploring this API before. I was planning on hosting a presentation online. Like many of us I chose to use JS to write this 'modern' presentation. In my computer, I generally use the presentation mode of chromium thereby making it a good solution without the need to use the terrible api of HTML5. It is not terrible because of the spec

subudeepak /
Last active Jun 4, 2022
The problems and some security implications of websockets - Cross-site WebSockets Scripting (XSWS)

WebSockets - An Introduction

WebSockets is a modern HTML5 standard which makes communication between client and server a lot more simpler than ever. We are all familiar with the technology of sockets. Sockets have been fundamental to network communication for a long time but usually the communication over the browser has been restricted. The general restrictions

  • The server used to have a permanent listener while the client (aka browser) was not designated any fixed listener for a more long term connection. Hence, every communication was restricted to the client demanding and the server responding.
  • This meant that unless the client requested for a particular resource, the server was unable to push such a resource to the client.
  • This was detrimental since the client is then forced to check with the server at regular intervals. This meant a lot of libraries focused on optimizing asynchronous calls and identifying the response of asynchronous calls. Notably t
subudeepak / nganimate.css
Created Mar 21, 2014
My nganimate for ngview
View nganimate.css
.view-animate {
}, {
-webkit-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
-moz-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
-ms-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
-o-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
subudeepak / angular-prettyprint.js
Last active May 16, 2017
Angular Prettyprint with linenums
View angular-prettyprint.js
function replaceText(str)
var str1 = String(str);
return str1.replace(/\n/g,"<br/>");
app.directive('prettyprint', function() {
return {
restrict: 'C',
link: function postLink(scope, element, attrs) {
subudeepak / angular-loadscript-with-documentwrite.js
Last active May 5, 2020 — forked from endorama/angular-loadscript.js
Loading scripts on ngInclude (ng route) - Script loading directive
View angular-loadscript-with-documentwrite.js
* This module is a variant which supports document.write. If you need document.write use this instead
* Author: Deepak Subramanian @subudeepak(
* Distributed under MIT License
/*global angular */
(function (ng) {
'use strict';
app.directive('script', function() {
return {