Skip to content

Instantly share code, notes, and snippets.

View brentkirby's full-sized avatar

Brent Kirby brentkirby

View GitHub Profile
@brentkirby
brentkirby / Dockerfile
Last active March 9, 2024 18:49
Create lambda layer from docker image
FROM public.ecr.aws/sam/build-ruby3.2:latest-x86_64
RUN yum install -y amazon-linux-extras && amazon-linux-extras enable postgresql14
RUN yum install -y postgresql postgresql-devel build-essential
ADD Gemfile /var/task/Gemfile
ADD Gemfile.lock /var/task/Gemfile.lock
RUN bundle config set --local deployment true
RUN bundle install
@brentkirby
brentkirby / DependentFields.js
Created February 15, 2022 22:07
JS Dependent FIelds ( no deps )
class DependentField{
constructor(dep, config){
this.options = config;
this.target = dep;
this.target.dataset.dependent = true;
const props = this.target.dataset.depends.toString();
const [input, value] = props.split('->');
@brentkirby
brentkirby / layout_helper.rb
Last active April 26, 2018 18:57
Various helpers for populating layout data.
module LayoutHelper
##
# Render flash messages
#
# @param [String] attrs Attributes to add to the surrounding <div>
#
def flash_messages(attrs = {})
return if flash.nil? or flash.empty?
closer = "<span class='close'>&times;</span>"
@brentkirby
brentkirby / app.conf
Last active December 24, 2015 08:58
Master nginx confs.
#-----------------------------------------------------------
# If using a proxy server
upstream app{
#server unix:///app_path/shared/sockets/app.sock fail_timeout=0;
server unix:///app_path/shared/sockets/app.sock;
}
#------------------------------------------------------------
@brentkirby
brentkirby / tables.coffee
Created May 29, 2013 23:21
Responsive tables ( custom implementation of foundation example )
class RTable
orig: null
wrap: null
pinned: null
constructor:(table)->
@orig = $(table)
@orig.addClass('modified')
.wrap("<div class='table-wrapper'></div>")
@wrap = @orig.parent('div.table-wrapper')
@split()
@brentkirby
brentkirby / divs.html
Last active December 15, 2015 14:09
Susy Grid Helper
<div id='grid'><div id='baseline_grid'></div></div>
@brentkirby
brentkirby / runner.js
Created September 8, 2012 22:53
Run raw coffeescript specs in browser with jasmine
/*
* Make sure coffeescript.js, jasmine, and all other dependencies are loaded,
* then assign a global "specs" variable which is an array of file names in
* your spec/ folder.
*
* window.specs = ['index'];
*
*/
(function() {
@brentkirby
brentkirby / _grid.scss
Created September 6, 2012 03:34
Susy debug action
// optional, i like the light black better
$grid-background-column-color:rgba(black, 0.075);
@mixin debug-susy-grid($points){
#grid{ position:absolute; top:0px; right:$grid-padding; left:$grid-padding; bottom:0px; display:none;
@include susy-grid-background; z-index:10000;
@for $i from 1 to length($points){
@include at-breakpoint(nth($points, $i)){
@include susy-grid-background;
@brentkirby
brentkirby / .gemrc
Created August 9, 2012 18:01
.gemrc
---
:verbose: true
:bulk_threshold: 1000
install: --no-ri --no-rdoc --env-shebang
:sources:
- http://gems.rubyforge.org/
- http://gemcutter.org
:benchmark: false
:backtrace: false
update: --no-ri --no-rdoc --env-shebang
require 'spec_helper'
describe Product do
it{ should belong_to :designer }
it{ should have_many :taggings }
it{ should have_many(:tags).through(:taggings) }
it{ should have_many :images }
it{ should have_many :product_properties }
it{ should have_many(:available_properties).through(:product_properties) }