Skip to content

Instantly share code, notes, and snippets.

View dayitv89's full-sized avatar
🎢
Rising

Gaurav D. Sharma dayitv89

🎢
Rising
View GitHub Profile
@dayitv89
dayitv89 / AdonisJS5_README.md
Last active April 3, 2022 07:14
Adonis 5 essentials

Create commands

node ace make:command db:create 
node ace make:command db:drop
## paste code of `DbCreate.ts` and `DbDrop.ts`
node ace generate:manifest ## After creating/change on commands, run this.

package.json

@dayitv89
dayitv89 / Handler.ts
Last active September 28, 2023 01:29
Adonisjs 5 http logger
//PATH: app/Exceptions/Handler.ts
/*
|--------------------------------------------------------------------------
| Http Exception Handler
|--------------------------------------------------------------------------
|
| AdonisJs will forward all exceptions occurred during an HTTP request to
| the following class. You can learn more about exception handling by
| reading docs.
|
@dayitv89
dayitv89 / full_setup.md
Created June 12, 2021 09:11
Nginx, node.js, mysql, letsencrypt setup on one lightsails/ec2 machine (Good for dev/ing/staging servers)
@dayitv89
dayitv89 / avrc.js
Last active April 11, 2021 00:42
avrc/avro to json convert
//node avrc.js > account.avrc.json
const avrc = {
type: 'record',
namespace: 'server',
name: 'account',
fields: [
{
name: 'updated_at',
type: 'string',
@dayitv89
dayitv89 / cors.json
Last active April 29, 2021 06:14
S3 user access to specific bucket and disable cors
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"PUT",
"POST"
],
"AllowedOrigins": [
@dayitv89
dayitv89 / Dockerfile
Last active December 11, 2024 18:15
GitHub action to deploy rails app into AWS ECS
# build/Dockerfile
FROM ruby:2.7.1-buster
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install -y nodejs yarn default-mysql-client nano --no-install-recommends && rm -rf /var/lib/apt/lists/*
@dayitv89
dayitv89 / tap_to_copy.html
Last active December 7, 2020 19:55
Javascript code to copy custom text in html, ref: enigma project
<script>
function copyToClipboard(textToCopy) {
const elem = document.createElement('textarea');
elem.value = textToCopy;
document.body.appendChild(elem);
elem.select();
document.execCommand('copy');
document.body.removeChild(elem);
}
@dayitv89
dayitv89 / ReadMe.txt
Last active December 7, 2020 15:16
enigma for ruby on rails
Engima https://github.com/dayitv89/enigma like vault from hashicorp. uses for transfer/manage environment variables securely on network.
node.js version also available on the enigma repo.
{
"customizeUI.stylesheet": {
".tabs-and-actions-container .editor-actions": "display: none !important; position: fixed; right: 0; z-index: 1; background-color: white; top: 50px;",
".tabs-and-actions-container:hover .editor-actions": "display: flex !important;",
".title.tabs.show-file-icons .editor-actions": "overflow: unset !important;"
}
}
@dayitv89
dayitv89 / nil_empty_blank_present_ffdierence_in_ruby
Last active August 24, 2020 16:09 — 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