Skip to content

Instantly share code, notes, and snippets.

View gingray's full-sized avatar
🎯
Focusing

Ivan gingray

🎯
Focusing
View GitHub Profile
@gingray
gingray / 0_reuse_code.js
Last active August 29, 2015 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@gingray
gingray / system prepare
Last active August 29, 2015 14:23
Actions for first system deploy
#add sudo if it wasn't present
apt-get install sudo
#add devops user
adduser devops
adduser devops sudo
#update && upgrade system
sudo apt-get update
sudo apt-get upgrade
#ERROR: cannot verify www.opscode.com's certificate thats mean tha u have to update certificates
sudo apt-get install --reinstall ca-certificates
@gingray
gingray / application.html.slim
Created June 19, 2015 11:31
application.html.slim
doctype html
html
head
title My App
meta name="viewport" content="width=device-width, initial-scale=1.0"
= stylesheet_link_tag "application", media: 'all', 'data-turbolinks-track' => true
= javascript_include_tag "application", 'data-turbolinks-track' => true
= csrf_meta_tags
body
@gingray
gingray / commands
Created June 19, 2015 11:33
chef knife solo berkshelf init
gem install knife-solo
gem install berkshelf
#init in current directory
knife solo init .
@gingray
gingray / rspec_common_practice
Last active August 29, 2015 14:24
RSpec common practice and technique
#stub chain of methods
```
describe '#chain stub' do
subject { Object.new }
let(:stb) { double sync:calc }
before { allow(subject).to receive_message_chain('method1.mathod2.calc') { stb } }
before { subject.method1.mathod2.calc }
it { expect(stb).to have_received(:calc) }
end
```
@gingray
gingray / git_snippets
Created August 18, 2015 08:43
git command snippets
remove all local merged branches (suppose ur main bracnh is master)
git branch --merged master | grep -v master | xargs git branch -d
@gingray
gingray / postgres.md
Last active July 1, 2016 15:35
postgresql add by default hstore to template0
psql -d template0 -c 'create extension hstore;'

if you get error like database "template0" is not currently accepting connections try this one solution

UPDATE pg_database SET datallowconn = TRUE WHERE datname = 'template0';

but this solution can cause problem when you you will do pg_upgrade be carefull

@gingray
gingray / mac_commands.md
Last active December 24, 2015 11:50
MAC useful commands

###show all files in finder in terminal paste this commands enable to view hidden files

defaults write com.apple.finder AppleShowAllFiles YES

reload Finder

killall Finder

@gingray
gingray / git_features.md
Last active August 20, 2017 15:57
git features

set mvim as editor for git

git config --global core.editor "mvim --remote-wait"

revert interactive rebase

git reset --hard ORIG_HEAD
@gingray
gingray / vim_config.md
Created October 19, 2015 09:48
vim config gist
" copy current file name (relative/absolute) to system clipboard
if has("mac") || has("gui_macvim") || has("gui_mac")
  " relative path  (src/foo.txt)
  nnoremap <leader>cf :let @*=expand("%")<CR>

  " absolute path  (/something/src/foo.txt)
  nnoremap <leader>cF :let @*=expand("%:p")<CR>

 " filename (foo.txt)