Skip to content

Instantly share code, notes, and snippets.

@jmarceli
jmarceli / .vimrc
Created March 30, 2019 20:41
Updated .vimrc configuration for ReactJS development
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc
"""
""" EXPERIMENTAL
""" tagbar
""" tern_for_vim
""" vim-obsession
""" ctrlp.vim
"""
@jmarceli
jmarceli / .vimrc
Created March 29, 2019 07:10
Flow suggestions
nnoremap <leader>fa :execute ":! yarn --silent flow type-at-pos --quiet %" line(".") col(".") "\| grep '^type' \| yarn --silent prettier --stdin-filepath test.js"<cr>
@jmarceli
jmarceli / docker-compose.yml
Last active April 27, 2022 13:54
Grafana and InfluxDB with Let's Encrypt SSL on Docker https://grzegorowski.com/grafana-with-lets-encrypt-ssl-on-docker/
version: '2'
services:
grafana:
image: grafana/grafana:5.0.0 # or probably any other version
container_name: grafana
restart: always
environment:
- VIRTUAL_HOST=YOUR.DOMAIN.TEST # adjust to match your domain name
- VIRTUAL_PROTO=https
@jmarceli
jmarceli / .vimrc
Created November 23, 2017 15:41
My .vimrc
" RELOAD WITHOUT closing vim
" :so ~/.vimrc
"
set nocompatible
"""""""""""""""""""
" PLUGINS
"""""""""""""""""""
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
@jmarceli
jmarceli / Capfile
Last active December 9, 2015 07:54
mydevil.net Rails Capistrano deploy (based on CucumisSativus/Capfile), '>' used instead of '/' in file path
# Load DSL and set up stages
require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'
# Include tasks from other gems included in your Gemfile
require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
@jmarceli
jmarceli / gist:91bc44a4ff8c0d10eb11
Last active October 20, 2015 12:06
Useful Vim commands

zo - open folding
za - toggle folding
zc - close folding

zf - create manual folding from selection

How to redirect from route if sth. (e.g. not logged in)

function createRoutes() {
  function requireLogin(store) {
    return (nextState, replaceState) => {
  
      const { users: { user }} = store.getState();
      if (_.isEmpty(user)) { // or any other authentication condition
 replaceState({ nextPathname: nextState.location.pathname }, '/');
@jmarceli
jmarceli / README.md
Last active October 31, 2019 09:46
React errors explained

1

You will get one of these:

Uncaught (in promise) TypeError: Cannot read property 'toUpperCase' of undefined(…)

ReactCompositeComponent.js:870 Uncaught TypeError: Cannot read property 'displayName' of undefined

if you try to:

@jmarceli
jmarceli / gist:651301ea895e48774896
Created March 31, 2015 21:32
client_side_validations with select2 and Ajax

Possible complete Select2 integration

Full live (client side) validation, "developed" to use with simple_form and foundation markup (should work in other cases too).

Create separate .coffee file e.g. client_side_select2.js.coffee with following code:

# Add select2 support
ClientSideValidations.selectors.validate_inputs += ', select[data-select2-validate]'
ClientSideValidations.selectors.inputs += ', .select2-container'
#! /usr/bin/env ruby
# Modified from : http://www.tkalin.com/blog_posts/using-console-vim-as-vim-protocol-handler-in-ubuntu
# NOTE: This opens with a link to the mvim protocol for compatibility with RailsPanel
# goes to /usr/local/bin/cvim
require 'uri'
require 'cgi'
full_path = ARGV[0]