Skip to content

Instantly share code, notes, and snippets.

View izikaj's full-sized avatar

Andrii izikaj

  • Full Stack Engineer at Railsware
View GitHub Profile
@izikaj
izikaj / migrate_hstore_to_json.rb
Last active January 19, 2022 08:02 — forked from estum/migrate_hstore_to_json.rb
Ruby on Rails & Postgres: Reversible migrate hstore column to jsonb with contents
class MigrateHstoreToJson < ActiveRecord::Migration
def up
rename_column :posts, :data, :data_hstore
add_column :posts, :data, :jsonb, default: {}, null: false, index: { using: 'gin' }
execute 'UPDATE "posts" SET "data" = jsonb_object(hstore_to_matrix("data_hstore"))'
remove_column :posts, :data_hstore
end
def down
rename_column :posts, :data, :data_jsonb
#/usr/bin/env bash
# "jump" command.
# Written by IzikAJ <izikaj@gmail.com>.
JUMP_PROJECTS_ROOT=~/www/
JUMP_PROJECTS_CONFIG_PATH=$JUMP_PROJECTS_ROOT/.config
__find_and_cache_projects()
{
local f_bold f_dim f_normal c_yellow c_green
TODO: put short useful notes/commands/hacks/etc.
#Make my terminal color
function parse_git_commit_prefix {
git show -q HEAD~0 2> /dev/null | grep commit | sed -Ee 's/commit\ ([a-zA-Z0-9]{7}).*/\1/'
}
function parse_git_status {
git status --porcelain 2> /dev/null | sed -Ene "s/\s*([A-Z\?]+).*/\1/p" | awk '!x[$0]++' | tr '\n' ' ' | sed -e '$s/ $//' | sed -Ee 's/\?\?/U/g' | sed -Ee 's/^[\ \t\s]+//' | sed -Ee 's/[\ \t\s]+/\ /g' | sed -Ee 's/\ /,/g' | sed -Ee 's/(.*)/\(\1\)/g'
}
function parse_git_branch {
Copy from here: http://stackoverflow.com/questions/33343159/gem-install-therubyracer-v-0-11-4#answer-36769517
I had the sam problem in OSX El Capitan. The steps I used to get over this were
First check if V8 is installed or not. I used brew to install it.
brew install homebrew/versions/v8-315
Try uninstalling libv8, therubyracer gems if some instance exists.
gem uninstall -a libv8
sed -i "" 's/\.\.\/images\//\/assets\//' $(find ~/www/.../app/assets/stylesheets/ -type f -name '*.scss')
sed -i "" 's/\/scss\/base\/fonts\//\/assets\//' $(find ~/www/.../app/assets/stylesheets/ -type f -name '*.scss')
sed -i "" 's/\/css\/base\/fonts\//\/assets\//' $(find ~/www/.../app/assets/stylesheets/ -type f -name '*.scss')
sed -i "" "/\/\/ Cabinet/,/@import \"\.\.\/\.\.\/\.\.\/shared\/scss\/base\"\;/ d" ~/www/.../app/assets/stylesheets/theme/application.scss
# Slim
.social
.like-block.facebook
div class="fb-like" data-href="#{facebook_page_url}" data-send="false" data-layout="button_count" data-width="120" data-show-faces="true"
.like-block.twitter
a href="https://twitter.com/share" class="twitter-share-button" data-url="#{root_url}" Tweet
.like-block.google
div class="g-plusone" data-size="medium" data-annotation="bubble" data-width="32" data-href="#{root_url}"
Old variants:
/Library/PostgreSQL/9.3/data/postmaster.pid
~/Library/Application Support/Postgres/var-9.4/postmaster.pid
UPD 2022.09.28:
From @luckyycode:
for brew installed PostgreSQL, its located in /usr/local/var/postgres
From me:
/usr/local/var/postgres@[YourPGversion]/postmaster.pid