Skip to content

Instantly share code, notes, and snippets.

View rbmrclo's full-sized avatar
Coffee 👨‍💻Code 🍸Cocktails

Robbie Marcelo rbmrclo

Coffee 👨‍💻Code 🍸Cocktails
View GitHub Profile
@rbmrclo
rbmrclo / Problem-1.php
Created November 16, 2012 11:52
Project Euler Solutions
/*
1.) If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
*/
// Solution in PHP, the simple way:
@rbmrclo
rbmrclo / gist:5900017
Last active October 18, 2019 15:43
Create a gemset per project
# I'm not using this anymore
#
# Assuming that you are already on your project directory.
# Step 1: rvm gemset create [name of gemset]
# Step 2: rvm --rvmrc [ruby version here]@[name of gemset] # Note: You can check your current ruby version by running "ruby -v" from your console.
# Step 3: Refresh your directory, you can do this by simply checking out of your directory via command: cd.. and going back to that directory again.
# Step 4: RVM will ask you a simple Yes, No, View, Cancel question. Press Y for yes.
# Step 5: You're done! Run bundle install.
@rbmrclo
rbmrclo / gist:6162467
Created August 6, 2013 06:17
Postgresql remove string limit of 255 chars
# in rails application.rb
initializer "postgresql.no_default_string_limit" do
ActiveSupport.on_load(:active_record) do
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:string].delete(:limit)
end
end
=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')
@rbmrclo
rbmrclo / sc-dl.js
Created August 22, 2013 05:36 — forked from pheuter/sc-dl.js
(function(d) {
var dl = d.createElement('a');
dl.innerText = 'Download MP3';
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1];
dl.download = d.querySelector('em').innerText+".mp3";
d.querySelector('.primary').appendChild(dl);
dl.style.marginLeft = '10px';
dl.style.color = 'red';
dl.style.fontWeight = 700;
})(document);
@rbmrclo
rbmrclo / README
Created August 23, 2013 04:44 — forked from vangberg/README
# Deploying a Sinatra app to Heroku
## Database
The location of the database Heroku provides can be found in the environment
variable DATABASE_URL. Check the configure-block of toodeloo.rb for an example
on how to use this.
## Server
Heroku is serving your apps with thin, with means you have all your thin goodness available,
such as EventMachine.
@rbmrclo
rbmrclo / Pletora's mouse
Created August 23, 2013 14:14
Fix mouse pletora
xinput set-int-prop "DualPoint Stick" "Device Enabled" 8 0
@rbmrclo
rbmrclo / gist:7095300
Created October 22, 2013 04:37
Liquid
class Liquify
attr_accessor :content, :template
class ::InvalidInputException < Exception; end;
def initialize(content)
@content = content
end
def template

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

@rbmrclo
rbmrclo / obfuscate.rb
Created November 27, 2013 08:11
Obfuscate an id
module Obfuscate
def cipher
OpenSSL::Cipher::Cipher.new('aes-256-cbc')
end
def cipher_key
'any string that you want'
end