Skip to content

Instantly share code, notes, and snippets.

View alex-min's full-sized avatar
🌴
On vacation

Alexandre alex-min

🌴
On vacation
View GitHub Profile

APPCache Api

You can now put headers inside the manifest :

CACHE MANIFEST
#////////////////////////
# Max-Validity: 2 Weeks and 5 Hours
# Check-Update-Every: 60 Minutes
# Update-Style: Immediate
# On-Update: reload
RSpec.feature 'Post react component test' do
before(:each) do
post_json(render_component_path, {
component: 'Post',
props: { title: title }
}.to_json)
end
context 'with a title' do
let(:title) { 'Hello World' }
<%= react_component(“Post”, {title: “Hello World”}, {camelize_props: true}) %>
<div data-react-class="Post" data-react-props="{&quot;title&quot;:&quot;Hello World&quot;}"></div>
class RenderComponentsController < ActionController::Base
def create
render component: params[:component], props: params[:props]
end
end
Error in crecto_test.rb:28: instantiating 'Repo:Module#all(Post.class)'
Repo.all Post
^~~
in lib/crecto/src/crecto/repo.cr:76: instantiating 'add_preloads(Array(Post), Post.class, Array(NamedTuple(symbol: Symbol, query: Crecto::Repo::Query | Nil)))'
add_preloads(results, queryable, preloads)
^~~~~~~~~~~~
@alex-min
alex-min / InfiniteScroll.js
Created January 1, 2021 14:24
Infinite Scrool hook for phoenix Live View and fattable.js
require('fattable/fattable.js');
/*
* This variable is used to keep the scroll position when the live view navigation changes.
* This is useful for modals.
*/
let keepScroll = {};
export default {
@alex-min
alex-min / generate_routes.cr
Created March 21, 2020 03:54
generate_routes.cr
require "json"
class RouteJSON
JSON.mapping({
verb: String,
controller: String,
action: String,
pipeline: String,
scope: String,
uri_pattern: String,