This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * allows you to wrap or insert an html tag over a selection/range using rangy | |
| * @param iframe the CKEditor iframe html element | |
| * @param tagName string representation of the tag, such as 'a' for anchor | |
| * @param withNodeFunc function to allow outside modification of the element before injecting/wrapping | |
| */ | |
| function wrapOrInsert(iframe, tagName, withNodeFunc) { | |
| var iframedoc = iframe.contentDocument || iframe.contentWindow.document, | |
| tag = iframedoc.createElement(tagName), | |
| selection = rangy.getIframeSelection(iframe), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ... | |
| gem 'carrierwave' | |
| gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| upstream app { | |
| server unix:/srv/app/current/tmp/sockets/unicorn.sock fail_timeout=0; | |
| } | |
| server { | |
| listen 80; | |
| server_name www.app.com; | |
| rewrite ^/(.*) http://app.com/$1 permanent; | |
| } | |
| server { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <form action="<%= @pay_desc['mrh_url'] %>" method="post"> | |
| <input type=hidden name=MrchLogin value="<%= @pay_desc['mrh_login'] %>"> | |
| <input type=hidden name=OutSum value="<%= @pay_desc['out_summ'] %>"> | |
| <input type=hidden name=InvId value="<%= @pay_desc['inv_id'] %>"> | |
| <input type=hidden name=Desc value="<%= @pay_desc['inv_desc'] %>"> | |
| <input type=hidden name=SignatureValue value="<%= @pay_desc['crc'] %>"> | |
| <input type=hidden name=Shp_item value="<%= @pay_desc['shp_item'] %>"> | |
| <input type=hidden name=IncCurrLabel value="<%= @pay_desc['in_curr'] %>"> | |
| <input type=hidden name=Culture value="<%= @pay_desc['culture'] %>"> | |
| <input type=submit value='Оплатить'> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "uri" | |
| (URI::REGEXP.constants - ["PATTERN"]).each do |rc| | |
| puts "#{rc}: #{URI::REGEXP.const_get(rc)}" | |
| end | |
| URI::REGEXP::PATTERN.constants.each do |pc| | |
| puts "#{pc}: #{URI::REGEXP::PATTERN.const_get(pc)}" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://gist.github.com/1214052 | |
| require 'sinatra/base' | |
| class ResqueWeb < Sinatra::Base | |
| require 'resque/server' | |
| use Rack::ShowExceptions | |
| if CFG[:user].present? and CFG[:password].present? | |
| Resque::Server.use Rack::Auth::Basic do |user, password| | |
| user == CFG[:user] && password == CFG[:password] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <rss version="2.0" | |
| xmlns:content="http://purl.org/rss/1.0/modules/content/" | |
| xmlns:dsq="http://www.disqus.com/" | |
| xmlns:dc="http://purl.org/dc/elements/1.1/" | |
| xmlns:wp="http://wordpress.org/export/1.0/" | |
| > | |
| <channel> | |
| <item> | |
| <!-- title of article --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Originall created by RailsWizard.org, adapted by David N. Welton - http://www.dedasys.com | |
| # rails new APP_NAME -m /path/to/gist/davidwrailstemplate.rb -T -J | |
| initializer 'generators.rb', <<-RUBY | |
| Rails.application.config.generators do |g| | |
| end | |
| RUBY | |
| template = {"orm"=>"activerecord", "unit_testing"=>"rspec", "integration_testing"=>"on", "javascript"=>"jquery", "authentication"=>"devise", "templating"=>"on", "css"=>"on"} | |
| recipes = template.values.flatten |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776 | |
| $ cd /usr/src | |
| $ wget http://nginx.org/download/nginx-1.2.1.tar.gz | |
| $ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz | |
| $ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz | |
| $ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz | |
| $ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' if RUBY_VERSION =~ /1\.8/ | |
| require 'rack' | |
| require "#{File.dirname(__FILE__)}/webapp" | |
| if __FILE__ == $0 | |
| def usage | |
| STDERR.puts("Usage: #{$0} <webrick, thin, mongrel>") | |
| exit | |
| end |