bin/rails g migration AuthlogicToDevise
- (see the file below for the actual migration,
authlogic_to_devise.rb
) bin/rake db:migrate
gem "devise", "~> 2.2.0"
bundle install
#!/usr/bin/awk -f | |
# | |
# Take a PEM format file as input and split out certs and keys into separate files | |
# | |
BEGIN { n=0; cert=0; key=0; if ( ARGC < 2 ) { print "Usage: pem-split FILENAME"; exit 1 } } | |
/-----BEGIN RSA PRIVATE KEY-----/ { key=1; cert=0 } | |
/-----BEGIN CERTIFICATE-----/ { cert=1; key=0 } | |
split_after == 1 { n++; split_after=0 } | |
/-----END CERTIFICATE-----/ { split_after=1 } |
require "./compiler/crystal/**" | |
while line = gets | |
compiler = Crystal::Compiler.new | |
program = Crystal::Program.new | |
program.target_machine = compiler.target_machine | |
prelude = program.normalize(Crystal::Require.new("prelude")) |
HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |
############################################## | |
## Example 1 - play a note | |
play 60 | |
############################################## | |
## Example 2 - play 4 random notes | |
4.times do | |
play rrand_i(60, 90) | |
sleep 0.5 |
#!/usr/bin/env python | |
# first, on cli: pip install mysqlclient | |
## Mysql-Python basic examples. | |
## All code is taken from [here](http://zetcode.com/databases/mysqlpythontutorial/) | |
## Gist created only for quick reference purpose | |
import sys | |
// import _mysql |
# lib/paperclip/copy_attachments.rb | |
# Copies S3-stored Paperclip attachments from one AR model to another. | |
# | |
# This module should be mixed into the target AR model. | |
if Gem::Version.new(::AWS::VERSION) >= Gem::Version.new(2) | |
raise NotImplementedError, 'coded for aws-sdk v1' | |
end |
<!DOCTYPE html> | |
<html> | |
<head> | |
<%= inline_js 'application.js' %> | |
<%= inline_css 'application.css' %> | |
</head> | |
<body> | |
</body> | |
</html> |