Skip to content

Instantly share code, notes, and snippets.


Marc Riera mrcasals

View GitHub Profile
View gist:2492118
class ActionDispatch::Routing::Mapper
def draw(routes_name)
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
otobrglez / Article.rb
Created Jul 12, 2011
Finding related articles using Jaccard index and tags
View Article.rb
# This method finds related articles using Jaccard index (optimized for PostgreSQL).
# More info:
class Article < ActiveRecord::Base
def related(limit=10)
( SELECT array_agg( FROM taggings tg, tags t
wbroek / genymotionwithplay.txt
Last active Jul 8, 2020
Genymotion with Google Play Services for ARM
View genymotionwithplay.txt
NOTE: Easier way is the X86 way, described on
Download the following ZIPs:
ARM Translation Installer v1.1 (
Download the correct GApps for your Android version:
Google Apps for Android 6.0 ( -
Google Apps for Android 5.1 ( -
Google Apps for Android 5.0 ( -
burgalon /
Last active Jul 6, 2020
Implementing OAuth2 with AccountManager, Retrofit and Dagger
public class AccountAuthenticator extends AbstractAccountAuthenticator {
private final Context context;
@Inject @ClientId String clientId;
@Inject @ClientSecret String clientSecret;
@Inject ApiService apiService;
public AccountAuthenticator(Context context) {
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
adham90 / spacemacs-keybindings
Last active Jul 1, 2020
spacemacs keybindings that i need to learn
View spacemacs-keybindings
SPC s c remove highlight
**** Files manipulations key bindings
Files manipulation commands (start with ~f~):
| Key Binding | Description |
| ~SPC f c~ | copy current file to a different location |
| ~SPC f C d~ | convert file from unix to dos encoding |
| ~SPC f C u~ | convert file from dos to unix encoding |
frontendbeast / sm-annotated.html
Last active Jun 25, 2020 — forked from hdragomir/sm-annotated.html
The deferred font loading logic for Smashing Magazine, updated to include IE8 support.
View sm-annotated.html
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
IanVaughan /
Created Jun 9, 2012
Uninstall all rbenv gems
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
gem list
gem install bundler

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
  • NBC
View default_param_hack.rb
def output name=((default=true); "caius")
puts "name: #{name.inspect}"
puts "default: #{default.inspect}"
# >> name: "caius"
# >> default: true
output "avdi"
You can’t perform that action at this time.