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
input { | |
file { | |
type => "rails" | |
path => [ "/data/*.log" ] | |
start_position => "beginning" | |
} | |
} | |
output { |
#!/usr/bin/env ruby | |
class ArWeirdnessUsage | |
def self.run | |
message = <<-EOF | |
Usage: | |
0) make this file executable and run it in order to see these instructions | |
1) Create a Rails Project (rails new foo) and add this file: cp %s ./foo/lib/ | |
2) rails g scaffold TestClass name && RAILS_ENV=test rake db:create db:migrate | |
3) echo 'TestClass; ArWeirdness.test_suite' \\ |
#!/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 |