Skip to content

Instantly share code, notes, and snippets.

## Controller
class Program < ActiveRecord::Base
STATUSES = %w(pending live on_hold completed)
KINDS = %w(social_video youtube facebook twitter)
has_one :flight, :dependent => :destroy
has_one :creative, :dependent => :destroy
accepts_nested_attributes_for :flight
accepts_nested_attributes_for :creative
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
This is the query:
SELECT * FROM questions
LEFT JOIN messages on questions.id = messages.question_id
LEFT JOIN questions_skip_counts qsc on questions.id = qsc.question_id AND questions.user_id = qsc.user_id
WHERE messages.sender_id = NULL and questions.user_id != 'FOO' AND qsc.skip_count =
(SELECT min(qsc.skip_count) FROM questions LEFT
JOIN messages on questions.id = messages.question_id LEFT JOIN questions_skip_counts qsc on questions.id = qsc.question_id AND questions.user_id = qsc.user_id WHERE messages.sender_id = NULL and questions.user_id != 'FOO')
class User < ActiveRecord::Base
attr_accessor :firstname, :lastname, :email
end
class CallListAbility
include CanCan::Ability
def initialize(user)
if user.admin
can :manage, CallList, :account => { :id => user.account.id }
else
can :create, CallList
# call list has one account through a campaign
class CallListAbility
include CanCan::Ability
def initialize(user)
if user.admin
can :manage, CallList, :account => { :id => user.account.id }
else
can :create, CallList
# call list has one account through a campaign
@omarqureshi
omarqureshi / README.md
Last active October 23, 2022 06:59 — forked from mrrooijen/README.md
Setting up XEN on a Hetzner Dedicated Server (EX-series)

Setting up XEN on a Hetzner Dedicated Server (EX-series)

Author: Michael van Rooijen (@meskyanichi)

DISCLAIMER: I am a programmer, not a sysadmin in my day-to-day life. I provide this guide simply as a self-reference, and as a way to contribute to the community of developers. The main motivation for writing this guide is because of the lack of properly written guides/tutorials. They were either out-dated, inaccurate, in a non-English language or simply too vague to understand (at least for me, as a programmer and not a sysadmin).

I hope this guide helps getting you up and running with your own collection of VPS's on your own Dedicated Server over at Hetzner.de.

Requirements:

# From a fresh install of wheezy
apt-get install ruby1.8 rubygems # Need ruby to use fpm
gem1.8 install fpm --no-ri --no-rdoc
apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev ncurses-dev libyaml-dev emacs curl autoconf
wget http://www.mirrorservice.org/sites/ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz
tar -zxvf ruby-1.9.3-p392.tar.gz
cd ruby-1.9.3-p392