Skip to content

Instantly share code, notes, and snippets.

View sathiyaseelan's full-sized avatar

sathya sathiyaseelan

  • Singapore
View GitHub Profile
@sathiyaseelan
sathiyaseelan / config.yml
Created August 2, 2018 10:48
Sample Circle ci config to deploy a node application in heroku and run integration tests before and after release using cypress
# .circleci/config.yml
version: 2
defaults: &defaults
working_directory: ~/app
docker:
# the Docker image with Cypress dependencies
- image: cypress/base:8
environment:
## this enables colors in the output
TERM: xterm
@sathiyaseelan
sathiyaseelan / store_index.js
Created July 18, 2018 05:08
Nuxt Example for modularised Vuex Store with multiple nuxtServer Init
export const actions = {
async nuxtServerInit ({ dispatch }, { app }) {
console.log('calling init methods')
await dispatch('providers/nuxtServerInit', { app })
await dispatch('products/nuxtServerInit', { app })
}
}
@sathiyaseelan
sathiyaseelan / golang_env_vars_setup.md
Created January 8, 2018 06:03
Using different .env files for loading environment variables.

Currently the godotenv library doesn't support loading different .env files such as .env.test for testing .env.staging for staging.

Here's the small snippet, to support different environments file dynamically. Based on the @adamcohen comment.(option 1)

joho/godotenv#43 - Follow this issue for future changes

  1. Create a config struct as below
  2. Access the env values using the config struct
  3. Run the program with current ENVIRONMENT value set
@sathiyaseelan
sathiyaseelan / golang_setup.md
Last active April 1, 2024 18:51
Basics to setup a golang project repo in your local

Simple Guide to setup Golang in your Mac and clone a repo.

Setup Go and workspace

Type go in terminal, to verify the installation.

  • Create a Go workspace and set GO PATH
@sathiyaseelan
sathiyaseelan / Elixir and Go lang comparison.md
Last active December 3, 2017 22:25
Golang and Elixir comparision with respect to building JSON APIs

Spent some time to understand go and (elixir + (phoenix)) with respect to write APIs. I’ve considered only syntax, developer productivity and features like ORM.

Golang

Pros

  1. Faster than Elixir.
  2. GORM provides similar functionality as ActiveRecord

Cons

@sathiyaseelan
sathiyaseelan / Responsive Spec Helpers With Meta tags
Last active November 29, 2017 01:57
Helpers for Responsive feature Specs in Capybara
The responsive helpers are to help the developer with writing responsive specs.
All you have to do is, add `responsive_helper.rb` to the spec support directory.
And tag the specs with :mobile, :tablet for mobile and tablet size respectively.
If you don't use any tag, it would render the desktop size.
@sathiyaseelan
sathiyaseelan / Database cleaner configuration with multiple ORMs
Created November 24, 2017 10:49
Database cleaner configuration for apps using both mongoid and activerecord
# Database cleaner configuration for apps using both mongoid and activerecord.
When your apps using multiple ORMs, you might want to fine tune each ORM in different way.
This contains the sample configuration for using mongoid and activerecord together.
This shows how to use different startegy for different ORMs.
@sathiyaseelan
sathiyaseelan / Selenium_with_headless_chrome.md
Created November 22, 2017 04:29 — forked from sathya-moneysmart/Selenium_with_headless_chrome.md
Capybara Setup for selenium with headless chrome

Setup for Capybara selenium with headless chrome

This gist contains all you need to setup capybara for selenium with headless chrome.

  1. Add these gems to the Gemfile under test group
  gem 'capybara'
  gem 'chromedriver-helper
  gem 'selenium-webdriver'
@sathiyaseelan
sathiyaseelan / insert_singly_circular_ll.rb
Created April 2, 2017 08:06
Insert in Sorted Circular Linked List
def insert(new_node)
if tail == nil
new_node.next = new_node
tail = new_node
else
curr = tail.next
while curr.next != tail && curr.data <= new_node.data
curr = curr.next
@sathiyaseelan
sathiyaseelan / count_set_bits.rb
Created February 24, 2017 04:26
Count number of set bits in a number (ruby)
#Brian Kernighan’s algorithm
def count_set_bits(num)
count = 0
while num != 0
num &= (num-1)
count += 1
end
count
end