A Gentile Introduction to Symfony
The Definitive Guid to Symfony
| #!/usr/bin/env ruby | |
| # | |
| # Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156) | |
| # | |
| # ## Advisory | |
| # | |
| # https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion | |
| # | |
| # ## Caveats | |
| # |
| import sublime_plugin, os | |
| class RemoteEdit(sublime_plugin.EventListener): | |
| def on_post_save(self, view): | |
| remote = { "/local/path/to/project": "/usr/bin/scp '$1' username@remote_host:'/remote/path/to/project$2'" } | |
| for dirname, target in remote.iteritems(): | |
| if view.file_name().startswith( dirname ): | |
| target = target.replace( "$1", view.file_name() ) | |
| target = target.replace( "$2", view.file_name()[len(dirname):] ) |
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use Template; | |
| my @coordinates = [ | |
| 11, 22, 39, 393, 102, 102 | |
| ]; | |
| my $vars = { |
| #!/usr/bin/env ruby | |
| # | |
| # Creates a block that temporarily suppresses STDOUT | |
| # This is useful if you want to run something that uses | |
| # puts or print, but don't actually want it to print to screen | |
| # | |
| require 'stringio' | |
| def quiet(&block) |
| # =========================================================== | |
| # = feature && hack && rake test && ship = | |
| # = http://reinh.com/blog/2008/08/27/hack-and-and-ship.html = | |
| # =========================================================== | |
| # create new named feature branch and switch to it | |
| feature() { | |
| git checkout -b $1 | |
| } |
| body { margin:0; padding:0; width:100%; | |
| /* Turn off kerning to prevent odd spacing problem | |
| when copying and pasting from PDFs on Windows */ | |
| text-rendering: optimize-speed; } | |
| body, table { font-size: 13px; } | |
| .page-numbers { text-align:right; } | |
| div.alwaysbreak { page-break-before: always; } | |
| div.nobreak:before { clear:both; } | |
| div.nobreak{ page-break-inside: avoid; | |
| /* http://code.google.com/p/wkhtmltopdf/issues/detail?id=9#c21 */ |
| # app/controllers/ballots_controller.rb | |
| def create | |
| @ballot = Ballot.new(params[:ballot]) | |
| if @ballot.save | |
| redirect_to @ballot, :notice => 'Successful' | |
| else | |
| session[:error_messages] = @ballot.errors.full_messages | |
| redirect_to edit_ballot_path(@ballot, :params => params), :notice => 'Ruh Roh!' | |
| end | |
| end |
| # Loads ActionMailer settings from config/email.yml | |
| # and turns deliveries on only if configuration block is found | |
| config_file = Rails.root.join('config','email.yml') | |
| if File.file?(config_file) | |
| mailconfig = YAML::load_file(config_file) | |
| if mailconfig.is_a?(Hash) && mailconfig.has_key?(Rails.env) | |
| # enable deliveries | |
| ActionMailer::Base.perform_deliveries = true |
| module ExpectedBehavior | |
| module ActsAsArchival | |
| module ActMethods | |
| def acts_as_archival | |
| unless included_modules.include? InstanceMethods | |
| include InstanceMethods | |
| before_save :raise_if_not_archival |