Skip to content

Instantly share code, notes, and snippets.

View lypborges's full-sized avatar

Felipe Borges Ferreira lypborges

View GitHub Profile
@lypborges
lypborges / Findable.rb
Last active February 12, 2016 04:19
Create a concern to use when using uuid as default primary key
module Findable
extend ActiveSupport::Concern
# When you use uuid some methods stop to work as expected. Using this concern in your models will do the job.
# Override methods on module FinderMethods that use id as default order when no order is defined
# It's a working in progress
# referencer:
# http://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-take
# https://github.com/rails/rails/blob/f52354ad1d15120dcc5284714bee7ee3f052986c/activerecord/lib/active_record/relation/finder_methods.rb#L503
module ClassMethods
@lypborges
lypborges / application.hbs
Created October 27, 2016 16:02
Ember Semantic UI - Nav Bar
<div class="ui grid fluid">
<!-- Desktop menu -->
<div class="computer tablet only row">
<div class="ui large menu navbar attached inverted teal">
<a href="" class="brand item">Logo</a>
{{#if session.isAuthenticated}}
<div class="right menu">
{{#each menu.app as |item|}}
{{link-to (t item.label) item.route class="item"}}
{{/each}}
-module(shapes).
-export([perimeter/1,area/1, bits/1]).
% Sample call, shapes:perimeter({square,{4}}) should return 16.
perimeter({square, {Side}}) ->
Side * 4;
% Sample call, shapes:perimeter({triangule,{4,3,5}}) should return 12.
perimeter({triangule,{SideA, SideB, SideC}}) ->
SideA + SideB + SideC.
@lypborges
lypborges / components.my-select.js
Last active December 5, 2017 11:58
Ember Power Select
import Ember from 'ember';
import { task, timeout} from 'ember-concurrency';
const { inject } = Ember;
const DEBOUNCE_MS = 600;
export default Ember.Component.extend({
intl: inject.service(),
store: inject.service(),
allowClear: true,