Skip to content

Instantly share code, notes, and snippets.

View apaciuk's full-sized avatar
🎯
Focusing

Paul Anthony McGowan apaciuk

🎯
Focusing
View GitHub Profile
@apaciuk
apaciuk / curl.md
Created March 17, 2023 15:58 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@apaciuk
apaciuk / Redis 6 install
Last active March 11, 2023 12:06
Redis 6 install #redis #install #ubuntu
sudo apt install tcl
wget http://download.redis.io/releases/redis-6.2.9.tar.gz
tar xzf redis-6.2.9.tar.gz
cd redis-6.2.9
make
make test
move and rename the src folder, start in the folder with ./redis-server
Crontab
@apaciuk
apaciuk / Ruby self extending modules
Created March 5, 2023 22:19
Ruby self extending modules #modules #self extending #ruby #rails #object
class Account
attr_accessor :balance
def initialize(balance: 0.0)
@balance = balance
end
def deposit(amount)
@balance += amount
end
@apaciuk
apaciuk / UserProfile.rb
Created February 12, 2023 18:23 — forked from rahul100885/UserProfile.rb
Simple json file upload in rails api
class UserProfile < ActiveRecord::Base
has_attached_file :picture,
styles: {
original: {geometry: '1000x0>'},
thumb: '100x100#',
large: '300x200>',
},
convert_options: {large: "-quality 80 -strip -interlace Plane"},
default_url: "http://s3-ap-southeast-1.amazonaws.com/#{ENV["S3_BUCKET"]}/user_profiles/placeholder.png",
path: (Rails.env == 'test' || Rails.env == 'development') ? ":rails_root/public/images/:class/:id/:style/:filename" : "/:class/:id/:style/:filename",
@apaciuk
apaciuk / cheatsheet-elasticsearch.md
Created January 27, 2023 14:23 — forked from ruanbekker/cheatsheet-elasticsearch.md
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
@apaciuk
apaciuk / Netsuite custom fields grabs
Last active January 3, 2023 21:10
Netsuite custom fields grabs #ruby #rails #object #array #Netsuite
delivery_date: netsuite_sales_order.custom_fields_list.custom_fields.select { |field| field.script_id == 'custbody_delivery_date' }.map { |field| field.value }.first
@apaciuk
apaciuk / arel_table active record
Last active November 6, 2022 22:28
arel_table active record
user_is_admin = AdminUser.arel_table
admin ||= AdminUser.all.where(user_is_admin[:email].eq(User.email).to_sql)
@apaciuk
apaciuk / Active Record filter some query data in to array object
Created November 5, 2022 18:13
Active Record filter some query data in to array object #active #rails #ruby #object #array
list_customers = []
customers = Customers.all.where(customer_status: 3)
customer.each do |customers|
list_customers << {
customer_number: customer.customer_number,
customer_status: customer.customer_status,
last_checked_date: customer.last_checked_date,
quantity_fulfilled: customer.quantity_fulfilled,
quantity_billed: customer.quantity_billed,
shipdate: customer.shipdate
@apaciuk
apaciuk / base service objects & active interactions
Created November 5, 2022 13:10
base service objects & active interactions #service objects #active interactions
class ApplicationService
# Global service class for all services
def self.call(*args, &block)
new(*args, &block).call
end
end
@apaciuk
apaciuk / global gems rbenv
Created October 29, 2022 18:48
global gems rbenv #rails #ruby #gems #global
# To have globally per version for use in projects and templates (dont forget rehash if rbenv)
gem install bundler-audit
gem install lefthook
gem install ransack
gem install spreadsheet_architect