Skip to content

Instantly share code, notes, and snippets.

View goodviber's full-sized avatar

GoodViber goodviber

View GitHub Profile
@goodviber
goodviber / gist:96e4017cd51390e9e99f8b68a2f04271
Last active February 17, 2020 14:54
Hash values as arrays
@avg_score_hash = Hash.new { |hash, key| hash[key] = [] }
@rows.each do |row|
row.last.each_with_index do |column, index|
if column != 0
@avg_score_hash[index] << column
end
end
end
@avg_score_hash
@goodviber
goodviber / gist:36960ad6f80ec9bcda2f5c7459f116a3
Last active November 22, 2022 21:41
postgres start stop
pg_ctl -D /usr/local/var/postgresql@version start
pg_ctl -D /usr/local/var/postgresql@version stop
sudo service redis-server stop
@goodviber
goodviber / gist:7769a594294152df320572cd6b74e042
Created July 2, 2019 08:14
after update path for devise
# Application controller
def user_root_path
your_url_here
end
@goodviber
goodviber / gist:bfdc661a69b6d4bae87d5d1a4acdee27
Created February 7, 2019 09:52
strip whitespace from headers
#strip whitespace from headers
CSV.foreach("tmp/client_mapping.csv", {headers: true,:header_converters=> lambda {|f| f.strip}) do
end
@goodviber
goodviber / delete schema migrations
Created October 30, 2018 10:51
Delete schema migrations
SELECT * FROM schema_migrations;
DELETE FROM schema_migrations WHERE version IN (<version>);
@goodviber
goodviber / gist:0d68937d26669cac2548d50f5cb6a2af
Last active August 1, 2018 11:18
dependant state logging in react
this.setState({ makeCalls: true }, () => {
console.log("makeCalls: ", this.state.makeCalls)
}
)
@goodviber
goodviber / gist:54898bc705a928a3e18c9b725d52e5ca
Created July 12, 2018 11:45
can't find executable webpack-dev-server for gem webpacker (Gem::Exception)
bundle exec rails webpacker:binstubs
@goodviber
goodviber / gist:93fe7cb05d7b023393e9a5ba81341f31
Created July 10, 2018 09:41
Postgres missing connection
trash /usr/local/var/postgres
initdb -D /usr/local/var/postgres/
git fetch origin branch:branch
git co branch