Skip to content

Instantly share code, notes, and snippets.

View ag0os's full-sized avatar
🔧

Agustin Nicolas Calabrese ag0os

🔧
View GitHub Profile
@justinweiss
justinweiss / filterable.rb
Last active January 11, 2024 07:28
Filterable
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with names based on the keys in <tt>filtering_params</tt>
# with their associated values. For example, "{ status: 'delayed' }" would call
@nicolai86
nicolai86 / calendar.coffee
Last active November 5, 2019 14:16
do it yourself calendar.
isSunday = (date) ->
return date.getDay() is 0
nextDay = (date, days = 1) ->
newDate = new Date(date.getTime())
newDate.setDate(date.getDate() + days)
return newDate
prevDay = (date, days = 1) ->
newDate = new Date(date.getTime())