Skip to content

Instantly share code, notes, and snippets.

View oleksiilevzhynskyi's full-sized avatar

Oleksii Levzhynskyi oleksiilevzhynskyi

View GitHub Profile
rails 3.1 java runtime error
gem 'execjs'
gem 'therubyracer'
@oleksiilevzhynskyi
oleksiilevzhynskyi / gist:1146869
Created August 15, 2011 14:32
Failed to build gem 'nokogiri' native extension.
sudo apt-get install libxslt1-dev
libxml, libxml-dev, libxslt, libzslt-dev
SHOW DATABASES; - список баз данных
SHOW TABLES [FROM db_name]; - список таблиц в базе
SHOW COLUMNS FROM таблица [FROM db_name]; - список столбцов в таблице
SHOW CREATE TABLE table_name; - показать структуру таблицы в формате "CREATE TABLE"
SHOW INDEX FROM tbl_name; - список индексов
SHOW GRANTS FOR user [FROM db_name]; - привилегии для пользователя.
SHOW VARIABLES; - значения системных переменных
SHOW [FULL] PROCESSLIST; - статистика по mysqld процессам
@oleksiilevzhynskyi
oleksiilevzhynskyi / gist:1186087
Created September 1, 2011 12:41
Removing rvm
rvm implode
rm ~/.rvmrc
curl -s https://rvm.beginrescueend.com/install/rvm -o rvm-installer ; chmod +x rvm-installer ; ./rvm-installer --version 1.8.0
;
rvm implode
gem uninstall rvm
@oleksiilevzhynskyi
oleksiilevzhynskyi / gist:1205996
Created September 9, 2011 11:39
has_many through polymorfic
class Widget < ActiveRecord::Base
has_many :widget_groupings
has_many :people, :through => :widget_groupings, :source => :grouper, :source_type => 'Person'
has_many :aliens, :through => :widget_groupings, :source => :grouper, :source_type => 'Alien'
end
class Person < ActiveRecord::Base
has_many :widget_groupings, :as => grouper
has_many :widgets, :through => :widget_groupings
@oleksiilevzhynskyi
oleksiilevzhynskyi / gist:1207023
Created September 9, 2011 18:52
ppa for sublime-text-2
sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text-2
@oleksiilevzhynskyi
oleksiilevzhynskyi / gist:1230077
Created September 20, 2011 19:28
Hot keys in terminal
ctrl+a or Home - Moves the cursor to the start of a line.
ctrl+e or End - Moves the cursor to the end of a line.
ctrl+b - Moves to the beginning of the previous or current word.
ctrl+k - Deletes from the current cursor position to the end of the line.
ctrl+u - Deletes the whole of the current line.
ctrl+w - Deletes the word before the cursor.
@oleksiilevzhynskyi
oleksiilevzhynskyi / gist:1258663
Created October 3, 2011 08:00
How to get git-completion.bash to work on Mac OS X?
sudo port install git-core +bash_completion
if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
fi
GIT_PS1_SHOWDIRTYSTATE=true
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]\[\033[01;31m\]$(__git_ps1 " {%s}")\[\033[00m\]\$ '
@oleksiilevzhynskyi
oleksiilevzhynskyi / gist:1259158
Created October 3, 2011 13:59
Problem with blame in TextMate
mkdir -p /Library/Application\ Support/TextMate/Bundles
cd !$
git clone git://github.com/timcharper/git-tmbundle.git Git.tmbundle
osascript -e 'tell app "TextMate" to reload bundles'
Ctr+Shift+G => blame
enjoy!
@oleksiilevzhynskyi
oleksiilevzhynskyi / syntax_highlighting.py
Created October 29, 2011 21:11 — forked from mstarkman/syntax_highlighting.py
Ruby on Rails syntax highlight switcher for Sublime Text 2
import sublime, sublime_plugin
import os
class DetectFileTypeCommand(sublime_plugin.EventListener):
""" Detects current file type if the file's extension isn't conclusive """
""" Modified for Ruby on Rails and Sublime Text 2 """
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """
def on_load(self, view):
filename = view.file_name()