Skip to content

Instantly share code, notes, and snippets.

@bishwahang
bishwahang / Gemfile
Created September 2, 2020 07:57 — forked from grantspeelman/Gemfile
Example Gemfile files preparing for the next rails upgrade (https://grant-ps.blog/2017/07/03/upgrading-ruby-on-rails-in-smallish-steps/)
@next_upgrade ||= false
source 'https://rubygems.org'
if @next_upgrade
gem 'rails', '6.0.0.rc2'
else
gem 'rails', '~> 5.2.0'
end
# rest of gems below ....
@bishwahang
bishwahang / Gemfile
Created September 2, 2020 07:57 — forked from grantspeelman/Gemfile
Example Gemfile files preparing for the next rails upgrade (https://grant-ps.blog/2017/07/03/upgrading-ruby-on-rails-in-smallish-steps/)
@next_upgrade ||= false
source 'https://rubygems.org'
if @next_upgrade
gem 'rails', '6.0.0.rc2'
else
gem 'rails', '~> 5.2.0'
end
# rest of gems below ....
@bishwahang
bishwahang / Gemfile
Created June 25, 2020 12:02 — 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
[
{
key: "welcome_good_day",
duration: 10
video: {
url: "https://assets.freeletics.com/videos/foobar.mp4",
starts_at: 3,
ends_at: 5
},
audio: {
@bishwahang
bishwahang / preview.rb
Created December 8, 2017 09:49
leaderboards
class V5::Coach::LeaderboardsController < V5::BaseController
def preview
training_ids = current_user.followings.with_personal_best_for_workout(workout.slug)
.training_ids_for_workout(workout.slug)
current_user_training_id = current_user.current_personal_best_trainings[workout.slug]
training_ids.push(current_user_training_id) if current_user_training_id
all_trainings = Training
.where(id: training_ids)
@bishwahang
bishwahang / row_number.sql
Created December 7, 2017 21:14
user row_number window function in postgres
freeletics_api_dev=# select row_nr, first_name, fl_uid from (select row_number() over (order by fl_uid asc) as row_nr, fl_uid, first_name from users) sub
where sub.first_name = 'nocoach';
row_nr | first_name | fl_uid
--------+------------+--------
2 | nocoach | 2
@bishwahang
bishwahang / ml-ruby.md
Created May 6, 2016 12:22 — forked from gbuesing/ml-ruby.md
Resources for Machine Learning in Ruby

Resources for Machine Learning in Ruby

Gems

Keybase proof

I hereby claim:

  • I am bishwahang on github.
  • I am bishwahang (https://keybase.io/bishwahang) on keybase.
  • I have a public key whose fingerprint is 4DAE E9C4 A5A3 5281 CF28 A700 CC7B D6E5 9CA5 B8A4

To claim this, I am signing this object:

@bishwahang
bishwahang / stack.rb
Created April 23, 2015 15:31
Stack implementation without list
class Stack
Node = Struct.new(:data,:next)
def initialize
@top = nil
end
def push(data)
n = Node.new(data,@top)
@top = n
end
def pop

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname