Skip to content

Instantly share code, notes, and snippets.

View gabytabs's full-sized avatar

Mar Gabriel Tabilla gabytabs

  • Queens, NY
View GitHub Profile
@gabytabs
gabytabs / htaccess
Created January 25, 2019 20:20
htaccess for vue
# RewriteEngine On
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteRule ^([^\.]+)$ $1.html [NC,L]
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
@gabytabs
gabytabs / Postman
Created September 12, 2017 22:18
POSTMAN!! ActionController::ParameterMissing
In Headers Tab add:
KEY => Content-Type,
VALUE => application/json
In Body Tab and click "raw"
example for adding objects:
{"contact": {"first_name": "asdasd", "last_name": "yesyesyesy", "email": "wiiwwi"}}
@gabytabs
gabytabs / controller.rb
Created July 3, 2017 15:58
Searchkick gem
def index
@metrics = Metric.search(params[:q])
end
@gabytabs
gabytabs / devise.rb
Created June 15, 2017 02:55
Devise rails 5.1 fix for signing out
config.sign_out_via = [:get, :delete]
@gabytabs
gabytabs / database.yml
Created June 9, 2017 18:41
Setup in c9 for Postgresql
# PostgreSQL. Versions 9.1 and up are supported.
#
# Install the pg driver:
# gem install pg
# On OS X with Homebrew:
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On OS X with MacPorts:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
@gabytabs
gabytabs / index.html.erb
Created June 9, 2017 05:11
Vue on rails
<%= content_tag :div,
id: "post-index",
data: {
posts: @posts.to_json(except: [:id, :created_at, :updated_at])
} do %>
<h1> Posts </h1>
<div v-for="post in posts">
<h2>{{post.tweet}}</h2>
@gabytabs
gabytabs / hello_vue.js
Created June 8, 2017 06:34
Webpack Vue on rails
import Vue from 'vue/dist/vue.js'
$ jekyll serve --host $IP --port $PORT --baseurl ''
@gabytabs
gabytabs / tweet with user
Created June 3, 2017 02:38
tweet with user
require 'rails_helper'
RSpec.describe TweetsController, type: :controller do
before(:example) do
@user = create(:user)
@tweet = create(:tweet, :user_id => @user)
end
it {should use_before_action :authenticate_user!}