Skip to content

Instantly share code, notes, and snippets.

View gist:da952009926e7e5ca27a
controller code:
def toggle_star(conn, %{"id" => id}) do
bookmark = Repo.one(Bookmark.by_id_and_user_id(id, user_id(conn)))
if bookmark do
Bookmark.changeset(bookmark)
|> put_change(:starred, !bookmark.starred)
|> Repo.update!
render(conn, "toggle_star.json", starred: !bookmark.starred)
end
View gist:914389
require "rubygems"
require "mongoid"
Mongoid.configure do |config|
name = "mongoid_bug"
host = "localhost"
config.master = Mongo::Connection.new.db(name)
config.persist_in_safe_mode = false
end
View gist:854461
11:53:41,087 ERROR [web.context.ContextLoader] Context initialization failed
java.lang.NullPointerException
at org.springframework.extensions.config.xml.XMLConfigService.removeElementReaders(XMLConfigService.java:478)
at org.springframework.extensions.config.xml.XMLConfigService.destroy(XMLConfigService.java:149)
at org.springframework.extensions.config.BaseConfigService.reset(BaseConfigService.java:143)
at org.springframework.extensions.webscripts.AbstractRuntimeContainer.reset(AbstractRuntimeContainer.java:243)
at org.alfresco.repo.web.scripts.RepositoryContainer.init(RepositoryContainer.java:591)
at org.alfresco.repo.web.scripts.RepositoryContainer.reset(RepositoryContainer.java:565)
at org.alfresco.repo.web.scripts.RepositoryContainer$4.doWork(RepositoryContainer.java:519)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:508)
View gist:850724
In 3.3:
http://localhost:8080/alfresco/service/api/server?alf_callback=func
returns
func({
"data":
{
"edition": "Enterprise",
"version": "3.3.3 (205)",
View gist:075f6f6944d10b83aa15
resources :photos do
member do
get 'preview'
end
end
View gist:702427
~/projects/jruby ➔ gem install -v1.5.5 org.jruby.jruby-complete
Installing from Maven using install at /Users/headius/apache-maven-3.0/bin
Successfully installed org.jruby.jruby-complete-1.5.5-java
1 gem installed
Installing ri documentation for org.jruby.jruby-complete-1.5.5-java...
Installing RDoc documentation for org.jruby.jruby-complete-1.5.5-java...
~/projects/jruby ➔ gem install -v1.5.3 org.jruby.jruby-complete
Installing from Maven using install at /Users/headius/apache-maven-3.0/bin
Successfully installed org.jruby.jruby-complete-1.5.3-java
View gist:9db349b19374b9b42b36
Test error:
3) test deletes chosen resource (Bookmarks.BookmarkControllerTest)
test/controllers/bookmark_controller_test.exs:66
** (ArgumentError) argument error
stacktrace:
:erlang.apply(695, :id, [])
test/controllers/bookmark_controller_test.exs:68
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
timestamps
end
View gist:524736
> npm config get root
npm it worked if it ends with ok
npm cli [ 'config', 'get', 'root' ]
npm version 0.1.23
npm config file /Users/ricn/.npmrc
npm config file /usr/local/Cellar/node/0.1.104/etc/npmrc
/usr/local/lib/node
npm ok
View My .gitignore
config/database.yml
config/*.sphinx.conf
config/s3_credentials.yml
*~
*.cache
*.log
*.pid
tmp/**/*
.DS_Store
db/cstore/**