Skip to content

Instantly share code, notes, and snippets.

View davidsekar's full-sized avatar
🏠
Working from home

David Gnanasekaran davidsekar

🏠
Working from home
View GitHub Profile
@davidsekar
davidsekar / BSNL Injected Illegal Ads.js
Last active October 28, 2020 08:58
BSNL telecom provider has injected AD, tracking scripts in the websites browsed by their customers. More analysis on this post - https://davidsekar.com/misc/bsnl-isp-injects-illegal-ad-scripts
'use strict';
function ctSuperFunction() {
function loadAd$jscomp$0() {
try {
if (jqNoti(_0x982e$jscomp$0[6] + AD_ID$jscomp$0)[_0x982e$jscomp$0[5]] === 0 && matchedView !== undefined && matchedView !== null) {
var _0xec25xb$jscomp$0 = matchedView[_0x982e$jscomp$0[7]];
switch (_0xec25xb$jscomp$0) {
case _0x982e$jscomp$0[8]:
case _0x982e$jscomp$0[9]:
@davidsekar
davidsekar / SassMeister-input.scss
Last active July 29, 2016 21:37
Scss force get hex value for the provided colour
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
@function returnHexValue($color){
@debug $color;
@if $color == "white" {
@return "#fff";
}
@davidsekar
davidsekar / icheck.directive.js
Created May 25, 2016 19:15
Angular directive for iCheck checkbox & radio buttons
angular.module("app")
.directive('icheck', function ($timeout, $parse) {
return {
require: 'ngModel',
link: function ($scope, element, $attrs, ngModel) {
return $timeout(function () {
var value;
value = $attrs['value'];
$scope.$watch($attrs['ngModel'], function (newValue) {
@davidsekar
davidsekar / gulpfile.js
Created April 22, 2016 18:18
Typical Gulp file for SASS and Typescript development projects
'use strict';
var gulp = require('gulp'),
sass = require('gulp-sass'),
plumber = require('gulp-plumber'),
autoprefixer = require('gulp-autoprefixer'),
sourcemaps = require('gulp-sourcemaps'),
ts = require('gulp-typescript'),
notify = require("gulp-notify"),
through = require('through2');
@davidsekar
davidsekar / Global.asax
Created April 22, 2016 18:12
Sitefinity – Add auto generated product detailed page URLs to Sitemap XML by hooking to ISitemapGeneratorBeforeWriting
protected void Application_Start(object sender, EventArgs e)
{
Telerik.Sitefinity.Abstractions.Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(this.Bootstrapper_Initialized);
}
private void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
{
if (e.CommandName == "Bootstrapped")
{
EventHub.Subscribe<ISitemapGeneratorBeforeWriting>(Before_Writing);
@davidsekar
davidsekar / Global.asax
Created April 22, 2016 18:05
Sitefinity – Create dynamic sitemap XML
protected void Application_BeginRequest(object sender, EventArgs e)
{
string strUrl = Request.Path.ToLowerInvariant();
//Code block to redirect the generic request to the correct sitemap index and sitemap XML
if (new Regex(@"^/sitemap\.xml", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant).IsMatch(Request.Path))
HttpContext.Current.RewritePath("/sitemap.ashx");
}
@davidsekar
davidsekar / Seive of Eratosthenes.cs
Last active June 25, 2023 19:24
C# - Program to find all primes upto a given number (Seive of Eratosthenes)
using System;
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Enter the number upto which you want to list primes");
int n = Convert.ToInt32(Console.ReadLine());
bool[] prime = new bool[n + 1]; // default value is false for boolean
@davidsekar
davidsekar / sticky-footer.css
Last active November 17, 2015 08:22
Simple HTML & CSS for creating a sticky footer that stays at the bottom of browser window even if the content is less than the window height. For lengthy pages the footer will flow at the end of the content.