Skip to content

Instantly share code, notes, and snippets.

View pawelztef's full-sized avatar

Paweł Stefaniak pawelztef

View GitHub Profile
@pawelztef
pawelztef / vgaoff
Created May 24, 2019 06:44
Simple Bash script to handle connections my monitor through VGA
#!/bin/bash
xrandr --output VGA1 --off
@pawelztef
pawelztef / .bashrc
Created February 24, 2019 20:06
bashrc config inspiron
# set show-mode-in-prompt off
# set vi-ins-mode-string \1\2  \1\2
# set vi-cmd-mode-string \1\2  \1\2
export HISTCONTROL=ignoreboth:erasedups
export HISTSIZE=1000
export HISTFILESIZE=20000
# append to the history file, don't overwrite it
shopt -s histappend
@pawelztef
pawelztef / init.vim
Created February 24, 2019 17:24
neovim config
call plug#begin('~/.local/share/nvim/plugged')
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'jeffkreeftmeijer/vim-numbertoggle'
Plug 'mattn/emmet-vim'
Plug '907th/vim-auto-save'
Plug 'vim-scripts/restore_view.vim'
Plug 'fxn/vim-monochrome'
Plug 'gosukiwi/vim-atom-dark'
@pawelztef
pawelztef / _header.html.erb
Created April 13, 2018 04:40
Rails and refineryCMS with Bootstrap Navbar
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#example_1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@pawelztef
pawelztef / list_of_refinery_overrides.txt
Created March 27, 2018 06:15
list of possible overrides - refinery
$ rake refinery:override view=refinery/pages/*
$ rake refinery:override view=layouts/*
$ rake refinery:override view=refinery/blog/shared/*
$ rake refinery:override view=refinery/blog/posts/*
$ rake refinery:override view=refinery/*
$ rake refinery:override controller=refinery/blog/*
$ rake refinery:override controller=refinery/*
trim '.html.erb', '.rb'.
@pawelztef
pawelztef / masonry-jumping-bricks.js
Last active March 20, 2018 09:44
Masonry - How do I avoid showing "jumping" bricks on page load
$(window).load(function(){
var grid = $('#masonry-container').masonry({
itemSelector: '.box',
columnWidth: 300,
gutterWidth: 10,
isFitWidth: true
});
function onLayout() {
$('#masonry-container').css('visibility', 'visible');
}
@pawelztef
pawelztef / application_helper.rb
Created March 20, 2018 09:11
Ruby on Rails. Class "active" for menu items based on Path or Controller and Action names
module ApplicationHelper
def active_for(options = {})
name_of_controller = options[:controller] || nil
name_of_action = options[:action] || nil
request_path = options[:path] || nil
if request_path.nil?
if (name_of_action.nil? or name_of_action == action_name) and
name_of_controller == controller_name
'active'
@pawelztef
pawelztef / pretty_curl
Created December 12, 2017 12:50
pretty_curl
#!/bin/bash
# install jq JSON processor
# apt isntall jq
pretty_curl() {
curl "$1" | jq
}
@pawelztef
pawelztef / slug_create
Created June 28, 2017 09:07
slugify text
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
guard 'livereload' do
extensions = {
css: :css,
scss: :css,
sass: :css,
js: :js,
coffee: :js,
html: :html,
png: :png,
gif: :gif,