Skip to content

Instantly share code, notes, and snippets.

View serradura's full-sized avatar
🎯
Focusing

Rodrigo Serradura serradura

🎯
Focusing
View GitHub Profile
######################################
# Ruby doc: http://ruby-doc.org/core #
######################################
#########
# Setup #
#########
#
# Install the gems:
# =================
@serradura
serradura / stopwatch-app.html
Created May 10, 2016 14:30
Stopwatch App - Based on http://www.sitepoint.com/series/building-a-stopwatch-in-react/, but using ES6 and React 15.0.1.
<!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;
@serradura
serradura / estilis.css
Created December 12, 2016 20:39
Turbolinks 5 demo - Lorem ipsum generators
body.mussum hr.primary {
margin: 0;
background-color: #A846A0;
height: 10px;
border: 0;
}
body.mussum hr.secondary {
margin: 0;
background-color: #23CE6B;
height: 10px;
@serradura
serradura / admin-product.rb
Created December 23, 2016 00:32 — forked from ottodranik/admin-product.rb
Example: Use Acts-As-Taggable-On gem with Active-Admin and rails observers
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
@serradura
serradura / firebase_admin.rb
Last active August 22, 2024 02:52
FirebaseAdmin::Auth.verify_id_token | Ruby solution for https://firebase.google.com/docs/auth/admin/verify-id-tokens
# 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'
@serradura
serradura / Counter.elm
Last active June 22, 2017 20:55
My firsts (basic) Elm-Lang applications. | http://elm-lang.org/try
module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
-- update
@serradura
serradura / benchmarks.rb
Last active August 30, 2017 18:56
Ruby FP playground
# 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') }
@serradura
serradura / core_ext.rb
Last active August 30, 2017 22:12
Ruby FP extensions (Pipe and Compose operators)
module Composable
def pipe(other)
-> (*args) { other.(self.(*args)) }
end
alias >> pipe
def compose(other)
-> (*args) { self.(other.(*args)) }
end
alias << compose
@serradura
serradura / index-EventBus.js
Last active September 20, 2017 18:25
jQuery Signal + EventBus
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
});