Skip to content

Instantly share code, notes, and snippets.

View gauravds's full-sized avatar
🚀
Focusing

Gaurav Sharma gauravds

🚀
Focusing
View GitHub Profile
@dayitv89
dayitv89 / A.js
Last active September 5, 2022 16:37
Prototype constructor in javascript / node.js
//node A.js > output.txt
// If Rabbit had any custom properties on it
// (or static properties as some call it), they would not be copied, you'd have to do that manually using getOwnPropertyNames
// ref: https://stackoverflow.com/a/9267343/1084917
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames
// var oldProto = Rabbit.prototype;
// Rabbit = function() {...};
// Rabbit.prototype = oldProto;
@thetutlage
thetutlage / context.ts
Last active May 15, 2024 15:11
Unploy Server API Abstraction for AdonisJS
import Up from './index'
declare module '@ioc:Adonis/Core/HttpContext' {
interface HttpContextContract {
up: Up
}
}
@yshmarov
yshmarov / 0 AWS Cloud9
Last active June 24, 2024 20:27
Ruby on Rails 6: Learn 25+ gems and build a Startup MVP 2020
# 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
Setting - set tabs to 2
@madrussa
madrussa / ProxyController.js
Created September 12, 2019 12:18
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
*
@quiver
quiver / athena.py
Last active August 19, 2022 11:19
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
@480
480 / gist:3b41f449686a089f34edb45d00672f28
Last active July 3, 2024 03:59
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)"
@kartiksura
kartiksura / main.go
Last active June 7, 2023 16:38
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"
)
@reagent
reagent / 00_README.md
Last active January 29, 2024 13:31
Custom HTTP Routing in Go

Custom HTTP Routing in Go

Basic Routing

Responding to requests via simple route matching is built in to Go's net/http standard library package. Just register the path prefixes and callbacks you want invoked and then call the ListenAndServe to have the default request handler invoked on each request. For example:

package main

import (
@NarendraPunchh
NarendraPunchh / controller.m
Last active February 22, 2017 09:30
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];
}
}
@dayitv89
dayitv89 / MockAPITest.m
Last active October 4, 2017 17:24
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"