Marc Riera mrcasals

View rss_parser.rb
1 2 3 4 5 6 7
require 'rss'
rss_url = 'https://github.com/mrcasals.atom'
response = RSS::Parser.parse(open(rss_url).read)
 
response.entries.each do |entry|
p entry.link.href if entry.title.content =~ /starred/
end
View explanation.md

rbenv: remove RUBY_FREE_MIN and RUBY_HEAP_MIN_SLOTS warnings on Ruby 2.1.0

If you are like me, then you might have some Ruby projects running on different Ruby versions, so you'll need to either upgrade those old projects to Ruby 2.1.10 or deal with these warnings:

/Users/marc/.rbenv/versions/2.1.0/bin/ruby: warning: RUBY_FREE_MIN is obsolete. Use RUBY_GC_HEAP_FREE_SLOTS instead.
/Users/marc/.rbenv/versions/2.1.0/bin/ruby: warning: RUBY_HEAP_MIN_SLOTS is obsolete. Use RUBY_GC_HEAP_INIT_SLOTS instead.
ruby: warning: RUBY_FREE_MIN is obsolete. Use RUBY_GC_HEAP_FREE_SLOTS instead.
ruby: warning: RUBY_HEAP_MIN_SLOTS is obsolete. Use RUBY_GC_HEAP_INIT_SLOTS instead.
View remove_local_merged_branches
1
git branch -d $( git branch --merged | grep -v '^\*' | grep -v 'master' )
View seeds.rb
1 2 3 4 5 6 7 8 9 10
@index = Tire::Index.new("my_custom_index")
@index.delete
 
@index.create :settings => {
:index => {
:analysis => {
:analyzer => {
:default => {
type: "snowball",
:language => 'Catalan'
View gist:2788529
1 2 3 4 5 6 7 8
$ brew uninstall postgresql
$ gem uninstall pg # ALL OF THEM
$ rm -fr /usr/local/var/postgres
$ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
$ pg_ctl -D /usr/local/var/postgres stop -s -m fast # WE SHOULD HAVE ALL postgres SERVERS & PROCESSES STOPPED BY NOW
$ brew install postgres
$ env ARCHFLAGS="-arch x86_64" gem install pg
$ echo "DONE." >> /dev/null
View gist:1904259

Spotify API integration:

{% spotify spotify:track:0CMaT6vi0XdnOgtOTeOIEj %} spotify:track:0CMaT6vi0XdnOgtOTeOIEj || http://open.spotify.com/track/0CMaT6vi0XdnOgtOTeOIEj spotify:artist:3eqjTLE0HfPfh78zjh6TqT || http://open.spotify.com/artist/3eqjTLE0HfPfh78zjh6TqT spotify:user:mrc2407:playlist:2AS7HhXVysUciOk9fPxZ8f || http://open.spotify.com/user/mrc2407/playlist/2AS7HhXVysUciOk9fPxZ8f

Can use any of these in http://ws.spotify.com/lookup/1/.json?uri={url}

Example: http://ws.spotify.com/lookup/1/.json?uri=http://open.spotify.com/track/2CDqQmDdYQfkCNoRwR14nt

View devise.ca.yml
1 2 3 4 5 6 7 8 9 10
ca:
errors:
messages:
expired: "ha caducat, demana'n un de nou"
not_found: "no s'ha trobat"
already_confirmed: "ja està confirmat"
not_locked: "no està bloquejat"
not_saved:
one: "1 error ha evitat que %{resource} es pugui desar:"
other: "%{count} errors han evitat que %{resource} es pugui desar:"
View books_controller.rb
1 2 3 4 5 6 7 8 9 10
# This class is responsible for the Books REST interface.
#
class BooksController < ApplicationController
 
# Get a book by the id
before_filter :get_book, only: [:edit, :update, :show, :destroy]
 
# Renders the form to create a new Book.
#
def new
View ca.yml
1 2 3 4 5 6 7 8 9 10
# This is the default format for Rails Translations.
# You can see the full file here:
# https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/ca.yml
ca:
date:
day_names:
- Diumenge
- Dilluns
- Dimarts
- Dimecres
Something went wrong with that request. Please try again.