Skip to content

Instantly share code, notes, and snippets.

@jourdein
jourdein / dnsmasq OS X.md
Last active February 14, 2024 09:04 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X
@jourdein
jourdein / qb-stripe-api.md
Last active January 29, 2024 08:09
QB-Stripe API

Requirements:

• JWT Authentication

• applicatoin/json

Onboarding

GET /api/v1/drivers/stripe/authorize

Return

@jourdein
jourdein / image-upload.md
Created April 8, 2023 08:23
Image upload

Workflow for uploading image

1. Request presign_endpoint

GET /api/v1/drivers/s3/params?type=image/jpeg&filename=the_signature.jpg
  • Sample response
@jourdein
jourdein / registration-progress.md
Last active January 27, 2023 02:43
Registration progress response

At the moment, API ni run kat my local development (http://gateway.jourdein.com)

Sample response bila call API /api/v1/drivers/account-verification/phone

{
    "registration": {
        "step": "2",
        "count": "4",
        "name": "email_verification",
 "path": "/api/v1/drivers/account-verification/email"

2 Issues

1. Json payload ni

sini app/views/api/v1/public/a937fc1e30d20bb9720a0d48aed837329937fc1e30d20bb9720a0d48aed837329/delivery_tasks/show.json.jbuilder

jadi double root kat response

rasanya sebab sini dah ada root json.delivery_task

@jourdein
jourdein / does_not_overwrite.rb
Created November 26, 2020 20:38
Overwrite Class/Instance methods (keyword: class_eval by itself, instance_eval & class_eval included)
# This structure will not overwrite bar class method.
# calling super will call the included module's bar.
# http://tech.tulentsev.com/2012/02/ruby-how-to-override-class-method-with-a-module/
module FooModule
def self.included base
base.extend ClassMethods
end
module ClassMethods
@jourdein
jourdein / myModule.rb
Created November 26, 2020 07:20
Module
module Extensions
module Popular
module ClassMethods
def most_popular(limit = 10)
order('points DESC').limit(limit).all
end
end
def popularity
@jourdein
jourdein / investor.rb
Created November 26, 2020 05:50
Extending Imported Class
# references:
# - https://guides.rubyonrails.org/v4.0/plugins.html
# - https://stackoverflow.com/questions/22473391/custom-search-with-ransacker?rq=1
require "./app/models/investor"
Investor.class_eval do
# can directly introduce class_eval
scope :total_investment, -> { 1000+500 }
# Rake Quick Reference
# by Greg Houston
# http://ghouston.blogspot.com/2008/07/rake-quick-reference.html
# -----------------------------------------------------------------------------
# Running Rake
# -----------------------------------------------------------------------------
# running rake from the command-line:
# rake --help
@jourdein
jourdein / Ubuntu Rails Setup Steps
Created November 8, 2017 22:20 — forked from JElbourne/Ubuntu Rails Setup Steps
SETUP STEPS for Ubuntu Desktop with various apps and settings, Ruby, Rails, PostgreSQL, and others
#********************************************************************
# Ubuntu Setup Steps for initial install PLUS
# Ruby on Rails setup using PostreSQL
#
# by: Jay Elbourne
# date: March 2016
# Ubuntu 15.10 (32 bit [because of VirtualBox])
# Ruby 2.2.3
# Rails 4.2.4
# PostreSQL 9.5