Skip to content

Instantly share code, notes, and snippets.

View americos's full-sized avatar
💭
Coding, coding, and coding some more

Americo Savinon americos

💭
Coding, coding, and coding some more
  • Malaga, Spain
  • 13:42 (UTC +02:00)
  • X @americos
View GitHub Profile
@americos
americos / game.rb
Created December 16, 2010 05:46
Main class for Codebreaker
module Codebreaker
class Game
def initialize(output)
@output = output
end
def start(secret)
@secret = secret
@output.puts 'Welcome to Codebreaker!'
@output.puts 'Enter guess:'
@americos
americos / selenium_webrat_cucumber.rb
Created January 11, 2011 15:48
Lines needed on features/suppor/env.rb to enable selenium automated browser testing
#Remember to get the proper gems on your gem file:
# gem 'database_cleaner', '>= 0.5.2'
# gem 'selenium-client', '>= 1.2.18'
# then: bundle install
#Step 1 for using Selenium. This goes after ActionContoller allow_resque line /Americo
Cucumber::Rails::World.use_transactional_fixtures = false
#Step 2 for using Selenium This goes at the bottom of the file /Americo
class ActiveSupport::TestCase
@americos
americos / setting_git.txt
Created January 12, 2011 16:30
Lines commonly used while setting up your project on github
Set Repo
$ git init
Add all files/folders
$ git add .
Push up code
$ git remote add origin git@githyb.com:<username>/app_name.git
$ git push origin master
@americos
americos / setting_heroku.txt
Created January 12, 2011 16:34
Lines commonly used to set up a Heroku deployment
Create a new app at Heroku
$ heroku create
Heroku deployment
$ git push heroku master
To deploy your Database (you need to use taps gem: $ gem install taps)
$ heroku db:push
Open Heroku app
@americos
americos / setting_Rails_with_RSpec_cucumber.rb
Created January 12, 2011 16:43
Common lines used to set up a Rails project with BDD
1) Add gems to gemfile
gem 'rails', '3.0.0'
gem 'sqlite3-ruby', :require => 'sqlite3'
group :development, :test do
gem 'rspec-rails', '>= 2.0.0'
gem 'cucumber-rails', '>= 0.3.2'
#gem 'webrat', '>= 0.7.2'
gem 'capybara', '0.4.0'
@americos
americos / person.rb
Created July 20, 2012 16:11
Documentation for Person.rb using Docco
# This is the documentation for Person
#### Person Class
class Person
# Age variable of Class Person
age = "21"
# Sample method to say Hello
def self.say_hello
puts("Hello there!")
@americos
americos / csv.html
Created January 31, 2013 16:08
Sample of Downloading data a .csv using a .jsp and a Form Post
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#csv_form").submit(function(event) {
event.preventDefault();
@americos
americos / sphinx.rb
Last active December 16, 2015 03:59 — forked from alexstubbs/sphinx.rb
require 'formula'
class Libstemmer < Formula
# upstream is constantly changing the tarball,
# so doing checksum verification here would require
# constant, rapid updates to this formula.
head 'http://snowball.tartarus.org/dist/libstemmer_c.tgz'
homepage 'http://snowball.tartarus.org/'
end
require 'youtube_it'
USER = "YOUTUBE_USER_NAME"
PASS = "YOUTUBE_PASS"
DEV_KEY = "YOUTUBE_DEV_KEY"
##Upload a video
uploader = YouTubeIt::Upload::VideoUpload.new(
:username => USER,
:password => PASS,
<%= form_for @video, :url => {:action => (@video.new_record? ? 'name_video' : 'update'),
:id => (@video.new_record? ? nil : @video)} do |f| %>
<div id='columnForm'>
<fieldset>
<legend>
Video Information
</legend>
<label for="source_code">Video Source:
<%= f.collection_select('video_source_id',