Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Vivek Kumar Bansal vkbansal

💭
I may be slow to respond.
Block or report user

Report or block vkbansal

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
@vkbansal
vkbansal / .gitignore
Last active Apr 17, 2019
Printing TypeScript code from AST
View .gitignore
node_modules
View noNegateNumbersRule.ts
/**
* This rules checks for negation on number type
*
* @example
* let x: number = 10;
*
* // The following will be considered as warning
* // as this will fail for cases for when x === 0
* if (!x) {
* }
@vkbansal
vkbansal / cloudfront-invalidation.js
Last active Oct 6, 2017
cloudfront invalidation
View cloudfront-invalidation.js
const Cloudfront = require('aws-sdk/clients/cloudfront');
const cf = new Cloudfront({
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
apiVersion: '2017-03-25'
});
cf.createInvalidation({
DistributionId: process.env.CLOUDFRONT_DISTRIBUTION_ID,
@vkbansal
vkbansal / commands.sh
Last active Sep 13, 2017
CertBot + S3 + CloudFront SSL Certificates
View commands.sh
# Generate Challenge
certbot certonly -d your-domain.com -d www.your-domain.com --manual
## save challenge to your-domain.com/.well-known/acme-challenge/<some_long_string>
echo "challenge text" > challenge.txt
# upload challenge
aws s3 cp challenge.txt \
s3://<BUCKET-NAME>/.well-known/acme-challenge/<some_long_string> \
--content-type text/plain
View slider.js
(function($) {
var Plugin, Slider, defaults, old;
defaults = {
delay: 5000,
duration: 600,
autoplay: true
};
/*
FILETREE CLASS DEFINITION
View eslint.analyze.js
// run this before
// npm run eslint > lint.log
const fs = require('fs');
let data = fs.readFileSync('./lint.log', 'utf8');
let output = {};
for (let line of data.split('\n')) {
@vkbansal
vkbansal / gulpfile.js
Created Nov 25, 2015
browserify-gulp-task
View gulpfile.js
let browserify = require('browserify'),
watchify = require('watchify'),
babelify = require('babelify'),
stream = require('vinyl-source-stream'),
{ argv } = require('yargs');
module.exports = function (gulp, $, _) {
return function (options) {
let appBundler = browserify({
entries: [options.src],
View git.js
// handle some git configuration for windows
exports.spawn = spawnGit
exports.chainableExec = chainableExec
exports.whichAndExec = whichAndExec
var exec = require("child_process").execFile
, spawn = require("./spawn")
, npm = require("../npm.js")
, which = require("which")
@vkbansal
vkbansal / artisan.php
Created Mar 12, 2015
Tying to use artisan migrate commands outside laravel
View artisan.php
<?php
require_once "vendor/autoload.php";
use Symfony\Component\Console\Application;
use Illuminate\Database\Console\Migrations;
use Pimple\Container;
$container = new Container();
$container['migration-table'] = 'migration';
View svg_edit.js
var fs = require('fs'),
xml2js = require('xml2js');
var parser = new xml2js.Parser();
var builder = new xml2js.Builder({rootName: 'svg'});
fs.readFile(__dirname + '/../map.svg', function(err,data){
parser.parseString(data, function(err, xml){
var nodes = xml.svg.g[0].circle;
You can’t perform that action at this time.