Skip to content

Instantly share code, notes, and snippets.

/usr/local/lib/ruby/1.9.1/net/smtp.rb:948 :in `check_response`
/usr/local/lib/ruby/1.9.1/net/smtp.rb:917 :in `getok`
/usr/local/lib/ruby/1.9.1/net/smtp.rb:832 :in `mailfrom`
/usr/local/lib/ruby/1.9.1/net/smtp.rb:659 :in `send_message`
[PROJECT_ROOT]/vendor/bundle/ruby/1.9.1/gems/mail-2.5.4/lib/mail/network/delivery_methods/smtp.rb:113 :in `block in deliver!`
/usr/local/lib/ruby/1.9.1/net/smtp.rb:520 :in `start`
[PROJECT_ROOT]/vendor/bundle/ruby/1.9.1/gems/mail-2.5.4/lib/mail/network/delivery_methods/smtp.rb:112 :in `deliver!`
[PROJECT_ROOT]/vendor/bundle/ruby/1.9.1/gems/mail-2.5.4/lib/mail/message.rb:2129 :in `do_delivery`
[PROJECT_ROOT]/vendor/bundle/ruby/1.9.1/gems/mail-2.5.4/lib/mail/message.rb:232 :in `block in deliver`
[PROJECT_ROOT]/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.13/lib/action_mailer/base.rb:415 :in `block in deliver_mail`
defmodule Koncur do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [worker(Repo, [])]
justin@Justins-MacBook-Pro ~/projects/elixir/koncur (master●)$ iex -S mix [system]
Erlang/OTP 17 [erts-6.1] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Interactive Elixir (1.0.0-rc1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Repo.get(User, 2)
%User{avatar_url: "https://avatars.githubusercontent.com/u/892382?v=2",
company: nil, github_id: "[REDACTED]",
github_token: "[REDACTED]", id: 2,
realname: "Justin McNally", username: "j-mcnally"}
justin@Justins-MacBook-Pro ~/projects/elixir/koncur (master)$ mix phoenix.start [system]
=INFO REPORT==== 12-Sep-2014::22:02:11 ===
application: logger
exited: stopped
type: temporary
=INFO REPORT==== 12-Sep-2014::22:02:11 ===
application: cowboy
exited: stopped
WORKER_TIMEOUT = 60 * 10 # 10 minutes
loop do
begin
begin
puts "Checking proccesses"
`ps -e -o pid,command | grep 'resque.*Forked'`.split("\n").each do |line|
parts = line.split(' ')
next if parts[-2] != "at"
started = parts[-1].to_i
defp extract_links(link_string) do
if link_string do
parts = for link <- String.split(link_string, ", "), do: Regex.named_captures(~r/\<.*\?page=(?<page>.*)\>; rel=\"(?<position>.*)\"/, link, capture: :all_but_first)
for capture <- parts, into: %{}, do: {Map.get(capture, "position"), Map.get(capture, "page")}
end
end
@j-mcnally
j-mcnally / gist:403812350dd02623857e
Created September 6, 2014 23:00
GithubOrg serializer
defmodule Koncur.Api.V1.OrganizationController do
use Phoenix.Controller
alias OAuth2Ex.Provider.Github, as: Github
plug Koncur.AuthenticationPlug
plug Koncur.GithubClientPlug
def index(conn, _params) do
github_token = conn.assigns[:github_token]
orgs = Github.organizations(github_token)
defmodule Koncur.AuthenticationPlug do
alias Plug.Conn
alias Phoenix.Status
alias Phoenix.Controller.Errors
alias Poison, as: JSON
import Phoenix.Controller.Connection
import Plug.Conn
import Ecto.Query, only: [from: 2]
def init(opts), do: opts
defmodule Koncur.Mixfile do
use Mix.Project
def project do
[ app: :koncur,
version: "0.0.1",
elixir: "~> 1.0.0-rc1",
elixirc_paths: ["lib", "web"],
deps: deps ]
end
Bookmark = DS.Model.extend
link_url: DS.attr 'string'
group_id: DS.attr 'number'
created_at: DS.attr 'date'
tag_list: DS.attr 'string'
collection_ids: DS.attr 'number'
link: DS.belongsTo 'link', {readOnly: true}
user: DS.belongsTo 'user', {readOnly: true}
star: DS.belongsTo 'star', {readOnly: true}
collection: DS.belongsTo 'collection', {readOnly: true}