Skip to content

Instantly share code, notes, and snippets.

View ramonrails's full-sized avatar
💭
Available to build SaaS, PaaS, MVP, consult and mentor

Ram ramonrails

💭
Available to build SaaS, PaaS, MVP, consult and mentor
View GitHub Profile
#!/bin/bash
# Thu Nov 7 18:43:39 IST 2013, [email protected] (ramonrails)
# Borrowed from gitflow & bumpversion (URLs referenced below) and enhanced further
# works with a file called VERSION in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3"
# this script will display the current version, automatically
#!/bin/bash
# Thu Nov 7 18:43:39 IST 2013, [email protected] (ramonrails)
# Borrowed from gitflow & bumpversion (URLs referenced below) and enhanced further
# works with a file called VERSION in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3"
# this script will display the current version, automatically
@ramonrails
ramonrails / box.rb
Last active May 14, 2017 15:48
easily run `knife solo` command on chef-solo configured rails app
#!/usr/bin/env ruby
# The MIT License (MIT)
# Copyright (c) 2016 Ram Kumar (ramonrails)
#
# 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
#!/bin/bash
# The MIT License (MIT)
# Copyright (c) 2016 Ram Kumar (ramonrails)
#
# 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
#!/bin/bash
# The MIT License (MIT)
# Copyright (c) 2016 Ram Kumar (ramonrails)
#
# 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
@ramonrails
ramonrails / assets.rb
Created November 15, 2016 12:06
rails: dynamically pickup controller-named-assets for pre-compilation
# config/initializers/assets.rb
javascripts = [...]
stylesheets = [...]
images = [...]
fonts = [...]
# NOTE: dynamically include for precompile: controller specific .coffee, .js and .scss, .css
#
# step 1: collect controller basenames
controllers = Dir.glob(File.join(Rails.root, 'app', 'controllers', '*.rb'))
@ramonrails
ramonrails / puma-dev.sh
Last active September 10, 2020 18:14
puma-dev management script
#!/bin/bash
# author: ramonrails.in
# version: 1.0
# release date: 7-Aug-2017
# license: MIT
# style for output
bold=$(tput bold)
cyan=$(tput setaf 6)
@ramonrails
ramonrails / .pryrc
Created November 12, 2018 06:57
Helper: pry + Apartment gem + rails console
# What is it?
# => Helper methods for Apartment::Tenant gem
# How does it work?
# * bin/rails console => auto-loads and asks to switch tenant
# * T.ask => anytime in console, to switch tenant from a list
# * T.me => same as Apartment::Tenant.current
# * T.hash => hash of tenants. Example: { 0 => "public", 1 => "tenant-a" }
# * T.names => array with all existing tenant names from DB
# * T.exists?(arg) => returns true/false if `arg` exists as tenant in DB
require "rubygems"
@ramonrails
ramonrails / html_form_to_json.js
Created March 8, 2020 07:58
HTML form elements to JSON
// developer: RamOnRails.in
// purpose: fetch form data as JSON
// parameters:
// form: the form object
// arg: [optional] query selector to pick elements
// defaults: arg: "input, select, textarea"
function toJSON(form, arg = null) {
// we will capture the elements and their values in this object
let hash = {};
// arg converted to string
@ramonrails
ramonrails / cucumber_example_outline.feature
Created May 10, 2020 20:19
cucumber BDD example: scenario outline with examples data table
Scenario Outline: Shipping options
Given the following shipping_options:
| description | price |
| UPS Overnight shipping | 60 |
| UPS 2 day shipping | 28 |
| UPS Ground Shipping | 16 |
And "default" coupon_code for "direct_to_consumer" group has "<_ship>" shipping
When I go to the online store
And I choose "product_complete"
And I choose "S2228"