Skip to content

Instantly share code, notes, and snippets.

View anlek's full-sized avatar
💬
Writing code...

Andrew Kalek anlek

💬
Writing code...
View GitHub Profile
@anlek
anlek / enhanced_association_id_setter.rb
Created August 23, 2021 19:10
Support ActiveRecord setting id columns on belong_to relationships
module EnhancedAssociationIdSetter
extend ActiveSupport::Concern
module ClassMethods
def belongs_to(name, scope = nil, **options)
result = super
build_assocation_id_setter_for(name)
result
end
@anlek
anlek / aws_cli_simple_test.sh
Last active October 1, 2020 22:01
BASH function to test what version of AWS CLI you're using.
[[ $(aws --version 2>&1) == aws-cli/1* ]] && echo "AWS CLI is V1" || echo "AWS CLI IS > V1"
@anlek
anlek / docker-compose.yml
Created August 21, 2019 00:53
Setting up error page for traefik and it's applications
app:
image: my/webapp:latest
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:supercoolapp.com"
- "traefik.frontend.errors.network.backend=error"
- "traefik.frontend.errors.network.query=/{status}.html"
- "traefik.frontend.errors.network.status=500-511"
- "traefik.port=3000"
error_pages:
@anlek
anlek / auto_dubstep.rb
Created February 3, 2018 20:13 — forked from xavriley/auto_dubstep.rb
Auto generating dubstep with Sonic Pi
# DUBSTEP
# Combines ideas from my other gists
current_bpm = 140.0
use_bpm current_bpm
# WOBBLE BASS
define :wob do
use_synth :dsaw
lowcut = note(:E1) # ~ 40Hz
highcut = note(:G8) # ~ 3000Hz
@anlek
anlek / application.scss
Last active April 30, 2020 13:51
My current work around for simple_form and Bootstrap 4 beta to work together (till simple_form allows input fields to have `is-invalid` set on it on error - see https://github.com/plataformatec/simple_form/pull/1476)
// Fix for validations on simple form
// Need to import bootstrap functions and mixins if you want to dynamically set colors
// Otherwise replace theme-color... with hex color
@import 'bootstrap/functions';
@import 'bootstrap/variables';
@import 'bootstrap/mixins';
.has-invalid {
.invalid-feedback {
yarn list v0.27.5
├─ abbrev@1.1.0
├─ accepts@1.3.3
│ ├─ mime-types@~2.1.11
│ └─ negotiator@0.6.1
├─ accounting@0.4.1
├─ acorn-dynamic-import@2.0.2
│ ├─ acorn@^4.0.3
│ └─ acorn@4.0.13
├─ acorn-globals@1.0.9
@anlek
anlek / Console output
Created November 3, 2016 21:41
Ruby 2.3 installation freezes during building of Passenger-Docker
In case of problems: https://rvm.io/help and https://twitter.com/rvm_io
+ Updating /etc/profile.d/rvm_secure_path.sh
+ chmod +x /etc/profile.d/rvm_secure_path.sh
+ usermod -a -G rvm app
+ install -o root /pd_build/ruby_support/system-rvm-exec.sh /usr/bin/rvm-exec
+ Creating /usr/bin/ruby
+ Creating /usr/bin/gem
+ Creating /usr/bin/rake
+ Creating /usr/bin/bundle
+ Creating /usr/bin/bundler
<template lang="jade">
#example
button(@click="greet") Greet
</template>
<script>
export default {
data () {
return {
@anlek
anlek / console
Created April 8, 2016 18:44
Installing vue-loader issue.
% npm install vue-loader --save AirNorth/tarmac (feature/vuejs ⚡) Andrews-MacBook-Pro
npm WARN vue-loader@8.2.2 requires a peer of vue-html-loader@^1.0.0 but none was installed.
npm WARN vue-loader@8.2.2 requires a peer of css-loader@* but none was installed.
npm WARN vue-loader@8.2.2 requires a peer of vue-style-loader@^1.0.0 but none was installed.
npm WARN vue-loader@8.2.2 requires a peer of babel-loader@^6.1.0 but none was installed.
npm WARN vue-loader@8.2.2 requires a peer of babel-core@^6.1.2 but none was installed.
npm WARN vue-loader@8.2.2 requires a peer of babel-plugin-transform-runtime@^6.1.2 but none was installed.
npm WARN vue-loader@8.2.2 requires a peer of babel-runtime@^5.8.0 but none was installed.
npm WARN vue-loader@8.2.2 requires a peer of babel-preset-es2015@^6.1.2 but none was installed.
npm WARN vue-loader@8.2.2 requires a peer of vue-hot-reload-api@^1.2.0 but none was installed.
$ root@ed4b13372429:/# bundle -v
bash: bundle: command not found
$ root@ed4b13372429:/# gem install bundler -V
HEAD https://api.rubygems.org/api/v1/dependencies
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=bundler
200 OK
Getting SRV record failed: DNS result has no information for _rubygems._tcp.api.rubygems.org
/var/lib/gems/2.2.0/gems/bundler-1.11.2/.gitignore
/var/lib/gems/2.2.0/gems/bundler-1.11.2/.rspec