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
| # http://unicorn.bogomips.org/SIGNALS.html | |
| rails_env = ENV['RAILS_ENV'] || 'production' | |
| rails_root = ENV['RAILS_ROOT'] || "/data/github/current" | |
| God.watch do |w| | |
| w.name = "unicorn" | |
| w.interval = 30.seconds # default | |
| # unicorn needs to be run from the rails root |
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
| class Book < ActiveRecord::Base | |
| has_many :pages | |
| belongs_to :p2fline | |
| belongs_to :print_profile | |
| belongs_to :publish_profile | |
| acts_as_audited :except => [:name, :file_name] | |
| include AASM | |
| aasm_column :state |
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
| - unless Rails.env.development? | |
| / Require jQuery | |
| = javascript_include_tag 'http://yandex.st/jquery/1.7.1/jquery.min.js' | |
| / Require Google's jQuery if Yandex is down | |
| :javascript | |
| window.jQuery || document.write('<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">\x3C/script>') | |
| / Require local jQuery if Google is down / is development env | |
| :javascript | |
| window.jQuery || document.write('<script src="#{asset_path('jquery.js')}">\x3C/script>') |
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
| # i hope this helps... | |
| # to set the username and picture send these events to fm | |
| # -> you don't need to define any event handlers | |
| # -> the session token (_session) could be your unique session id | |
| # or the unique user id (it's hashed) | |
| # set the user name | |
| { "_type": "_set_name", "name": "Tingle Tangle Bob", "_session": "mysessiontoken" } |
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
| namespace :app do | |
| namespace :error_pages do | |
| desc "Generates static pages 500, 403, 404, 422" | |
| task :generate => :environment do | |
| av = ActionView::Base.new | |
| av.class_eval do | |
| include ApplicationHelper | |
| include Rails.application.routes.url_helpers | |
| 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
| Steps to install and run PostgreSQL 9.2 using Homebrew (Mac OS X) | |
| (if you aren't using version 9.1.5, change line 6 with the correct version) | |
| 1. pg_ctl -D /usr/local/var/postgres stop -s -m fast | |
| 2. mv /usr/local/var/postgres /usr/local/var/postgres91 | |
| 3. curl https://raw.github.com/fragility/homebrew/737af01178590950749cf5e841f2d086c57c5a80/Library/Formula/postgresql.rb > /usr/local/Library/Formula/postgresql.rb | |
| 4. brew upgrade postgresql | |
| 5. initdb /usr/local/var/postgres -E utf8 | |
| 6. pg_upgrade -b /usr/local/Cellar/postgresql/9.1.5/bin -B /usr/local/Cellar/postgresql/9.2.0/bin -d /usr/local/var/postgres91 -D /usr/local/var/postgres | |
| 7. pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start |
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 'spec_helper' | |
| describe "HistoryItems" do | |
| before(:each) {login_as :user} | |
| describe "GET /history_items" do | |
| it "works!" do | |
| visit history_items_path | |
| response.should be_success | |
| end | |
| 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
| class Cache | |
| def initialize | |
| @fuck = 0 | |
| end | |
| def refresh(from) | |
| puts "[#{from}] #{@fuck}" | |
| @fuck = "given" | |
| 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
| require 'socket' | |
| socket = UDPSocket.new | |
| socket.send("I am ok.", 0, 'localhost', 1234) | |
| text, sender = socket.recvfrom(16) | |
| socket.close |
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
| apt update | |
| apt upgrade | |
| apt install build-essential | |
| apt install pkg-config | |
| apt install libnet-dev python-yaml libaio-dev | |
| apt install libprotobuf-dev libprotobuf-c0-dev protobuf-c-compiler protobuf-compiler python-protobuf libnl-3-dev libcap-dev python-future | |
| # criu install | |
| curl -O -sSL http://download.openvz.org/criu/criu-3.10.tar.bz2 | |
| tar xjf criu-3.10.tar.bz2 |
OlderNewer