Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

abhishek verma absk1317

🎯
Focusing
  • Mobikwik
  • BENGALURU/BANGALORE
View GitHub Profile
View NetworkInfo.js
import React, { Component } from 'react';
import { ActivityIndicator } from 'react-native';
import NetInfo from '@react-native-community/netinfo';
import { connect } from 'react-redux';
import { setInternetStatus } from 'actions';
import { showToast } from '../utils/Library';
import PubSub from 'pubsub-js';
import { MESSAGE_TOPICS, Locales } from 'utils';
import { SemiBoldText } from 'components/common';
import { TextStyle, Row } from 'styles';
@absk1317
absk1317 / Api.js
Created Aug 20, 2020
Axios interceptor
View Api.js
import axios from 'axios';
import configureStore from './Store';
const { store } = configureStore();
const instance = axios.create({
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
}
@absk1317
absk1317 / SessionManager.js
Created Aug 20, 2020
Handling sessions with react native
View SessionManager.js
import { Component } from 'react';
import { AppState } from 'react-native';
import { connect } from 'react-redux';
import { recordSomething } from 'some-component';
import { recordSomethingElse } from 'some-other-component';
import { storeSessionData } from 'redux/actions/sessions';
import * as Sentry from '@sentry/react-native';
import { navigator } from 'utils';
import { chatActions } from 'actions';
View like_observer.rb
# frozen_string_literal: true
class BaseObserver < ActiveRecord::Observer
def create?(resource)
resource.send(:transaction_include_any_action?, [:create])
end
def deleted?(resource)
resource.send(:transaction_include_any_action?, [:destroy])
end
View contact_storage_worker.rb
# frozen_string_literal: true
class ContactStorageWorker
include Sidekiq::Worker
sidekiq_options retry: false
attr_accessor :user_id, :contact_params
def perform(contact_params, user_id)
@user_id = user_id
@absk1317
absk1317 / users.rb
Last active Aug 20, 2020
Google Sheets Entries
View users.rb
# frozen_string_literal: true
# For abstracting out updating approved users sheet
class GoogleSheets::Users
SHEET_NAME = 'users'
QUEUE_NAME = 'google_sheet'
include Sidekiq::Worker
sidekiq_options queue: QUEUE_NAME
sidekiq_options lock: :until_and_while_executing
@absk1317
absk1317 / image.rb
Last active Aug 20, 2020
Async Image Processing
View image.rb
# frozen_string_literal: true
# == Schema Information
#
# Table name: images
#
# id :bigint not null, primary key
# deleted_at :datetime indexed
# height :decimal(, )
# image :string
View Nginx Prerender conf
server {
server_name xyz.com;
root /home/ubuntu/www;
large_client_header_buffers 4 16k;
client_max_body_size 4G;
keepalive_timeout 10;
gzip_static on;
View backup-gem.rb
# encoding: utf-8
Model.new(:producion_backup, 'Description for producion_backup') do
archive :configs do |archive|
archive.add "/home/ubuntu/projects/api/shared/config/"
archive.add '/etc/nginx/'
end
database PostgreSQL do |db|
db.name = "db_name"
@absk1317
absk1317 / app_version.gradle
Created Sep 20, 2019 — forked from IlyaEremin/app_version.gradle
Npm version for gradle
View app_version.gradle
def getVersionName = { getVersionProps()['appVersionName'] }
def getVersionProps() {
def versionPropsFile = file('gradle.properties')
if (!versionPropsFile.exists()) {
versionPropsFile.createNewFile()
}
def versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
return versionProps