Skip to content

Instantly share code, notes, and snippets.

View bntzio's full-sized avatar

Enrique Benitez bntzio

View GitHub Profile
@bntzio
bntzio / example.c
Created September 20, 2014 18:48
Simple example in C
#import <stdio.h>
#import <stdlib.h>
int main() {
char name;
printf("Hello! this is a basic example of programming with the C language!\n");
return 0;
}
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@bntzio
bntzio / gist:8b91ece1479e8dffffb5
Created April 3, 2015 17:37
icnoming controller
class IncomingController < ApplicationController
# http://stackoverflow.com/questions/1177863/how-do-i-ignore-the-authenticity-token-for-specific-actions-in-rails
skip_before_action :verify_authenticity_token, only: [:create]
def create
@user = current_user
@topic = Topic.create(title: params[:subject], user_id: @user.id)
@url = params["body-plain"]
@bntzio
bntzio / gist:b2c82108e3b5b8b02357
Created April 3, 2015 17:38
/layours/application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>BookmarkThis!</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>
@bntzio
bntzio / gist:15028f283008e0ba5513
Created April 3, 2015 17:39
welcome/about.html.erb
<h1>About BookmarkThis!</h1>
<p>BookmarkThis! is a web application that allow users to save their favorite links they found on the Web!</p>
<p>Since there are so much content in today's Web, with BookmarkThis! you can have your digital content organized in a fashion manner, as well as discovering new awesome links out there!</p>
@bntzio
bntzio / gist:a5bcb9f797abb0d92238
Created April 3, 2015 17:39
welcome/index.html.erb
<br/>
<div class="jumbotron">
<h1 id='index-title'>Welcome to <span id='bookmarkthis-index-title'>BookmarkThis!</span></h1>
<p id='index-description'>BookmarkThis! is a web application that allow users to save and share their favorite links they found on the Web!</p>
<p>
<%= link_to "Sign in with Facebook", user_omniauth_authorize_path(:facebook), class: 'btn btn-primary' %> or
<%= link_to "Register", new_user_registration_path, class: 'btn btn-primary' %> today!
</p>
</div>
@bntzio
bntzio / gist:fd5d164d422046e9f8c6
Created April 3, 2015 17:42
/stylesheets/application.scss
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
class IncomingController < ApplicationController
skip_before_action :verify_authenticity_token, only: [:create]
def create
# Take a look at these in your server logs
# to get a sense of what you're dealing with.
puts "INCOMING PARAMS HERE: #{params}"
# You put the message-splitting and business
# magic here.
def create
puts "INCOMING PARAMS HERE: #{params}"
sender = params['sender']
subject = params['subject']
body = params['stripped-text']
@user = User.find_by_email(sender)
@bookmark = @user.bookmarks.new(url: body)
@bookmark.save!
def create
puts "INCOMING PARAMS HERE: #{params}"
sender = params['sender']
subject = params['subject']
body = params['stripped-text']
@user = User.find_by_email(sender)
@bookmark = @user.bookmarks.new(url: body)
@bookmark.save!