Skip to content

Instantly share code, notes, and snippets.

View obie's full-sized avatar
🎧
digital nomad making music

Obie Fernandez obie

🎧
digital nomad making music
View GitHub Profile
@obie
obie / _search.haml
Created November 5, 2020 01:24
Search Implementation using stimulus, shoelace, and mark.js
.spreadsheet--search.grid.grid-flow-col.grid-cols-auto.gap-0.auto-cols-fr.pl-1.pr-8.hidden{ data: { controller: "spreadsheet--search", action: "toggle-search@window->spreadsheet--search#toggleSearch" }}
.input.col-span-9.p-2
%sl-input.w-full(placeholder="Search" size="small" clearable pill){ data: { target: "spreadsheet--search.input"}}
%sl-icon(name="search" slot="prefix")
%sl-dropdown(slot="suffix" placement="bottom-end" hoist){ data: { target: "spreadsheet--search.dropdown"}}
%sl-button(slot="trigger" caret type="text" size="small"){ data: { target: "spreadsheet--search.trigger"}} Highlight
%sl-menu
%sl-menu-item{ data: { target: "spreadsheet--search.higlight"}, checked: true} Highlight
%sl-menu-item{ data: { target: "spreadsheet--search.filter"}} Filter
@obie
obie / _alert.haml
Created October 15, 2020 03:29
Alerts in Reactive Rails style (with Shoelace web components)
%sl-alert.popup-toast{id: id, type: type, open: false, duration: duration, closable: true}
%sl-icon{slot: "icon", name: icon}
- if title.present?
%strong= title
%br
= text
@obie
obie / application_controller.rb
Created October 5, 2020 05:15
Workaround solution for having to restart Rails server to pickup changes to ViewComponent templates (Rails 6.1)
class ApplicationController < ActionController::Base
after_action :clear_view_component_cache, if: -> { Rails.env.development? }
def clear_view_component_cache
ViewComponent::CompileCache.cache = Set.new
end
end
@obie
obie / quizizz.css
Created November 1, 2016 15:11
Print Quizizz Stylesheet
div {
font-family: Georgia;
font-size: 10pt;
}
h1 {
font-family: Helvetica;
}
img {
padding: 2em;
}
<div class="question">
<div class="q-no">42.&nbsp;&nbsp;</div>
<div class="q-text">When the charge is reversed in a neuron during an action potential it is called</div>
<div class="answers">
<div class="answer">
<span class="answer-hole"></span>
<div class="opt">a)</div>
<div class="option">Polarization</div>
</div>
<div class="answer">
<div class="question">
<div class="q-no">42.&nbsp;&nbsp;</div>
<div class="q-text">When the charge is reversed in a neuron during an action potential it is called</div>
<div class="answers">
<div class="answer">
<span class="answer-hole"></span>
<div class="opt">a)</div>
<div class="option">Polarization</div>
</div>
<div class="answer">
console.log('Loading function');
var doc = require('dynamodb-doc');
var dynamo = new doc.DynamoDB();
/**
* Provide an event that contains the following keys:
*
* - operation: one of the operations in the switch statement below
* - tableName: required for operations that interact with DynamoDB
@obie
obie / designer.html
Created September 6, 2014 00:09
designer
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<polymer-element name="my-element">
<template>
<style>
@obie
obie / source_maps.rb
Last active December 15, 2015 10:39 — forked from alexspeller/source_maps.rb
patches the generated source map with the otherwise missing filename
if Rails.env.development?
module CoffeeScript
class SourceMapError < StandardError; end;
class << self
def compile script, options
script = script.read if script.respond_to?(:read)
if options.key?(:no_wrap) and !options.key?(:bare)
# See http://blog.obiefernandez.com/content/2012/02/metaprogramming-your-activerecord-objects-at-runtime.html for an explanation
require 'spec_helper'
describe Nomination do
let(:user1) { FactoryGirl.create(:user) }
let(:user2) { FactoryGirl.create(:user_with_nominations_received) }
let(:user3) { FactoryGirl.create(:user_with_nominations_received) }
let(:user4) { FactoryGirl.create(:user) }
let(:user5) { FactoryGirl.create(:user) }