Skip to content

Instantly share code, notes, and snippets.

View phlegx's full-sized avatar
💪
never stop coding

Phlegx Systems phlegx

💪
never stop coding
View GitHub Profile
Warning: copy(/www/htdocs/w00fd404/wordpress/wp-content/themes/piratenkleider/embed_template.php) [function.copy]: failed to open stream: Permission denied in /www/htdocs/w00fd404/wordpress/wp-content/plugins/vanilla-forums/embed.php on line 74
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w00fd404/wordpress/wp-content/plugins/vanilla-forums/embed.php:74) in /www/htdocs/w00fd404/wordpress/wp-includes/pluggable.php on line 881
1.9.2p290 :011 > url = "http://mentalized.net/journal/2011/04/14/ruby_how_to_check_if_a_string_is_numeric/"
=> "http://mentalized.net/journal/2011/04/14/ruby_how_to_check_if_a_string_is_numeric/"
1.9.2p290 :012 > url[0..-1]
=> "http://mentalized.net/journal/2011/04/14/ruby_how_to_check_if_a_string_is_numeric/"
1.9.2p290 :013 > url[0..-2]
=> "http://mentalized.net/journal/2011/04/14/ruby_how_to_check_if_a_string_is_numeric"
class Upload < ActiveRecord::Base
attr_accessible :upload
has_attached_file :upload, :processors => [:watermark]
before_save :test
#https://gist.github.com/784445
include Rails.application.routes.url_helpers
def test
module Paperclip
class Watermark < Processor
def initialize(file, options = {}, attachment = nil)
super
STDERR.puts "################################# INITIALIZE ##############################"
@watermark_path = options[:watermark_path]
@position = options[:position].nil? ? "SouthEast" : options[:position]
end
def make
ActiveRecord::Base.establish_connection(
{ :adapter => 'mysql2',
:database => 'some_database',
:host => 'localhost',
:username => 'root',
:password => "" }
)
routes:
resources :images do
collection do
post "get_image"
end
member { get :custom_show }
end
<div id="1" class="1">
SOME TEXT 1
<div id="2">SOME TEXT 2 </div>
</div>
<div id="example">
<a href="http://example.com">Title</a>
</div>
<a href="URL">TEXT</a>
namespace :daemon do
desc "Start, stop and restart daemon"
task :restart do
run("/etc/init.d/daemon-#{STAGE} restart")
end
end