Skip to content

Instantly share code, notes, and snippets.

View dsazup's full-sized avatar

Dainius Pužas dsazup

View GitHub Profile
@dsazup
dsazup / devise.rb
Last active December 31, 2020 04:45
make devise work with turbo streams
# need to update devise config with these settings
config.parent_controller = 'Users::DeviseController'
@dsazup
dsazup / trix.blade.php
Created October 24, 2020 21:58 — forked from tanthammar/trix.blade.php
Livewire trix input
@push('body-styles')
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/trix/1.2.0/trix.css">
@endpush
<form x-data="form()">
<input x-ref="description" id="description" name="description" value='{{ $description }}' type="hidden" />
<div wire:ignore>
<trix-editor input="description"></trix-editor>
</div>
<%= @user_assignments.each do |assignment| %>
assignment.steps.size -- will do query for each assignment
It would be nice to do something like
@user_assignments.preload_counts(:steps) and then just do assignment.steps_count
<% end %>
@dsazup
dsazup / test.rb
Last active July 1, 2020 14:38
rails optional parameter bug
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
@dsazup
dsazup / app\Providers\AppServiceProvider.php
Created April 14, 2020 17:27
Laravel response()->to()
<?php
namespace App\Providers;
use Illuminate\Routing\ResponseFactory;
use Illuminate\Support\ServiceProvider;
use Illuminate\Contracts\Support\Responsable;
use Illuminate\Contracts\View\Factory as ViewFactoryContract;
use Illuminate\Contracts\Routing\ResponseFactory as ResponseFactoryContract;
@dsazup
dsazup / CssModules.js
Created June 4, 2019 16:31
Css modules laravel mix
module.exports = class CssModules {
/**
* The optional name to be used when called by Mix.
* Defaults to the class name, lowercased.
*
* Ex: mix.example();
*
* @return {String|Array}
*/
name() {
@dsazup
dsazup / attachWebsocketServer.diff
Created November 2, 2018 10:05 — forked from cihadturhan/attachWebsocketServer.diff
dirty hack to react-native/local-cli/server/util/attachWebsocketServer.js
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @format
* @flow