Skip to content

Instantly share code, notes, and snippets.

Richard Nyström ricn

Block or report user

Report or block ricn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View app.js
var Vue = require('vue')
new Vue({
el: '#app',
data: {
message: 'Hello Vue.js!'
ricn / 0_reuse_code.js
Created Dec 3, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View mix.exs
=PROGRESS REPORT==== 9-Nov-2015::22:39:02 ===
supervisor: {local,sasl_safe_sup}
started: [{pid,<0.175.0>},
=PROGRESS REPORT==== 9-Nov-2015::22:39:02 ===
View tags.ex
# Migration
defmodule Bookmarks.Repo.Migrations.CreateBookmark do
use Ecto.Migration
def change do
create table(:bookmarks) do
add :href, :string, null: false, size: 2000
add :title, :string
add :description, :text
add :tags, {:array, :string}
View gist:da952009926e7e5ca27a
controller code:
def toggle_star(conn, %{"id" => id}) do
bookmark =, user_id(conn)))
if bookmark do
|> put_change(:starred, !bookmark.starred)
|> Repo.update!
render(conn, "toggle_star.json", starred: !bookmark.starred)
View gist:075f6f6944d10b83aa15
resources :photos do
member do
get 'preview'
View gist:9db349b19374b9b42b36
Test error:
3) test deletes chosen resource (Bookmarks.BookmarkControllerTest)
** (ArgumentError) argument error
:erlang.apply(695, :id, [])
Test code:
View bookmark.ex
defmodule Bookmarks.Bookmark do
use Bookmarks.Web, :model
schema "bookmarks" do
field :href, :string
field :title, :string
field :description, :string
View mix.exs
defmodule Bitdoc.Mixfile do
use Mix.Project
def project do
[app: :bitdoc,
version: "0.0.1",
elixir: "~> 1.0",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix] ++ Mix.compilers,
build_embedded: Mix.env == :prod,
ricn / blah
Created May 11, 2015
Phoenix 0.13
View blah
Air:bitdoc ricn$ mix deps.get
Running dependency resolution
Dependency resolution completed successfully
All dependencies up to date
Air:bitdoc ricn$ mix phoenix.server
lib/phoenix_html.ex:1: warning: redefining module Phoenix.HTML
lib/phoenix_html/engine.ex:1: warning: redefining module Phoenix.HTML.Engine
lib/phoenix_html/form_data.ex:1: warning: redefining module Phoenix.HTML.FormData
lib/phoenix_html/form.ex:1: warning: redefining module Phoenix.HTML.Form
==> phoenix_html
You can’t perform that action at this time.