Skip to content

Instantly share code, notes, and snippets.

View gauravds's full-sized avatar
🚀
Focusing

Gaurav Sharma gauravds

🚀
Focusing
View GitHub Profile
@gauravds
gauravds / ProxyController.js
Created April 10, 2023 19:41 — forked from madrussa/ProxyController.js
Using node-http-proxy in AdonisJs as a controller action, allows Adonis to act as a gateway
'use strict'
const httpProxy = require('http-proxy');
const Logger = use('Logger');
class ProxyController {
/**
* Proxy any request to the targeted PROXY_HOST
*
@gauravds
gauravds / gist:7d9a3844182c2e89849a366001989279
Created April 26, 2021 12:29 — forked from 480/gist:3b41f449686a089f34edb45d00672f28
MacOS X + oh my zsh + powerline fonts + visual studio code terminal settings

MacOS X + oh my zsh + powerline fonts + visual studio code (vscode) terminal settings

Thank you everybody, Your comments makes it better

Install oh my zsh

http://ohmyz.sh/

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
@gauravds
gauravds / 0 Sign up for AWS C9 IDE!
Created August 31, 2020 23:00 — forked from yshmarov/0 AWS Cloud9
The Complete Ruby on Rails 6 Web Development Course 2020 - notes
## AWS ##
# All AWS C9 envments
https://eu-central-1.console.aws.amazon.com/cloud9/home?region=us-east-1
# Instance management
https://console.aws.amazon.com/ec2/home?region=eu-central-1#Instances:sort=instanceId
# Create AWS C9 environment
https://eu-central-1.console.aws.amazon.com/cloud9/home/create
@gauravds
gauravds / nil_empty_blank_present_ffdierence_in_ruby
Created August 24, 2020 16:08 — forked from pythonicrubyist/nil_empty_blank_present_ffdierence_in_ruby
Difference between nil?, empty?, blank? and present? in Ruby and Ruby on Rasils.
# nil? can be used on any Ruby object. It returns true only if the object is nil.
nil.nil? # => true
[].nil? # => false
{}.nil? # => false
"".nil? # => false
" ".nil? # => false
true.nil? # => false
# empty? can be used on some Ruby objects including Arrays, Hashes and Strings. It returns true only if the object's length is zero.
nil.empty? # NoMethodError: undefined method `empty?' for nil:NilClass
@gauravds
gauravds / main.go
Created February 26, 2020 10:36 — forked from kartiksura/main.go
Querying AWS Athena using Golang SDK
package main
import (
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/athena"
)
@gauravds
gauravds / athena.py
Created February 26, 2020 10:36 — forked from quiver/athena.py
query SQL to Amazon Athena and save its results from Amazon S3 Raw
#!/usr/bin/env python
# vim: set fileencoding=utf8 :
```
$ pip install -U boto3 retrying
$ export AWS_DEFAULT_PROFILE=test
$ cat foo.sql
select count(*)
from bar
$ python athena.py foo.sql
$ ls -1
@gauravds
gauravds / windowTimers.js
Created May 30, 2017 11:40 — forked from kevinoid/windowTimers.js
An implementation of setInterval/setTimeout for Rhino and SpiderMonkey
/* Implementation of HTML Timers (setInterval/setTimeout) based on sleep.
*
* This file is provided under the following terms (MIT License):
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@gauravds
gauravds / Controller.m
Last active February 22, 2017 09:30 — forked from NarendraPunchh/controller.m
This will help us in creating a clear section header. As right now the simple solution is to use a solid color in place of clear background so the content is not visible behind header.
#define Header_height 30
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
for (UITableViewCell *cell in self.tblRedeemables.visibleCells) {
CGFloat hiddenFrameHeight = scrollView.contentOffset.y + Header_height - cell.frame.origin.y;
if (hiddenFrameHeight >= 0 || hiddenFrameHeight <= cell.frame.size.height) {
[self maskCell:cell
fromTopWithMargin:hiddenFrameHeight];
}
}
@gauravds
gauravds / MockAPITest.m
Created December 28, 2016 18:58 — forked from dayitv89/MockAPITest.m
Objective-C iOS API Mocking using XCTest (Xcode 8.1) & OHHTTPStub v5.2.3
//
// MockAPITest.m
// iOS-API-Mock-Test
//
// Created by gauravds on 28/12/16.
// Copyright © 2016 iOS Dev Group. All rights reserved.
//
#import "ModelTestHelper.h"
@gauravds
gauravds / index.ios.js
Created December 16, 2016 11:23 — forked from Jpoliachik/index.ios.js
ReactNative LayoutAnimation Example
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';