Skip to content

Instantly share code, notes, and snippets.

View kannans's full-sized avatar
💻
☝️

Kannan S kannans

💻
☝️
View GitHub Profile
@kannans
kannans / 00_Heroku-Release-Phase-Review-Apps-Rails_README.md
Created March 12, 2023 12:19 — forked from stevenharman/00_Heroku-Release-Phase-Review-Apps-Rails_README.md
Heroku Release Phase script for managing Rails DB migrations, and playing nice with Review Apps and postdeploy scripts

Heroku Release Phase + Review Apps + Rails

This is a simplified, but fairly thorough, set of scripts and configuration to enable Heroku Release Phase for Rails apps. Further, this particular set up plays nicely with Heroku Review Apps in that the release phase script will:

  1. Fail, loudly, if the DB does not yet exist.
  2. Load the DB schema if the current schema version (as determined by bin/rails db:version) is 0.
  3. Run DB migrations otherwise.

For a "normal" app that usually means it will run the DB migrations.

@kannans
kannans / ruby-openssl-build.sh
Created February 27, 2023 10:41 — forked from vbatts/ruby-openssl-build.sh
building ruby with a specific openssl
#!/bin/sh
t_dir="$HOME/tmp"
mkdir -p ${t_dir}
pushd ${t_dir}
for url in \
ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.9.3-p194.tar.bz2 \
http://openssl.org/source/openssl-1.0.1c.tar.gz
@kannans
kannans / 写経.txt
Created August 12, 2022 17:01 — forked from usutani/写経.txt
Rails 7: The Demo
macOS 11.6
rails 7.0.0
brew install vips
brew install redis
redis-server /usr/local/etc/redis.conf
00:00 Scaffolding
rails new demo
cd demo
@kannans
kannans / application.css
Created August 28, 2021 10:33 — forked from Joseph-N/application.css
Gists for autocomplete tutorial - foxycomplete rails. Tutorial link http://josephndungu.com/tutorials/autocomplete-search-with-images-in-rails
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
@kannans
kannans / Gemfile
Created December 25, 2020 18:03 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@kannans
kannans / command.txt
Created July 13, 2020 17:23 — forked from fbn4sc/command.txt
Delete all branches except master and develop.
git branch | grep -v "master\|develop" | xargs git branch -D
@kannans
kannans / homebrew.mxcl.nginx.plist
Created April 19, 2020 12:41 — forked from cmbankester/homebrew.mxcl.nginx.plist
NGINX startup on Mac OSX El Capitan
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.nginx</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
@kannans
kannans / The Technical Interview Cheat Sheet.md
Created August 27, 2019 18:25 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@kannans
kannans / webpacker_rails.md
Created June 15, 2019 14:02 — forked from maxivak/webpacker_rails.md
Webpack, Yarn, Npm in Rails
@kannans
kannans / sort.rb
Created September 24, 2018 18:33 — forked from aspyct/sort.rb
Ruby implementation of quicksort, mergesort and binary search
# Sample implementation of quicksort and mergesort in ruby
# Both algorithm sort in O(n * lg(n)) time
# Quicksort works inplace, where mergesort works in a new array
def quicksort(array, from=0, to=nil)
if to == nil
# Sort the whole array, by default
to = array.count - 1
end