gem install rails
rails new my_app -T
# autoload concerns | |
module YourApp | |
class Application < Rails::Application | |
config.autoload_paths += %W( | |
#{config.root}/app/controllers/concerns | |
#{config.root}/app/models/concerns | |
) | |
end | |
end |
https://chart.googleapis.com/chart?cht=bhs&chs=250x100&chd=t:33,50,17&chxt=y,r&chxl=0:|friends|search%20engine|social%20media|1:|33%|50%|17%&chxs=1,0000dd,13,-1,t |
#list current backups | |
heroku pgbackups --app app_name | |
#do a manual backup immediately | |
heroku pgbackups:capture --expire --app app_name | |
#restore postgres with dump (overwrite current state) | |
pg_restore --clean --no-acl --no-owner -d database_name dump_filename | |
#download dump and save as file |
#use activesupport's hash to xml without rails | |
require 'active_support/core_ext/hash/conversions' |
require 'nokogiri' | |
def create_resource(xml) | |
xml.resource('path' => 'statuses/public_timeline.{format}') { | |
xml.param('name' => 'format', :'required' => 'true') { | |
xml.option('value' => 'json', 'mediaType' => 'application/json') | |
xml.option('value' => 'xml', 'mediaType' => 'application/xml') | |
} | |
xml.method_('id' => 'METHOD_ID', 'name' => 'GET', 'apigee:displayName' => 'METHOD_DISPALY_NAME') { |
class Client | |
attr_accessor :calls | |
def get() | |
api = "http://www.cslew.com/api/" | |
request = "" | |
@calls.each do |c| | |
request += "#{c.keys[0]}/" | |
request += "#{c.values[0]}/" if c.values[0] != [] |
#Part of a school project using SAP ERP. | |
#Created a composite application using a Linux EC2 Instance & created SOAP web services. | |
#Used Ruby to invoke enterprises services in SAP. | |
require 'rubygems' | |
require 'savon' | |
client = Savon::Client.new do | |
wsdl.document = File.read("wsdl_document.wsdl") | |
http.auth.basic "username", "password" |
from PIL import ImageFont | |
from PIL import Image | |
from PIL import ImageDraw | |
from StringIO import StringIO | |
font = ImageFont.load_default() | |
input = StringIO(self.request.get("img")) | |
img = Image.open(input) | |
draw = ImageDraw.Draw(img) |
log4j.rootLogger=debug, stdout, file | |
### direct log messages to stdout ### | |
log4j.appender.stdout=org.apache.log4j.ConsoleAppender | |
log4j.appender.stdout.Target=System.out | |
log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout | |
### file appender | |
log4j.appender.file=org.apache.log4j.RollingFileAppender | |
log4j.appender.file.maxFileSize=100KB |