Skip to content

Instantly share code, notes, and snippets.

View rpbaltazar's full-sized avatar
🧶
Knitting the next thing

Rui Baltazar rpbaltazar

🧶
Knitting the next thing
View GitHub Profile
@rpbaltazar
rpbaltazar / Dockerfile
Created August 16, 2019 08:36
dockerfile and sample docker-compose for whistler services
FROM ruby:2.6.3-stretch as base
# WORKDIR needs to be the same as in the final base image or compiled gems will point to an invalid directory
# NOTE: For the compiled gems to be shared across services then the WORKDIR needs to be same for all images
RUN mkdir -p /home/rails/services/app
WORKDIR /home/rails/services/app
ENV BUNDLE_PATH=/bundle \
BUNDLE_BIN=/bundle/bin \
GEM_HOME=/bundle
ERROR in ./src/img/plaing_img.png
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
@ ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-1d34fbe4","hasScoped":true,"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/app/containers/ProfilePage/components/Profile.vue 1:4578-4619
@ ./src/app/containers/ProfilePage/components/Profile.vue
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/app/containers/ProfilePage/index.vue
@ ./src/app/containers/ProfilePage/index.vue
@ ./src/index.js
"Conns"=>{:name=>"Conns", :part_of_name=>true, :options=>["5-1/2\" (VX54)", "4\" IF (NC46)", "4-1/2\" IF (NC50)", "3-1/2\" IF (NC38)", "5-1/2\" VX54"], :type=>"Single Choice"},
"Clamp"=>{:name=>"Clamp", :part_of_name=>true, :options=>["Manual", "Hydraulic"], :type=>"Single Choice"},
"Conn 1"=>{:name=>"Conn 1", :part_of_name=>true, :options=>["21-1/4\" API 2K", "7-1/16\" API 5K", "10\" ANSI 600 RTJ", "1/4\" NPT Male", "1/2\" NPT male", "13-5/8\" API 5K", "8-5/8\" Reg Box", "4-1/16\" API 5K", "2-1/16\" API 5K", "13-5/8\" API 3K", "2\" ANSI 2500 RTJ", "20-3/4\" API 3K", "13-5/8\" API 10K", "33\" API ?", "3\" NPT Female", "1\" NPT Male", "2\" NPT Male", "2\" Fig 400 Thread", "3\" Fig 400 Thread", "3\" Fig 1502 Thread", "3-1/16\" API 10K", "11\" API 5K", "1/8\" NPT Male"], :type=>"Single Choice"},
"Length"=>{:name=>"Length", :part_of_name=>true, :options=>["m", "ft", "inch"], :type=>"Number"},
"Capacity"=>{:name=>"Capacity", :part_of_name=>true, :options=>["kg", "lbs"], :type=>"Number"},
"Sling Legs"=>{:name=>"Sli
@rpbaltazar
rpbaltazar / autoresize.coffee
Created April 6, 2018 02:10
Text box auto resize
ko.bindingHandlers.autoResize =
init: (element, _valueAccessor, allBindings) ->
$(element).addClass("resizable")
observable = allBindings().textInput
updateHeight = (element) ->
$(element).css("height", "1px")
totalHeight = element.scrollHeight
$(element).css("height", "#{totalHeight}px")
@rpbaltazar
rpbaltazar / world_capitals.csv
Last active May 8, 2018 01:45
World capitals
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Abu Dhabi
Abuja
Accra
Adamstown
Addis Ababa
Algiers
Alofi
Amman
Amsterdam
Andorra la Vella
@rpbaltazar
rpbaltazar / alternative_endpoint.rb
Last active February 24, 2018 07:43
Endpoint proposal
require 'dry-matcher'
module FirstTouch
# This class assumes that the project is api only and its rendering
# JSON. For other options (e.g render a view) this needs to be thought
class Endpoint
Matcher = Dry::Matcher.new(
success: Dry::Matcher::Case.new(
match: ->(result:, **) { result.success? },
resolve: ->(result:, representer:, **) do
@rpbaltazar
rpbaltazar / aliases.zsh
Last active August 28, 2018 05:54
Git aliases for zsh
# Customize to your needs...
alias gitspec='rspec $(git st | grep "...spec/.*_spec.rb" | cut -c 4- | xargs)'
alias gap='git add -p'
alias gan='git add -N .'
alias ganp='git add -N . && git add -p'
alias gpb='`git push 2>&1 > /dev/null | grep "git push"`'
alias gplush='git pull; git push'
alias grbrm='git-branch-remote-delete' # from functions.zsh
alias gbrrm='git-branch-remote-delete' # from functions.zsh
@rpbaltazar
rpbaltazar / controller_with_endpoint.rb
Created November 20, 2017 04:44
TRB endpoint integration
class Api::V1::MyController < Api::V1::BaseController
def push_all
op_res = V1::MyOperation::PushAll.(params, current_user: current_user)
success_proc = ->(result, _representer) do
{ "data": result["response"], "status": :ok }
end
endpoint_res = OPL::Endpoint.(op_res, nil, success: { resolve: success_proc })
render json: endpoint_res[:data], status: endpoint_res[:status]
end