Skip to content

Instantly share code, notes, and snippets.

View samarpanda's full-sized avatar
👋

Samar Panda samarpanda

👋
View GitHub Profile
{
/*** Globals ***/
// To ignore any custom global variables, enable the `predef` option and list
// your variables within it.
"predef": [
"exports",
"YUITest",
"YUI",
"YUI_config",
"YAHOO",
@samarpanda
samarpanda / gist:9dac392d37bf3baa6270
Created June 18, 2014 02:53
_fbq.push.toSting()
/*
* _fbq used for facebook custom audience
* Array.push overriden
*/
function (t) {
if (Object.prototype.toString.call(t) !== '[object Array]') return false;
var u = t.shift();
if (!u) return false;
var v = f[u];
if (typeof v !== 'function') return false;
@samarpanda
samarpanda / index.js
Created July 16, 2014 12:41
node_modules/gulp-ruby-sass/index.js
'use strict';
var fs = require('fs');
var path = require('path');
var chalk = require('chalk');
var dargs = require('dargs');
var slash = require('slash');
var gutil = require('gulp-util');
var spawn = require('win-spawn');
var eachAsync = require('each-async');
var intermediate = require('gulp-intermediate');
@samarpanda
samarpanda / index.js
Created July 20, 2014 08:56
Debugging an issue with gulp-ruby-sass. Index.js
'use strict';
var fs = require('fs');
var path = require('path');
var chalk = require('chalk');
var dargs = require('dargs');
var slash = require('slash');
var gutil = require('gulp-util');
var spawn = require('win-spawn');
var eachAsync = require('each-async');
var intermediate = require('gulp-intermediate');
@samarpanda
samarpanda / Eval_VS_Function.js
Created July 22, 2014 08:58
Difference between using eval and new Function.
/**
* test1();
* Output: 22
*/
function test1(){
var a = 11;
eval('(a = 22)');
alert(a);
}
#!/bin/bash -eu
#
# Color log4j-style logs for easier visual parsing.
#
# Usage:
# tail foo.log | log-color
# run-service | log-color
black="` tput setaf 0; tput bold`"
red="` tput setaf 1; tput bold`"
  1. ###Feature Testing Checkfor the existence of a method and checks that i returns the correct output

  2. ###Feature Detection Check for the existence of a method

  3. ###Weak Inference Check for the existence of an unrelated method

  4. ###User Agent Sniffing

@samarpanda
samarpanda / Benchmark_test_execution.md
Last active August 29, 2015 14:06
How a benchmark test is executed!

Benchmark.js how it works

  • For each benchmark in a suite:
    • Fire event: Suite.onStart()
    • For each benchmark:
    • Fire event: Benchmark.onStart()
    • For each sampled run
      • Run unit once to check for errors
        1. setup()
  1. testfn()
@samarpanda
samarpanda / .zshrc
Last active August 29, 2015 14:08 — forked from SlexAxton/.zshrc
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@samarpanda
samarpanda / LogTail.md
Last active August 29, 2015 14:08
Atom colourful tails
function atomuitail(){
  tail -f $1 | awk '
    /MEMC/ {print "\033[32m" $0 "\033[39m"}
    /DEBUG/ {print "\033[32m" $0 "\033[39m"}
    /ERROR/ {print "\033[31m" $0 "\033[39m"}
    /error_message/ {print "\033[31m" $0 "\033[39m"}
  '
}