Skip to content

Instantly share code, notes, and snippets.

View stefanvermaas's full-sized avatar
👨‍💻

Stefan Vermaas stefanvermaas

👨‍💻
View GitHub Profile
@adrienpoly
adrienpoly / upgrade.md
Created September 24, 2021 09:32
Upgrade to Stimulus 3 recommandations

To upgrade to Stimulus 3.0 and minimize the side effects of the npm package name change here is my suggestion

# add the proxy package
yarn add stimulus

# add the new @hotwired/stimulus package
yarn add @hotwired/stimulus

# add the dedicated package for the Webpack helpers
@afomera
afomera / README.md
Last active January 1, 2023 14:48
How to customize Bootstrap with esbuild-rails

How to customize Bootstrap 5 with esbuild-rails

You can see the various files added in this gist to really do the bulk of the work.

The important bits seem to be:

yarn add esbuild-sass-plugin
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@bradleythughes
bradleythughes / turnserver.conf.awk
Last active April 28, 2022 19:38
Example configuration for coturn on AWS
/^external-ip=/ {
print "external-ip=" PUBLIC "/" PRIVATE
next
}
/^static-auth-secret=/ {
print "static-auth-secret=" SECRET
next
}
{ print }
@rob-murray
rob-murray / find_dups.rb
Created October 27, 2015 09:59
Rails find duplicate records
columns_that_make_record_distinct = [:some_id, :another_name]
distinct_ids = Model.select("MIN(id) as id").group(columns_that_make_record_distinct).map(&:id)
duplicate_records = Model.where.not(id: distinct_ids)
module Filterable
extend ActiveSupport::Concern
module ClassMethods
def filter(filtering_params)
filtering_params.reduce(self) do |relation, (scope_name, value)|
relation.public_send(scope_name, value) if value.present?
end
end
end
@stevenharman
stevenharman / _angularjs_and_rails_asset_pipeline.md
Last active April 30, 2016 23:20
Load the Angular.js $templateCache while building assets for Rails Asset Pipeline. Be sure in require the `templates` module as a dependency of your Angular.js app.

AngularJS + Rails Asset Pipeline

This is my hand-rolled solution for getting Angular assets (Controllers, Models, Directives, Templates, etc.) integrated into the Rails Asset Pipeline.

Templates and the $templateCache

Of particular note: this hack will also load the AngularJS $templateCache with your templates, while allowing you to use Slim, ERB, etc. to write your templates.

@richardvenneman
richardvenneman / _bg-variants.scss
Created November 12, 2013 16:00
This bg-variants mixin is a responsive images solution which supports multiple screen widths and densities. It uses CSS3 multiple backgrounds and is an improvement in user experience over just specifying backgrounds since any low res background image specified later in the stack will load first. This solution doesn't play well with IE8 as it wil…
//-----------------------------------------------------------------------------
// Background Variants
@mixin bg-variants($filename, $path: '/online/', $extension: 'jpg') {
background-image: url(#{$path + $filename + '.small.' + $extension});
@include hidpi(1.5) {
background-image:
url(#{$path + $filename + '.small@2x.' + $extension}),
url(#{$path + $filename + '.small.' + $extension});
@brendanstennett
brendanstennett / Guardfile
Last active December 19, 2015 06:38
Example Guardfile for using Zeus with RSpec
guard :rspec, cmd: 'zeus rspec --color' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }