Skip to content

Instantly share code, notes, and snippets.

View juandazapata's full-sized avatar

Juanda juandazapata

View GitHub Profile
@juandazapata
juandazapata / web-fonts-asset-pipeline.md
Created June 10, 2018 15:38 — forked from anotheruiguy/web-fonts-asset-pipeline.md
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

set nocompatible
filetype off
filetype plugin indent on
syntax enable
call plug#begin('~/.local/share/nvim/plugged')
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'w0rp/ale'
# Remap prefix from 'C-b' to 'C-t'
unbind C-b
set -g prefix C-t
bind-key -r C-t send-prefix
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded."
# Split panes using / and -
bind / split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# =============================================================
# REQUIREMENTS
# =============================================================
# - Heroku toolbelt installed in your system
# - A heroku remote named `staging`.
# - A heroku remote named `production`.
# =============================================================
namespace :h do
# -------------------------------------------------------------
@juandazapata
juandazapata / localized-models.md
Last active December 16, 2015 08:38
Localized model
class Hostel < ActiveRecord::Base
  attr_accessible :name, :address_1...
  
  # Model definition...
  has_one :conditions, class_name: 'Hostel::Condition'
  has_one :directions, class_name: 'Hostel::Direction'
end

class Hostel::Condition &lt; ActiveRecord::Base
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
wget https://github.com/elasticsearch/elasticsearch/archive/v0.20.1.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@juandazapata
juandazapata / redis.sh
Created March 22, 2013 15:57
Redis setup
apt-get -y update
apt-get -y upgrade
apt-get -y install redis-server
@juandazapata
juandazapata / memcached.sh
Last active December 15, 2015 05:59
Memcached script
apt-get -y update
apt-get -y install build-essential
apt-get -y install make
apt-get install memcached
#cd /tmp
#wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz
#tar -xvzf ruby-1.9.3-p327.tar.gz
#cd ruby-1.9.3-p327/
#./configure --prefix=/usr/local
@juandazapata
juandazapata / gist:5212968
Created March 21, 2013 13:22
MySQL number of connections
mysql -u root -p -e"show processlist;"|awk '{print $3}'|awk -F":" '{print $1}'|sort|uniq -c
template = require 'views/templates/hostels/search'
CollectionView= require 'views/base/collection-view'
HostelItemView = require 'views/hostels/item'
module.exports = class HostelSearchView extends CollectionView
className: 'search-results'
itemView: HostelItemView
template: template
listSelector: '.hostels'
fallbackSelector: '.empty-message'