Skip to content

Instantly share code, notes, and snippets.

View sasikanth's full-sized avatar

Sasi Kanth Nimmagadda sasikanth

View GitHub Profile
@sasikanth
sasikanth / app.component.ts
Created April 27, 2019 11:29 — forked from tomastrajan/app.component.ts
Angular Material Theming - overlay handling
import { OverlayContainer } from '@angular/cdk/overlay';
export class AppComponent implements OnInit {
// use this to set correct theme class on app holder
// eg: <div [class]="themeClass">...</div>
themeClass: string;
constructor(
private overlayContainer: OverlayContainer
@sasikanth
sasikanth / fix-homebrew-npm.md
Created April 26, 2019 12:11 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

@sasikanth
sasikanth / custom_contentType_spec.js
Last active July 27, 2016 15:23
Workaround for providing custom content-type - FrisbyJs 0.8.x
var frisby=require('frisby');
frisby.create('test')
.post('http://httpbin.org/post',
{
"input": "data",
"url": "http://httpbin.org/get"
},
{
json:true
}
@sasikanth
sasikanth / Gzip sample _spec.js
Created July 27, 2016 15:19
Convert gzip formatted response - FrisbyJs 0.8.x
frisby.create('Gzip Sample')
.get('http://httpbin.org/gzip', {gzip : true})
.inspectBody()
.expectHeader('content-encoding', 'gzip')
.toss();
@sasikanth
sasikanth / verify if header is present _spec.js
Created July 27, 2016 15:16
How to assert on header key and not the value - Using FrisbyJs v0.8.x
var frisby = require("frisby");
frisby.create("Sample header test case")
.get("http://httpbin.org/response-headers?key=value")
.expectHeader("key",'value') // checks for equality.
.expectHeaderToMatch("key",'') // checks if 'key' exists & matches the pattern ''
.expectHeaderToMatch("key",'lue') // checks if 'key' exists & matches the pattern 'lue'
.after(function(err,res,body){
console.log(res.headers);
expect(res.headers.key).toBeDefined();
@sasikanth
sasikanth / gunzip_spec.js
Created September 28, 2015 06:45
Frisby test : How to decompress a raw Buffer with Gunzip.( Asynchronously )
//gunzip Sample
var frisby=require('frisby');
var zlib = require('zlib');
var tc02 = frisby.create('Gzip Test');
tc02.get('http://httpbin.org/gzip', { encoding: null })
.after(function(error, response, body){
if (!error && response.statusCode == 200) {
var encoding = response.headers['content-encoding']
if (encoding && encoding.indexOf('gzip') > -1) {
@sasikanth
sasikanth / gunzipSync_spec.js
Created September 28, 2015 06:43
Frisby test : Decompress a raw Buffer with Gunzip.(Synchronously)
//gunZipSync sample
var frisby=require('frisby');
var zlib = require('zlib');
var tc01 = frisby.create('Gzip Test');
tc01.get('http://httpbin.org/gzip', { encoding: null} )
.after(function(error, response, body){
if (!error && response.statusCode == 200) {
var encoding = response.headers['content-encoding']
if (encoding && encoding.indexOf('gzip') > -1) {