Skip to content

Instantly share code, notes, and snippets.

View pedrogrande's full-sized avatar

Pete Argent pedrogrande

View GitHub Profile
@pedrogrande
pedrogrande / seeds.rb
Last active December 17, 2015 15:29
seeds.rb template
puts 'CREATING ROLES'
Role.create([
{ :name => 'admin' },
{ :name => 'user' },
{ :name => 'VIP' }
])
puts 'SETTING UP DEFAULT USER LOGIN'
user = User.create! :name => 'User1', :email => 'user@example.com', :password => 'pleaseme', :password_confirmation => 'pleaseme'
puts 'New user created: ' << user.name
user2 = User.create! :name => 'User2', :email => 'user2@example.com', :password => 'pleaseme', :password_confirmation => 'pleaseme'
<html>
<head>
<title>Page title</title>
</head>
<body>
<p>Hello world</p>
</body>
</html>
<b>Bold</b>
<i>Italics</i>
<u>Underlined</u>
<strikethrough>strikethrough</strikethrough>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<div>
<div>
<div>
<p>Content here.</p>
</div>
<p>More content here.</p>
</div>
<p>Even more here</p>
</div>
@pedrogrande
pedrogrande / carrierwave.rb
Last active October 9, 2017 20:29
Carrierwave initializer file to use Fog and S3 storage for your file uploads
#config/initializers/carrierwave.rb
CarrierWave.configure do |config|
config.fog_credentials = {
# Configuration for Amazon S3 should be made available through an Environment variable.
# For local installations, export the env variable through the shell OR
# if using Passenger, set an Apache environment variable.
#
# In Heroku, follow http://devcenter.heroku.com/articles/config-vars
#
@pedrogrande
pedrogrande / database.yml
Created November 13, 2013 01:47
Example Postgres config/database.yml
# PostgreSQL. Versions 8.2 and up are supported.
#
# Install the pg driver:
# gem install pg
# On Mac OS X with macports:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
# Choose the win32 build.
# Install PostgreSQL and put its /bin directory on your path.
@pedrogrande
pedrogrande / .bash_profile
Created November 17, 2013 22:47
Add colours to Terminal shell
export PS1="\W $ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

<form action="." method="post">
<noscript>You must <a href="http://www.enable-javascript.com" target="_blank">enable JavaScript</a> in your web browser in order to pay via Stripe.</noscript>
<input
type="submit"
value="Pay with Card"
data-key="PUBLISHABLE STRIPE KEY"
data-amount="500"
data-currency="cad"
data-name="Example Company Inc"
/*Transparent pattern placed over an image, like we see on the bootstrap homepage: http://twitter.github.com/bootstrap/index.html*/
div {
width: 200px;
height: 200px;
display: block;
position: relative;
background: url(images/background-image.png);
}