- Primeiro slash command (calculadora) que fizemos: https://gist.github.com/serradura/ef3885d6ba736757150c
- Projeto de referência: https://github.com/samg/timetrap
- https://api.slack.com/slash-commands
- Ruby Explained: Procs, blocks and lambdas: http://www.eriktrautman.com/posts/ruby-explained-blocks-procs-and-lambdas-aka-closures
- Diff between block, procs and lambdas: http://awaxman11.github.io/blog/2013/08/05/what-is-the-difference-between-a-block/
- RubyMonk with running codes: https://rubymonk.com/learning/books/4-ruby-primer-ascent/chapters/18-blocks/lessons/64-blocks-procs-lambdas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################### | |
# Ruby doc: http://ruby-doc.org/core # | |
###################################### | |
######### | |
# Setup # | |
######### | |
# | |
# Install the gems: | |
# ================= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Serradura's version</title> | |
<style media="screen"> | |
body { | |
font-family: 'HelveticaNeue-UltraLight', 'Helvetica Neue UltraLight', | |
'Helvetica Neue', Helvetica, Arial, sans-serif; | |
margin: 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body.mussum hr.primary { | |
margin: 0; | |
background-color: #A846A0; | |
height: 10px; | |
border: 0; | |
} | |
body.mussum hr.secondary { | |
margin: 0; | |
background-color: #23CE6B; | |
height: 10px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveAdmin.register Product do | |
permit_params :name, :category_id, :description, :text, :slug, :in_slider, :tag_ids => [] | |
filter :category | |
filter :base_tags | |
filter :name | |
filter :text | |
filter :created_at | |
filter :updated_at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# ======== | |
# FirebaseAdmin::Auth.verify_id_token(your_id_token) | |
# | |
# The method call follows the same API of the Node.js, JAVA and Python SDKs. | |
# See https://firebase.google.com/docs/auth/admin/verify-id-tokens#verify_id_tokens_using_the_firebase_admin_sdk | |
# Dependencies: | |
# --------------- | |
# gem 'activesupport' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main exposing (..) | |
import Html exposing (..) | |
import Html.Attributes exposing (..) | |
import Html.Events exposing (..) | |
-- update | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gem install benchmark-ips | |
require "benchmark/ips" | |
######### | |
# shout # | |
######### | |
Benchmark.ips do |x| | |
x.report("inline") { "#{'foo'.upcase}!" } | |
x.report("util") { TUtils.shout('fooz') } | |
x.report("util_2") { TUtils2.shout('fooz') } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Composable | |
def pipe(other) | |
-> (*args) { other.(self.(*args)) } | |
end | |
alias >> pipe | |
def compose(other) | |
-> (*args) { self.(other.(*args)) } | |
end | |
alias << compose |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const forEach = applier => ($model, args) => args[1].forEach( fn => applier( $model, [ args[0], fn ] ) ); | |
const iterateIf = (isAnArrayHandler, args) => isAnArrayHandler && $.isArray( args[1] ); | |
const fetchArgsWith = handler => args => handler ? handler.apply( null, args ) : args; | |
const featureApplier = (feature, fetch) => ($model, args) => feature.apply( $model, fetch( args ) ); | |
const featureMounter = (feature, argsHandler, isAnArrayHandler) => { | |
const applyFeature = featureApplier( feature, fetchArgsWith( argsHandler ) ); | |
return $model => (function() { | |
( iterateIf(isAnArrayHandler, arguments) ? forEach(applyFeature) : applyFeature )( $model, arguments ); | |
return this | |
}); |