###SSH into a remote machine###
ssh [email protected]
#or by ip address
ssh [email protected]
exit: exit
###Install Something###
#If it's a new server, update apt-get first thing
# Shoulda activemodel cheatsheet | |
# DB | |
should have_db_column(:title).of_type(:string).with_options(default: 'Untitled', null: false) | |
should have_db_index(:email).unique(:true) | |
# Associations | |
should belong_to :company | |
should have_one(:profile).dependent(:destroy) | |
should have_many(:posts).dependent(:nullify) |
# 1) Use VCR.use_cassette in your let block. This will use | |
# the cassette just for requests made by creating bar, not | |
# for anything else in your test. | |
let(:foo) { VCR.use_cassette("foo") { create(:bar) } } | |
it "uses foo" do | |
foo | |
end | |
# 2) Wrap the it block that uses #foo in VCR.use_cassette. |
/*------------------------------------------ | |
Responsive Grid Media Queries - 1280, 1024, 768, 480 | |
1280-1024 - desktop (default grid) | |
1024-768 - tablet landscape | |
768-480 - tablet | |
480-less - phone landscape & smaller | |
--------------------------------------------*/ | |
@media all and (min-width: 1024px) and (max-width: 1280px) { } | |
@media all and (min-width: 768px) and (max-width: 1024px) { } |
packages: | |
yum: | |
gcc-c++: [] | |
make: [] | |
sources: | |
/home/ec2-user: http://download.redis.io/releases/redis-2.8.4.tar.gz | |
commands: | |
redis_build: | |
command: make | |
cwd: /home/ec2-user/redis-2.8.4 |
# Install Git needed for Git based gems | |
packages: | |
yum: | |
git: [] | |
###SSH into a remote machine###
ssh [email protected]
#or by ip address
ssh [email protected]
exit: exit
###Install Something###
#If it's a new server, update apt-get first thing
class SomeService | |
def call | |
call_service_a | |
end | |
private | |
def service_a | |
# ... uses status objects | |
end |
#!/usr/bin/env ruby | |
require 'rest-client' | |
require 'time' | |
require 'json' | |
require 'bundler' | |
CHECK_GEMS_BEFORE = Time.parse("Feb 8, 2015") | |
def check_bundler |
# two different ways to implement a find_or_create for Ecto | |
find_or_create_user = fn user -> | |
case Repo.all(from u in users, where: u.id == ^user.id and u.email == ^user.email) do | |
[] -> | |
%User{} | |
|> User.changeset(user) | |
|> Repo.insert!() | |
_ -> | |
IO.puts "Already inserted" |
If you want a run-down of the 1.3 changes and the design decisions behidn those changes, check out the LonestarElixir Phoenix 1.3 keynote: https://www.youtube.com/watch?v=tMO28ar0lW8
To use the new phx.new
project generator, you can install the archive with the following command:
$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
Phoenix v1.3.0 is a backwards compatible release with v1.2.x. To upgrade your existing 1.2.x project, simply bump your phoenix dependency in mix.exs
: